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

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

_ZN4qpdf10BaseHandleD2Ev:
  131|  51.7M|        ~BaseHandle() = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|  7.45k|        {
   68|  7.45k|            return obj == other.obj;
   69|  7.45k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  8.12k|        {
   83|  8.12k|            return size() == 0;
   84|  8.12k|        }
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  1.77M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  15.9M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|  3.75M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  4.00M|        BaseHandle(BaseHandle const&) = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|  3.22M|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  24.2M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   412k|        BaseHandle& operator=(BaseHandle const&) = default;

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

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

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

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

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

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

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

_ZN10QPDFObjGenC2Eii:
   40|  1.56M|        obj(obj),
   41|  1.56M|        gen(gen)
   42|  1.56M|    {
   43|  1.56M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  51.9M|    {
   47|  51.9M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 30.4M, False: 21.4M]
  |  Branch (47:36): [True: 4.27M, False: 17.1M]
  |  Branch (47:54): [True: 167k, False: 4.10M]
  ------------------
   48|  51.9M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   108k|    {
   52|   108k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 103k, False: 5.03k]
  |  Branch (52:34): [True: 103k, False: 149]
  ------------------
   53|   108k|    }
_ZNK10QPDFObjGenneERKS_:
   56|  91.6k|    {
   57|  91.6k|        return !(*this == rhs);
   58|  91.6k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  1.56M|    {
   62|  1.56M|        return obj;
   63|  1.56M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  2.71k|    {
   67|  2.71k|        return gen;
   68|  2.71k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  4.46M|    {
   72|  4.46M|        return obj != 0;
   73|  4.46M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|   206k|    {
   77|   206k|        return std::to_string(obj) + separator + std::to_string(gen);
   78|   206k|    }
_ZN10QPDFObjGen3set3addES_:
  111|   152k|        {
  112|   152k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 62.9k, False: 89.7k]
  ------------------
  113|  62.9k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 10.3k, False: 52.6k]
  ------------------
  114|  10.3k|                    return false;
  115|  10.3k|                }
  116|  52.6k|                emplace(og);
  117|  52.6k|            }
  118|   142k|            return true;
  119|   152k|        }
_ZN10QPDFObjGenC2Ev:
   38|  20.0M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  4.47k|            llx(llx),
  244|  4.47k|            lly(lly),
  245|  4.47k|            urx(urx),
  246|  4.47k|            ury(ury)
  247|  4.47k|        {
  248|  4.47k|        }
_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|  1.35M|        qpdf::BaseHandle(obj)
 1316|  1.35M|    {
 1317|  1.35M|    }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  15.8M|        qpdf::BaseHandle(std::move(obj))
 1320|  15.8M|    {
 1321|  15.8M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|  9.80k|    {
 1325|  9.80k|        return obj;
 1326|  9.80k|    }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  2.32M|    {
 1560|  2.32M|        return static_cast<bool>(obj);
 1561|  2.32M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   145k|    {
 1566|   145k|        return {obj};
 1567|   145k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|  3.68M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleC2ERKS_:
  290|  3.85M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|  3.22M|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  24.2M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   403k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  10.8k|        TokenFilter() = default;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

_ZN11InputSource13setLastOffsetEx:
   15|  19.6M|{
   16|  19.6M|    this->last_offset = offset;
   17|  19.6M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  20.9M|{
   22|  20.9M|    return this->last_offset;
   23|  20.9M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  10.9k|{
   28|       |    // Return at most max_line_length characters from the next line. Lines are terminated by one or
   29|       |    // more \r or \n characters. Consume the trailing newline characters but don't return them.
   30|       |    // After this is called, the file will be positioned after a line terminator or at the end of
   31|       |    // the file, and last_offset will point to position the file had when this method was called.
   32|       |
   33|  10.9k|    read(str, count, at);
   34|  10.9k|    auto eol = str.find_first_of("\n\r"sv);
   35|  10.9k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 8.32k, False: 2.67k]
  ------------------
   36|  8.32k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  8.32k|        str.resize(eol);
   38|  8.32k|        if (next_line != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 7.73k, False: 585]
  ------------------
   39|  7.73k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  7.73k|            return eol;
   41|  7.73k|        }
   42|  8.32k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  3.25k|    seek(last_offset, SEEK_SET);
   45|  3.25k|    findAndSkipNextEOL();
   46|  3.25k|    return eol;
   47|  10.9k|}
_ZN11InputSource8readLineEm:
   51|  10.9k|{
   52|  10.9k|    return read_line(max_line_length);
   53|  10.9k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|  68.2k|{
   66|       |    // Basic approach: search for the first character of start_chars starting from offset but not
   67|       |    // going past len (if len != 0). Once the first character is found, see if it is the beginning
   68|       |    // of a sequence of characters matching start_chars. If so, call finder.check() to do
   69|       |    // caller-specific additional checks. If not, keep searching.
   70|       |
   71|       |    // This code is tricky and highly subject to off-by-one or other edge case logic errors. See
   72|       |    // comments throughout that explain how we're not missing any edge cases. There are also tests
   73|       |    // specifically constructed to make sure we caught the edge cases in testing.
   74|       |
   75|  68.2k|    char buf[1025]; // size known to input_source.cc in libtests
   76|       |    // To enable us to guarantee null-termination, save an extra byte so that buf[size] is valid
   77|       |    // memory.
   78|  68.2k|    size_t size = sizeof(buf) - 1;
   79|  68.2k|    util::assertion(
   80|  68.2k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 68.2k]
  |  Branch (80:38): [True: 0, False: 68.2k]
  ------------------
   81|  68.2k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|  68.2k|    );
   83|       |
   84|  68.2k|    char* p = nullptr;
   85|  68.2k|    qpdf_offset_t buf_offset = offset;
   86|  68.2k|    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|   514k|    while (true) {
  ------------------
  |  Branch (91:12): [True: 514k, 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|   514k|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 68.2k, False: 446k]
  |  Branch (97:31): [True: 188k, False: 257k]
  ------------------
   98|   257k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 188k, False: 68.2k]
  ------------------
   99|   188k|                QTC::TC(
  100|   188k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 185k, False: 3.24k]
  ------------------
  101|   188k|                buf_offset += (p - buf);
  102|   188k|            }
  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: 40.0k, False: 217k]
  ------------------
  109|  40.0k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 33.4k, False: 6.54k]
  ------------------
  110|  40.0k|                return false;
  111|  40.0k|            }
  112|   217k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   217k|            p = buf;
  114|   217k|        }
  115|       |
  116|       |        // Search for the first character.
  117|   474k|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 288k, False: 185k]
  ------------------
  118|       |                 // line-break
  119|   474k|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|   288k|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 3.82k, False: 284k]
  ------------------
  121|  3.82k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  3.82k|            }
  123|       |            // Found first letter.
  124|   288k|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 17.8k, False: 270k]
  ------------------
  125|       |                // Make sure it's in range.
  126|  17.8k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  17.8k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 1.17k, False: 16.6k]
  ------------------
  128|       |                    // out of range
  129|  1.17k|                    QTC::TC("libtests", "InputSource out of range");
  130|  1.17k|                    return false;
  131|  1.17k|                }
  132|  17.8k|            }
  133|   287k|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 2.36k, False: 285k]
  ------------------
  134|       |                // If there are not enough bytes left in the file for start_chars, we will detect
  135|       |                // this on the next pass as EOF and return.
  136|  2.36k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  2.36k|                continue;
  138|  2.36k|            }
  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|   285k|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 36.6k, False: 248k]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  36.6k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  36.6k|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 27.0k, False: 9.63k]
  ------------------
  146|  27.0k|                    return true;
  147|  27.0k|                } else {
  148|  9.63k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  9.63k|                }
  150|   248k|            } else {
  151|   248k|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|   248k|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|   258k|            ++p;
  156|   258k|        } else {
  157|       |            // Trigger reading the next block
  158|   185k|            p = buf + bytes_read;
  159|   185k|        }
  160|   474k|    }
  161|  68.2k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  20.5k|{
  166|  20.5k|    bool found = false;
  167|  20.5k|    qpdf_offset_t after_found_offset = 0;
  168|  20.5k|    qpdf_offset_t cur_offset = offset;
  169|  20.5k|    size_t cur_len = len;
  170|  26.7k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 6.12k, False: 20.5k]
  ------------------
  171|  6.12k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 385, False: 5.74k]
  ------------------
  172|    385|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  5.74k|        } else {
  174|  5.74k|            found = true;
  175|  5.74k|        }
  176|  6.12k|        after_found_offset = this->tell();
  177|  6.12k|        cur_offset = after_found_offset;
  178|  6.12k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  6.12k|    }
  180|  20.5k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 5.74k, False: 14.8k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  5.74k|    }
  183|  20.5k|    return found;
  184|  20.5k|}
_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|  98.6k|{
   13|  98.6k|    init();
   14|  98.6k|}
_ZN3MD54initEv:
   18|  98.6k|{
   19|  98.6k|    crypto = QPDFCryptoProvider::getImpl();
   20|  98.6k|    crypto->MD5_init();
   21|  98.6k|}
_ZN3MD56digestEPh:
   88|  98.6k|{
   89|  98.6k|    crypto->MD5_finalize();
   90|  98.6k|    crypto->MD5_digest(result);
   91|  98.6k|}
_ZN3MD56digestEv:
   95|    981|{
   96|    981|    Digest digest_val;
   97|    981|    digest(digest_val);
   98|    981|    return {reinterpret_cast<char*>(digest_val), 16};
   99|    981|}
_ZN3MD56digestENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  103|  1.98k|{
  104|  1.98k|    MD5 m;
  105|  1.98k|    m.encodeDataIncrementally(data.data(), data.size());
  106|  1.98k|    Digest digest_val;
  107|  1.98k|    m.digest(digest_val);
  108|  1.98k|    return {reinterpret_cast<char*>(digest_val), 16};
  109|  1.98k|}

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

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

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

_ZN10Pl_AES_PDFC2EPKcP8PipelinebNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
   16|   137k|    Pipeline(identifier, next),
   17|   137k|    key(key),
   18|   137k|    crypto(QPDFCryptoProvider::getImpl()),
   19|   137k|    encrypt(encrypt)
   20|   137k|{
   21|   137k|    util::assertion(next, "Attempt to create Pl_AES_PDF with nullptr as next");
   22|   137k|    util::no_ci_rt_error_if(!(key.size() == 32 || key.size() == 16), "unsupported key length");
  ------------------
  |  Branch (22:31): [True: 4.41k, False: 132k]
  |  Branch (22:51): [True: 132k, False: 4]
  ------------------
   23|   137k|    std::memset(this->inbuf, 0, this->buf_size);
   24|   137k|    std::memset(this->outbuf, 0, this->buf_size);
   25|   137k|    std::memset(this->cbc_block, 0, this->buf_size);
   26|   137k|}
_ZN10Pl_AES_PDF9useZeroIVEv:
   30|    634|{
   31|    634|    use_zero_iv = true;
   32|    634|}
_ZN10Pl_AES_PDF14disablePaddingEv:
   36|   126k|{
   37|   126k|    disable_padding = true;
   38|   126k|}
_ZN10Pl_AES_PDF5setIVEPKhm:
   42|   126k|{
   43|   126k|    util::assertion(
   44|   126k|        bytes == buf_size,
   45|   126k|        "Pl_AES_PDF: specified initialization vector size in bytes must be " +
   46|   126k|            std::to_string(bytes));
   47|   126k|    use_specified_iv = true;
   48|   126k|    memcpy(specified_iv, iv, bytes);
   49|   126k|}
_ZN10Pl_AES_PDF5writeEPKhm:
   65|  8.09M|{
   66|  8.09M|    size_t bytes_left = len;
   67|  8.09M|    unsigned char const* p = data;
   68|       |
   69|  42.8M|    while (bytes_left > 0) {
  ------------------
  |  Branch (69:12): [True: 34.7M, False: 8.09M]
  ------------------
   70|  34.7M|        if (offset == buf_size) {
  ------------------
  |  Branch (70:13): [True: 34.5M, False: 136k]
  ------------------
   71|  34.5M|            flush(false);
   72|  34.5M|        }
   73|       |
   74|  34.7M|        size_t available = buf_size - offset;
   75|  34.7M|        size_t bytes = (bytes_left < available ? bytes_left : available);
  ------------------
  |  Branch (75:25): [True: 8.55k, False: 34.7M]
  ------------------
   76|  34.7M|        bytes_left -= bytes;
   77|  34.7M|        std::memcpy(inbuf + offset, p, bytes);
   78|  34.7M|        offset += bytes;
   79|  34.7M|        p += bytes;
   80|  34.7M|    }
   81|  8.09M|}
_ZN10Pl_AES_PDF6finishEv:
   85|   137k|{
   86|   137k|    if (encrypt) {
  ------------------
  |  Branch (86:9): [True: 126k, False: 11.1k]
  ------------------
   87|   126k|        if (offset == buf_size) {
  ------------------
  |  Branch (87:13): [True: 126k, False: 0]
  ------------------
   88|   126k|            flush(false);
   89|   126k|        }
   90|   126k|        if (!disable_padding) {
  ------------------
  |  Branch (90:13): [True: 0, False: 126k]
  ------------------
   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|   126k|    } else {
   99|  11.1k|        if (offset != buf_size) {
  ------------------
  |  Branch (99:13): [True: 9.12k, False: 1.98k]
  ------------------
  100|       |            // This is never supposed to happen as the output is always supposed to be padded.
  101|       |            // However, we have encountered files for which the output is not a multiple of the
  102|       |            // block size.  In this case, pad with zeroes and hope for the best.
  103|  9.12k|            util::assertion(offset < buf_size, "buffer overflow in AES encryption pipeline");
  104|  9.12k|            std::memset(inbuf + offset, 0, buf_size - offset);
  105|  9.12k|            offset = buf_size;
  106|  9.12k|        }
  107|  11.1k|        flush(!disable_padding);
  108|  11.1k|    }
  109|   137k|    crypto->rijndael_finalize();
  110|   137k|    next()->finish();
  111|   137k|}
_ZN10Pl_AES_PDF16initializeVectorEv:
  115|   126k|{
  116|   126k|    if (use_zero_iv) {
  ------------------
  |  Branch (116:9): [True: 634, False: 126k]
  ------------------
  117|  10.7k|        for (unsigned int i = 0; i < buf_size; ++i) {
  ------------------
  |  Branch (117:34): [True: 10.1k, False: 634]
  ------------------
  118|  10.1k|            cbc_block[i] = 0;
  119|  10.1k|        }
  120|   126k|    } else if (use_specified_iv) {
  ------------------
  |  Branch (120:16): [True: 126k, False: 0]
  ------------------
  121|   126k|        std::memcpy(cbc_block, specified_iv, buf_size);
  122|   126k|    } 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|   126k|}
_ZN10Pl_AES_PDF5flushEb:
  133|  34.7M|{
  134|  34.7M|    util::assertion(offset == buf_size, "AES pipeline: flush called when buffer was not full");
  135|       |
  136|  34.7M|    if (first) {
  ------------------
  |  Branch (136:9): [True: 137k, False: 34.5M]
  ------------------
  137|   137k|        first = false;
  138|   137k|        bool return_after_init = false;
  139|   137k|        if (cbc_mode) {
  ------------------
  |  Branch (139:13): [True: 137k, False: 0]
  ------------------
  140|   137k|            if (encrypt) {
  ------------------
  |  Branch (140:17): [True: 126k, False: 11.1k]
  ------------------
  141|       |                // Set cbc_block to the initialization vector, and if not zero, write it to the
  142|       |                // output stream.
  143|   126k|                initializeVector();
  144|   126k|                if (!(use_zero_iv || use_specified_iv)) {
  ------------------
  |  Branch (144:23): [True: 0, False: 126k]
  |  Branch (144:38): [True: 126k, False: 0]
  ------------------
  145|      0|                    next()->write(cbc_block, buf_size);
  146|      0|                }
  147|   126k|            } else if (use_zero_iv || use_specified_iv) {
  ------------------
  |  Branch (147:24): [True: 634, False: 10.4k]
  |  Branch (147:39): [True: 0, False: 10.4k]
  ------------------
  148|       |                // Initialize vector with zeroes; zero vector was not written to the beginning of
  149|       |                // the input file.
  150|    634|                initializeVector();
  151|  10.4k|            } else {
  152|       |                // Take the first block of input as the initialization vector.  There's nothing to
  153|       |                // write at this time.
  154|  10.4k|                memcpy(cbc_block, inbuf, buf_size);
  155|  10.4k|                offset = 0;
  156|  10.4k|                return_after_init = true;
  157|  10.4k|            }
  158|   137k|        }
  159|   137k|        crypto->rijndael_init(
  160|   137k|            encrypt,
  161|   137k|            reinterpret_cast<const unsigned char*>(key.data()),
  162|   137k|            key.size(),
  163|   137k|            cbc_mode,
  164|   137k|            cbc_block);
  165|   137k|        if (return_after_init) {
  ------------------
  |  Branch (165:13): [True: 10.4k, False: 126k]
  ------------------
  166|  10.4k|            return;
  167|  10.4k|        }
  168|   137k|    }
  169|       |
  170|  34.7M|    crypto->rijndael_process(inbuf, outbuf);
  171|  34.7M|    unsigned int bytes = buf_size;
  172|  34.7M|    if (strip_padding) {
  ------------------
  |  Branch (172:9): [True: 8.33k, False: 34.6M]
  ------------------
  173|  8.33k|        unsigned char last = outbuf[buf_size - 1];
  174|  8.33k|        if (last <= buf_size) {
  ------------------
  |  Branch (174:13): [True: 1.24k, False: 7.09k]
  ------------------
  175|  1.24k|            bool strip = true;
  176|  2.69k|            for (unsigned int i = 1; i <= last; ++i) {
  ------------------
  |  Branch (176:38): [True: 2.25k, False: 440]
  ------------------
  177|  2.25k|                if (outbuf[buf_size - i] != last) {
  ------------------
  |  Branch (177:21): [True: 805, False: 1.45k]
  ------------------
  178|    805|                    strip = false;
  179|    805|                    break;
  180|    805|                }
  181|  2.25k|            }
  182|  1.24k|            if (strip) {
  ------------------
  |  Branch (182:17): [True: 440, False: 805]
  ------------------
  183|    440|                bytes -= last;
  184|    440|            }
  185|  1.24k|        }
  186|  8.33k|    }
  187|  34.7M|    offset = 0;
  188|  34.7M|    next()->write(outbuf, bytes);
  189|  34.7M|}

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|    654|    Pipeline(identifier, next)
   13|    654|{
   14|    654|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|    654|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|    769|{
   20|    769|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 0, False: 769]
  ------------------
   21|      0|        return;
   22|      0|    }
   23|   346k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 346k, False: 557]
  ------------------
   24|   346k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 5.62k, False: 340k]
  ------------------
   25|    779|        case ' ':
  ------------------
  |  Branch (25:9): [True: 779, False: 345k]
  ------------------
   26|  1.36k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 590, False: 345k]
  ------------------
   27|  1.66k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 295, False: 345k]
  ------------------
   28|  1.95k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 286, False: 345k]
  ------------------
   29|  4.55k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 2.60k, False: 343k]
  ------------------
   30|  5.62k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 1.06k, False: 345k]
  ------------------
   31|  5.62k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  5.62k|            continue;
   34|   346k|        }
   35|   340k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 6, False: 340k]
  ------------------
   36|      6|            break;
   37|   340k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 30, False: 340k]
  ------------------
   38|     30|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|     30|            flush();
   40|     30|            eod = 2;
   41|   340k|        } else {
   42|   340k|            switch (buf[i]) {
   43|     29|            case '~':
  ------------------
  |  Branch (43:13): [True: 29, False: 340k]
  ------------------
   44|     29|                eod = 1;
   45|     29|                break;
   46|       |
   47|    635|            case 'z':
  ------------------
  |  Branch (47:13): [True: 635, False: 339k]
  ------------------
   48|    635|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 20, False: 615]
  ------------------
   49|     20|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     20|                }
   51|    615|                unsigned char zeroes[4];
   52|    615|                memset(zeroes, '\0', 4);
   53|    615|                next()->write(zeroes, 4);
   54|    615|                break;
   55|       |
   56|   339k|            default:
  ------------------
  |  Branch (56:13): [True: 339k, False: 664]
  ------------------
   57|   339k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 46, False: 339k]
  |  Branch (57:36): [True: 103, False: 339k]
  ------------------
   58|    149|                    error = true;
   59|    149|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   339k|                } else {
   61|   339k|                    this->inbuf[this->pos++] = buf[i];
   62|   339k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 67.7k, False: 271k]
  ------------------
   63|  67.7k|                        flush();
   64|  67.7k|                    }
   65|   339k|                }
   66|   339k|                break;
   67|   340k|            }
   68|   340k|        }
   69|   340k|    }
   70|    769|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|  68.2k|{
   75|  68.2k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 198, False: 68.0k]
  ------------------
   76|    198|        return;
   77|    198|    }
   78|  68.0k|    unsigned long lval = 0;
   79|   408k|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 340k, False: 68.0k]
  ------------------
   80|   340k|        lval *= 85;
   81|   340k|        lval += (this->inbuf[i] - 33U);
   82|   340k|    }
   83|       |
   84|  68.0k|    unsigned char outbuf[4];
   85|  68.0k|    memset(outbuf, 0, 4);
   86|   340k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 272k, False: 68.0k]
  ------------------
   87|   272k|        outbuf[i] = lval & 0xff;
   88|   272k|        lval >>= 8;
   89|   272k|    }
   90|       |
   91|  68.0k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 67.7k, False: 262]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|  68.0k|    auto t = this->pos - 1;
   94|  68.0k|    this->pos = 0;
   95|  68.0k|    memset(this->inbuf, 117, 5);
   96|       |
   97|  68.0k|    next()->write(outbuf, t);
   98|  68.0k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|    578|{
  103|    578|    if (error) {
  ------------------
  |  Branch (103:9): [True: 125, False: 453]
  ------------------
  104|    125|        return;
  105|    125|    }
  106|    453|    flush();
  107|    453|    next()->finish();
  108|    453|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|    420|    Pipeline(identifier, next)
   14|    420|{
   15|    420|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|    420|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|    727|{
   21|    727|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 205, False: 522]
  ------------------
   22|    205|        return;
   23|    205|    }
   24|  4.75k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 4.38k, False: 368]
  ------------------
   25|  4.38k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  4.38k|        switch (ch) {
   27|    297|        case ' ':
  ------------------
  |  Branch (27:9): [True: 297, False: 4.08k]
  ------------------
   28|    614|        case '\f':
  ------------------
  |  Branch (28:9): [True: 317, False: 4.06k]
  ------------------
   29|    905|        case '\v':
  ------------------
  |  Branch (29:9): [True: 291, False: 4.09k]
  ------------------
   30|  1.18k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 277, False: 4.10k]
  ------------------
   31|  1.47k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 297, False: 4.08k]
  ------------------
   32|  1.79k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 318, False: 4.06k]
  ------------------
   33|  1.79k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  1.79k|            break;
   36|       |
   37|     41|        case '>':
  ------------------
  |  Branch (37:9): [True: 41, False: 4.34k]
  ------------------
   38|     41|            eod = true;
   39|     41|            flush();
   40|     41|            break;
   41|       |
   42|  2.54k|        default:
  ------------------
  |  Branch (42:9): [True: 2.54k, False: 1.83k]
  ------------------
   43|  2.54k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 2.47k, False: 70]
  |  Branch (43:31): [True: 1.80k, False: 668]
  |  Branch (43:46): [True: 662, False: 76]
  |  Branch (43:59): [True: 625, False: 37]
  ------------------
   44|  2.43k|                inbuf[pos++] = ch;
   45|  2.43k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 1.16k, False: 1.27k]
  ------------------
   46|  1.16k|                    flush();
   47|  1.16k|                }
   48|  2.43k|            } else {
   49|    113|                char t[2];
   50|    113|                t[0] = ch;
   51|    113|                t[1] = 0;
   52|    113|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|    113|            }
   54|  2.43k|            break;
   55|  4.38k|        }
   56|  4.26k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 40, False: 4.22k]
  ------------------
   57|     40|            break;
   58|     40|        }
   59|  4.26k|    }
   60|    522|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  1.52k|{
   65|  1.52k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 260, False: 1.26k]
  ------------------
   66|    260|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|    260|        return;
   68|    260|    }
   69|  1.26k|    int b[2];
   70|  3.79k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 2.53k, False: 1.26k]
  ------------------
   71|  2.53k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 624, False: 1.90k]
  ------------------
   72|    624|            b[i] = inbuf[i] - 'A' + 10;
   73|  1.90k|        } else {
   74|  1.90k|            b[i] = inbuf[i] - '0';
   75|  1.90k|        }
   76|  2.53k|    }
   77|  1.26k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  1.26k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 1.16k, False: 104]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  1.26k|    pos = 0;
   82|  1.26k|    inbuf[0] = '0';
   83|  1.26k|    inbuf[1] = '0';
   84|  1.26k|    inbuf[2] = '\0';
   85|       |
   86|  1.26k|    next()->write(&ch, 1);
   87|  1.26k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|    323|{
   92|    323|    flush();
   93|    323|    next()->finish();
   94|    323|}

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

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

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

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

_ZN10Pl_OStreamC2EPKcRNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
   19|      2|    Pipeline(identifier, nullptr),
   20|      2|    m(std::make_unique<Members>(os))
   21|      2|{
   22|      2|}
_ZN10Pl_OStreamD2Ev:
   25|      2|Pl_OStream::~Pl_OStream() = default;
_ZN10Pl_OStream5writeEPKhm:
   29|  2.01M|{
   30|  2.01M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   31|  2.01M|}
_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.97k|    Pipeline(identifier, next),
   31|  1.97k|    action(action)
   32|  1.97k|{
   33|  1.97k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  1.97k|    util::no_ci_rt_error_if(
   35|  1.97k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  1.97k|    util::no_ci_rt_error_if(
   37|  1.97k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 132, False: 1.84k]
  |  Branch (37:35): [True: 69, False: 1.77k]
  |  Branch (37:59): [True: 69, False: 1.70k]
  ------------------
   38|  1.70k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 1.61k, False: 88]
  |  Branch (38:35): [True: 65, False: 23]
  ------------------
   39|  1.97k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  1.97k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  1.97k|    util::no_ci_rt_error_if(
   42|  1.97k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  1.97k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  1.97k|    util::no_ci_rt_error_if(
   45|  1.97k|        !util::fits<uint32_t>(columns),
   46|  1.97k|        "PNGFilter created with columns value that causes overflow");
   47|  1.97k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   48|  1.97k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   49|  1.97k|    util::no_ci_rt_error_if(
   50|  1.97k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (50:9): [True: 26, False: 1.95k]
  |  Branch (50:21): [True: 3, False: 1.94k]
  ------------------
   51|  1.97k|    util::no_ci_rt_error_if(
   52|  1.97k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (52:9): [True: 1.94k, False: 29]
  |  Branch (52:29): [True: 37, False: 1.91k]
  ------------------
   53|  1.97k|    bytes_per_row = static_cast<uint32_t>(bpr);
   54|  1.97k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   55|  1.97k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   56|  1.97k|    memset(buf1.get(), 0, bytes_per_row + 1);
   57|  1.97k|    memset(buf2.get(), 0, bytes_per_row + 1);
   58|  1.97k|    cur_row = buf1.get();
   59|  1.97k|    prev_row = buf2.get();
   60|       |
   61|       |    // number of bytes per incoming row
   62|  1.97k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (62:17): [True: 0, False: 1.97k]
  ------------------
   63|  1.97k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   73|   247k|{
   74|   247k|    size_t left = incoming - pos;
   75|   247k|    size_t offset = 0;
   76|  1.23M|    while (len >= left) {
  ------------------
  |  Branch (76:12): [True: 983k, False: 247k]
  ------------------
   77|       |        // finish off current row
   78|   983k|        memcpy(cur_row + pos, data + offset, left);
   79|   983k|        offset += left;
   80|   983k|        len -= left;
   81|       |
   82|   983k|        processRow();
   83|       |
   84|       |        // Swap rows
   85|   983k|        unsigned char* t = prev_row;
   86|   983k|        prev_row = cur_row;
   87|   983k|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (87:19): [True: 983k, False: 2]
  ------------------
   88|   983k|        memset(cur_row, 0, bytes_per_row + 1);
   89|   983k|        left = incoming;
   90|   983k|        pos = 0;
   91|   983k|    }
   92|   247k|    if (len) {
  ------------------
  |  Branch (92:9): [True: 246k, False: 675]
  ------------------
   93|   246k|        memcpy(cur_row + pos, data + offset, len);
   94|   246k|    }
   95|   247k|    pos += len;
   96|   247k|}
_ZN12Pl_PNGFilter10processRowEv:
  100|   984k|{
  101|   984k|    if (action == a_encode) {
  ------------------
  |  Branch (101:9): [True: 0, False: 984k]
  ------------------
  102|      0|        encodeRow();
  103|   984k|    } else {
  104|   984k|        decodeRow();
  105|   984k|    }
  106|   984k|}
_ZN12Pl_PNGFilter9decodeRowEv:
  110|   984k|{
  111|   984k|    int filter = cur_row[0];
  112|   984k|    if (prev_row) {
  ------------------
  |  Branch (112:9): [True: 984k, False: 0]
  ------------------
  113|   984k|        switch (filter) {
  114|   280k|        case 0:
  ------------------
  |  Branch (114:9): [True: 280k, False: 703k]
  ------------------
  115|   280k|            break;
  116|   174k|        case 1:
  ------------------
  |  Branch (116:9): [True: 174k, False: 810k]
  ------------------
  117|   174k|            decodeSub();
  118|   174k|            break;
  119|   426k|        case 2:
  ------------------
  |  Branch (119:9): [True: 426k, False: 557k]
  ------------------
  120|   426k|            decodeUp();
  121|   426k|            break;
  122|    537|        case 3:
  ------------------
  |  Branch (122:9): [True: 537, False: 983k]
  ------------------
  123|    537|            decodeAverage();
  124|    537|            break;
  125|  7.95k|        case 4:
  ------------------
  |  Branch (125:9): [True: 7.95k, False: 976k]
  ------------------
  126|  7.95k|            decodePaeth();
  127|  7.95k|            break;
  128|  93.6k|        default:
  ------------------
  |  Branch (128:9): [True: 93.6k, False: 890k]
  ------------------
  129|       |            // ignore
  130|  93.6k|            break;
  131|   984k|        }
  132|   984k|    }
  133|       |
  134|   984k|    next()->write(cur_row + 1, bytes_per_row);
  135|   984k|}
_ZN12Pl_PNGFilter9decodeSubEv:
  139|   174k|{
  140|   174k|    unsigned char* buffer = cur_row + 1;
  141|   174k|    unsigned int bpp = bytes_per_pixel;
  142|       |
  143|  2.00M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (143:30): [True: 1.82M, False: 174k]
  ------------------
  144|  1.82M|        unsigned char left = 0;
  145|       |
  146|  1.82M|        if (i >= bpp) {
  ------------------
  |  Branch (146:13): [True: 1.65M, False: 177k]
  ------------------
  147|  1.65M|            left = buffer[i - bpp];
  148|  1.65M|        }
  149|       |
  150|  1.82M|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  151|  1.82M|    }
  152|   174k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  156|   426k|{
  157|   426k|    unsigned char* buffer = cur_row + 1;
  158|   426k|    unsigned char* above_buffer = prev_row + 1;
  159|       |
  160|  2.87M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (160:30): [True: 2.45M, False: 426k]
  ------------------
  161|  2.45M|        unsigned char up = above_buffer[i];
  162|  2.45M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  163|  2.45M|    }
  164|   426k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  168|    537|{
  169|    537|    unsigned char* buffer = cur_row + 1;
  170|    537|    unsigned char* above_buffer = prev_row + 1;
  171|    537|    auto bpp = bytes_per_pixel;
  172|       |
  173|   706k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (173:30): [True: 706k, False: 537]
  ------------------
  174|   706k|        int left = 0;
  175|   706k|        int up = 0;
  176|       |
  177|   706k|        if (i >= bpp) {
  ------------------
  |  Branch (177:13): [True: 448k, False: 258k]
  ------------------
  178|   448k|            left = buffer[i - bpp];
  179|   448k|        }
  180|       |
  181|   706k|        up = above_buffer[i];
  182|   706k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  183|   706k|    }
  184|    537|}
_ZN12Pl_PNGFilter11decodePaethEv:
  188|  7.95k|{
  189|  7.95k|    unsigned char* buffer = cur_row + 1;
  190|  7.95k|    unsigned char* above_buffer = prev_row + 1;
  191|  7.95k|    auto bpp = bytes_per_pixel;
  192|       |
  193|   629k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (193:30): [True: 621k, False: 7.95k]
  ------------------
  194|   621k|        int left = 0;
  195|   621k|        int up = above_buffer[i];
  196|   621k|        int upper_left = 0;
  197|       |
  198|   621k|        if (i >= bpp) {
  ------------------
  |  Branch (198:13): [True: 519k, False: 101k]
  ------------------
  199|   519k|            left = buffer[i - bpp];
  200|   519k|            upper_left = above_buffer[i - bpp];
  201|   519k|        }
  202|       |
  203|   621k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  204|   621k|    }
  205|  7.95k|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  209|   621k|{
  210|   621k|    int p = a + b - c;
  211|   621k|    int pa = abs_diff(p, a);
  212|   621k|    int pb = abs_diff(p, b);
  213|   621k|    int pc = abs_diff(p, c);
  214|       |
  215|   621k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (215:9): [True: 599k, False: 22.4k]
  |  Branch (215:21): [True: 599k, False: 288]
  ------------------
  216|   599k|        return a;
  217|   599k|    }
  218|  22.6k|    if (pb <= pc) {
  ------------------
  |  Branch (218:9): [True: 22.3k, False: 300]
  ------------------
  219|  22.3k|        return b;
  220|  22.3k|    }
  221|    300|    return c;
  222|  22.6k|}
_ZN12Pl_PNGFilter6finishEv:
  242|  1.89k|{
  243|  1.89k|    if (pos) {
  ------------------
  |  Branch (243:9): [True: 929, False: 965]
  ------------------
  244|       |        // write partial row
  245|    929|        processRow();
  246|    929|    }
  247|  1.89k|    prev_row = nullptr;
  248|  1.89k|    cur_row = buf1.get();
  249|  1.89k|    pos = 0;
  250|  1.89k|    memset(cur_row, 0, bytes_per_row + 1);
  251|       |
  252|  1.89k|    next()->finish();
  253|  1.89k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|  1.86M|{
   20|  1.86M|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 715k, False: 1.15M]
  ------------------
   21|  1.86M|}

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

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

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

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

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

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

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

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   373k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 309k, False: 64.6k]
  ------------------
   10|   373k|    error_code(error_code),
   11|   373k|    filename(filename),
   12|   373k|    object(object),
   13|   373k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 309k, False: 64.6k]
  ------------------
   14|   373k|    message(message)
   15|   373k|{
   16|   373k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   355k|    std::runtime_error(
   26|   355k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 355k, False: 94]
  |  Branch (26:49): [True: 94, False: 0]
  ------------------
   27|   355k|    error_code(error_code),
   28|   355k|    filename(filename),
   29|   355k|    object(object),
   30|   355k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 355k, False: 94]
  |  Branch (30:22): [True: 94, False: 0]
  ------------------
   31|   355k|    message(message)
   32|   355k|{
   33|   355k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|   729k|{
   42|   729k|    std::string result;
   43|   729k|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 671k, False: 58.2k]
  ------------------
   44|   671k|        result += filename;
   45|   671k|    }
   46|   729k|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 148k, False: 581k]
  |  Branch (46:29): [True: 105k, False: 42.1k]
  ------------------
   47|   623k|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 565k, False: 57.9k]
  ------------------
   48|   565k|            result += " (";
   49|   565k|        }
   50|   623k|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 581k, False: 42.1k]
  ------------------
   51|   581k|            result += object;
   52|   581k|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 517k, False: 63.9k]
  ------------------
   53|   517k|                result += ", ";
   54|   517k|            }
   55|   581k|        }
   56|   623k|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 559k, False: 63.9k]
  ------------------
   57|   559k|            result += "offset " + std::to_string(offset);
   58|   559k|        }
   59|   623k|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 565k, False: 57.9k]
  ------------------
   60|   565k|            result += ")";
   61|   565k|        }
   62|   623k|    }
   63|   729k|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 729k, False: 297]
  ------------------
   64|   729k|        result += ": ";
   65|   729k|    }
   66|   729k|    result += message;
   67|   729k|    return result;
   68|   729k|}

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

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

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   34|   144k|{
   35|   144k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (35:12): [True: 144k, False: 0]
  ------------------
   36|   144k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   46|  20.5k|    supports_retry(supports_retry)
   47|  20.5k|{
   48|  20.5k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   51|  20.5k|{
   52|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   53|  20.5k|}
_ZNK4qpdf10BaseHandle4copyEb:
  252|   115k|{
  253|   115k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (253:13): [True: 115k, False: 0]
  ------------------
  254|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (254:5): [True: 0, False: 115k]
  ------------------
  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: 115k]
  ------------------
  258|      0|        return QPDFObject::create<QPDF_Reserved>();
  259|    693|    case ::ot_null:
  ------------------
  |  Branch (259:5): [True: 693, False: 114k]
  ------------------
  260|    693|        return QPDFObject::create<QPDF_Null>();
  261|    252|    case ::ot_boolean:
  ------------------
  |  Branch (261:5): [True: 252, False: 114k]
  ------------------
  262|    252|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  263|  1.35k|    case ::ot_integer:
  ------------------
  |  Branch (263:5): [True: 1.35k, False: 113k]
  ------------------
  264|  1.35k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  265|    564|    case ::ot_real:
  ------------------
  |  Branch (265:5): [True: 564, False: 114k]
  ------------------
  266|    564|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  267|  1.88k|    case ::ot_string:
  ------------------
  |  Branch (267:5): [True: 1.88k, False: 113k]
  ------------------
  268|  1.88k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  269|   109k|    case ::ot_name:
  ------------------
  |  Branch (269:5): [True: 109k, False: 5.87k]
  ------------------
  270|   109k|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  271|    418|    case ::ot_array:
  ------------------
  |  Branch (271:5): [True: 418, False: 114k]
  ------------------
  272|    418|        {
  273|    418|            auto const& a = std::get<QPDF_Array>(obj->value);
  274|    418|            if (shallow) {
  ------------------
  |  Branch (274:17): [True: 0, False: 418]
  ------------------
  275|      0|                return QPDFObject::create<QPDF_Array>(a);
  276|    418|            } else {
  277|    418|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (277:52): [True: 26, False: 392]
  ------------------
  278|    418|                if (a.sp) {
  ------------------
  |  Branch (278:21): [True: 26, False: 392]
  ------------------
  279|     26|                    QPDF_Array result;
  280|     26|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  281|     26|                    result.sp->size = a.sp->size;
  282|  5.12k|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (282:47): [True: 5.12k, False: 26]
  ------------------
  283|  5.12k|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (283:52): [True: 67, False: 5.06k]
  ------------------
  284|  5.12k|                    }
  285|     26|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  286|    392|                } else {
  287|    392|                    std::vector<QPDFObjectHandle> result;
  288|    392|                    result.reserve(a.elements.size());
  289|   109k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (289:45): [True: 109k, False: 392]
  ------------------
  290|   109k|                        result.emplace_back(
  291|   109k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (291:29): [True: 109k, False: 0]
  |  Branch (291:40): [True: 1.58k, False: 107k]
  ------------------
  292|   109k|                    }
  293|    392|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  294|    392|                }
  295|    418|            }
  296|    418|        }
  297|    705|    case ::ot_dictionary:
  ------------------
  |  Branch (297:5): [True: 705, False: 114k]
  ------------------
  298|    705|        {
  299|    705|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  300|    705|            if (shallow) {
  ------------------
  |  Branch (300:17): [True: 0, False: 705]
  ------------------
  301|      0|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  302|    705|            } else {
  303|    705|                std::map<std::string, QPDFObjectHandle> new_items;
  304|  2.84k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (304:44): [True: 2.84k, False: 705]
  ------------------
  305|  2.84k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (305:38): [True: 484, False: 2.36k]
  ------------------
  306|  2.84k|                }
  307|    705|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  308|    705|            }
  309|    705|        }
  310|      0|    case ::ot_stream:
  ------------------
  |  Branch (310:5): [True: 0, False: 115k]
  ------------------
  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: 115k]
  ------------------
  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: 115k]
  ------------------
  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: 115k]
  ------------------
  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: 115k]
  ------------------
  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: 115k]
  ------------------
  325|      0|        return referenced_object().obj_sp();
  326|   115k|    }
  327|      0|    return {}; // unreachable
  328|   115k|}
_ZN4qpdf10BaseHandle10disconnectEb:
  692|  4.19M|{
  693|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  694|  4.19M|    if (only_direct && indirect()) {
  ------------------
  |  Branch (694:9): [True: 3.90M, False: 290k]
  |  Branch (694:24): [True: 102k, False: 3.80M]
  ------------------
  695|   102k|        return;
  696|   102k|    }
  697|       |
  698|  4.09M|    switch (raw_type_code()) {
  699|  54.9k|    case ::ot_array:
  ------------------
  |  Branch (699:5): [True: 54.9k, False: 4.04M]
  ------------------
  700|  54.9k|        {
  701|  54.9k|            auto& a = std::get<QPDF_Array>(obj->value);
  702|  54.9k|            if (a.sp) {
  ------------------
  |  Branch (702:17): [True: 221, False: 54.7k]
  ------------------
  703|  1.41M|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (703:32): [True: 1.41M, False: 221]
  ------------------
  704|  1.41M|                    item.second.disconnect();
  705|  1.41M|                }
  706|  54.7k|            } else {
  707|  2.12M|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (707:30): [True: 2.12M, False: 54.7k]
  ------------------
  708|  2.12M|                    oh.disconnect();
  709|  2.12M|                }
  710|  54.7k|            }
  711|  54.9k|        }
  712|  54.9k|        break;
  713|  96.5k|    case ::ot_dictionary:
  ------------------
  |  Branch (713:5): [True: 96.5k, False: 3.99M]
  ------------------
  714|   347k|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (714:24): [True: 347k, False: 96.5k]
  ------------------
  715|   347k|            iter.second.disconnect();
  716|   347k|        }
  717|  96.5k|        break;
  718|  20.2k|    case ::ot_stream:
  ------------------
  |  Branch (718:5): [True: 20.2k, False: 4.07M]
  ------------------
  719|  20.2k|        {
  720|  20.2k|            auto& s = std::get<QPDF_Stream>(obj->value);
  721|  20.2k|            s.m->stream_provider = nullptr;
  722|  20.2k|            s.m->stream_dict.disconnect();
  723|  20.2k|        }
  724|  20.2k|        break;
  725|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (725:5): [True: 0, False: 4.09M]
  ------------------
  726|      0|        return;
  727|  3.92M|    default:
  ------------------
  |  Branch (727:5): [True: 3.92M, False: 171k]
  ------------------
  728|  3.92M|        break;
  729|  4.09M|    }
  730|  4.09M|    obj->qpdf = nullptr;
  731|  4.09M|    obj->og = QPDFObjGen();
  732|  4.09M|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  736|    191|{
  737|    191|    return obj == rhs.obj;
  738|    191|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  748|  5.86k|{
  749|  5.86k|    static constexpr std::array<char const*, 16> tn{
  750|  5.86k|        "uninitialized",
  751|  5.86k|        "reserved",
  752|  5.86k|        "null",
  753|  5.86k|        "boolean",
  754|  5.86k|        "integer",
  755|  5.86k|        "real",
  756|  5.86k|        "string",
  757|  5.86k|        "name",
  758|  5.86k|        "array",
  759|  5.86k|        "dictionary",
  760|  5.86k|        "stream",
  761|  5.86k|        "operator",
  762|  5.86k|        "inline-image",
  763|  5.86k|        "unresolved",
  764|  5.86k|        "destroyed",
  765|  5.86k|        "reference"};
  766|  5.86k|    return tn[type_code()];
  767|  5.86k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  783|  5.13k|{
  784|  5.13k|    return type_code() == ::ot_boolean;
  785|  5.13k|}
_ZNK16QPDFObjectHandle6isNullEv:
  797|  2.38k|{
  798|  2.38k|    return type_code() == ::ot_null;
  799|  2.38k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  803|   169k|{
  804|   169k|    return type_code() == ::ot_integer;
  805|   169k|}
_ZNK16QPDFObjectHandle6isRealEv:
  809|  16.9k|{
  810|  16.9k|    return type_code() == ::ot_real;
  811|  16.9k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  815|  27.1k|{
  816|  27.1k|    return (isInteger() || isReal());
  ------------------
  |  Branch (816:13): [True: 10.7k, False: 16.4k]
  |  Branch (816:28): [True: 16.2k, False: 160]
  ------------------
  817|  27.1k|}
_ZNK16QPDFObjectHandle6isNameEv:
  845|  18.7k|{
  846|  18.7k|    return type_code() == ::ot_name;
  847|  18.7k|}
_ZNK16QPDFObjectHandle8isStringEv:
  851|  12.0k|{
  852|  12.0k|    return type_code() == ::ot_string;
  853|  12.0k|}
_ZNK16QPDFObjectHandle7isArrayEv:
  869|   150k|{
  870|   150k|    return type_code() == ::ot_array;
  871|   150k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  875|   462k|{
  876|   462k|    return type_code() == ::ot_dictionary;
  877|   462k|}
_ZNK16QPDFObjectHandle8isScalarEv:
  893|  4.07k|{
  894|  4.07k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (894:12): [True: 15, False: 4.06k]
  |  Branch (894:24): [True: 247, False: 3.81k]
  |  Branch (894:39): [True: 3.30k, False: 510]
  |  Branch (894:51): [True: 0, False: 510]
  |  Branch (894:63): [True: 118, False: 392]
  |  Branch (894:75): [True: 21, False: 371]
  ------------------
  895|  4.07k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  899|  2.05k|{
  900|  2.05k|    return Name(*this) == name;
  901|  2.05k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  905|   156k|{
  906|   156k|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (906:12): [True: 59.1k, False: 97.6k]
  |  Branch (906:31): [True: 0, False: 59.1k]
  |  Branch (906:47): [True: 10.7k, False: 48.4k]
  ------------------
  907|  10.7k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (907:10): [True: 10.6k, False: 54]
  |  Branch (907:29): [True: 18, False: 36]
  ------------------
  908|   156k|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  912|  59.9k|{
  913|  59.9k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (913:14): [True: 26.1k, False: 33.7k]
  ------------------
  914|  26.1k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (914:16): [True: 26.1k, False: 0]
  |  Branch (914:27): [True: 0, False: 26.1k]
  |  Branch (914:43): [True: 16.7k, False: 9.39k]
  ------------------
  915|  16.7k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (915:14): [True: 16.7k, False: 0]
  |  Branch (915:33): [True: 0, False: 0]
  ------------------
  916|  26.1k|    }
  917|  33.7k|    return false;
  918|  59.9k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  924|      3|{
  925|      3|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (925:14): [True: 3, False: 0]
  ------------------
  926|      3|        return boolean->val;
  927|      3|    } else {
  928|      0|        typeWarning("boolean", "returning false");
  929|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  930|      0|        return false;
  931|      0|    }
  932|      3|}
_ZN4qpdf7IntegerC2Ex:
  947|  1.77k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  948|  1.77k|{
  949|  1.77k|}
_ZNK4qpdf7Integer5valueEv:
  959|   144k|{
  960|   144k|    auto* i = as<QPDF_Integer>();
  961|   144k|    if (!i) {
  ------------------
  |  Branch (961:9): [True: 1.54k, False: 142k]
  ------------------
  962|  1.54k|        throw invalid_error("Integer");
  963|  1.54k|    }
  964|   142k|    return i->val;
  965|   144k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  969|  57.4k|{
  970|  57.4k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (970:20): [True: 57.4k, False: 0]
  ------------------
  971|  57.4k|        return integer;
  972|  57.4k|    } else {
  973|      0|        typeWarning("integer", "returning 0");
  974|      0|        return 0;
  975|      0|    }
  976|  57.4k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  980|  8.82k|{
  981|  8.82k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (981:20): [True: 8.78k, False: 42]
  ------------------
  982|  8.78k|        value = integer;
  983|  8.78k|        return true;
  984|  8.78k|    }
  985|     42|    return false;
  986|  8.82k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  990|  51.1k|{
  991|  51.1k|    try {
  992|  51.1k|        return Integer(*this).value<int>();
  993|  51.1k|    } catch (std::invalid_argument&) {
  994|     30|        typeWarning("integer", "returning 0");
  995|     30|        return 0;
  996|     30|    }
  997|  51.1k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
 1001|  2.64k|{
 1002|  2.64k|    if (!isInteger()) {
  ------------------
  |  Branch (1002:9): [True: 45, False: 2.60k]
  ------------------
 1003|     45|        return false;
 1004|     45|    }
 1005|  2.60k|    value = getIntValueAsInt();
 1006|  2.60k|    return true;
 1007|  2.64k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1011|  16.8k|{
 1012|  16.8k|    try {
 1013|  16.8k|        return Integer(*this).value<unsigned long long>();
 1014|  16.8k|    } catch (std::invalid_argument&) {
 1015|  1.08k|        typeWarning("integer", "returning 0");
 1016|  1.08k|        return 0;
 1017|  1.08k|    }
 1018|  16.8k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1032|  10.1k|{
 1033|  10.1k|    try {
 1034|  10.1k|        return Integer(*this).value<unsigned int>();
 1035|  10.1k|    } catch (std::invalid_argument&) {
 1036|    427|        typeWarning("integer", "returning 0");
 1037|    427|        return 0;
 1038|    427|    }
 1039|  10.1k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1043|  3.19k|{
 1044|  3.19k|    if (!isInteger()) {
  ------------------
  |  Branch (1044:9): [True: 545, False: 2.65k]
  ------------------
 1045|    545|        return false;
 1046|    545|    }
 1047|  2.65k|    value = getUIntValueAsUInt();
 1048|  2.65k|    return true;
 1049|  3.19k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1087|  12.1k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1088|  12.1k|{
 1089|  12.1k|}
_ZNK4qpdf4Name5valueEv:
 1093|  72.4k|{
 1094|  72.4k|    auto* n = as<QPDF_Name>();
 1095|  72.4k|    if (!n) {
  ------------------
  |  Branch (1095:9): [True: 0, False: 72.4k]
  ------------------
 1096|      0|        throw invalid_error("Name");
 1097|      0|    }
 1098|  72.4k|    return n->name;
 1099|  72.4k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1103|  6.04k|{
 1104|  6.04k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1104:15): [True: 6.04k, False: 0]
  ------------------
 1105|  6.04k|        return name->name;
 1106|  6.04k|    }
 1107|      0|    typeWarning("name", "returning dummy name");
 1108|      0|    return "/QPDFFakeName";
 1109|  6.04k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1125|     28|{
 1126|     28|    return {QPDFObject::create<QPDF_String>(str)};
 1127|     28|}
_ZN16QPDFObjectHandle16newUnicodeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1131|  2.99k|{
 1132|  2.99k|    return {String::utf16(utf8_str).obj_sp()};
 1133|  2.99k|}
_ZN4qpdf6StringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1136|  2.27k|    BaseHandle(QPDFObject::create<QPDF_String>(str))
 1137|  2.27k|{
 1138|  2.27k|}
_ZN4qpdf6StringC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1141|    723|    BaseHandle(QPDFObject::create<QPDF_String>(std::move(str)))
 1142|    723|{
 1143|    723|}
_ZN4qpdf6String5utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1147|  2.99k|{
 1148|  2.99k|    std::string result;
 1149|  2.99k|    if (QUtil::utf8_to_pdf_doc(utf8_str, result, '?')) {
  ------------------
  |  Branch (1149:9): [True: 2.27k, False: 723]
  ------------------
 1150|  2.27k|        return String(result);
 1151|  2.27k|    }
 1152|    723|    return String(QUtil::utf8_to_utf16(utf8_str));
 1153|  2.99k|}
_ZNK4qpdf6String5valueEv:
 1157|  4.04k|{
 1158|  4.04k|    auto* s = as<QPDF_String>();
 1159|  4.04k|    if (!s) {
  ------------------
  |  Branch (1159:9): [True: 0, False: 4.04k]
  ------------------
 1160|      0|        throw invalid_error("String");
 1161|      0|    }
 1162|  4.04k|    return s->val;
 1163|  4.04k|}
_ZNK4qpdf6String10utf8_valueEv:
 1167|   743k|{
 1168|   743k|    auto* s = as<QPDF_String>();
 1169|   743k|    if (!s) {
  ------------------
  |  Branch (1169:9): [True: 0, False: 743k]
  ------------------
 1170|      0|        throw invalid_error("String");
 1171|      0|    }
 1172|   743k|    if (util::is_utf16(s->val)) {
  ------------------
  |  Branch (1172:9): [True: 46.2k, False: 697k]
  ------------------
 1173|  46.2k|        return QUtil::utf16_to_utf8(s->val);
 1174|  46.2k|    }
 1175|   697k|    if (util::is_explicit_utf8(s->val)) {
  ------------------
  |  Branch (1175:9): [True: 4.88k, False: 692k]
  ------------------
 1176|       |        // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
 1177|       |        // of U+FEFF.
 1178|  4.88k|        return s->val.substr(3);
 1179|  4.88k|    }
 1180|   692k|    return QUtil::pdf_doc_to_utf8(s->val);
 1181|   697k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1185|  4.04k|{
 1186|  4.04k|    try {
 1187|  4.04k|        return String(obj).value();
 1188|  4.04k|    } catch (std::invalid_argument&) {
 1189|      0|        typeWarning("string", "returning empty string");
 1190|      0|        return {};
 1191|      0|    }
 1192|  4.04k|}
_ZNK16QPDFObjectHandle12getUTF8ValueEv:
 1207|   743k|{
 1208|   743k|    try {
 1209|   743k|        return String(obj).utf8_value();
 1210|   743k|    } catch (std::invalid_argument&) {
 1211|      0|        typeWarning("string", "returning empty string");
 1212|      0|        return {};
 1213|      0|    }
 1214|   743k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1289|    523|{
 1290|    523|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1290:9): [True: 1, False: 522]
  ------------------
 1291|      1|        return true;
 1292|    522|    } else if (isArray()) {
  ------------------
  |  Branch (1292:16): [True: 68, False: 454]
  ------------------
 1293|  1.38k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1293:24): [True: 1.38k, False: 39]
  ------------------
 1294|  1.38k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1294:17): [True: 29, False: 1.35k]
  ------------------
 1295|     29|                return true;
 1296|     29|            }
 1297|  1.38k|        }
 1298|     68|    }
 1299|    493|    return false;
 1300|    523|}
_ZN16QPDFObjectHandle7newNullEv:
 1895|  20.5k|{
 1896|  20.5k|    return {QPDFObject::create<QPDF_Null>()};
 1897|  20.5k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1907|  17.9k|{
 1908|  17.9k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1909|  17.9k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1931|  4.47k|{
 1932|  4.47k|    return {QPDFObject::create<QPDF_Array>(items)};
 1933|  4.47k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1937|  4.47k|{
 1938|  4.47k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1939|  4.47k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1985|  5.89k|{
 1986|  5.89k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1987|  5.89k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1991|  5.89k|{
 1992|  5.89k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1993|  5.89k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2036|  58.2k|{
 2037|  58.2k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2037:12): [True: 58.2k, False: 0]
  ------------------
 2038|  58.2k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2051|  28.4k|{
 2052|  28.4k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2052:12): [True: 28.4k, False: 0]
  |  Branch (2052:19): [True: 28.4k, False: 0]
  ------------------
 2053|  28.4k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2057|    180|{
 2058|    180|    if (!obj) {
  ------------------
  |  Branch (2058:9): [True: 0, False: 180]
  ------------------
 2059|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2060|      0|    }
 2061|    180|    return {copy()};
 2062|    180|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2137|  1.54k|{
 2138|  1.54k|    return std::invalid_argument(method + " operation attempted on invalid object");
 2139|  1.54k|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2149|  5.86k|{
 2150|  5.86k|    return {
 2151|  5.86k|        qpdf_e_object,
 2152|  5.86k|        "",
 2153|  5.86k|        description(),
 2154|  5.86k|        0,
 2155|  5.86k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2156|  5.86k|            message};
 2157|  5.86k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2161|  5.86k|{
 2162|  5.86k|    if (!obj) {
  ------------------
  |  Branch (2162:9): [True: 0, False: 5.86k]
  ------------------
 2163|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2164|      0|    }
 2165|  5.86k|    warn(type_error(expected_type, message));
 2166|  5.86k|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2338|  58.2k|{
 2339|  58.2k|    if (!qpdf()) {
  ------------------
  |  Branch (2339:9): [True: 297, False: 57.9k]
  ------------------
 2340|    297|        throw std::move(e);
 2341|    297|    }
 2342|  57.9k|    qpdf()->warn(std::move(e));
 2343|  57.9k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2347|  62.1k|{
 2348|  62.1k|    if (qpdf()) {
  ------------------
  |  Branch (2348:9): [True: 52.3k, False: 9.81k]
  ------------------
 2349|  52.3k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2350|  52.3k|    } else {
 2351|  9.81k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2352|  9.81k|    }
 2353|  62.1k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2522|  37.9k|{
 2523|  37.9k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2523:12): [True: 37.9k, False: 0]
  ------------------
 2524|  37.9k|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2528|  26.3k|{
 2529|  26.3k|    return getObjGen().getObj();
 2530|  26.3k|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2540|  20.7k|{
 2541|  20.7k|    return getObjectID() != 0;
 2542|  20.7k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2547|  62.1k|{
 2548|  62.1k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2548:12): [True: 62.1k, False: 0]
  ------------------
 2549|  62.1k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2562|     28|{
 2563|     28|    if (obj) {
  ------------------
  |  Branch (2563:9): [True: 28, False: 0]
  ------------------
 2564|     28|        obj->setParsedOffset(offset);
 2565|     28|    }
 2566|     28|}

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

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  8.42k|{
   24|  8.42k|    return !dh.m->seen.add(og);
   25|  8.42k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  1.91k|    QPDFDocumentHelper(qpdf),
   29|  1.91k|    m(std::make_shared<Members>())
   30|  1.91k|{
   31|  1.91k|    validate();
   32|  1.91k|}
_ZN25QPDFOutlineDocumentHelper3getER4QPDF:
   36|  1.91k|{
   37|  1.91k|    return qpdf.doc().outlines();
   38|  1.91k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  1.91k|{
   43|  1.91k|    m->outlines.clear();
   44|  1.91k|    m->names_dest = nullptr;
   45|       |
   46|  1.91k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  1.91k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 258, False: 1.66k]
  ------------------
   48|    258|        return;
   49|    258|    }
   50|  1.66k|    auto outlines = root.getKey("/Outlines");
   51|  1.66k|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 16, False: 1.64k]
  |  Branch (51:11): [True: 1.65k, False: 2]
  |  Branch (51:38): [True: 1.64k, False: 14]
  ------------------
   52|     16|        return;
   53|     16|    }
   54|  1.64k|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|  1.64k|    QPDFObjGen::set seen;
   56|  4.19k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 2.62k, False: 1.57k]
  ------------------
   57|  2.62k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 69, False: 2.55k]
  ------------------
   58|     69|            cur.warn("Loop detected loop in /Outlines tree");
   59|     69|            return;
   60|     69|        }
   61|  2.55k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  2.55k|        cur = cur.getKey("/Next");
   63|  2.55k|    }
   64|  1.64k|}
_ZN25QPDFOutlineDocumentHelper19getTopLevelOutlinesEv:
   74|  1.91k|{
   75|  1.91k|    return m->outlines;
   76|  1.91k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  3.67k|{
  108|  3.67k|    QPDFObjectHandle result;
  109|  3.67k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 243, False: 3.43k]
  ------------------
  110|    243|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 91, False: 152]
  ------------------
  111|     91|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     91|        }
  113|    243|        result = m->dest_dict.getKeyIfDict(name.getName());
  114|  3.43k|    } else if (name.isString()) {
  ------------------
  |  Branch (114:16): [True: 3.43k, False: 0]
  ------------------
  115|  3.43k|        if (!m->names_dest) {
  ------------------
  |  Branch (115:13): [True: 1.63k, False: 1.79k]
  ------------------
  116|  1.63k|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|  1.63k|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 1.38k, False: 251]
  ------------------
  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.63k|        }
  128|  3.43k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 2.99k, False: 432]
  ------------------
  129|  2.99k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 519, False: 2.48k]
  ------------------
  130|    519|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    519|            }
  132|  2.99k|        }
  133|  3.43k|    }
  134|  3.67k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 2.69k, False: 983]
  ------------------
  135|  2.69k|        return QPDFObjectHandle::newNull();
  136|  2.69k|    }
  137|    983|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 292, False: 691]
  ------------------
  138|    292|        return result.getKey("/D");
  139|    292|    }
  140|    691|    return result;
  141|    983|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  1.91k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  1.91k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|   138k|                    [](QPDFObjectHandle const& o) -> bool {
  122|   138k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 132k, False: 6.03k]
  |  Branch (122:47): [True: 4.82k, False: 1.20k]
  ------------------
  123|   138k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  8.42k|    dh(dh)
    9|  8.42k|{
   10|  8.42k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  8.42k|    QPDFObjectHelper(a_oh),
   15|  8.42k|    m(new Members(dh))
   16|  8.42k|{
   17|  8.42k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 8.42k]
  ------------------
   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.42k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 4.82k, False: 3.59k]
  ------------------
   23|  4.82k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  4.82k|        return;
   25|  4.82k|    }
   26|       |
   27|  3.59k|    QPDFObjGen::set children;
   28|  3.59k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  9.46k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 6.24k, False: 3.21k]
  |  Branch (29:27): [True: 6.15k, False: 90]
  ------------------
   30|  6.15k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 289, False: 5.86k]
  ------------------
   31|    289|            cur.warn("Loop detected loop in /Outlines tree");
   32|    289|            break;
   33|    289|        }
   34|  5.86k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  5.86k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  5.86k|        m->kids.emplace_back(new_ooh);
   37|  5.86k|        cur = cur.getKey("/Next");
   38|  5.86k|    }
   39|  3.59k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  8.12k|{
   50|  8.12k|    return m->kids;
   51|  8.12k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  8.34k|{
   56|  8.34k|    auto dest = get("/Dest");
   57|  8.34k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 7.07k, False: 1.27k]
  ------------------
   58|  7.07k|        auto const& A = get("/A");
   59|  7.07k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 3.08k, False: 3.99k]
  ------------------
   60|  3.08k|            dest = A["/D"];
   61|  3.08k|        }
   62|  7.07k|    }
   63|  8.34k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 4.05k, False: 4.29k]
  ------------------
   64|  4.05k|        return QPDFObjectHandle::newNull();
   65|  4.05k|    }
   66|  4.29k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 243, False: 4.04k]
  |  Branch (66:26): [True: 3.43k, False: 617]
  ------------------
   67|  3.67k|        return m->dh.resolveNamedDest(dest);
   68|  3.67k|    }
   69|    617|    return dest;
   70|  4.29k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  8.34k|{
   75|  8.34k|    QPDFObjectHandle dest = getDest();
   76|  8.34k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 1.13k, False: 7.21k]
  |  Branch (76:26): [True: 746, False: 390]
  ------------------
   77|    746|        return dest.getArrayItem(0);
   78|    746|    }
   79|  7.60k|    return QPDFObjectHandle::newNull();
   80|  8.34k|}

_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   107k|{
  130|   107k|    return Parser(
  131|   107k|               input,
  132|   107k|               make_description(input.getName(), object_description),
  133|   107k|               object_description,
  134|   107k|               tokenizer,
  135|   107k|               decrypter,
  136|   107k|               &context,
  137|   107k|               true,
  138|   107k|               0,
  139|   107k|               0,
  140|   107k|               sanity_checks)
  141|   107k|        .parse();
  142|   107k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  25.8k|{
  148|  25.8k|    return Parser(
  149|  25.8k|               input,
  150|  25.8k|               std::make_shared<QPDFObject::Description>(
  151|  25.8k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  25.8k|               "",
  153|  25.8k|               tokenizer,
  154|  25.8k|               nullptr,
  155|  25.8k|               &context,
  156|  25.8k|               true,
  157|  25.8k|               stream_id,
  158|  25.8k|               obj_id)
  159|  25.8k|        .parse();
  160|  25.8k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|   133k|{
  165|   133k|    try {
  166|   133k|        return parse_first(content_stream);
  167|   133k|    } catch (Error&) {
  168|  8.36k|        return {};
  169|  8.36k|    } catch (QPDFExc& e) {
  170|  3.41k|        throw e;
  171|  3.41k|    } catch (std::logic_error& e) {
  172|      1|        throw e;
  173|  1.23k|    } catch (std::exception& e) {
  174|  1.23k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  1.23k|        return {};
  176|  1.23k|    }
  177|   133k|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|   133k|{
  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|   133k|    QPDF::Doc::ParseGuard pg(context_);
  188|   133k|    start_ = input_.tell();
  189|   133k|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 1.53k, False: 132k]
  ------------------
  190|  1.53k|        warn(tokenizer_.getErrorMessage());
  191|  1.53k|    }
  192|       |
  193|   133k|    switch (tokenizer_.getType()) {
  194|    530|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 530, False: 133k]
  ------------------
  195|    530|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 0, False: 530]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|      0|            empty_ = true;
  198|      0|            return {};
  199|      0|        }
  200|    530|        warn("unexpected EOF");
  201|    530|        return {};
  202|       |
  203|  1.40k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 1.40k, False: 132k]
  ------------------
  204|  1.40k|        return {};
  205|       |
  206|    229|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 229, False: 133k]
  ------------------
  207|    328|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 99, False: 133k]
  ------------------
  208|    328|        warn("treating unexpected brace token as null");
  209|    328|        return {};
  210|       |
  211|    464|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 464, False: 133k]
  ------------------
  212|    464|        warn("treating unexpected array close token as null");
  213|    464|        return {};
  214|       |
  215|    300|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 300, False: 133k]
  ------------------
  216|    300|        warn("unexpected dictionary close token");
  217|    300|        return {};
  218|       |
  219|  10.7k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 10.7k, False: 122k]
  ------------------
  220|   108k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 97.9k, False: 35.6k]
  ------------------
  221|   108k|        stack_.clear();
  222|   108k|        stack_.emplace_back(
  223|   108k|            input_,
  224|   108k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 10.7k, False: 97.9k]
  ------------------
  225|   108k|        frame_ = &stack_.back();
  226|   108k|        return parse_remainder(content_stream);
  227|       |
  228|    466|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 466, False: 133k]
  ------------------
  229|    466|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    139|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 139, False: 133k]
  ------------------
  232|    139|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|  8.98k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 8.98k, False: 124k]
  ------------------
  235|  8.98k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|  1.76k|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 1.76k, False: 131k]
  ------------------
  238|  1.76k|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  1.73k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 1.73k, False: 131k]
  ------------------
  241|  1.73k|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  8.11k|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 8.11k, False: 125k]
  ------------------
  244|  8.11k|        {
  245|  8.11k|            auto const& value = tokenizer_.getValue();
  246|  8.11k|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 0, False: 8.11k]
  ------------------
  247|      0|                return with_description<QPDF_Operator>(value);
  248|  8.11k|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 322, False: 7.79k]
  ------------------
  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|    322|                empty_ = true;
  254|    322|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    322|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 322, False: 0]
  ------------------
  256|    322|                    warn("empty object treated as null");
  257|    322|                }
  258|    322|                return {};
  259|  7.79k|            } else {
  260|  7.79k|                warn("unknown token while reading object; treating as string");
  261|  7.79k|                return with_description<QPDF_String>(value);
  262|  7.79k|            }
  263|  8.11k|        }
  264|       |
  265|    512|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 512, False: 133k]
  ------------------
  266|    512|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 125, False: 387]
  ------------------
  267|    125|            std::string s{tokenizer_.getValue()};
  268|    125|            decrypter_->decryptString(s);
  269|    125|            return with_description<QPDF_String>(s);
  270|    387|        } else {
  271|    387|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|    387|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 133k]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|   133k|    }
  278|   133k|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|   108k|{
  283|       |    // This method must take care not to resolve any objects. Don't check the type of any object
  284|       |    // without first ensuring that it is a direct object. Otherwise, doing so may have the side
  285|       |    // effect of reading the object and changing the file pointer. If you do this, it will cause a
  286|       |    // logic error to be thrown from QPDF::inParse().
  287|       |
  288|   108k|    bad_count_ = 0;
  289|   108k|    bool b_contents = false;
  290|       |
  291|  17.1M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 17.1M, Folded]
  ------------------
  292|  17.1M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 36.3k, False: 17.0M]
  ------------------
  293|  36.3k|            warn(tokenizer_.getErrorMessage());
  294|  36.3k|        }
  295|  17.1M|        ++good_count_; // optimistically
  296|       |
  297|  17.1M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 7.15M, False: 9.94M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  7.15M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 6.69M, False: 459k]
  ------------------
  301|  6.69M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 6.36M, False: 329k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|  6.36M|                    add_int(int_count_);
  304|  6.36M|                }
  305|  6.69M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  6.69M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  6.69M|                continue;
  308|       |
  309|  6.69M|            } else if (
  310|   459k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 329k, False: 129k]
  |  Branch (310:36): [True: 291k, False: 38.1k]
  ------------------
  311|   291k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 276k, False: 14.6k]
  ------------------
  312|   276k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 276k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   276k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   276k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   276k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 1.94k, False: 274k]
  |  Branch (319:33): [True: 416, False: 274k]
  |  Branch (319:44): [True: 386, False: 274k]
  ------------------
  320|   274k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   274k|                } else {
  322|  2.74k|                    add_bad_null(
  323|  2.74k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  2.74k|                        std::to_string(gen) + " R) as null");
  325|  2.74k|                }
  326|   276k|                int_count_ = 0;
  327|   276k|                continue;
  328|       |
  329|   276k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 182k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   182k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 52.7k, False: 129k]
  ------------------
  332|  52.7k|                    add_int(int_count_ - 1);
  333|  52.7k|                }
  334|   182k|                add_int(int_count_);
  335|   182k|                int_count_ = 0;
  336|   182k|            }
  337|  7.15M|        }
  338|       |
  339|  10.1M|        switch (tokenizer_.getType()) {
  340|  7.31k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 7.31k, False: 10.1M]
  ------------------
  341|  7.31k|            warn("parse error while reading object");
  342|  7.31k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 0, False: 7.31k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|      0|                return {};
  345|      0|            }
  346|  7.31k|            warn("unexpected EOF");
  347|  7.31k|            return {};
  348|       |
  349|  28.9k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 28.9k, False: 10.0M]
  ------------------
  350|  28.9k|            check_too_many_bad_tokens();
  351|  28.9k|            add_null();
  352|  28.9k|            continue;
  353|       |
  354|  1.65k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 1.65k, False: 10.1M]
  ------------------
  355|  3.91k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 2.26k, False: 10.1M]
  ------------------
  356|  3.91k|            add_bad_null("treating unexpected brace token as null");
  357|  3.91k|            continue;
  358|       |
  359|  75.7k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 75.7k, False: 10.0M]
  ------------------
  360|  75.7k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 73.6k, False: 2.14k]
  ------------------
  361|  73.6k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 584, False: 73.0k]
  ------------------
  362|  73.6k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|  73.6k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|  73.6k|                set_description(object, frame_->offset - 1);
  365|       |                // The `offset` points to the next of "[".  Set the rewind offset to point to the
  366|       |                // beginning of "[". This has been explicitly tested with whitespace surrounding the
  367|       |                // array start delimiter. getLastOffset points to the array end token and therefore
  368|       |                // can't be used here.
  369|  73.6k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 2.15k, False: 71.4k]
  ------------------
  370|  2.15k|                    return object;
  371|  2.15k|                }
  372|  71.4k|                stack_.pop_back();
  373|  71.4k|                frame_ = &stack_.back();
  374|  71.4k|                add(std::move(object));
  375|  71.4k|            } else {
  376|  2.14k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 1.43k, False: 705]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  1.43k|                    warn("unexpected array close token; giving up on reading object");
  380|  1.43k|                    return {};
  381|  1.43k|                }
  382|    705|                add_bad_null("treating unexpected array close token as null");
  383|    705|            }
  384|  72.1k|            continue;
  385|       |
  386|   130k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 130k, False: 9.99M]
  ------------------
  387|   130k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 129k, False: 1.13k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   129k|                auto& dict = frame_->dict;
  390|       |
  391|   129k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 9.14k, False: 120k]
  ------------------
  392|  9.14k|                    warn(
  393|  9.14k|                        frame_->offset,
  394|  9.14k|                        "dictionary ended prematurely; using null as value for last key");
  395|  9.14k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  9.14k|                }
  397|   129k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 36.7k, False: 92.9k]
  ------------------
  398|  36.7k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 33.0k, False: 3.69k]
  ------------------
  399|  33.0k|                        warn(
  400|  33.0k|                            frame_->offset,
  401|  33.0k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  33.0k|                    } else {
  403|  3.69k|                        fix_missing_keys();
  404|  3.69k|                    }
  405|  36.7k|                }
  406|       |
  407|   129k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 291, False: 129k]
  |  Branch (407:21): [True: 28, False: 129k]
  |  Branch (407:57): [True: 151, False: 140]
  ------------------
  408|    151|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 58, False: 93]
  |  Branch (408:62): [True: 38, False: 20]
  ------------------
  409|     38|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 28, False: 10]
  |  Branch (409:51): [True: 28, False: 0]
  ------------------
  410|     28|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     28|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     28|                }
  413|   129k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   129k|                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|   129k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 84.5k, False: 45.0k]
  ------------------
  420|  84.5k|                    return object;
  421|  84.5k|                }
  422|  45.0k|                stack_.pop_back();
  423|  45.0k|                frame_ = &stack_.back();
  424|  45.0k|                add(std::move(object));
  425|  45.0k|            } else {
  426|  1.13k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 606, False: 528]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|    606|                    warn("unexpected dictionary close token; giving up on reading object");
  430|    606|                    return {};
  431|    606|                }
  432|    528|                add_bad_null("unexpected dictionary close token");
  433|    528|            }
  434|  45.6k|            continue;
  435|       |
  436|   154k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 154k, False: 9.97M]
  ------------------
  437|   226k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 72.1k, False: 10.0M]
  ------------------
  438|   226k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 89, False: 226k]
  ------------------
  439|     89|                limits_error(
  440|     89|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|     89|            }
  442|   226k|            b_contents = false;
  443|   226k|            stack_.emplace_back(
  444|   226k|                input_,
  445|   226k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 154k, False: 72.1k]
  ------------------
  446|   226k|                                                                       : st_dictionary_key);
  447|   226k|            frame_ = &stack_.back();
  448|   226k|            continue;
  449|       |
  450|  8.62k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 8.62k, False: 10.1M]
  ------------------
  451|  8.62k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  8.62k|            continue;
  453|       |
  454|  68.1k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 68.1k, False: 10.0M]
  ------------------
  455|  68.1k|            add_null();
  456|  68.1k|            continue;
  457|       |
  458|   459k|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 459k, False: 9.66M]
  ------------------
  459|   459k|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 459k, False: 0]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   459k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   459k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   459k|                int_count_ = 1;
  464|   459k|            } else {
  465|      0|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|      0|            }
  467|   459k|            continue;
  468|       |
  469|  58.3k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 58.3k, False: 10.0M]
  ------------------
  470|  58.3k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|  58.3k|            continue;
  472|       |
  473|  8.75M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 8.75M, False: 1.37M]
  ------------------
  474|  8.75M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 475k, False: 8.27M]
  ------------------
  475|   475k|                frame_->key = tokenizer_.getValue();
  476|   475k|                frame_->state = st_dictionary_value;
  477|   475k|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 23.9k, False: 451k]
  |  Branch (477:44): [True: 632, False: 23.3k]
  ------------------
  478|   475k|                continue;
  479|  8.27M|            } else {
  480|  8.27M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  8.27M|            }
  482|  8.27M|            continue;
  483|       |
  484|  8.27M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 158k, False: 9.96M]
  ------------------
  485|   158k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 0, False: 158k]
  ------------------
  486|      0|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|      0|                continue;
  488|      0|            }
  489|       |
  490|   158k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 150k, False: 8.71k]
  ------------------
  491|   150k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 1.00k, False: 149k]
  |  Branch (491:58): [True: 320, False: 148k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  1.32k|                    warn(
  495|  1.32k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  1.32k|                        "reading object");
  497|  1.32k|                    return {};
  498|  1.32k|                }
  499|       |
  500|   148k|                add_bad_null("unknown token while reading object; treating as null");
  501|   148k|                continue;
  502|   150k|            }
  503|       |
  504|  8.71k|            warn("unknown token while reading object; treating as string");
  505|  8.71k|            check_too_many_bad_tokens();
  506|  8.71k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  8.71k|            continue;
  509|       |
  510|   146k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 146k, False: 9.98M]
  ------------------
  511|   146k|            {
  512|   146k|                auto const& val = tokenizer_.getValue();
  513|   146k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 15.8k, False: 130k]
  ------------------
  514|  15.8k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 599, False: 15.2k]
  ------------------
  515|    599|                        frame_->contents_string = val;
  516|    599|                        frame_->contents_offset = input_.getLastOffset();
  517|    599|                        b_contents = false;
  518|    599|                    }
  519|  15.8k|                    std::string s{val};
  520|  15.8k|                    decrypter_->decryptString(s);
  521|  15.8k|                    add_scalar<QPDF_String>(s);
  522|   130k|                } else {
  523|   130k|                    add_scalar<QPDF_String>(val);
  524|   130k|                }
  525|   146k|            }
  526|   146k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 10.1M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  10.1M|        }
  531|  10.1M|    }
  532|   108k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  15.4M|{
  537|  15.4M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 15.0M, False: 435k]
  ------------------
  538|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  539|       |        // processing once the tt_dict_close token has been found.
  540|  15.0M|        frame_->olist.emplace_back(std::move(obj));
  541|  15.0M|    } else {
  542|   435k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 6.76k, False: 428k]
  ------------------
  543|  6.76k|            warn_duplicate_key();
  544|  6.76k|        }
  545|   435k|        frame_->state = st_dictionary_key;
  546|   435k|    }
  547|  15.4M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   245k|{
  552|   245k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   245k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 220k, False: 24.3k]
  ------------------
  555|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  556|       |        // processing once the tt_dict_close token has been found.
  557|   220k|        frame_->olist.emplace_back(null_obj);
  558|   220k|    } else {
  559|  24.3k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 2.35k, False: 21.9k]
  ------------------
  560|  2.35k|            warn_duplicate_key();
  561|  2.35k|        }
  562|  24.3k|        frame_->state = st_dictionary_key;
  563|  24.3k|    }
  564|   245k|    ++frame_->null_count;
  565|   245k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   156k|{
  570|   156k|    warn(msg);
  571|   156k|    check_too_many_bad_tokens();
  572|   156k|    add_null();
  573|   156k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|  6.60M|{
  578|  6.60M|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|  6.60M|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|  6.60M|    add(std::move(obj));
  581|  6.60M|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   202k|{
  611|   202k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 202k, False: 0]
  ------------------
  612|   202k|        obj->setDescription(context_, description_, parsed_offset);
  613|   202k|    }
  614|   202k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  3.69k|{
  619|  3.69k|    std::set<std::string> names;
  620|  12.1k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 12.1k, False: 3.69k]
  ------------------
  621|  12.1k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 605, False: 11.5k]
  ------------------
  622|    605|            names.insert(obj.getName());
  623|    605|        }
  624|  12.1k|    }
  625|  3.69k|    int next_fake_key = 1;
  626|  11.7k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 11.7k, False: 3.69k]
  ------------------
  627|  11.8k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 11.8k, Folded]
  ------------------
  628|  11.8k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  11.8k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 11.7k, False: 68]
  |  Branch (629:68): [True: 11.7k, False: 18]
  ------------------
  630|  11.8k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 11.7k, False: 86]
  ------------------
  631|  11.8k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 11.7k, False: 86]
  ------------------
  632|  11.7k|                warn(
  633|  11.7k|                    frame_->offset,
  634|  11.7k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  11.7k|                frame_->dict[key] = item;
  636|  11.7k|                break;
  637|  11.7k|            }
  638|  11.8k|        }
  639|  11.7k|    }
  640|  3.69k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   201k|{
  645|   201k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 154k, False: 47.5k]
  |  Branch (645:66): [True: 44.1k, False: 3.44k]
  ------------------
  646|   201k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 510, False: 201k]
  |  Branch (646:42): [True: 0, False: 201k]
  ------------------
  647|    510|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 432, False: 78]
  ------------------
  648|    432|            limits_error(
  649|    432|                "parser-max-container-size-damaged",
  650|    432|                "encountered errors while parsing an array or dictionary with more than " +
  651|    432|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    432|        }
  653|    510|        limits_error(
  654|    510|            "parser-max-container-size",
  655|    510|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    510|                " elements during xref recovery; giving up on reading object");
  657|    510|    }
  658|   201k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 201k, False: 510]
  |  Branch (658:27): [True: 1.54k, False: 199k]
  ------------------
  659|  1.54k|        limits_error(
  660|  1.54k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  1.54k|    }
  662|   201k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 63.7k, False: 138k]
  ------------------
  663|  63.7k|        good_count_ = 0;
  664|  63.7k|        bad_count_ = 1;
  665|  63.7k|        return;
  666|  63.7k|    }
  667|   138k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 6.26k, False: 131k]
  ------------------
  668|   131k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 82.6k, False: 49.1k]
  |  Branch (668:39): [True: 2.07k, False: 80.5k]
  ------------------
  669|       |        // Give up after 5 errors in close proximity or if the number of missing dictionary keys
  670|       |        // exceeds the remaining number of allowable total errors.
  671|  6.29k|        warn("too many errors; giving up on reading object");
  672|  6.29k|        throw Error();
  673|  6.29k|    }
  674|   131k|    good_count_ = 0;
  675|   131k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.13k|{
  680|  2.13k|    Limits::error();
  681|  2.13k|    warn("limits error("s + limit + "): " + msg);
  682|  2.13k|    throw Error();
  683|  2.13k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   303k|{
  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|   303k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 303k, False: 0]
  ------------------
  692|   303k|        context_->warn(e);
  693|   303k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   303k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  9.11k|{
  701|  9.11k|    warn(
  702|  9.11k|        frame_->offset,
  703|  9.11k|        "dictionary has duplicated key " + frame_->key +
  704|  9.11k|            "; last occurrence overrides earlier ones");
  705|  9.11k|    check_too_many_bad_tokens();
  706|  9.11k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   303k|{
  711|   303k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 17.6k, False: 285k]
  ------------------
  712|  17.6k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  713|  17.6k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  714|  17.6k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  715|   285k|    } else {
  716|   285k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   285k|    }
  718|   303k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   240k|{
  723|   240k|    warn(input_.getLastOffset(), msg);
  724|   240k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|   133k|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 133k, False: 0]
  ------------------
   27|   133k|    {
   28|   133k|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 133k, False: 0]
  ------------------
   29|   133k|            objects->inParse(true);
   30|   133k|        }
   31|   133k|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|   133k|    {
   41|   133k|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 133k, False: 0]
  ------------------
   42|   133k|            objects->inParse(false);
   43|   133k|        }
   44|   133k|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   274k|    {
   36|   274k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   274k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|    466|{
  603|    466|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    466|    obj->setDescription(context_, description_, start_);
  605|    466|    return {obj};
  606|    466|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|  8.57k|{
  603|  8.57k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  8.57k|    obj->setDescription(context_, description_, start_);
  605|  8.57k|    return {obj};
  606|  8.57k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.76k|{
  603|  1.76k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.76k|    obj->setDescription(context_, description_, start_);
  605|  1.76k|    return {obj};
  606|  1.76k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.73k|{
  603|  1.73k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.73k|    obj->setDescription(context_, description_, start_);
  605|  1.73k|    return {obj};
  606|  1.73k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  7.68k|{
  603|  7.68k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  7.68k|    obj->setDescription(context_, description_, start_);
  605|  7.68k|    return {obj};
  606|  7.68k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    123|{
  603|    123|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    123|    obj->setDescription(context_, description_, start_);
  605|    123|    return {obj};
  606|    123|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_BoolJbEEEvDpOT0_:
  586|  8.62k|{
  587|  8.62k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 5.58k, False: 3.04k]
  |  Branch (587:66): [True: 1.88k, False: 1.15k]
  ------------------
  588|  8.62k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 70, False: 8.55k]
  |  Branch (588:42): [True: 0, False: 8.55k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     70|        max_bad_count_ = 1;
  592|     70|        check_too_many_bad_tokens(); // always throws Error()
  593|     70|    }
  594|  8.62k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  8.62k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  8.62k|    add(std::move(obj));
  597|  8.62k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  58.3k|{
  587|  58.3k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 11.1k, False: 47.1k]
  |  Branch (587:66): [True: 45.5k, False: 1.61k]
  ------------------
  588|  58.3k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 73, False: 58.2k]
  |  Branch (588:42): [True: 0, False: 58.2k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     73|        max_bad_count_ = 1;
  592|     73|        check_too_many_bad_tokens(); // always throws Error()
  593|     73|    }
  594|  58.3k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  58.3k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  58.3k|    add(std::move(obj));
  597|  58.3k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  8.27M|{
  587|  8.27M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 1.89M, False: 6.38M]
  |  Branch (587:66): [True: 349k, False: 6.03M]
  ------------------
  588|  8.27M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 231, False: 8.27M]
  |  Branch (588:42): [True: 0, False: 8.27M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    231|        max_bad_count_ = 1;
  592|    231|        check_too_many_bad_tokens(); // always throws Error()
  593|    231|    }
  594|  8.27M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  8.27M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  8.27M|    add(std::move(obj));
  597|  8.27M|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   139k|{
  587|   139k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 115k, False: 23.4k]
  |  Branch (587:66): [True: 19.9k, False: 3.55k]
  ------------------
  588|   139k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 92, False: 138k]
  |  Branch (588:42): [True: 0, False: 138k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     92|        max_bad_count_ = 1;
  592|     92|        check_too_many_bad_tokens(); // always throws Error()
  593|     92|    }
  594|   139k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   139k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   139k|    add(std::move(obj));
  597|   139k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  15.8k|{
  587|  15.8k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 11.1k, False: 4.74k]
  |  Branch (587:66): [True: 4.71k, False: 35]
  ------------------
  588|  15.8k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 26, False: 15.8k]
  |  Branch (588:42): [True: 0, False: 15.8k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     26|        max_bad_count_ = 1;
  592|     26|        check_too_many_bad_tokens(); // always throws Error()
  593|     26|    }
  594|  15.8k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  15.8k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  15.8k|    add(std::move(obj));
  597|  15.8k|}

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

_ZN4qpdf9Tokenizer5resetEv:
   85|  21.2M|{
   86|  21.2M|    state = st_before_token;
   87|  21.2M|    type = tt::tt_bad;
   88|  21.2M|    val.clear();
   89|  21.2M|    raw_val.clear();
   90|  21.2M|    error_message = "";
   91|  21.2M|    before_token = true;
   92|  21.2M|    in_token = false;
   93|  21.2M|    char_to_unread = '\0';
   94|  21.2M|    inline_image_bytes = 0;
   95|  21.2M|    string_depth = 0;
   96|  21.2M|    bad = false;
   97|  21.2M|}
_ZN4qpdf9TokenizerC2Ev:
  119|  20.5k|{
  120|  20.5k|    reset();
  121|  20.5k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  20.5k|{
  132|  20.5k|    allow_eof = true;
  133|  20.5k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  31.9M|{
  150|  31.9M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 2.76M, False: 29.2M]
  |  Branch (150:27): [True: 9.94M, False: 19.2M]
  ------------------
  151|  31.9M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   154M|{
  156|   154M|    return is_delimiter(ch);
  157|   154M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  17.6k|{
  168|  17.6k|    handleCharacter(ch);
  169|       |
  170|  17.6k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 17.6k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  17.6k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   347M|{
  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|   347M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 347M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|      0|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 0, False: 347M]
  ------------------
  187|      0|        inSpace(ch);
  188|      0|        return;
  189|       |
  190|  1.86M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 1.86M, False: 345M]
  ------------------
  191|  1.86M|        inComment(ch);
  192|  1.86M|        return;
  193|       |
  194|   263k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 263k, False: 347M]
  ------------------
  195|   263k|        inLt(ch);
  196|   263k|        return;
  197|       |
  198|   175k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 175k, False: 347M]
  ------------------
  199|   175k|        inGt(ch);
  200|   175k|        return;
  201|       |
  202|   143M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 143M, False: 204M]
  ------------------
  203|   143M|        inString(ch);
  204|   143M|        return;
  205|       |
  206|  91.0M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 91.0M, False: 256M]
  ------------------
  207|  91.0M|        inName(ch);
  208|  91.0M|        return;
  209|       |
  210|  23.5M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 23.5M, False: 324M]
  ------------------
  211|  23.5M|        inNumber(ch);
  212|  23.5M|        return;
  213|       |
  214|   231k|    case st_real:
  ------------------
  |  Branch (214:5): [True: 231k, False: 347M]
  ------------------
  215|   231k|        inReal(ch);
  216|   231k|        return;
  217|       |
  218|   180k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 180k, False: 347M]
  ------------------
  219|   180k|        inStringAfterCR(ch);
  220|   180k|        return;
  221|       |
  222|  33.7k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 33.7k, False: 347M]
  ------------------
  223|  33.7k|        inStringEscape(ch);
  224|  33.7k|        return;
  225|       |
  226|  7.13k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 7.13k, False: 347M]
  ------------------
  227|  7.13k|        inCharCode(ch);
  228|  7.13k|        return;
  229|       |
  230|  54.9M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 54.9M, False: 292M]
  ------------------
  231|  54.9M|        inLiteral(ch);
  232|  54.9M|        return;
  233|       |
  234|      0|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 0, False: 347M]
  ------------------
  235|      0|        inInlineImage(ch);
  236|      0|        return;
  237|       |
  238|   100k|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 100k, False: 347M]
  ------------------
  239|   100k|        inHexstring(ch);
  240|   100k|        return;
  241|       |
  242|   106k|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 106k, False: 347M]
  ------------------
  243|   106k|        inHexstring2nd(ch);
  244|   106k|        return;
  245|       |
  246|  22.1k|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 22.1k, False: 347M]
  ------------------
  247|  22.1k|        inNameHex1(ch);
  248|  22.1k|        return;
  249|       |
  250|  9.16k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 9.16k, False: 347M]
  ------------------
  251|  9.16k|        inNameHex2(ch);
  252|  9.16k|        return;
  253|       |
  254|  20.9k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 20.9k, False: 347M]
  ------------------
  255|  20.9k|        inSign(ch);
  256|  20.9k|        return;
  257|       |
  258|  8.69k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 8.69k, False: 347M]
  ------------------
  259|  8.69k|        inDecimal(ch);
  260|  8.69k|        return;
  261|       |
  262|  31.9M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 31.9M, False: 315M]
  ------------------
  263|  31.9M|        inBeforeToken(ch);
  264|  31.9M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 347M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 347M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   347M|    }
  273|   347M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  31.9M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  31.9M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 12.6M, False: 19.2M]
  ------------------
  287|  12.6M|        before_token = !include_ignorable;
  288|  12.6M|        in_token = include_ignorable;
  289|  12.6M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 0, False: 12.6M]
  ------------------
  290|      0|            state = st_in_space;
  291|      0|        }
  292|  19.2M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 19.6k, False: 19.2M]
  ------------------
  293|  19.6k|        before_token = !include_ignorable;
  294|  19.6k|        in_token = include_ignorable;
  295|  19.6k|        state = st_in_comment;
  296|  19.2M|    } else {
  297|  19.2M|        before_token = false;
  298|  19.2M|        in_token = true;
  299|  19.2M|        inTop(ch);
  300|  19.2M|    }
  301|  31.9M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  19.2M|{
  306|  19.2M|    switch (ch) {
  307|   143k|    case '(':
  ------------------
  |  Branch (307:5): [True: 143k, False: 19.0M]
  ------------------
  308|   143k|        string_depth = 1;
  309|   143k|        state = st_in_string;
  310|   143k|        return;
  311|       |
  312|   263k|    case '<':
  ------------------
  |  Branch (312:5): [True: 263k, False: 18.9M]
  ------------------
  313|   263k|        state = st_lt;
  314|   263k|        return;
  315|       |
  316|   175k|    case '>':
  ------------------
  |  Branch (316:5): [True: 175k, False: 19.0M]
  ------------------
  317|   175k|        state = st_gt;
  318|   175k|        return;
  319|       |
  320|  17.3k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 17.3k, False: 19.2M]
  ------------------
  321|  17.3k|        type = tt::tt_bad;
  322|  17.3k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|  17.3k|        error_message = "unexpected )";
  324|  17.3k|        state = st_token_ready;
  325|  17.3k|        return;
  326|       |
  327|   167k|    case '[':
  ------------------
  |  Branch (327:5): [True: 167k, False: 19.0M]
  ------------------
  328|   167k|        type = tt::tt_array_open;
  329|   167k|        state = st_token_ready;
  330|   167k|        return;
  331|       |
  332|  87.6k|    case ']':
  ------------------
  |  Branch (332:5): [True: 87.6k, False: 19.1M]
  ------------------
  333|  87.6k|        type = tt::tt_array_close;
  334|  87.6k|        state = st_token_ready;
  335|  87.6k|        return;
  336|       |
  337|  3.48k|    case '{':
  ------------------
  |  Branch (337:5): [True: 3.48k, False: 19.2M]
  ------------------
  338|  3.48k|        type = tt::tt_brace_open;
  339|  3.48k|        state = st_token_ready;
  340|  3.48k|        return;
  341|       |
  342|  3.84k|    case '}':
  ------------------
  |  Branch (342:5): [True: 3.84k, False: 19.2M]
  ------------------
  343|  3.84k|        type = tt::tt_brace_close;
  344|  3.84k|        state = st_token_ready;
  345|  3.84k|        return;
  346|       |
  347|  8.87M|    case '/':
  ------------------
  |  Branch (347:5): [True: 8.87M, False: 10.3M]
  ------------------
  348|  8.87M|        state = st_name;
  349|  8.87M|        val += ch;
  350|  8.87M|        return;
  351|       |
  352|   744k|    case '0':
  ------------------
  |  Branch (352:5): [True: 744k, False: 18.4M]
  ------------------
  353|  1.98M|    case '1':
  ------------------
  |  Branch (353:5): [True: 1.23M, False: 17.9M]
  ------------------
  354|  2.62M|    case '2':
  ------------------
  |  Branch (354:5): [True: 643k, False: 18.5M]
  ------------------
  355|  2.89M|    case '3':
  ------------------
  |  Branch (355:5): [True: 273k, False: 18.9M]
  ------------------
  356|  3.31M|    case '4':
  ------------------
  |  Branch (356:5): [True: 418k, False: 18.8M]
  ------------------
  357|  4.14M|    case '5':
  ------------------
  |  Branch (357:5): [True: 830k, False: 18.4M]
  ------------------
  358|  5.94M|    case '6':
  ------------------
  |  Branch (358:5): [True: 1.79M, False: 17.4M]
  ------------------
  359|  7.51M|    case '7':
  ------------------
  |  Branch (359:5): [True: 1.56M, False: 17.6M]
  ------------------
  360|  7.92M|    case '8':
  ------------------
  |  Branch (360:5): [True: 410k, False: 18.8M]
  ------------------
  361|  8.06M|    case '9':
  ------------------
  |  Branch (361:5): [True: 143k, False: 19.0M]
  ------------------
  362|  8.06M|        state = st_number;
  363|  8.06M|        return;
  364|       |
  365|  2.56k|    case '+':
  ------------------
  |  Branch (365:5): [True: 2.56k, False: 19.2M]
  ------------------
  366|  20.9k|    case '-':
  ------------------
  |  Branch (366:5): [True: 18.3k, False: 19.2M]
  ------------------
  367|  20.9k|        state = st_sign;
  368|  20.9k|        return;
  369|       |
  370|  8.42k|    case '.':
  ------------------
  |  Branch (370:5): [True: 8.42k, False: 19.2M]
  ------------------
  371|  8.42k|        state = st_decimal;
  372|  8.42k|        return;
  373|       |
  374|  1.39M|    default:
  ------------------
  |  Branch (374:5): [True: 1.39M, False: 17.8M]
  ------------------
  375|  1.39M|        state = st_literal;
  376|  1.39M|        return;
  377|  19.2M|    }
  378|  19.2M|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  1.86M|{
  395|  1.86M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 4.50k, False: 1.85M]
  |  Branch (395:25): [True: 14.0k, False: 1.84M]
  ------------------
  396|  18.5k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 0, False: 18.5k]
  ------------------
  397|      0|            type = tt::tt_comment;
  398|      0|            in_token = false;
  399|      0|            char_to_unread = ch;
  400|      0|            state = st_token_ready;
  401|  18.5k|        } else {
  402|  18.5k|            state = st_before_token;
  403|  18.5k|        }
  404|  18.5k|    }
  405|  1.86M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   143M|{
  410|   143M|    switch (ch) {
  411|  33.8k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 33.8k, False: 143M]
  ------------------
  412|  33.8k|        state = st_string_escape;
  413|  33.8k|        return;
  414|       |
  415|  88.8k|    case '(':
  ------------------
  |  Branch (415:5): [True: 88.8k, False: 143M]
  ------------------
  416|  88.8k|        val += ch;
  417|  88.8k|        ++string_depth;
  418|  88.8k|        return;
  419|       |
  420|   200k|    case ')':
  ------------------
  |  Branch (420:5): [True: 200k, False: 143M]
  ------------------
  421|   200k|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 137k, False: 62.6k]
  ------------------
  422|   137k|            type = tt::tt_string;
  423|   137k|            state = st_token_ready;
  424|   137k|            return;
  425|   137k|        }
  426|       |
  427|  62.6k|        val += ch;
  428|  62.6k|        return;
  429|       |
  430|   179k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 179k, False: 143M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   179k|        val += '\n';
  433|   179k|        state = st_string_after_cr;
  434|   179k|        return;
  435|       |
  436|   357k|    case '\n':
  ------------------
  |  Branch (436:5): [True: 357k, False: 142M]
  ------------------
  437|   357k|        val += ch;
  438|   357k|        return;
  439|       |
  440|   142M|    default:
  ------------------
  |  Branch (440:5): [True: 142M, False: 859k]
  ------------------
  441|   142M|        val += ch;
  442|   142M|        return;
  443|   143M|    }
  444|   143M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|  91.0M|{
  449|  91.0M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 8.87M, False: 82.2M]
  ------------------
  450|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  451|       |        // the whitespace character even though it is ignored since it may be the newline after a
  452|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  453|       |        // though not on any files in the test suite as of this
  454|       |        // writing.
  455|       |
  456|  8.87M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 252, False: 8.87M]
  ------------------
  457|  8.87M|        in_token = false;
  458|  8.87M|        char_to_unread = ch;
  459|  8.87M|        state = st_token_ready;
  460|  82.2M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 22.1k, False: 82.2M]
  ------------------
  461|  22.1k|        char_code = 0;
  462|  22.1k|        state = st_name_hex1;
  463|  82.2M|    } else {
  464|  82.2M|        val += ch;
  465|  82.2M|    }
  466|  91.0M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  22.1k|{
  471|  22.1k|    hex_char = ch;
  472|       |
  473|  22.1k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 9.17k, False: 12.9k]
  ------------------
  474|  9.17k|        char_code = int(hval) << 4;
  475|  9.17k|        state = st_name_hex2;
  476|  12.9k|    } else {
  477|  12.9k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  12.9k|        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|  12.9k|        val += '\0';
  481|  12.9k|        state = st_name;
  482|  12.9k|        inName(ch);
  483|  12.9k|    }
  484|  22.1k|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  9.16k|{
  489|  9.16k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 2.06k, False: 7.09k]
  ------------------
  490|  2.06k|        char_code |= int(hval);
  491|  7.09k|    } else {
  492|  7.09k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  7.09k|        error_message = "name with stray # will not work with PDF >= 1.2";
  494|       |        // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
  495|  7.09k|        val += '\0';
  496|  7.09k|        val += hex_char;
  497|  7.09k|        state = st_name;
  498|  7.09k|        inName(ch);
  499|  7.09k|        return;
  500|  7.09k|    }
  501|  2.06k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 1.34k, False: 725]
  ------------------
  502|  1.34k|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|  1.34k|        error_message = "null character not allowed in name token";
  504|  1.34k|        val += "#00";
  505|  1.34k|        state = st_name;
  506|  1.34k|        bad = true;
  507|  1.34k|    } else {
  508|    725|        val += char(char_code);
  509|    725|        state = st_name;
  510|    725|    }
  511|  2.06k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|  20.9k|{
  516|  20.9k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 15.0k, False: 5.89k]
  ------------------
  517|  15.0k|        state = st_number;
  518|  15.0k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 271, False: 5.62k]
  ------------------
  519|    271|        state = st_decimal;
  520|  5.62k|    } else {
  521|  5.62k|        state = st_literal;
  522|  5.62k|        inLiteral(ch);
  523|  5.62k|    }
  524|  20.9k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|  8.69k|{
  529|  8.69k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 5.51k, False: 3.17k]
  ------------------
  530|  5.51k|        state = st_real;
  531|  5.51k|    } else {
  532|  3.17k|        state = st_literal;
  533|  3.17k|        inLiteral(ch);
  534|  3.17k|    }
  535|  8.69k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  23.5M|{
  540|  23.5M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 15.5M, False: 8.00M]
  ------------------
  541|  15.5M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 61.8k, False: 7.93M]
  ------------------
  542|  61.8k|        state = st_real;
  543|  7.93M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 7.90M, False: 37.9k]
  ------------------
  544|  7.90M|        type = tt::tt_integer;
  545|  7.90M|        state = st_token_ready;
  546|  7.90M|        in_token = false;
  547|  7.90M|        char_to_unread = ch;
  548|  7.90M|    } else {
  549|  37.9k|        state = st_literal;
  550|  37.9k|    }
  551|  23.5M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|   231k|{
  556|   231k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 164k, False: 67.3k]
  ------------------
  557|   164k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 65.7k, False: 1.56k]
  ------------------
  558|  65.7k|        type = tt::tt_real;
  559|  65.7k|        state = st_token_ready;
  560|  65.7k|        in_token = false;
  561|  65.7k|        char_to_unread = ch;
  562|  65.7k|    } else {
  563|  1.56k|        state = st_literal;
  564|  1.56k|    }
  565|   231k|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|  33.7k|{
  569|  33.7k|    state = st_in_string;
  570|  33.7k|    switch (ch) {
  571|  1.59k|    case '0':
  ------------------
  |  Branch (571:5): [True: 1.59k, False: 32.1k]
  ------------------
  572|  2.07k|    case '1':
  ------------------
  |  Branch (572:5): [True: 476, False: 33.2k]
  ------------------
  573|  3.00k|    case '2':
  ------------------
  |  Branch (573:5): [True: 930, False: 32.8k]
  ------------------
  574|  4.04k|    case '3':
  ------------------
  |  Branch (574:5): [True: 1.04k, False: 32.7k]
  ------------------
  575|  4.63k|    case '4':
  ------------------
  |  Branch (575:5): [True: 585, False: 33.1k]
  ------------------
  576|  5.30k|    case '5':
  ------------------
  |  Branch (576:5): [True: 672, False: 33.0k]
  ------------------
  577|  5.68k|    case '6':
  ------------------
  |  Branch (577:5): [True: 383, False: 33.3k]
  ------------------
  578|  6.08k|    case '7':
  ------------------
  |  Branch (578:5): [True: 400, False: 33.3k]
  ------------------
  579|  6.08k|        state = st_char_code;
  580|  6.08k|        char_code = 0;
  581|  6.08k|        digit_count = 0;
  582|  6.08k|        inCharCode(ch);
  583|  6.08k|        return;
  584|       |
  585|  3.24k|    case 'n':
  ------------------
  |  Branch (585:5): [True: 3.24k, False: 30.5k]
  ------------------
  586|  3.24k|        val += '\n';
  587|  3.24k|        return;
  588|       |
  589|    688|    case 'r':
  ------------------
  |  Branch (589:5): [True: 688, False: 33.0k]
  ------------------
  590|    688|        val += '\r';
  591|    688|        return;
  592|       |
  593|    307|    case 't':
  ------------------
  |  Branch (593:5): [True: 307, False: 33.4k]
  ------------------
  594|    307|        val += '\t';
  595|    307|        return;
  596|       |
  597|    310|    case 'b':
  ------------------
  |  Branch (597:5): [True: 310, False: 33.4k]
  ------------------
  598|    310|        val += '\b';
  599|    310|        return;
  600|       |
  601|    337|    case 'f':
  ------------------
  |  Branch (601:5): [True: 337, False: 33.4k]
  ------------------
  602|    337|        val += '\f';
  603|    337|        return;
  604|       |
  605|    288|    case '\n':
  ------------------
  |  Branch (605:5): [True: 288, False: 33.4k]
  ------------------
  606|    288|        return;
  607|       |
  608|    319|    case '\r':
  ------------------
  |  Branch (608:5): [True: 319, False: 33.4k]
  ------------------
  609|    319|        state = st_string_after_cr;
  610|    319|        return;
  611|       |
  612|  22.1k|    default:
  ------------------
  |  Branch (612:5): [True: 22.1k, False: 11.5k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|  22.1k|        val += ch;
  615|  22.1k|        return;
  616|  33.7k|    }
  617|  33.7k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   180k|{
  622|   180k|    state = st_in_string;
  623|   180k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 86.1k, False: 94.0k]
  ------------------
  624|  86.1k|        inString(ch);
  625|  86.1k|    }
  626|   180k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   263k|{
  631|   263k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 234k, False: 29.0k]
  ------------------
  632|   234k|        type = tt::tt_dict_open;
  633|   234k|        state = st_token_ready;
  634|   234k|        return;
  635|   234k|    }
  636|       |
  637|  29.0k|    state = st_in_hexstring;
  638|  29.0k|    inHexstring(ch);
  639|  29.0k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   175k|{
  644|   175k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 162k, False: 12.1k]
  ------------------
  645|   162k|        type = tt::tt_dict_close;
  646|   162k|        state = st_token_ready;
  647|   162k|    } else {
  648|  12.1k|        type = tt::tt_bad;
  649|  12.1k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  12.1k|        error_message = "unexpected >";
  651|  12.1k|        in_token = false;
  652|  12.1k|        char_to_unread = ch;
  653|  12.1k|        state = st_token_ready;
  654|  12.1k|    }
  655|   175k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|  54.9M|{
  660|  54.9M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 1.30M, False: 53.6M]
  ------------------
  661|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  662|       |        // the whitespace character even though it is ignored since it may be the newline after a
  663|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  664|       |        // though not on any files in the test suite as of this writing.
  665|       |
  666|  1.30M|        in_token = false;
  667|  1.30M|        char_to_unread = ch;
  668|  1.30M|        state = st_token_ready;
  669|  1.30M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 8.89k, False: 1.30M]
  |  Branch (669:39): [True: 1.53k, False: 1.29M]
  ------------------
  670|  1.30M|            ? tt::tt_bool
  671|  1.30M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 68.7k, False: 1.23M]
  ------------------
  672|  1.30M|    }
  673|  54.9M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|   129k|{
  678|   129k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 96.4k, False: 33.2k]
  ------------------
  679|  96.4k|        char_code = int(hval) << 4;
  680|  96.4k|        state = st_in_hexstring_2nd;
  681|       |
  682|  96.4k|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 7.56k, False: 25.7k]
  ------------------
  683|  7.56k|        type = tt::tt_string;
  684|  7.56k|        state = st_token_ready;
  685|       |
  686|  25.7k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 11.5k, False: 14.1k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  14.1k|    } else {
  690|  14.1k|        type = tt::tt_bad;
  691|  14.1k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  14.1k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  14.1k|        state = st_token_ready;
  694|  14.1k|    }
  695|   129k|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|   106k|{
  700|   106k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 89.4k, False: 17.2k]
  ------------------
  701|  89.4k|        val += char(char_code) | hval;
  702|  89.4k|        state = st_in_hexstring;
  703|       |
  704|  89.4k|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 4.10k, False: 13.1k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  4.10k|        val += char(char_code);
  707|  4.10k|        type = tt::tt_string;
  708|  4.10k|        state = st_token_ready;
  709|       |
  710|  13.1k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 10.5k, False: 2.65k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  10.5k|    } else {
  714|  2.65k|        type = tt::tt_bad;
  715|  2.65k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  2.65k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  2.65k|        state = st_token_ready;
  718|  2.65k|    }
  719|   106k|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|  13.2k|{
  724|  13.2k|    bool handled = false;
  725|  13.2k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 11.0k, False: 2.20k]
  |  Branch (725:24): [True: 7.63k, False: 3.38k]
  ------------------
  726|  7.63k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|  7.63k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 7.30k, False: 331]
  ------------------
  728|  7.30k|            return;
  729|  7.30k|        }
  730|    331|        handled = true;
  731|    331|    }
  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|  5.91k|    val += char(char_code % 256);
  735|  5.91k|    state = st_in_string;
  736|  5.91k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 5.58k, False: 331]
  ------------------
  737|  5.58k|        inString(ch);
  738|  5.58k|    }
  739|  5.91k|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|  37.7k|{
  761|  37.7k|    switch (state) {
  762|  1.98k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 1.98k, False: 35.7k]
  ------------------
  763|  2.14k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 155, False: 37.6k]
  ------------------
  764|  2.28k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 136, False: 37.6k]
  ------------------
  765|  8.04k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 5.76k, False: 32.0k]
  ------------------
  766|  8.31k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 272, False: 37.5k]
  ------------------
  767|  8.49k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 177, False: 37.6k]
  ------------------
  768|  8.62k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 135, False: 37.6k]
  ------------------
  769|  17.6k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 9.02k, False: 28.7k]
  ------------------
  770|  17.6k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  17.6k|        presentCharacter('\f');
  773|  17.6k|        in_token = true;
  774|  17.6k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 37.7k]
  ------------------
  777|  15.6k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 15.6k, False: 22.1k]
  ------------------
  778|  15.6k|        type = tt::tt_eof;
  779|  15.6k|        break;
  780|       |
  781|      0|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 0, False: 37.7k]
  ------------------
  782|      0|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  ------------------
  783|      0|        break;
  784|       |
  785|  1.10k|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 1.10k, False: 36.6k]
  ------------------
  786|  1.10k|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 0, False: 1.10k]
  ------------------
  787|  1.10k|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 37.7k]
  ------------------
  790|      0|        break;
  791|       |
  792|  3.38k|    default:
  ------------------
  |  Branch (792:5): [True: 3.38k, False: 34.3k]
  ------------------
  793|  3.38k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  3.38k|        type = tt::tt_bad;
  795|  3.38k|        error_message = "EOF while reading token";
  796|  37.7k|    }
  797|  37.7k|    state = st_token_ready;
  798|  37.7k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  2.01M|{
  917|  2.01M|    bool ready = (state == st_token_ready);
  918|  2.01M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 1.64M, False: 367k]
  |  Branch (918:32): [True: 1.63M, False: 8.71k]
  ------------------
  919|  2.01M|    ch = char_to_unread;
  920|  2.01M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 2.01M, False: 0]
  ------------------
  921|  2.01M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 114k, False: 1.90M]
  |  Branch (921:43): [True: 2.23k, False: 1.89M]
  ------------------
  922|  2.01M|            ? Token(type, raw_val, raw_val, error_message)
  923|  2.01M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  2.01M|        reset();
  926|  2.01M|    }
  927|  2.01M|    return ready;
  928|  2.01M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  2.01M|{
  959|  2.01M|    nextToken(input, context, max_len);
  960|       |
  961|  2.01M|    Token token;
  962|  2.01M|    bool unread_char;
  963|  2.01M|    char char_to_unread;
  964|  2.01M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  2.01M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 245k, False: 1.76M]
  ------------------
  967|   245k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 245k, False: 0]
  ------------------
  968|   245k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   245k|        } 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|   245k|    }
  978|  2.01M|    return token;
  979|  2.01M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  19.2M|{
  984|  19.2M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 19.2M, False: 0]
  ------------------
  985|  19.2M|        reset();
  986|  19.2M|    }
  987|  19.2M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   366M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 347M, False: 19.2M]
  ------------------
  990|   347M|        char ch;
  991|   347M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 37.7k, False: 347M]
  ------------------
  992|  37.7k|            presentEOF();
  993|       |
  994|  37.7k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 15.6k, False: 22.1k]
  |  Branch (994:41): [True: 0, False: 15.6k]
  ------------------
  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|   347M|        } else {
 1002|   347M|            handleCharacter(ch);
 1003|   347M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 14.5M, False: 333M]
  ------------------
 1004|  14.5M|                ++offset;
 1005|  14.5M|            }
 1006|   347M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 314M, False: 32.7M]
  ------------------
 1007|   314M|                raw_val += ch;
 1008|   314M|            }
 1009|   347M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 10.4M, False: 337M]
  |  Branch (1009:28): [True: 225k, False: 10.1M]
  |  Branch (1009:61): [True: 224k, False: 955]
  ------------------
 1010|       |                // terminate this token now
 1011|   224k|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|   224k|                type = tt::tt_bad;
 1013|   224k|                state = st_token_ready;
 1014|   224k|                error_message = "exceeded allowable length while reading token";
 1015|   224k|            }
 1016|   347M|        }
 1017|   347M|    }
 1018|       |
 1019|  19.2M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 18.1M, False: 1.08M]
  |  Branch (1019:35): [True: 18.1M, False: 16.7k]
  ------------------
 1020|       |
 1021|  19.2M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 19.2M, False: 15.6k]
  ------------------
 1022|  19.2M|        input.setLastOffset(offset);
 1023|  19.2M|    }
 1024|       |
 1025|  19.2M|    return error_message.empty();
 1026|  19.2M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   154M|{
   26|   154M|    return (
   27|   154M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 8.37M, False: 145M]
  |  Branch (27:22): [True: 477k, False: 145M]
  |  Branch (27:36): [True: 8.44M, False: 136M]
  |  Branch (27:49): [True: 29.9k, False: 136M]
  |  Branch (27:62): [True: 34.6k, False: 136M]
  |  Branch (27:75): [True: 9.14k, False: 136M]
  |  Branch (27:88): [True: 9.35k, False: 136M]
  ------------------
   28|   136M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 102k, False: 136M]
  |  Branch (28:22): [True: 82.8k, False: 136M]
  |  Branch (28:35): [True: 95.7k, False: 136M]
  |  Branch (28:48): [True: 65.4k, False: 136M]
  |  Branch (28:61): [True: 13.1k, False: 136M]
  |  Branch (28:74): [True: 23.2k, False: 136M]
  |  Branch (28:88): [True: 205k, False: 136M]
  ------------------
   29|   136M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 14.1k, False: 136M]
  |  Branch (29:23): [True: 53.9k, False: 135M]
  |  Branch (29:37): [True: 110k, False: 135M]
  ------------------
   30|   154M|}

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|    976|{
   40|    976|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 584, False: 392]
  ------------------
   41|    584|        sp = std::make_unique<Sparse>();
   42|  2.85M|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 2.85M, False: 584]
  ------------------
   43|  2.85M|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 2.78M, False: 67.6k]
  |  Branch (43:54): [True: 220, False: 67.4k]
  ------------------
   44|  2.78M|                sp->elements[sp->size] = std::move(item);
   45|  2.78M|            }
   46|  2.85M|            ++sp->size;
   47|  2.85M|        }
   48|    584|    } else {
   49|    392|        elements = std::move(v);
   50|    392|    }
   51|    976|}
_ZNK4qpdf5Array5arrayEv:
   55|   125k|{
   56|   125k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 125k, False: 0]
  ------------------
   57|   125k|        return a;
   58|   125k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|   125k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  2.84k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  2.84k|{
   67|  2.84k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  8.78k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  8.78k|{
   72|  8.78k|}
_ZN4qpdf5Array5emptyEv:
   76|  1.66k|{
   77|  1.66k|    return Array(std::vector<QPDFObjectHandle>());
   78|  1.66k|}
_ZN4qpdf5Array5beginEv:
   82|  34.8k|{
   83|  34.8k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 17.4k, False: 17.4k]
  ------------------
   84|  17.4k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 16.9k, False: 493]
  ------------------
   85|  16.9k|            return a->elements.begin();
   86|  16.9k|        }
   87|    493|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 493, False: 0]
  ------------------
   88|    493|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    493|        }
   90|    493|        return sp_elements->begin();
   91|  17.4k|    }
   92|  17.4k|    return {};
   93|  34.8k|}
_ZN4qpdf5Array3endEv:
   97|  34.8k|{
   98|  34.8k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 17.4k, False: 17.4k]
  ------------------
   99|  17.4k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 16.9k, False: 493]
  ------------------
  100|  16.9k|            return a->elements.end();
  101|  16.9k|        }
  102|    493|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 493]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    493|        return sp_elements->end();
  106|  17.4k|    }
  107|  17.4k|    return {};
  108|  34.8k|}
_ZNK4qpdf5Array4sizeEv:
  178|   345k|{
  179|   345k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 295k, False: 50.0k]
  ------------------
  180|   295k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 1.53k, False: 294k]
  ------------------
  181|   295k|    }
  182|  50.0k|    return 0;
  183|   345k|}
_ZNK4qpdf5ArrayixEm:
  187|   677k|{
  188|   677k|    static const QPDFObjectHandle null_obj;
  189|   677k|    auto a = as<QPDF_Array>();
  190|   677k|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 975, False: 676k]
  ------------------
  191|    975|        return null_obj;
  192|    975|    }
  193|   676k|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 923, False: 675k]
  ------------------
  194|    923|        auto const& iter = a->sp->elements.find(n);
  195|    923|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 138, False: 785]
  ------------------
  196|    923|    }
  197|   675k|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 1.80k, False: 673k]
  ------------------
  198|   676k|}
_ZNK4qpdf5ArrayixEi:
  202|   671k|{
  203|   671k|    static const QPDFObjectHandle null_obj;
  204|   671k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 2.55k, False: 668k]
  ------------------
  205|  2.55k|        return null_obj;
  206|  2.55k|    }
  207|   668k|    return (*this)[static_cast<size_t>(n)];
  208|   671k|}
_ZNK4qpdf5Array3getEm:
  212|    157|{
  213|    157|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 157]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|    157|    auto a = array();
  217|    157|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 157, False: 0]
  ------------------
  218|    157|        return a->elements[n];
  219|    157|    }
  220|      0|    auto const& iter = a->sp->elements.find(n);
  221|      0|    return iter == a->sp->elements.end() ? null() : iter->second;
  ------------------
  |  Branch (221:12): [True: 0, False: 0]
  ------------------
  222|    157|}
_ZNK4qpdf5Array3getEi:
  226|    157|{
  227|    157|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 157]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|    157|    return get(to_s(n));
  231|    157|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  10.7k|{
  236|  10.7k|    auto a = array();
  237|  10.7k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 523, False: 10.2k]
  ------------------
  238|    523|        std::vector<QPDFObjectHandle> v;
  239|    523|        v.reserve(size());
  240|   700k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 700k, False: 523]
  ------------------
  241|   700k|            v.resize(item.first, null_oh);
  242|   700k|            v.emplace_back(item.second);
  243|   700k|        }
  244|    523|        v.resize(size(), null_oh);
  245|    523|        return v;
  246|  10.2k|    } else {
  247|  10.2k|        return a->elements;
  248|  10.2k|    }
  249|  10.7k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|     17|{
  254|     17|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 17]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|     17|    auto a = array();
  258|     17|    checkOwnership(oh);
  259|     17|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 0, False: 17]
  ------------------
  260|      0|        a->sp->elements[at] = oh;
  261|     17|    } else {
  262|     17|        a->elements[at] = oh;
  263|     17|    }
  264|     17|    return true;
  265|     17|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|     17|{
  270|     17|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 17]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|     17|    return set(to_s(at), oh);
  274|     17|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  35.5k|{
  291|  35.5k|    auto a = array();
  292|  35.5k|    size_t sz = size();
  293|  35.5k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 35.5k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  35.5k|    checkOwnership(item);
  297|  35.5k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 35.5k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  35.5k|        push_back(item);
  300|  35.5k|        return true;
  301|  35.5k|    }
  302|      0|    if (!a->sp) {
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|      0|        a->elements.insert(a->elements.cbegin() + to_i(at), item);
  304|      0|        return true;
  305|      0|    }
  306|      0|    auto iter = a->sp->elements.crbegin();
  307|      0|    while (iter != a->sp->elements.crend()) {
  ------------------
  |  Branch (307:12): [True: 0, False: 0]
  ------------------
  308|      0|        auto key = (iter++)->first;
  309|      0|        if (key >= at) {
  ------------------
  |  Branch (309:13): [True: 0, False: 0]
  ------------------
  310|      0|            auto nh = a->sp->elements.extract(key);
  311|      0|            ++nh.key();
  312|      0|            a->sp->elements.insert(std::move(nh));
  313|      0|        } else {
  314|      0|            break;
  315|      0|        }
  316|      0|    }
  317|      0|    a->sp->elements[at] = item;
  318|      0|    ++a->sp->size;
  319|      0|    return true;
  320|      0|}
_ZN4qpdf5Array6insertEiRK16QPDFObjectHandle:
  324|  35.5k|{
  325|  35.5k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 35.5k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  35.5k|    return insert(to_s(at_i), item);
  329|  35.5k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|  57.6k|{
  334|  57.6k|    auto a = array();
  335|  57.6k|    checkOwnership(item);
  336|  57.6k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 0, False: 57.6k]
  ------------------
  337|      0|        a->sp->elements[(a->sp->size)++] = item;
  338|  57.6k|    } else {
  339|  57.6k|        a->elements.emplace_back(item);
  340|  57.6k|    }
  341|  57.6k|}
_ZN4qpdf5Array5eraseEm:
  345|  21.7k|{
  346|  21.7k|    auto a = array();
  347|  21.7k|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 21.7k]
  ------------------
  348|      0|        return false;
  349|      0|    }
  350|  21.7k|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 21.7k, False: 0]
  ------------------
  351|  21.7k|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|  21.7k|        return true;
  353|  21.7k|    }
  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|  21.7k|}
_ZN4qpdf5Array5eraseEi:
  373|  21.7k|{
  374|  21.7k|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 21.7k]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|  21.7k|    return erase(to_s(at_i));
  378|  21.7k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|  27.9k|{
  394|  27.9k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 27.9k, False: 0]
  ------------------
  395|  27.9k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 27.9k, False: 44]
  ------------------
  396|  27.9k|            return result;
  397|  27.9k|        }
  398|     44|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 44, False: 0]
  |  Branch (398:23): [True: 44, False: 0]
  ------------------
  399|       |            // sparse array null
  400|     44|            return newNull();
  401|     44|        }
  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|  27.9k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  17.3k|{
  413|  17.3k|    Array array(*this);
  414|  27.1k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 27.1k, False: 17.1k]
  ------------------
  415|  27.1k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 160, False: 27.0k]
  ------------------
  416|    160|            return false;
  417|    160|        }
  418|  27.1k|    }
  419|  17.1k|    return array.size() == 4;
  420|  17.3k|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  10.2k|{
  473|  10.2k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 10.2k, False: 0]
  ------------------
  474|  10.2k|        return array.getAsVector();
  475|  10.2k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  10.2k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|  26.4k|{
  567|  26.4k|    switch (resolved_type_code()) {
  568|  12.4k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 12.4k, False: 13.9k]
  ------------------
  569|  12.4k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 26.4k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 26.4k]
  ------------------
  572|  8.35k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 8.35k, False: 18.0k]
  ------------------
  573|  8.35k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 26.4k]
  ------------------
  574|  8.35k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 26.4k]
  ------------------
  575|  8.35k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 26.4k]
  ------------------
  576|  8.35k|        return 0;
  577|     37|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 37, False: 26.3k]
  ------------------
  578|    114|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 77, False: 26.3k]
  ------------------
  579|    182|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 68, False: 26.3k]
  ------------------
  580|    256|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 74, False: 26.3k]
  ------------------
  581|  5.54k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 5.29k, False: 21.1k]
  ------------------
  582|  5.59k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 45, False: 26.3k]
  ------------------
  583|  5.61k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 19, False: 26.4k]
  ------------------
  584|  5.61k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 26.4k]
  ------------------
  585|  5.61k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 26.4k]
  ------------------
  586|  5.61k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 26.4k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|  26.4k|    }
  591|  26.4k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  1.13k|{
  596|  1.13k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 1.13k, False: 0]
  ------------------
  597|  1.13k|        return Array(obj)[n];
  598|  1.13k|    }
  599|      0|    if (n < size()) {
  ------------------
  |  Branch (599:9): [True: 0, False: 0]
  ------------------
  600|      0|        return *this;
  601|      0|    }
  602|      0|    return {};
  603|      0|}
_ZNK4qpdf10BaseHandleixEi:
  607|  1.13k|{
  608|  1.13k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 1.13k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  1.13k|    return (*this)[static_cast<size_t>(n)];
  612|  1.13k|}
QPDF_Array.cc:_ZL4to_si:
   15|  57.5k|{
   16|  57.5k|    return static_cast<size_t>(n);
   17|  57.5k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|  93.2k|{
   28|  93.2k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 93.2k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|  93.2k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 17, False: 93.2k]
  |  Branch (31:19): [True: 17, False: 0]
  |  Branch (31:34): [True: 0, False: 17]
  ------------------
   32|      0|        throw std::logic_error(
   33|      0|            "Attempting to add an object from a different QPDF. Use "
   34|      0|            "QPDF::copyForeignObject to add objects from another file.");
   35|      0|    }
   36|  93.2k|}
QPDF_Array.cc:_ZL4to_im:
   21|  21.7k|{
   22|  21.7k|    return static_cast<int>(n);
   23|  21.7k|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  11.3k|{
   13|  11.3k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 11.3k, False: 0]
  ------------------
   14|  11.3k|        return d;
   15|  11.3k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  11.3k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|   884k|{
   23|   884k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 873k, False: 11.1k]
  ------------------
   24|   873k|        auto it = d->items.find(key);
   25|   873k|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 671k, False: 201k]
  ------------------
   26|   671k|            return it->second;
   27|   671k|        }
   28|   873k|    }
   29|   212k|    static const QPDFObjectHandle null_obj;
   30|   212k|    return null_obj;
   31|   884k|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|  58.9k|{
   64|  58.9k|    return !(*this)[key].null();
   65|  58.9k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  11.3k|{
  100|  11.3k|    std::set<std::string> result;
  101|  39.2k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 39.2k, False: 11.3k]
  ------------------
  102|  39.2k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 36.3k, False: 2.92k]
  ------------------
  103|  36.3k|            result.insert(iter.first);
  104|  36.3k|        }
  105|  39.2k|    }
  106|  11.3k|    return result;
  107|  11.3k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  16.3k|{
  118|       |    // no-op if key does not exist
  119|  16.3k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 16.3k, False: 0]
  ------------------
  120|  16.3k|        return d->items.erase(key);
  121|  16.3k|    }
  122|      0|    return 0;
  123|  16.3k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|  40.9k|{
  141|  40.9k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 40.9k, False: 0]
  ------------------
  142|  40.9k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 532, False: 40.4k]
  |  Branch (142:29): [True: 532, 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|    532|            d->items.erase(key);
  147|  40.4k|        } else {
  148|       |            // add or replace value
  149|  40.4k|            d->items[key] = value;
  150|  40.4k|        }
  151|  40.9k|        return true;
  152|  40.9k|    }
  153|      0|    return false;
  154|  40.9k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|  40.9k|{
  173|  40.9k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 40.9k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|  40.9k|}
_ZN4qpdf10DictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  179|  1.66k|    BaseDictionary(std::move(dict))
  180|  1.66k|{
  181|  1.66k|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|  47.4k|    BaseDictionary(obj)
  185|  47.4k|{
  186|  47.4k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|  31.0k|{
  197|  31.0k|    auto qpdf = getOwningQPDF();
  198|  31.0k|    auto item_qpdf = item.getOwningQPDF();
  199|  31.0k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 29.2k, False: 1.79k]
  |  Branch (199:17): [True: 5.33k, False: 23.9k]
  |  Branch (199:30): [True: 0, False: 5.33k]
  ------------------
  200|      0|        throw std::logic_error(
  201|      0|            "Attempting to add an object from a different QPDF. Use "
  202|      0|            "QPDF::copyForeignObject to add objects from another file.");
  203|      0|    }
  204|  31.0k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|  37.8k|{
  209|  37.8k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 37.7k, False: 164]
  ------------------
  210|  37.7k|        return dict.contains(key);
  211|  37.7k|    } else {
  212|    164|        typeWarning("dictionary", "returning false for a key containment request");
  213|    164|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    164|        return false;
  215|    164|    }
  216|  37.8k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   246k|{
  221|   246k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 171k, False: 74.6k]
  ------------------
  222|   171k|        return result;
  223|   171k|    }
  224|  74.6k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 74.4k, False: 239]
  ------------------
  225|  74.4k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|  74.4k|        return QPDF_Null::create(obj, msg, key);
  227|  74.4k|    }
  228|    239|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|    239|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|    239|    return QPDF_Null::create(obj, msg, "");
  231|  74.6k|}
_ZNK16QPDFObjectHandle12getKeyIfDictERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  235|  1.87k|{
  236|  1.87k|    return isNull() ? newNull() : getKey(key);
  ------------------
  |  Branch (236:12): [True: 288, False: 1.58k]
  ------------------
  237|  1.87k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  11.5k|{
  242|  11.5k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 11.3k, False: 185]
  ------------------
  243|  11.3k|        return dict.getKeys();
  244|  11.3k|    }
  245|    185|    typeWarning("dictionary", "treating as empty");
  246|    185|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|    185|    return {};
  248|  11.5k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|  34.8k|{
  264|  34.8k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 31.0k, False: 3.73k]
  ------------------
  265|  31.0k|        checkOwnership(value);
  266|  31.0k|        dict.replace(key, value);
  267|  31.0k|        return;
  268|  31.0k|    }
  269|  3.73k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  3.73k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  289|     20|{
  290|     20|    if (erase(key) || isDictionary()) {
  ------------------
  |  Branch (290:9): [True: 20, False: 0]
  |  Branch (290:23): [True: 0, False: 0]
  ------------------
  291|     20|        return;
  292|     20|    }
  293|      0|    typeWarning("dictionary", "ignoring key removal request");
  294|      0|}

_ZN4QPDF3Doc7Objects7StreamsC2ERNS0_6CommonE:
  126|  20.5k|    Common(common),
  127|  20.5k|    copier_(std::make_shared<Copier>(*this))
  128|  20.5k|{
  129|  20.5k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  13.6k|{
  226|  13.6k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 13.6k]
  ------------------
  227|       |        // We need to check user provided filters first as we allow users to replace qpdf provided
  228|       |        // default filters. This will have a performance impact if the facility to register stream
  229|       |        // filters is actually used. We can optimize this away if necessary.
  230|      0|        auto ff = filter_factories.find(expand_filter_name(name));
  231|      0|        if (ff != filter_factories.end()) {
  ------------------
  |  Branch (231:13): [True: 0, False: 0]
  ------------------
  232|      0|            return ff->second;
  233|      0|        }
  234|      0|    }
  235|  13.6k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 3.42k, False: 10.1k]
  ------------------
  236|  3.42k|        return SF_FlateLzwDecode::flate_factory;
  237|  3.42k|    }
  238|  10.1k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 1.06k, False: 9.12k]
  ------------------
  239|  1.06k|        return []() { return std::make_shared<SF_Crypt>(); };
  240|  1.06k|    }
  241|  9.12k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 488, False: 8.63k]
  ------------------
  242|    488|        return SF_FlateLzwDecode::lzw_factory;
  243|    488|    }
  244|  8.63k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 70, False: 8.56k]
  ------------------
  245|     70|        return SF_RunLengthDecode::factory;
  246|     70|    }
  247|  8.56k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 34, False: 8.53k]
  ------------------
  248|     34|        return SF_DCTDecode::factory;
  249|     34|    }
  250|  8.53k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 518, False: 8.01k]
  ------------------
  251|    518|        return SF_ASCII85Decode::factory;
  252|    518|    }
  253|  8.01k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 7, False: 8.00k]
  ------------------
  254|      7|        return SF_ASCIIHexDecode::factory;
  255|      7|    }
  256|       |    // The PDF specification provides these filter abbreviations for use in inline images, but
  257|       |    // according to table H.1 in the pre-ISO versions of the PDF specification, Adobe Reader
  258|       |    // also accepts them for stream filters.
  259|       |
  260|  8.00k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 2.22k, False: 5.78k]
  ------------------
  261|  2.22k|        return SF_FlateLzwDecode::flate_factory;
  262|  2.22k|    }
  263|  5.78k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 488, False: 5.29k]
  ------------------
  264|    488|        return SF_ASCIIHexDecode::factory;
  265|    488|    }
  266|  5.29k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 253, False: 5.04k]
  ------------------
  267|    253|        return SF_ASCII85Decode::factory;
  268|    253|    }
  269|  5.04k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 3.37k, False: 1.66k]
  ------------------
  270|  3.37k|        return SF_FlateLzwDecode::lzw_factory;
  271|  3.37k|    }
  272|  1.66k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 1.17k, False: 498]
  ------------------
  273|  1.17k|        return SF_RunLengthDecode::factory;
  274|  1.17k|    }
  275|    498|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 132, False: 366]
  ------------------
  276|    132|        return SF_DCTDecode::factory;
  277|    132|    }
  278|    366|    return nullptr;
  279|    498|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  28.4k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  28.4k|{
  285|  28.4k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  28.4k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  28.4k|    obj->setDescription(&qpdf, descr, offset);
  288|  28.4k|    setDictDescription();
  289|  28.4k|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  28.4k|{
  452|  28.4k|    auto s = stream();
  453|  28.4k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 0, False: 28.4k]
  ------------------
  454|      0|        s->stream_dict.setObjectDescription(
  455|      0|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|      0|    }
  457|  28.4k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  10.8k|{
  462|  10.8k|    std::string result;
  463|  10.8k|    pl::String buf(result);
  464|  10.8k|    bool filtered;
  465|  10.8k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  10.8k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 2.38k, False: 8.50k]
  ------------------
  467|  2.38k|        throw QPDFExc(
  468|  2.38k|            qpdf_e_unsupported,
  469|  2.38k|            qpdf()->getFilename(),
  470|  2.38k|            "",
  471|  2.38k|            offset(),
  472|  2.38k|            "getStreamData called on unfilterable stream");
  473|  2.38k|    }
  474|  8.50k|    return result;
  475|  10.8k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  10.7k|{
  496|  10.7k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 10.7k, False: 18]
  ------------------
  497|  10.7k|        return false;
  498|  10.7k|    }
  499|     18|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  10.7k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  10.8k|{
  507|  10.8k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  10.8k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  10.8k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 3.89k, False: 7.00k]
  ------------------
  513|       |        // No filters
  514|  3.89k|        return true;
  515|  3.89k|    }
  516|  7.00k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 55, False: 6.94k]
  ------------------
  517|     55|        global::Limits::error();
  518|     55|        warn(
  519|     55|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|     55|            "not filterable");
  521|     55|        return false;
  522|     55|    }
  523|  6.94k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 5.19k, False: 1.75k]
  ------------------
  524|       |        // One filter
  525|  5.19k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  5.19k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 199, False: 4.99k]
  ------------------
  527|    199|            return false;
  528|    199|        }
  529|  4.99k|        filters.emplace_back(ff());
  530|  4.99k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 1.74k, False: 9]
  ------------------
  531|       |        // Potentially multiple filters
  532|  8.43k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 8.43k, False: 1.56k]
  ------------------
  533|  8.43k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 15, False: 8.42k]
  ------------------
  534|     15|                warn("stream filter type is not name or array");
  535|     15|                return false;
  536|     15|            }
  537|  8.42k|            auto ff = s->filter_factory(item);
  538|  8.42k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 167, False: 8.25k]
  ------------------
  539|    167|                filters.clear();
  540|    167|                return false;
  541|    167|            }
  542|  8.25k|            filters.emplace_back(ff());
  543|  8.25k|        }
  544|  1.74k|    } else {
  545|      9|        warn("stream filter type is not name or array");
  546|      9|        return false;
  547|      9|    }
  548|       |
  549|       |    // filters now contains a list of filters to be applied in order. See which ones we can support.
  550|       |    // See if we can support any decode parameters that are specified.
  551|       |
  552|  6.55k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  6.55k|    auto can_filter = // linebreak
  555|  6.55k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  6.55k|        if (!filter.setDecodeParms(d_obj) ||
  557|  6.55k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  6.55k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  6.55k|            return false;
  560|  6.55k|        }
  561|  6.55k|        return true;
  562|  6.55k|    };
  563|       |
  564|  6.55k|    auto decode_array = decode_obj.as_array(strict);
  565|  6.55k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 6.51k, False: 48]
  |  Branch (565:26): [True: 6, False: 42]
  ------------------
  566|  6.51k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 6, False: 6.51k]
  ------------------
  567|      6|            decode_obj = QPDFObjectHandle::newNull();
  568|      6|        }
  569|       |
  570|  12.2k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 12.2k, False: 6.34k]
  ------------------
  571|  12.2k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 171, False: 12.0k]
  ------------------
  572|    171|                return false;
  573|    171|            }
  574|  12.2k|        }
  575|  6.51k|    } else {
  576|       |        // Ignore /DecodeParms entirely if /Filters is empty.  At least one case of a file whose
  577|       |        // /DecodeParms was [ << >> ] when /Filters was empty has been seen in the wild.
  578|     42|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 39, False: 3]
  |  Branch (578:13): [True: 5, False: 37]
  |  Branch (578:33): [True: 5, False: 34]
  ------------------
  579|      5|            warn("stream /DecodeParms length is inconsistent with filters");
  580|      5|            return false;
  581|      5|        }
  582|       |
  583|     37|        int i = -1;
  584|    157|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 157, False: 27]
  ------------------
  585|    157|            auto d_obj = decode_array.get(++i);
  586|    157|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 10, False: 147]
  ------------------
  587|     10|                return false;
  588|     10|            }
  589|    157|        }
  590|     37|    }
  591|       |
  592|  6.37k|    return true;
  593|  6.55k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  10.8k|{
  604|  10.8k|    auto s = stream();
  605|  10.8k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  10.8k|    bool ignored;
  607|  10.8k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 10.8k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  10.8k|    bool& filter = *filterp;
  611|       |
  612|  10.8k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 10.8k, False: 0]
  |  Branch (612:54): [True: 10.8k, False: 0]
  |  Branch (612:73): [True: 770, False: 10.1k]
  ------------------
  613|  10.8k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 0, False: 10.8k]
  |  Branch (613:54): [True: 0, False: 0]
  ------------------
  614|  10.8k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 770, False: 10.1k]
  |  Branch (614:40): [True: 0, False: 10.1k]
  ------------------
  615|       |
  616|  10.8k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 770, False: 10.1k]
  |  Branch (616:25): [True: 0, False: 10.1k]
  ------------------
  617|    770|        filter = true;
  618|    770|    }
  619|       |
  620|  10.8k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 770, False: 10.1k]
  |  Branch (620:23): [True: 0, False: 10.1k]
  |  Branch (620:39): [True: 10.1k, False: 0]
  ------------------
  621|  10.8k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 10.8k, False: 0]
  ------------------
  622|  10.8k|        filter = filterable(decode_level, filters);
  623|  10.8k|    }
  624|       |
  625|  10.8k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 10.8k]
  ------------------
  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.8k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  10.8k|    ContentNormalizer normalizer;
  637|  10.8k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 10.2k, False: 638]
  ------------------
  638|  10.2k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 10.2k]
  ------------------
  639|      0|            auto new_pipeline =
  640|      0|                std::make_unique<Pl_Flate>("compress stream", pipeline, Pl_Flate::a_deflate);
  641|      0|            pipeline = new_pipeline.get();
  642|      0|            to_delete.push_back(std::move(new_pipeline));
  643|      0|        }
  644|       |
  645|  10.2k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 0, False: 10.2k]
  ------------------
  646|      0|            auto new_pipeline =
  647|      0|                std::make_unique<Pl_QPDFTokenizer>("normalizer", &normalizer, pipeline);
  648|      0|            pipeline = new_pipeline.get();
  649|      0|            to_delete.push_back(std::move(new_pipeline));
  650|      0|        }
  651|       |
  652|  10.2k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 10.2k]
  ------------------
  653|      0|            auto new_pipeline =
  654|      0|                std::make_unique<Pl_QPDFTokenizer>("token filter", (*iter).get(), pipeline);
  655|      0|            pipeline = new_pipeline.get();
  656|      0|            to_delete.push_back(std::move(new_pipeline));
  657|      0|        }
  658|       |
  659|  22.3k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 12.1k, False: 10.2k]
  ------------------
  660|  12.1k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 11.0k, False: 1.09k]
  ------------------
  661|  11.0k|                pipeline = decode_pipeline;
  662|  11.0k|            }
  663|  12.1k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  12.1k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 6.20k, False: 5.90k]
  ------------------
  665|  6.20k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  6.20k|            }
  667|  12.1k|        }
  668|  10.2k|    }
  669|       |
  670|  10.8k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 0, False: 10.8k]
  ------------------
  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.8k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 0, False: 10.8k]
  ------------------
  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.8k|    } else {
  699|  10.8k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 10.8k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  10.8k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 1.76k, False: 9.13k]
  ------------------
  703|  10.8k|                qpdf(),
  704|  10.8k|                id_gen(),
  705|  10.8k|                offset(),
  706|  10.8k|                s->length,
  707|  10.8k|                s->stream_dict,
  708|  10.8k|                isRootMetadata(),
  709|  10.8k|                pipeline,
  710|  10.8k|                suppress_warnings,
  711|  10.8k|                will_retry)) {
  712|  1.76k|            filter = false;
  713|  1.76k|            return false;
  714|  1.76k|        }
  715|  10.8k|    }
  716|       |
  717|  9.13k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 8.26k, False: 874]
  |  Branch (717:19): [True: 8.26k, False: 0]
  |  Branch (717:41): [True: 0, False: 8.26k]
  ------------------
  718|      0|        warn("content normalization encountered bad tokens");
  719|      0|        if (normalizer.lastTokenWasBad()) {
  ------------------
  |  Branch (719:13): [True: 0, False: 0]
  ------------------
  720|      0|            QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize");
  721|      0|            warn(
  722|      0|                "normalized content ended with a bad token; you may be able to resolve this by "
  723|      0|                "coalescing content streams in combination with normalizing content. From the "
  724|      0|                "command line, specify --coalesce-contents");
  725|      0|        }
  726|      0|        warn(
  727|      0|            "Resulting stream data may be corrupted but is may still useful for manual "
  728|      0|            "inspection. For more information on this warning, search for content normalization "
  729|      0|            "in the manual.");
  730|      0|    }
  731|       |
  732|  9.13k|    return true;
  733|  10.8k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  2.59k|{
  790|  2.59k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  2.59k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  24.1k|{
  796|  24.1k|    return as_stream(error).getDict();
  797|  24.1k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  8.30k|{
  832|  8.30k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  8.30k|}
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  12.4k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  12.4k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 166, False: 12.2k]
  |  Branch (556:13): [True: 181, False: 12.2k]
  ------------------
  557|  12.2k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 12.2k, False: 0]
  |  Branch (557:39): [True: 22, False: 12.2k]
  ------------------
  558|  12.2k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 0, False: 12.2k]
  |  Branch (558:47): [True: 0, False: 0]
  ------------------
  559|    181|            return false;
  560|    181|        }
  561|  12.2k|        return true;
  562|  12.4k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  20.5k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  20.5k|        streams(streams)
   69|  20.5k|    {
   70|  20.5k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  20.5k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|  1.06k|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|  1.06k|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|  1.00k|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|  1.00k|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 810, False: 194]
  ------------------
  144|  2.71k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 2.71k, False: 783]
  ------------------
  145|  2.71k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 142, False: 2.57k]
  |  Branch (145:25): [True: 134, False: 2.58k]
  ------------------
  146|    142|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 67, False: 75]
  |  Branch (146:42): [True: 67, False: 8]
  ------------------
  147|    134|                        continue;
  148|    134|                    }
  149|  2.58k|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 66, False: 2.51k]
  ------------------
  150|     66|                        continue;
  151|     66|                    }
  152|  2.51k|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 27, False: 2.49k]
  ------------------
  153|     27|                        return false;
  154|     27|                    }
  155|  2.51k|                }
  156|    783|                return true;
  157|    810|            }
  158|    194|            return decode_parms.null();
  159|  1.00k|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|    967|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|    967|            return nullptr;
  166|    967|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  2.51k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

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

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

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

_ZN5QUtil16double_to_stringEdib:
  355|  17.9k|{
  356|       |    // Backward compatibility -- this code used to use sprintf and treated decimal_places <= 0 to
  357|       |    // mean to use the default, which was six decimal places. Starting in 10.2, we trim trailing
  358|       |    // zeroes by default.
  359|  17.9k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (359:9): [True: 17.9k, False: 0]
  ------------------
  360|  17.9k|        decimal_places = 6;
  361|  17.9k|    }
  362|  17.9k|    std::ostringstream buf;
  363|  17.9k|    buf.imbue(std::locale::classic());
  364|  17.9k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  365|  17.9k|    std::string result = buf.str();
  366|  17.9k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (366:9): [True: 17.9k, False: 0]
  ------------------
  367|   125k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (367:16): [True: 125k, False: 0]
  |  Branch (367:41): [True: 107k, False: 17.9k]
  ------------------
  368|   107k|            result.pop_back();
  369|   107k|        }
  370|  17.9k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (370:13): [True: 17.9k, False: 0]
  |  Branch (370:38): [True: 17.9k, False: 0]
  ------------------
  371|  17.9k|            result.pop_back();
  372|  17.9k|        }
  373|  17.9k|    }
  374|  17.9k|    return result;
  375|  17.9k|}
_ZN5QUtil12string_to_llEPKc:
  379|  7.69M|{
  380|  7.69M|    errno = 0;
  381|       |#ifdef _MSC_VER
  382|       |    long long result = _strtoi64(str, 0, 10);
  383|       |#else
  384|  7.69M|    long long result = strtoll(str, nullptr, 10);
  385|  7.69M|#endif
  386|  7.69M|    if (errno == ERANGE) {
  ------------------
  |  Branch (386:9): [True: 667, False: 7.69M]
  ------------------
  387|    667|        throw std::range_error(
  388|    667|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  389|    667|    }
  390|  7.69M|    return result;
  391|  7.69M|}
_ZN5QUtil13string_to_intEPKc:
  395|   520k|{
  396|       |    // QIntC::to_int does range checking
  397|   520k|    return QIntC::to_int(string_to_ll(str));
  398|   520k|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  447|   131k|{
  448|   131k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  449|   131k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  453|  5.05k|{
  454|  5.05k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  455|  5.05k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  717|  5.05k|{
  718|  5.05k|    auto result = std::make_unique<char[]>(str.length() + 1);
  719|       |    // Use memcpy in case string contains nulls
  720|  5.05k|    result.get()[str.length()] = '\0';
  721|  5.05k|    memcpy(result.get(), str.c_str(), str.length());
  722|  5.05k|    return result;
  723|  5.05k|}
_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|   198M|{
 1005|   198M|    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|   198M|    if (uval > 0x7fffffff) {
  ------------------
  |  Branch (1014:9): [True: 0, False: 198M]
  ------------------
 1015|      0|        throw std::runtime_error("bounds error in QUtil::toUTF8");
 1016|   198M|    } else if (uval < 128) {
  ------------------
  |  Branch (1016:16): [True: 47.3M, False: 150M]
  ------------------
 1017|  47.3M|        result += static_cast<char>(uval);
 1018|   150M|    } else {
 1019|   150M|        unsigned char bytes[7];
 1020|   150M|        bytes[6] = '\0';
 1021|   150M|        unsigned char* cur_byte = &bytes[5];
 1022|       |
 1023|       |        // maximum value that will fit in the current number of bytes
 1024|   150M|        unsigned char maxval = 0x3f; // six bits
 1025|       |
 1026|   441M|        while (uval > QIntC::to_ulong(maxval)) {
  ------------------
  |  Branch (1026:16): [True: 291M, False: 150M]
  ------------------
 1027|       |            // Assign low six bits plus 10000000 to lowest unused byte position, then shift
 1028|   291M|            *cur_byte = static_cast<unsigned char>(0x80 + (uval & 0x3f));
 1029|   291M|            uval >>= 6;
 1030|       |            // Maximum that will fit in high byte now shrinks by one bit
 1031|   291M|            maxval = static_cast<unsigned char>(maxval >> 1);
 1032|       |            // Slide to the left one byte
 1033|   291M|            if (cur_byte <= bytes) {
  ------------------
  |  Branch (1033:17): [True: 0, False: 291M]
  ------------------
 1034|      0|                throw std::logic_error("QUtil::toUTF8: overflow error");
 1035|      0|            }
 1036|   291M|            --cur_byte;
 1037|   291M|        }
 1038|       |        // If maxval is k bits long, the high (7 - k) bits of the resulting byte must be high.
 1039|   150M|        *cur_byte = static_cast<unsigned char>(QIntC::to_ulong(0xff - (1 + (maxval << 1))) + uval);
 1040|       |
 1041|   150M|        result += reinterpret_cast<char*>(cur_byte);
 1042|   150M|    }
 1043|       |
 1044|   198M|    return result;
 1045|   198M|}
_ZN5QUtil7toUTF16Em:
 1049|  3.33M|{
 1050|  3.33M|    std::string result;
 1051|  3.33M|    if ((uval >= 0xd800) && (uval <= 0xdfff)) {
  ------------------
  |  Branch (1051:9): [True: 12.5k, False: 3.32M]
  |  Branch (1051:29): [True: 578, False: 11.9k]
  ------------------
 1052|    578|        result = "\xff\xfd";
 1053|  3.33M|    } else if (uval <= 0xffff) {
  ------------------
  |  Branch (1053:16): [True: 3.33M, False: 2.62k]
  ------------------
 1054|  3.33M|        char out[2];
 1055|  3.33M|        out[0] = static_cast<char>((uval & 0xff00) >> 8);
 1056|  3.33M|        out[1] = static_cast<char>(uval & 0xff);
 1057|  3.33M|        result = std::string(out, 2);
 1058|  3.33M|    } else if (uval <= 0x10ffff) {
  ------------------
  |  Branch (1058:16): [True: 1.46k, False: 1.15k]
  ------------------
 1059|  1.46k|        char out[4];
 1060|  1.46k|        uval -= 0x10000;
 1061|  1.46k|        unsigned short high = static_cast<unsigned short>(((uval & 0xffc00) >> 10) + 0xd800);
 1062|  1.46k|        unsigned short low = static_cast<unsigned short>((uval & 0x3ff) + 0xdc00);
 1063|  1.46k|        out[0] = static_cast<char>((high & 0xff00) >> 8);
 1064|  1.46k|        out[1] = static_cast<char>(high & 0xff);
 1065|  1.46k|        out[2] = static_cast<char>((low & 0xff00) >> 8);
 1066|  1.46k|        out[3] = static_cast<char>(low & 0xff);
 1067|  1.46k|        result = std::string(out, 4);
 1068|  1.46k|    } else {
 1069|  1.15k|        result = "\xff\xfd";
 1070|  1.15k|    }
 1071|       |
 1072|  3.33M|    return result;
 1073|  3.33M|}
_ZN5QUtil21getRandomDataProviderEv:
 1126|    317|{
 1127|    317|    return getRandomDataProviderProvider()->getProvider();
 1128|    317|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1132|    317|{
 1133|    317|    getRandomDataProvider()->provideRandomData(data, len);
 1134|    317|}
_ZN5QUtil23get_next_utf8_codepointERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERmRb:
 1479|  43.5M|{
 1480|  43.5M|    auto o_pos = pos;
 1481|  43.5M|    size_t len = utf8_val.length();
 1482|  43.5M|    unsigned char ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1483|  43.5M|    error = false;
 1484|  43.5M|    if (ch < 128) {
  ------------------
  |  Branch (1484:9): [True: 5.56M, False: 37.9M]
  ------------------
 1485|  5.56M|        return static_cast<unsigned long>(ch);
 1486|  5.56M|    }
 1487|       |
 1488|  37.9M|    size_t bytes_needed = 0;
 1489|  37.9M|    unsigned bit_check = 0x40;
 1490|  37.9M|    unsigned char to_clear = 0x80;
 1491|  66.5M|    while (ch & bit_check) {
  ------------------
  |  Branch (1491:12): [True: 28.5M, False: 37.9M]
  ------------------
 1492|  28.5M|        ++bytes_needed;
 1493|  28.5M|        to_clear = static_cast<unsigned char>(to_clear | bit_check);
 1494|  28.5M|        bit_check >>= 1;
 1495|  28.5M|    }
 1496|  37.9M|    if (((bytes_needed > 5) || (bytes_needed < 1)) || ((pos + bytes_needed) > len)) {
  ------------------
  |  Branch (1496:10): [True: 153k, False: 37.7M]
  |  Branch (1496:32): [True: 23.1M, False: 14.6M]
  |  Branch (1496:55): [True: 424, False: 14.6M]
  ------------------
 1497|  23.2M|        error = true;
 1498|  23.2M|        return 0xfffd;
 1499|  23.2M|    }
 1500|       |
 1501|  14.6M|    auto codepoint = static_cast<unsigned long>(ch & ~to_clear);
 1502|  39.6M|    while (bytes_needed > 0) {
  ------------------
  |  Branch (1502:12): [True: 26.7M, False: 12.9M]
  ------------------
 1503|  26.7M|        --bytes_needed;
 1504|  26.7M|        ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1505|  26.7M|        if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (1505:13): [True: 1.68M, False: 25.0M]
  ------------------
 1506|  1.68M|            --pos;
 1507|  1.68M|            error = true;
 1508|  1.68M|            return 0xfffd;
 1509|  1.68M|        }
 1510|  25.0M|        codepoint <<= 6;
 1511|  25.0M|        codepoint += (ch & 0x3f);
 1512|  25.0M|    }
 1513|  12.9M|    unsigned long lower_bound = 0;
 1514|  12.9M|    switch (pos - o_pos) {
 1515|  1.07M|    case 2:
  ------------------
  |  Branch (1515:5): [True: 1.07M, False: 11.9M]
  ------------------
 1516|  1.07M|        lower_bound = 1 << 7;
 1517|  1.07M|        break;
 1518|  11.8M|    case 3:
  ------------------
  |  Branch (1518:5): [True: 11.8M, False: 1.08M]
  ------------------
 1519|  11.8M|        lower_bound = 1 << 11;
 1520|  11.8M|        break;
 1521|  4.07k|    case 4:
  ------------------
  |  Branch (1521:5): [True: 4.07k, False: 12.9M]
  ------------------
 1522|  4.07k|        lower_bound = 1 << 16;
 1523|  4.07k|        break;
 1524|    818|    case 5:
  ------------------
  |  Branch (1524:5): [True: 818, False: 12.9M]
  ------------------
 1525|    818|        lower_bound = 1 << 12;
 1526|    818|        break;
 1527|    412|    case 6:
  ------------------
  |  Branch (1527:5): [True: 412, False: 12.9M]
  ------------------
 1528|    412|        lower_bound = 1 << 26;
 1529|    412|        break;
 1530|      0|    default:
  ------------------
  |  Branch (1530:5): [True: 0, False: 12.9M]
  ------------------
 1531|      0|        lower_bound = 0;
 1532|  12.9M|    }
 1533|       |
 1534|  12.9M|    if (lower_bound > 0 && codepoint < lower_bound) {
  ------------------
  |  Branch (1534:9): [True: 12.9M, False: 0]
  |  Branch (1534:28): [True: 9.58k, False: 12.9M]
  ------------------
 1535|       |        // Too many bytes were used, but return whatever character was encoded.
 1536|  9.58k|        error = true;
 1537|  9.58k|    }
 1538|  12.9M|    return codepoint;
 1539|  12.9M|}
_ZN5QUtil13utf8_to_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1637|    723|{
 1638|    723|    return transcode_utf8(utf8, e_utf16, 0);
 1639|    723|}
_ZN5QUtil15utf8_to_pdf_docERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_c:
 1685|  2.99k|{
 1686|  2.99k|    return transcode_utf8(utf8, pdfdoc, e_pdfdoc, unknown_char);
 1687|  2.99k|}
_ZN5QUtil8is_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1691|  46.2k|{
 1692|  46.2k|    return util::is_utf16(val);
 1693|  46.2k|}
_ZN5QUtil13utf16_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1703|  46.2k|{
 1704|  46.2k|    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|  46.2k|    unsigned long codepoint = 0L;
 1709|  46.2k|    size_t len = val.length();
 1710|  46.2k|    size_t start = 0;
 1711|  46.2k|    bool is_le = false;
 1712|  46.2k|    if (is_utf16(val)) {
  ------------------
  |  Branch (1712:9): [True: 46.2k, False: 0]
  ------------------
 1713|  46.2k|        if (static_cast<unsigned char>(val.at(0)) == 0xff) {
  ------------------
  |  Branch (1713:13): [True: 33.9k, False: 12.3k]
  ------------------
 1714|  33.9k|            is_le = true;
 1715|  33.9k|        }
 1716|  46.2k|        start += 2;
 1717|  46.2k|    }
 1718|       |    // If the string has an odd number of bytes, the last byte is ignored.
 1719|  17.3M|    for (size_t i = start; i + 1 < len; i += 2) {
  ------------------
  |  Branch (1719:28): [True: 17.3M, False: 46.2k]
  ------------------
 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|  17.3M|        auto msb = is_le ? i + 1 : i;
  ------------------
  |  Branch (1724:20): [True: 1.22M, False: 16.1M]
  ------------------
 1725|  17.3M|        auto lsb = is_le ? i : i + 1;
  ------------------
  |  Branch (1725:20): [True: 1.22M, False: 16.1M]
  ------------------
 1726|  17.3M|        unsigned short bits = QIntC::to_ushort(
 1727|  17.3M|            (static_cast<unsigned char>(val.at(msb)) << 8) +
 1728|  17.3M|            static_cast<unsigned char>(val.at(lsb)));
 1729|  17.3M|        if ((bits & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (1729:13): [True: 3.66k, False: 17.3M]
  ------------------
 1730|  3.66k|            codepoint = 0x10000U + ((bits & 0x3FFU) << 10U);
 1731|  3.66k|            continue;
 1732|  17.3M|        } else if ((bits & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (1732:20): [True: 5.59k, False: 17.3M]
  ------------------
 1733|  5.59k|            if (codepoint != 0) {
  ------------------
  |  Branch (1733:17): [True: 1.80k, False: 3.79k]
  ------------------
 1734|  1.80k|                QTC::TC("qpdf", "QUtil non-trivial UTF-16");
 1735|  1.80k|            }
 1736|  5.59k|            codepoint += bits & 0x3FF;
 1737|  17.3M|        } else {
 1738|  17.3M|            codepoint = bits;
 1739|  17.3M|        }
 1740|       |
 1741|  17.3M|        result += QUtil::toUTF8(codepoint);
 1742|  17.3M|        codepoint = 0;
 1743|  17.3M|    }
 1744|  46.2k|    return result;
 1745|  46.2k|}
_ZN5QUtil15pdf_doc_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1781|   692k|{
 1782|   692k|    std::string result;
 1783|   692k|    size_t len = val.length();
 1784|   181M|    for (unsigned int i = 0; i < len; ++i) {
  ------------------
  |  Branch (1784:30): [True: 180M, False: 692k]
  ------------------
 1785|   180M|        unsigned char ch = static_cast<unsigned char>(val.at(i));
 1786|   180M|        unsigned short ch_short = ch;
 1787|   180M|        if ((ch >= 127) && (ch <= 160)) {
  ------------------
  |  Branch (1787:13): [True: 138M, False: 42.8M]
  |  Branch (1787:28): [True: 128M, False: 9.64M]
  ------------------
 1788|   128M|            ch_short = pdf_doc_to_unicode[ch - 127];
 1789|   128M|        } else if ((ch >= 24) && (ch <= 31)) {
  ------------------
  |  Branch (1789:20): [True: 45.6M, False: 6.80M]
  |  Branch (1789:34): [True: 479k, False: 45.1M]
  ------------------
 1790|   479k|            ch_short = pdf_doc_low_to_unicode[ch - 24];
 1791|  51.9M|        } else if (ch == 173) {
  ------------------
  |  Branch (1791:20): [True: 14.2k, False: 51.9M]
  ------------------
 1792|  14.2k|            ch_short = 0xfffd;
 1793|  14.2k|        }
 1794|   180M|        result += QUtil::toUTF8(ch_short);
 1795|   180M|    }
 1796|   692k|    return result;
 1797|   692k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1112|    317|{
 1113|       |    // Thread-safe static initializer
 1114|    317|    static RandomDataProviderProvider rdpp;
 1115|    317|    return &rdpp;
 1116|    317|}
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|    317|{
 1101|    317|    return this->current_provider;
 1102|    317|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE10encoding_ec:
 1629|    723|{
 1630|    723|    std::string result;
 1631|    723|    transcode_utf8(utf8_val, result, encoding, unknown);
 1632|    723|    return result;
 1633|    723|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_10encoding_ec:
 1543|  3.72k|{
 1544|  3.72k|    bool okay = true;
 1545|  3.72k|    result.clear();
 1546|  3.72k|    size_t len = utf8_val.length();
 1547|  3.72k|    switch (encoding) {
 1548|    723|    case e_utf16:
  ------------------
  |  Branch (1548:5): [True: 723, False: 2.99k]
  ------------------
 1549|    723|        result += "\xfe\xff";
 1550|    723|        break;
 1551|  2.99k|    case e_pdfdoc:
  ------------------
  |  Branch (1551:5): [True: 2.99k, False: 723]
  ------------------
 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.99k|        if ((len >= 4) && (utf8_val[0] == '\xc3')) {
  ------------------
  |  Branch (1558:13): [True: 2.37k, False: 626]
  |  Branch (1558:27): [True: 1.28k, False: 1.08k]
  ------------------
 1559|  1.28k|            static std::string fe_ff("\xbe\xc3\xbf");
 1560|  1.28k|            static std::string ff_fe("\xbf\xc3\xbe");
 1561|  1.28k|            static std::string ef_bb_bf("\xaf\xc2\xbb\xc2\xbf");
 1562|       |            // C++-20 has starts_with, but when this was written, qpdf had a minimum supported
 1563|       |            // version of C++-17.
 1564|  1.28k|            if ((utf8_val.compare(1, 3, fe_ff) == 0) || (utf8_val.compare(1, 3, ff_fe) == 0) ||
  ------------------
  |  Branch (1564:17): [True: 23, False: 1.26k]
  |  Branch (1564:57): [True: 21, False: 1.24k]
  ------------------
 1565|  1.24k|                (utf8_val.compare(1, 5, ef_bb_bf) == 0)) {
  ------------------
  |  Branch (1565:17): [True: 36, False: 1.20k]
  ------------------
 1566|     80|                result += unknown;
 1567|     80|                okay = false;
 1568|     80|            }
 1569|  1.28k|        }
 1570|  2.99k|        break;
 1571|      0|    default:
  ------------------
  |  Branch (1571:5): [True: 0, False: 3.72k]
  ------------------
 1572|      0|        break;
 1573|  3.72k|    }
 1574|  3.72k|    size_t pos = 0;
 1575|  43.5M|    while (pos < len) {
  ------------------
  |  Branch (1575:12): [True: 43.5M, False: 3.72k]
  ------------------
 1576|  43.5M|        bool error = false;
 1577|  43.5M|        unsigned long codepoint = QUtil::get_next_utf8_codepoint(utf8_val, pos, error);
 1578|  43.5M|        if (error) {
  ------------------
  |  Branch (1578:13): [True: 24.9M, False: 18.5M]
  ------------------
 1579|  24.9M|            okay = false;
 1580|  24.9M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1580:17): [True: 12.4M, False: 12.4M]
  ------------------
 1581|  12.4M|                result += "\xff\xfd";
 1582|  12.4M|            } else {
 1583|  12.4M|                result.append(1, unknown);
 1584|  12.4M|            }
 1585|  24.9M|        } else if (codepoint < 128) {
  ------------------
  |  Branch (1585:20): [True: 5.56M, False: 12.9M]
  ------------------
 1586|  5.56M|            char ch = static_cast<char>(codepoint);
 1587|  5.56M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1587:17): [True: 2.26M, False: 3.29M]
  ------------------
 1588|  2.26M|                result += QUtil::toUTF16(QIntC::to_ulong(ch));
 1589|  3.29M|            } else if ((encoding == e_pdfdoc) && (((ch >= 0x18) && (ch <= 0x1f)) || (ch == 127))) {
  ------------------
  |  Branch (1589:24): [True: 3.29M, False: 0]
  |  Branch (1589:52): [True: 2.66M, False: 629k]
  |  Branch (1589:68): [True: 76.1k, False: 2.59M]
  |  Branch (1589:85): [True: 11.9k, False: 3.20M]
  ------------------
 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|  88.0k|                okay = false;
 1594|  88.0k|                result.append(1, unknown);
 1595|  3.20M|            } else {
 1596|  3.20M|                result.append(1, ch);
 1597|  3.20M|            }
 1598|  12.9M|        } else if (encoding == e_utf16) {
  ------------------
  |  Branch (1598:20): [True: 1.07M, False: 11.9M]
  ------------------
 1599|  1.07M|            result += QUtil::toUTF16(codepoint);
 1600|  11.9M|        } else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) {
  ------------------
  |  Branch (1600:20): [True: 237, False: 11.9M]
  |  Branch (1600:43): [True: 237, False: 0]
  ------------------
 1601|       |            // PDFDocEncoding omits 0x00ad (soft hyphen).
 1602|    237|            okay = false;
 1603|    237|            result.append(1, unknown);
 1604|  11.9M|        } else if (
 1605|  11.9M|            (codepoint > 160) && (codepoint < 256) &&
  ------------------
  |  Branch (1605:13): [True: 11.9M, False: 1.34k]
  |  Branch (1605:34): [True: 754k, False: 11.1M]
  ------------------
 1606|   754k|            ((encoding == e_winansi) || (encoding == e_pdfdoc))) {
  ------------------
  |  Branch (1606:14): [True: 0, False: 754k]
  |  Branch (1606:41): [True: 754k, False: 0]
  ------------------
 1607|   754k|            result.append(1, static_cast<char>(codepoint & 0xff));
 1608|  11.1M|        } else {
 1609|  11.1M|            unsigned char ch = '\0';
 1610|  11.1M|            if (encoding == e_winansi) {
  ------------------
  |  Branch (1610:17): [True: 0, False: 11.1M]
  ------------------
 1611|      0|                ch = encode_winansi(codepoint);
 1612|  11.1M|            } else if (encoding == e_macroman) {
  ------------------
  |  Branch (1612:24): [True: 0, False: 11.1M]
  ------------------
 1613|      0|                ch = encode_macroman(codepoint);
 1614|  11.1M|            } else if (encoding == e_pdfdoc) {
  ------------------
  |  Branch (1614:24): [True: 11.1M, False: 0]
  ------------------
 1615|  11.1M|                ch = encode_pdfdoc(codepoint);
 1616|  11.1M|            }
 1617|  11.1M|            if (ch == '\0') {
  ------------------
  |  Branch (1617:17): [True: 1.06M, False: 10.0M]
  ------------------
 1618|  1.06M|                okay = false;
 1619|  1.06M|                ch = static_cast<unsigned char>(unknown);
 1620|  1.06M|            }
 1621|  11.1M|            result.append(1, static_cast<char>(ch));
 1622|  11.1M|        }
 1623|  43.5M|    }
 1624|  3.72k|    return okay;
 1625|  3.72k|}
QUtil.cc:_ZL13encode_pdfdocm:
 1469|  11.1M|{
 1470|  11.1M|    auto i = unicode_to_pdf_doc.find(codepoint);
 1471|  11.1M|    if (i != unicode_to_pdf_doc.end()) {
  ------------------
  |  Branch (1471:9): [True: 10.0M, False: 1.06M]
  ------------------
 1472|  10.0M|        return i->second;
 1473|  10.0M|    }
 1474|  1.06M|    return '\0';
 1475|  11.1M|}

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

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

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  9.26k|{
   14|  9.26k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 4.13k, False: 5.13k]
  ------------------
   15|  4.13k|        return true;
   16|  4.13k|    }
   17|       |
   18|  5.13k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  5.13k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  11.8k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 11.8k, False: 5.02k]
  ------------------
   22|  11.8k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  11.8k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 3.09k, False: 8.77k]
  ------------------
   24|  3.09k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 3.09k, False: 3]
  ------------------
   25|  3.09k|                predictor = value.getIntValueAsInt();
   26|  3.09k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 68, False: 3.02k]
  |  Branch (26:41): [True: 944, False: 2.08k]
  |  Branch (26:60): [True: 2.04k, False: 37]
  |  Branch (26:79): [True: 2.02k, False: 22]
  ------------------
   27|     59|                    return false;
   28|     59|                }
   29|  3.09k|            } else {
   30|      3|                return false;
   31|      3|            }
   32|  8.77k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 1.83k, False: 6.94k]
  |  Branch (32:41): [True: 644, False: 6.29k]
  |  Branch (32:61): [True: 527, False: 5.76k]
  ------------------
   33|  3.00k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 3.00k, False: 3]
  ------------------
   34|  3.00k|                int val = value.getIntValueAsInt();
   35|  3.00k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 3.00k, False: 1]
  |  Branch (35:37): [True: 15, False: 2.98k]
  ------------------
   36|     15|                    QPDFLogger::defaultLogger()->warn(
   37|     15|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     15|                    return false;
   39|     15|                }
   40|  2.98k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 1.82k, False: 1.16k]
  ------------------
   41|  1.82k|                    columns = val;
   42|  1.82k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 643, False: 524]
  ------------------
   43|    643|                    colors = val;
   44|    643|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 523, False: 1]
  ------------------
   45|    523|                    bits_per_component = val;
   46|    523|                }
   47|  2.98k|            } else {
   48|      3|                return false;
   49|      3|            }
   50|  5.76k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 5.19k, False: 570]
  |  Branch (50:27): [True: 169, False: 5.03k]
  ------------------
   51|    169|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 166, False: 3]
  ------------------
   52|    166|                int earlychange = value.getIntValueAsInt();
   53|    166|                early_code_change = (earlychange == 1);
   54|    166|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 66, False: 100]
  |  Branch (54:43): [True: 68, False: 32]
  ------------------
   55|     32|                    return false;
   56|     32|                }
   57|    166|            } else {
   58|      3|                return false;
   59|      3|            }
   60|    169|        }
   61|  11.8k|    }
   62|       |
   63|  5.02k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 2.96k, False: 2.05k]
  |  Branch (63:26): [True: 3, False: 2.96k]
  ------------------
   64|      3|        return false;
   65|      3|    }
   66|       |
   67|  5.01k|    return true;
   68|  5.02k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  9.04k|{
   73|  9.04k|    std::unique_ptr<Pipeline> pipeline;
   74|  9.04k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 1.97k, False: 7.06k]
  |  Branch (74:28): [True: 1.97k, False: 0]
  ------------------
   75|  1.97k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  1.97k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  1.97k|            "png decode",
   78|  1.97k|            next,
   79|  1.97k|            Pl_PNGFilter::a_decode,
   80|  1.97k|            QIntC::to_uint(columns),
   81|  1.97k|            QIntC::to_uint(colors),
   82|  1.97k|            QIntC::to_uint(bits_per_component));
   83|  1.97k|        next = pipeline.get();
   84|  1.97k|        pipelines.push_back(std::move(pipeline));
   85|  7.06k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 892, False: 6.17k]
  ------------------
   86|    892|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|    892|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|    892|            "tiff decode",
   89|    892|            next,
   90|    892|            Pl_TIFFPredictor::a_decode,
   91|    892|            QIntC::to_uint(columns),
   92|    892|            QIntC::to_uint(colors),
   93|    892|            QIntC::to_uint(bits_per_component));
   94|    892|        next = pipeline.get();
   95|    892|        pipelines.push_back(std::move(pipeline));
   96|    892|    }
   97|       |
   98|  9.04k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 3.53k, False: 5.50k]
  ------------------
   99|  3.53k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  5.50k|    } else {
  101|  5.50k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  5.50k|    }
  103|  9.04k|    next = pipeline.get();
  104|  9.04k|    pipelines.push_back(std::move(pipeline));
  105|  9.04k|    return next;
  106|  9.04k|}

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

_ZN24SecureRandomDataProvider17provideRandomDataEPhm:
   81|    317|{
   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|    317|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   93|    317|        FILE* f = fopen("/dev/urandom", "rb");
   94|    317|        if (f == nullptr) {
   95|    317|            f = fopen("/dev/arandom", "rb");
   96|    317|        }
   97|    317|        if (f == nullptr) {
   98|    317|            f = fopen("/dev/random", "rb");
   99|    317|        }
  100|    317|        if (f == nullptr) {
  101|    317|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  102|    317|        }
  103|    317|        return std::make_unique<QUtil::FileCloser>(f);
  104|    317|    }();
  105|       |
  106|    317|    size_t fr = fread(data, 1, len, random_device->f);
  107|    317|    if (fr != len) {
  ------------------
  |  Branch (107:9): [True: 0, False: 317]
  ------------------
  108|      0|        throw std::runtime_error(
  109|      0|            "unable to read " + std::to_string(len) + " bytes from random number device");
  110|      0|    }
  111|       |
  112|    317|# endif
  113|    317|}
_ZN24SecureRandomDataProvider11getInstanceEv:
  117|      1|{
  118|      1|    static SecureRandomDataProvider instance;
  119|      1|    return &instance;
  120|      1|}
SecureRandomDataProvider.cc:_ZZN24SecureRandomDataProvider17provideRandomDataEPhmENK3$_0clEv:
   92|      1|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   93|      1|        FILE* f = fopen("/dev/urandom", "rb");
   94|      1|        if (f == nullptr) {
  ------------------
  |  Branch (94:13): [True: 0, False: 1]
  ------------------
   95|      0|            f = fopen("/dev/arandom", "rb");
   96|      0|        }
   97|      1|        if (f == nullptr) {
  ------------------
  |  Branch (97:13): [True: 0, False: 1]
  ------------------
   98|      0|            f = fopen("/dev/random", "rb");
   99|      0|        }
  100|      1|        if (f == nullptr) {
  ------------------
  |  Branch (100:13): [True: 0, False: 1]
  ------------------
  101|      0|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  102|      0|        }
  103|      1|        return std::make_unique<QUtil::FileCloser>(f);
  104|      1|    }();

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

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

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

_ZNK4qpdf2is12OffsetBuffer7getNameEv:
   48|   808k|        {
   49|   808k|            return description;
   50|   808k|        }
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|  26.0M|        {
   55|  26.0M|            return pos + global_offset;
   56|  26.0M|        }
_ZN4qpdf2is12OffsetBuffer8unreadChEc:
   70|  22.8k|        {
   71|  22.8k|            if (pos > 0) {
  ------------------
  |  Branch (71:17): [True: 22.8k, False: 0]
  ------------------
   72|  22.8k|                --pos;
   73|  22.8k|            }
   74|  22.8k|        }
_ZN4qpdf2is12OffsetBufferD2Ev:
   42|  48.1k|        ~OffsetBuffer() final = default;
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|  48.1k|            description(description),
   22|  48.1k|            view_(view),
   23|  48.1k|            global_offset(global_offset)
   24|  48.1k|        {
   25|  48.1k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 47, False: 48.1k]
  ------------------
   26|     47|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     47|            }
   28|  48.1k|            last_offset = global_offset;
   29|  48.1k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  21.7k|{
   88|  21.7k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 10.7k, False: 10.9k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  10.7k|    }
   91|  21.7k|    str.resize(count);
   92|  21.7k|    str.resize(read(str.data(), count));
   93|  21.7k|    return str.size();
   94|  21.7k|}
_ZN11InputSource4readEmx:
   98|  10.7k|{
   99|  10.7k|    std::string result(count, '\0');
  100|  10.7k|    (void)read(result, count, at);
  101|  10.7k|    return result;
  102|  10.7k|}
_ZN11InputSource10loadBufferEv:
  106|  2.89M|{
  107|  2.89M|    buf_idx = 0;
  108|  2.89M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  2.89M|    buf_start = last_offset;
  111|  2.89M|}
_ZN11InputSource8fastTellEv:
  115|  21.7M|{
  116|  21.7M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 76.7k, False: 21.7M]
  ------------------
  117|  76.7k|        loadBuffer();
  118|  21.7M|    } else {
  119|  21.7M|        auto curr = tell();
  120|  21.7M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 47.8k, False: 21.6M]
  |  Branch (120:33): [True: 2.77M, False: 18.8M]
  ------------------
  121|  2.82M|            loadBuffer();
  122|  18.8M|        } else {
  123|  18.8M|            last_offset = curr;
  124|  18.8M|            buf_idx = curr - buf_start;
  125|  18.8M|        }
  126|  21.7M|    }
  127|  21.7M|    return last_offset;
  128|  21.7M|}
_ZN11InputSource8fastReadERc:
  132|   350M|{
  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|   350M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 347M, False: 2.56M]
  ------------------
  136|   347M|        ch = buffer[buf_idx];
  137|   347M|        ++(buf_idx);
  138|   347M|        ++(last_offset);
  139|   347M|        return true;
  140|       |
  141|   347M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 37.7k, False: 2.52M]
  ------------------
  142|  37.7k|        return false;
  143|  2.52M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  2.52M|        fastTell();
  146|  2.52M|        return fastRead(ch);
  147|  2.52M|    }
  148|   350M|}
_ZN11InputSource10fastUnreadEb:
  152|  19.2M|{
  153|  19.2M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 18.1M, False: 1.10M]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  19.2M|}

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

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

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

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

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

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

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

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

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

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

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

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|  17.2M|    {
  934|  17.2M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 17.2M, False: 0]
  ------------------
  935|  17.2M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|   287k|    {
  928|   287k|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 287k, False: 0]
  ------------------
  929|   287k|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|  27.5k|    {
  922|  27.5k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 27.5k, False: 0]
  ------------------
  923|  27.5k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  2.69M|    {
  952|  2.69M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 72.4k, False: 2.62M]
  ------------------
  953|  72.4k|            return ::ot_uninitialized;
  954|  72.4k|        }
  955|  2.62M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 123k, False: 2.50M]
  ------------------
  956|   123k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   123k|        }
  958|  2.50M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 2.50M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  2.50M|        return raw_type_code();
  962|  2.50M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|  4.11M|    {
  861|  4.11M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 4.11M, False: 532]
  ------------------
  862|  4.11M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|   231k|    {
  908|   231k|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 50.0k, False: 181k]
  |  Branch (908:24): [True: 52.9k, False: 129k]
  ------------------
  909|   231k|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   413k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 360k, False: 53.7k]
  ------------------
   58|   413k|        {
   59|   413k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|  1.24M|    {
  940|  1.24M|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 47.1k, False: 1.19M]
  ------------------
  941|  47.1k|            return ::ot_uninitialized;
  942|  47.1k|        }
  943|  1.19M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 598, False: 1.19M]
  ------------------
  944|    598|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|    598|        }
  946|  1.19M|        return raw_type_code();
  947|  1.19M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|  1.29M|        obj(oh.obj)
  789|  1.29M|    {
  790|  1.29M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   151k|            BaseDictionary(oh)
  269|   151k|        {
  270|   151k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   151k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 143k, False: 7.66k]
  ------------------
  239|   151k|        {
  240|   151k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|  1.86k|        {
  142|  1.86k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 1.49k, False: 375]
  ------------------
  143|  1.49k|                return d->items.begin();
  144|  1.49k|            }
  145|    375|            return {};
  146|  1.86k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|   957k|    {
  771|   957k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 5.25k, False: 951k]
  ------------------
  772|  5.25k|            return nullptr;
  773|  5.25k|        }
  774|   951k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 945k, False: 6.85k]
  ------------------
  775|   945k|            return &std::get<T>(obj->value);
  776|   945k|        }
  777|  6.85k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 193, False: 6.66k]
  ------------------
  778|    193|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|    193|        }
  780|  6.66k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 6.66k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  6.66k|        return nullptr;
  785|  6.66k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|  1.86k|        {
  151|  1.86k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 1.49k, False: 374]
  ------------------
  152|  1.49k|                return d->items.end();
  153|  1.49k|            }
  154|    374|            return {};
  155|  1.86k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|  12.3k|    {
  855|  12.3k|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 12.3k, False: 0]
  ------------------
  856|  12.3k|    }
_ZNK4qpdf6Stream7getDictEv:
  554|  53.7k|        {
  555|  53.7k|            return {stream()->stream_dict};
  556|  53.7k|        }
_ZNK4qpdf6Stream6streamEv:
  697|   114k|        {
  698|   114k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 114k, False: 0]
  ------------------
  699|   114k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 114k, False: 2]
  ------------------
  700|   114k|                    return ptr;
  701|   114k|                }
  702|      2|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|   114k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|   114k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|   114k|    {
  771|   114k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 114k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   114k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 114k, False: 0]
  ------------------
  775|   114k|            return &std::get<T>(obj->value);
  776|   114k|        }
  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|   616k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 142k, False: 473k]
  ------------------
  320|   616k|        {
  321|   616k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   302k|        {
  331|   302k|            return obj != nullptr;
  332|   302k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|   103k|        {
  474|   103k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 63.0k, False: 40.7k]
  |  Branch (474:27): [True: 35.3k, False: 27.6k]
  ------------------
  475|   103k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   114k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 70.4k, False: 44.0k]
  ------------------
  450|   114k|        {
  451|   114k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|  12.6k|    {
  806|  12.6k|        return {obj};
  807|  12.6k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   314k|{
  989|   314k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   314k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  51.1k|        {
  362|  51.1k|            try {
  363|  51.1k|                return static_cast<T>(*this);
  364|  51.1k|            } catch (std::underflow_error&) {
  365|     77|                if constexpr (std::is_same_v<T, int>) {
  366|     77|                    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|     77|                return std::numeric_limits<T>::min();
  377|     77|            } catch (std::overflow_error&) {
  378|     41|                if constexpr (std::is_same_v<T, int>) {
  379|     41|                    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|     41|                return std::numeric_limits<T>::max();
  388|     41|            }
  389|  51.1k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  51.1k|        {
  340|  51.1k|            auto v = value();
  341|       |
  342|  51.1k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 41, False: 51.1k]
  ------------------
  343|     41|                throw std::overflow_error("Integer conversion overflow");
  344|     41|            }
  345|  51.1k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 77, False: 51.0k]
  ------------------
  346|     77|                throw std::underflow_error("Integer conversion underflow");
  347|     77|            }
  348|  51.0k|            return static_cast<T>(v);
  349|  51.1k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  17.7k|        {
   37|  17.7k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 17.7k, False: 0]
  ------------------
   38|  17.7k|                obj = other.obj;
   39|  17.7k|            }
   40|  17.7k|            return *this;
   41|  17.7k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|  20.9k|            BaseHandle(obj)
   48|  20.9k|        {
   49|  20.9k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  6.51k|            BaseHandle(std::move(obj))
   53|  6.51k|        {
   54|  6.51k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  51.9k|        {
   64|  51.9k|            assign(::ot_array, oh);
   65|  51.9k|            return *this;
   66|  51.9k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|     18|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 0, False: 18]
  ------------------
   70|     18|        {
   71|     18|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|  1.66k|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|  1.66k|        {
  222|  1.66k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|  47.4k|            BaseHandle(obj)
  226|  47.4k|        {
  227|  47.4k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  1.76k|            BaseHandle(
  244|  1.76k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 1.26k, False: 500]
  ------------------
  245|  1.76k|        {
  246|  1.76k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  48.1k|        {
  275|  48.1k|            assign(::ot_dictionary, oh);
  276|  48.1k|            return *this;
  277|  48.1k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  1.76k|            BaseDictionary(std::move(oh))
  281|  1.76k|        {
  282|  1.76k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|     17|        {
  287|     17|            assign(::ot_dictionary, std::move(oh));
  288|     17|            return *this;
  289|     17|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  9.46k|        {
  462|  9.46k|            return value();
  463|  9.46k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|  58.6k|            BaseHandle(obj)
  516|  58.6k|        {
  517|  58.6k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|  30.6k|            BaseHandle(std::move(obj))
  521|  30.6k|        {
  522|  30.6k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  39.8k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 3.44k, False: 36.4k]
  ------------------
  538|  39.8k|        {
  539|  39.8k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  26.1k|        {
  602|  26.1k|            return {getDict()["/Type"]};
  603|  26.1k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  737|   747k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (737:24): [True: 747k, False: 0]
  ------------------
  738|   747k|        {
  739|   747k|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  799|  90.0k|    {
  800|  90.0k|        return obj;
  801|  90.0k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  838|   100k|    {
  839|   100k|        if (obj != other.obj) {
  ------------------
  |  Branch (839:13): [True: 47.6k, False: 52.3k]
  ------------------
  840|  47.6k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (840:19): [True: 46.7k, False: 964]
  ------------------
  841|  47.6k|        }
  842|   100k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  846|     17|    {
  847|     17|        if (obj != other.obj) {
  ------------------
  |  Branch (847:13): [True: 0, False: 17]
  ------------------
  848|      0|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (848:19): [True: 0, False: 0]
  ------------------
  849|      0|        }
  850|     17|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|   261k|    {
  902|   261k|        return (*this)[key];
  903|   261k|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|  74.6k|{
  975|  74.6k|    auto n = QPDFObject::create<QPDF_Null>();
  976|  74.6k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|  74.6k|    return n;
  978|  74.6k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|  26.2k|{
 1007|  26.2k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 26.2k]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|  26.2k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 9.42k, False: 16.8k]
  |  Branch (1010:37): [True: 10.3k, False: 6.51k]
  ------------------
 1011|  19.7k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 6.51k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|  19.7k|        return qpdf::Array(obj);
 1013|  19.7k|    }
 1014|  6.51k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|  26.2k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|  47.4k|{
 1020|  47.4k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 1.05k, False: 46.3k]
  |  Branch (1020:37): [True: 42.4k, False: 3.92k]
  ------------------
 1021|  43.5k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 3.92k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|  43.5k|        return qpdf::Dictionary(obj);
 1023|  43.5k|    }
 1024|  3.92k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 3.92k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  3.92k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|  47.4k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|  92.4k|{
 1033|  92.4k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 92.4k]
  |  Branch (1033:37): [True: 61.7k, False: 30.6k]
  ------------------
 1034|  58.6k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 30.6k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|  58.6k|        return qpdf::Stream(obj);
 1036|  58.6k|    }
 1037|  33.7k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 0, False: 33.7k]
  ------------------
 1038|      0|        assertType("stream", false);
 1039|      0|    }
 1040|  33.7k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|  92.4k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  5.89k|{
  989|  5.89k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  5.89k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   131k|{
  989|   131k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   131k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|   787k|        obj(std::move(oh.obj))
  794|   787k|    {
  795|   787k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  48.8k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  48.8k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|   126k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|   126k|        BaseDictionary(BaseDictionary const&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    252|{
  989|    252|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    252|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  6.60M|{
  989|  6.60M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  6.60M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    564|{
  989|    564|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    564|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  17.8k|{
  989|  17.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  17.8k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   109k|{
  989|   109k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   109k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  988|     26|{
  989|     26|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|     26|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    976|{
  989|    976|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    976|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    705|{
  989|    705|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    705|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|      3|    {
  771|      3|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 3]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|      3|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 3, False: 0]
  ------------------
  775|      3|            return &std::get<T>(obj->value);
  776|      3|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZNK4qpdf10BaseHandle2asI12QPDF_IntegerEEPT_v:
  770|   144k|    {
  771|   144k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 1.54k, False: 142k]
  ------------------
  772|  1.54k|            return nullptr;
  773|  1.54k|        }
  774|   142k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 142k, False: 0]
  ------------------
  775|   142k|            return &std::get<T>(obj->value);
  776|   142k|        }
  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|  66.2k|        {
  340|  66.2k|            auto v = value();
  341|       |
  342|  66.2k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 66.2k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  66.2k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 66.2k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  66.2k|            return static_cast<T>(v);
  349|  66.2k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  16.8k|        {
  362|  16.8k|            try {
  363|  16.8k|                return static_cast<T>(*this);
  364|  16.8k|            } 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|    201|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    201|                    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|    201|                return std::numeric_limits<T>::min();
  377|    201|            } 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|  16.8k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  16.8k|        {
  340|  16.8k|            auto v = value();
  341|       |
  342|  16.8k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 16.8k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  16.8k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 201, False: 16.6k]
  ------------------
  346|    201|                throw std::underflow_error("Integer conversion underflow");
  347|    201|            }
  348|  16.6k|            return static_cast<T>(v);
  349|  16.8k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  10.1k|        {
  362|  10.1k|            try {
  363|  10.1k|                return static_cast<T>(*this);
  364|  10.1k|            } 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|    150|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    150|                    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|    150|                return std::numeric_limits<T>::min();
  377|    150|            } 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|    137|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|    137|                    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|    137|                return std::numeric_limits<T>::max();
  388|    137|            }
  389|  10.1k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  10.1k|        {
  340|  10.1k|            auto v = value();
  341|       |
  342|  10.1k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 137, False: 9.98k]
  ------------------
  343|    137|                throw std::overflow_error("Integer conversion overflow");
  344|    137|            }
  345|  9.98k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 150, False: 9.83k]
  ------------------
  346|    150|                throw std::underflow_error("Integer conversion underflow");
  347|    150|            }
  348|  9.83k|            return static_cast<T>(v);
  349|  9.98k|        }
_ZN10QPDFObject6createI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  8.28M|{
  989|  8.28M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  8.28M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  12.1k|{
  989|  12.1k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  12.1k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|  78.5k|    {
  771|  78.5k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 78.5k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  78.5k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 78.5k, False: 0]
  ------------------
  775|  78.5k|            return &std::get<T>(obj->value);
  776|  78.5k|        }
  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|   148k|{
  989|   148k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   148k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    723|{
  989|    723|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    723|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|   747k|    {
  771|   747k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 747k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   747k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 747k, False: 0]
  ------------------
  775|   747k|            return &std::get<T>(obj->value);
  776|   747k|        }
  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|  60.0k|{
  989|  60.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  60.0k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  17.9k|{
  989|  17.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  17.9k|}
_ZN9QPDF_RealC2Edib:
  981|  17.9k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  17.9k|{
  983|  17.9k|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  7.31k|{
  989|  7.31k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  7.31k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  967|   131k|    items(std::move(items))
  968|   131k|{
  969|   131k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  9.02k|{
  989|  9.02k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  9.02k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  8.57k|{
  989|  8.57k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  8.57k|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  81.8k|{
  989|  81.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  81.8k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|  1.23M|    {
  771|  1.23M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 79.6k, False: 1.15M]
  ------------------
  772|  79.6k|            return nullptr;
  773|  79.6k|        }
  774|  1.15M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1.14M, False: 6.25k]
  ------------------
  775|  1.14M|            return &std::get<T>(obj->value);
  776|  1.14M|        }
  777|  6.25k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 6.25k]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  6.25k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 6.25k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  6.25k|        return nullptr;
  785|  6.25k|    }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  1.77k|            Integer(static_cast<long long>(value))
  308|  1.77k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  1.77k|                              std::numeric_limits<long long>::max())) {
  312|  1.77k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 1.77k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  1.77k|            }
  316|  1.77k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  2.38k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  2.38k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  9.24k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  9.24k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  17.7k|        Array() = default;

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

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

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  18.0M|        {
   65|  18.0M|            return this->type;
   66|  18.0M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  16.7M|        {
   70|  16.7M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 8.75M, False: 7.98M]
  |  Branch (70:61): [True: 146k, False: 7.84M]
  ------------------
   71|  16.7M|                ? this->val
   72|  16.7M|                : this->raw_val;
   73|  16.7M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  37.8k|        {
   82|  37.8k|            return this->error_message;
   83|  37.8k|        }

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

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

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

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

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

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

_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|  4.49M|    {
   37|  4.49M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 4.49M]
  ------------------
   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.49M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|  69.0k|    {
   28|  69.0k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 69.0k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  69.0k|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|   267k|    {
  100|   267k|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 183k, False: 84.0k]
  |  Branch (100:32): [True: 139k, False: 44.6k]
  ------------------
  101|   267k|            ? char(digit - '0')
  102|   267k|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 23.4k, False: 105k]
  ------------------
  103|   128k|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 44.9k, False: 60.3k]
  ------------------
  104|   267k|    }
_ZN4qpdf4util8is_spaceEc:
  114|  29.4M|    {
  115|  29.4M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 9.36M, False: 20.1M]
  |  Branch (115:29): [True: 492k, False: 19.6M]
  |  Branch (115:43): [True: 127k, False: 19.5M]
  |  Branch (115:57): [True: 61.3k, False: 19.4M]
  |  Branch (115:71): [True: 66.5k, False: 19.3M]
  |  Branch (115:85): [True: 23.5k, False: 19.3M]
  ------------------
  116|  29.4M|    }
_ZN4qpdf4util8is_digitEc:
  120|  24.2M|    {
  121|  24.2M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 16.1M, False: 8.09M]
  |  Branch (121:30): [True: 16.0M, False: 89.2k]
  ------------------
  122|  24.2M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  149|   789k|    {
  150|   789k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (150:16): [True: 24.6k, False: 765k]
  |  Branch (150:47): [True: 67.8k, False: 697k]
  ------------------
  151|   789k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  155|   697k|    {
  156|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  157|   697k|        return str.starts_with("\xef\xbb\xbf");
  158|   697k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|  68.2k|    {
   28|  68.2k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 68.2k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  68.2k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|    654|    {
   28|    654|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 654]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    654|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|    602|    {
   28|    602|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 602]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    602|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  20.5k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  20.5k|                          std::numeric_limits<T>::min())) {
   67|  20.5k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 20.5k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  20.5k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  20.5k|                          std::numeric_limits<T>::max())) {
   74|  20.5k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 20.5k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  20.5k|        }
   78|  20.5k|        return true;
   79|  20.5k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  20.5k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  20.5k|                          std::numeric_limits<T>::min())) {
   67|  20.5k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 20.5k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  20.5k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|       |                          std::numeric_limits<T>::max())) {
   74|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   75|       |                return false;
   76|       |            }
   77|       |        }
   78|  20.5k|        return true;
   79|  20.5k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|  88.0k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|       |                          std::numeric_limits<T>::min())) {
   67|       |            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
   68|       |                return false;
   69|       |            }
   70|       |        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  88.0k|                          std::numeric_limits<T>::max())) {
   74|  88.0k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 6, False: 88.0k]
  ------------------
   75|      6|                return false;
   76|      6|            }
   77|  88.0k|        }
   78|  88.0k|        return true;
   79|  88.0k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   232k|    {
   28|   232k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 232k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   232k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|   578k|    {
   28|   578k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 578k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   578k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|   181k|    {
   28|   181k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 181k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   181k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  3.53k|    {
   28|  3.53k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.53k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.53k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  3.13k|    {
   28|  3.13k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.13k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.13k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|   267k|    {
   37|   267k|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 1, False: 267k]
  ------------------
   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|   267k|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  2.84k|    {
   28|  2.84k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.84k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.84k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   27|  2.49k|    {
   28|  2.49k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.49k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.49k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   27|  17.7k|    {
   28|  17.7k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 17.7k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  17.7k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  9.12k|    {
   28|  9.12k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 9.12k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  9.12k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|  1.14M|    {
   49|  1.14M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 28, False: 1.14M]
  ------------------
   50|     28|            throw std::runtime_error(std::forward<T>(msg));
   51|     28|        }
   52|  1.14M|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   27|   265k|    {
   28|   265k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 265k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   265k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|  3.21M|    {
   49|  3.21M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 16, False: 3.21M]
  ------------------
   50|     16|            throw std::runtime_error(std::forward<T>(msg));
   51|     16|        }
   52|  3.21M|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  34.7M|    {
   28|  34.7M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 34.7M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  34.7M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  11.9k|    {
   49|  11.9k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 23, False: 11.8k]
  ------------------
   50|     23|            throw std::runtime_error(std::forward<T>(msg));
   51|     23|        }
   52|  11.9k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|    420|    {
   28|    420|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 420]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    420|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  5.38k|    {
   28|  5.38k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 5.38k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  5.38k|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|    268|    {
   28|    268|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 268]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    268|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|  24.3k|    {
   49|  24.3k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 24.3k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  24.3k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  7.35k|    {
   49|  7.35k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 23, False: 7.33k]
  ------------------
   50|     23|            throw std::runtime_error(std::forward<T>(msg));
   51|     23|        }
   52|  7.35k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|   110k|    {
   49|   110k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 110k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|   110k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  12.4k|    {
   49|  12.4k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 12.4k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  12.4k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  2.85k|    {
   49|  2.85k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 6, False: 2.84k]
  ------------------
   50|      6|            throw std::runtime_error(std::forward<T>(msg));
   51|      6|        }
   52|  2.85k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  1.95k|    {
   49|  1.95k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.95k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.95k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEjQsr3stdE8integralIT_EEEbT0_:
   63|  1.95k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|       |                          std::numeric_limits<T>::min())) {
   67|       |            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
   68|       |                return false;
   69|       |            }
   70|       |        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|       |                          std::numeric_limits<T>::max())) {
   74|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   75|       |                return false;
   76|       |            }
   77|       |        }
   78|  1.95k|        return true;
   79|  1.95k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA58_KcEEvbOT_:
   48|  1.95k|    {
   49|  1.95k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.95k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.95k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  1.95k|    {
   49|  1.95k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 1.94k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  1.95k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  1.94k|    {
   49|  1.94k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 37, False: 1.91k]
  ------------------
   50|     37|            throw std::runtime_error(std::forward<T>(msg));
   51|     37|        }
   52|  1.94k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|  21.5k|    {
   49|  21.5k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 27, False: 21.5k]
  ------------------
   50|     27|            throw std::runtime_error(std::forward<T>(msg));
   51|     27|        }
   52|  21.5k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   27|   128k|    {
   28|   128k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 128k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   128k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|    892|    {
   28|    892|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 892]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    892|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|    892|    {
   49|    892|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 889]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|    892|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|    874|    {
   49|    874|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 874]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|    874|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|    871|    {
   49|    871|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 38, False: 833]
  ------------------
   50|     38|            throw std::runtime_error(std::forward<T>(msg));
   51|     38|        }
   52|    871|    }

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

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

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

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

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

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

sha2.c:sph_dec32be_aligned:
 1471|  47.2M|{
 1472|  47.2M|#if SPH_LITTLE_ENDIAN
 1473|  47.2M|        return sph_bswap32(*(const sph_u32 *)src);
 1474|       |#elif SPH_BIG_ENDIAN
 1475|       |        return *(const sph_u32 *)src;
 1476|       |#else
 1477|       |        return ((sph_u32)(((const unsigned char *)src)[0]) << 24)
 1478|       |                | ((sph_u32)(((const unsigned char *)src)[1]) << 16)
 1479|       |                | ((sph_u32)(((const unsigned char *)src)[2]) << 8)
 1480|       |                | (sph_u32)(((const unsigned char *)src)[3]);
 1481|       |#endif
 1482|  47.2M|}
sha2.c:sph_bswap32:
 1220|  47.5M|{
 1221|  47.5M|        __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x));
 1222|  47.5M|        return x;
 1223|  47.5M|}
sha2.c:sph_enc64be_aligned:
 1706|  44.4k|{
 1707|  44.4k|#if SPH_LITTLE_ENDIAN
 1708|  44.4k|        *(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|  44.4k|}
sha2.c:sph_bswap64:
 1229|  44.4k|{
 1230|  44.4k|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  44.4k|        return x;
 1232|  44.4k|}
sha2.c:sph_enc32be:
 1374|   355k|{
 1375|   355k|#if defined SPH_UPTR
 1376|   355k|#if SPH_UNALIGNED
 1377|   355k|#if SPH_LITTLE_ENDIAN
 1378|   355k|        val = sph_bswap32(val);
 1379|   355k|#endif
 1380|   355k|        *(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|   355k|}
sha2big.c:sph_dec64be_aligned:
 1778|  46.5M|{
 1779|  46.5M|#if SPH_LITTLE_ENDIAN
 1780|  46.5M|        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|  46.5M|}
sha2big.c:sph_bswap64:
 1229|  47.2M|{
 1230|  47.2M|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  47.2M|        return x;
 1232|  47.2M|}
sha2big.c:sph_enc64be_aligned:
 1706|   167k|{
 1707|   167k|#if SPH_LITTLE_ENDIAN
 1708|   167k|        *(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|   167k|}
sha2big.c:sph_enc64be:
 1661|   586k|{
 1662|   586k|#if defined SPH_UPTR
 1663|   586k|#if SPH_UNALIGNED
 1664|   586k|#if SPH_LITTLE_ENDIAN
 1665|   586k|        val = sph_bswap64(val);
 1666|   586k|#endif
 1667|   586k|        *(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|   586k|}

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

inflate_fast:
   50|   106k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|   106k|    struct inflate_state FAR *state;
   52|   106k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|   106k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|   106k|    unsigned char FAR *out;     /* local strm->next_out */
   55|   106k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|   106k|    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|   106k|    unsigned wsize;             /* window size or zero if not using window */
   61|   106k|    unsigned whave;             /* valid bytes in the window */
   62|   106k|    unsigned wnext;             /* window write index */
   63|   106k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|   106k|    unsigned long hold;         /* local strm->hold */
   65|   106k|    unsigned bits;              /* local strm->bits */
   66|   106k|    code const FAR *lcode;      /* local strm->lencode */
   67|   106k|    code const FAR *dcode;      /* local strm->distcode */
   68|   106k|    unsigned lmask;             /* mask for first level of length codes */
   69|   106k|    unsigned dmask;             /* mask for first level of distance codes */
   70|   106k|    code const *here;           /* retrieved table entry */
   71|   106k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|   106k|    unsigned len;               /* match length, unused bytes */
   74|   106k|    unsigned dist;              /* match distance */
   75|   106k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|   106k|    state = (struct inflate_state FAR *)strm->state;
   79|   106k|    in = strm->next_in;
   80|   106k|    last = in + (strm->avail_in - 5);
   81|   106k|    out = strm->next_out;
   82|   106k|    beg = out - (start - strm->avail_out);
   83|   106k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|   106k|    wsize = state->wsize;
   88|   106k|    whave = state->whave;
   89|   106k|    wnext = state->wnext;
   90|   106k|    window = state->window;
   91|   106k|    hold = state->hold;
   92|   106k|    bits = state->bits;
   93|   106k|    lcode = state->lencode;
   94|   106k|    dcode = state->distcode;
   95|   106k|    lmask = (1U << state->lenbits) - 1;
   96|   106k|    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.12M|    do {
  101|  3.12M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 1.41M, False: 1.70M]
  ------------------
  102|  1.41M|            hold += (unsigned long)(*in++) << bits;
  103|  1.41M|            bits += 8;
  104|  1.41M|            hold += (unsigned long)(*in++) << bits;
  105|  1.41M|            bits += 8;
  106|  1.41M|        }
  107|  3.12M|        here = lcode + (hold & lmask);
  108|  3.21M|      dolen:
  109|  3.21M|        op = (unsigned)(here->bits);
  110|  3.21M|        hold >>= op;
  111|  3.21M|        bits -= op;
  112|  3.21M|        op = (unsigned)(here->op);
  113|  3.21M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 1.72M, False: 1.49M]
  ------------------
  114|  1.72M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  1.72M|                    "inflate:         literal '%c'\n" :
  116|  1.72M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  1.72M|            *out++ = (unsigned char)(here->val);
  118|  1.72M|        }
  119|  1.49M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 1.39M, False: 95.5k]
  ------------------
  120|  1.39M|            len = (unsigned)(here->val);
  121|  1.39M|            op &= 15;                           /* number of extra bits */
  122|  1.39M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 276k, False: 1.12M]
  ------------------
  123|   276k|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 1.89k, False: 274k]
  ------------------
  124|  1.89k|                    hold += (unsigned long)(*in++) << bits;
  125|  1.89k|                    bits += 8;
  126|  1.89k|                }
  127|   276k|                len += (unsigned)hold & ((1U << op) - 1);
  128|   276k|                hold >>= op;
  129|   276k|                bits -= op;
  130|   276k|            }
  131|  1.39M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  1.39M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 392k, False: 1.00M]
  ------------------
  133|   392k|                hold += (unsigned long)(*in++) << bits;
  134|   392k|                bits += 8;
  135|   392k|                hold += (unsigned long)(*in++) << bits;
  136|   392k|                bits += 8;
  137|   392k|            }
  138|  1.39M|            here = dcode + (hold & dmask);
  139|  1.47M|          dodist:
  140|  1.47M|            op = (unsigned)(here->bits);
  141|  1.47M|            hold >>= op;
  142|  1.47M|            bits -= op;
  143|  1.47M|            op = (unsigned)(here->op);
  144|  1.47M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 1.39M, False: 79.3k]
  ------------------
  145|  1.39M|                dist = (unsigned)(here->val);
  146|  1.39M|                op &= 15;                       /* number of extra bits */
  147|  1.39M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 1.76k, False: 1.39M]
  ------------------
  148|  1.76k|                    hold += (unsigned long)(*in++) << bits;
  149|  1.76k|                    bits += 8;
  150|  1.76k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 1.76k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  1.76k|                }
  155|  1.39M|                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.39M|                hold >>= op;
  165|  1.39M|                bits -= op;
  166|  1.39M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  167|  1.39M|                op = (unsigned)(out - beg);     /* max distance in output */
  168|  1.39M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (168:21): [True: 96.0k, False: 1.30M]
  ------------------
  169|  96.0k|                    op = dist - op;             /* distance back in window */
  170|  96.0k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 125, False: 95.8k]
  ------------------
  171|    125|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 125, False: 0]
  ------------------
  172|    125|                            strm->msg = (z_const char *)
  173|    125|                                "invalid distance too far back";
  174|    125|                            state->mode = BAD;
  175|    125|                            break;
  176|    125|                        }
  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|    125|                    }
  197|  95.8k|                    from = window;
  198|  95.8k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 4.03k, False: 91.8k]
  ------------------
  199|  4.03k|                        from += wsize - op;
  200|  4.03k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (200:29): [True: 238, False: 3.79k]
  ------------------
  201|    238|                            len -= op;
  202|  12.8k|                            do {
  203|  12.8k|                                *out++ = *from++;
  204|  12.8k|                            } while (--op);
  ------------------
  |  Branch (204:38): [True: 12.6k, False: 238]
  ------------------
  205|    238|                            from = out - dist;  /* rest from output */
  206|    238|                        }
  207|  4.03k|                    }
  208|  91.8k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 1.01k, False: 90.8k]
  ------------------
  209|  1.01k|                        from += wsize + wnext - op;
  210|  1.01k|                        op -= wnext;
  211|  1.01k|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 44, False: 971]
  ------------------
  212|     44|                            len -= op;
  213|    633|                            do {
  214|    633|                                *out++ = *from++;
  215|    633|                            } while (--op);
  ------------------
  |  Branch (215:38): [True: 589, False: 44]
  ------------------
  216|     44|                            from = window;
  217|     44|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (217:33): [True: 9, False: 35]
  ------------------
  218|      9|                                op = wnext;
  219|      9|                                len -= op;
  220|    106|                                do {
  221|    106|                                    *out++ = *from++;
  222|    106|                                } while (--op);
  ------------------
  |  Branch (222:42): [True: 97, False: 9]
  ------------------
  223|      9|                                from = out - dist;      /* rest from output */
  224|      9|                            }
  225|     44|                        }
  226|  1.01k|                    }
  227|  90.8k|                    else {                      /* contiguous in window */
  228|  90.8k|                        from += wnext - op;
  229|  90.8k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 1.19k, False: 89.6k]
  ------------------
  230|  1.19k|                            len -= op;
  231|  6.30k|                            do {
  232|  6.30k|                                *out++ = *from++;
  233|  6.30k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 5.10k, False: 1.19k]
  ------------------
  234|  1.19k|                            from = out - dist;  /* rest from output */
  235|  1.19k|                        }
  236|  90.8k|                    }
  237|   440k|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 344k, False: 95.8k]
  ------------------
  238|   344k|                        *out++ = *from++;
  239|   344k|                        *out++ = *from++;
  240|   344k|                        *out++ = *from++;
  241|   344k|                        len -= 3;
  242|   344k|                    }
  243|  95.8k|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 56.9k, False: 38.9k]
  ------------------
  244|  56.9k|                        *out++ = *from++;
  245|  56.9k|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 31.1k, False: 25.8k]
  ------------------
  246|  31.1k|                            *out++ = *from++;
  247|  56.9k|                    }
  248|  95.8k|                }
  249|  1.30M|                else {
  250|  1.30M|                    from = out - dist;          /* copy direct from output */
  251|  18.3M|                    do {                        /* minimum length is three */
  252|  18.3M|                        *out++ = *from++;
  253|  18.3M|                        *out++ = *from++;
  254|  18.3M|                        *out++ = *from++;
  255|  18.3M|                        len -= 3;
  256|  18.3M|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 17.0M, False: 1.30M]
  ------------------
  257|  1.30M|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 708k, False: 592k]
  ------------------
  258|   708k|                        *out++ = *from++;
  259|   708k|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 367k, False: 340k]
  ------------------
  260|   367k|                            *out++ = *from++;
  261|   708k|                    }
  262|  1.30M|                }
  263|  1.39M|            }
  264|  79.3k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 79.3k, False: 28]
  ------------------
  265|  79.3k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|  79.3k|                goto dodist;
  267|  79.3k|            }
  268|     28|            else {
  269|     28|                strm->msg = (z_const char *)"invalid distance code";
  270|     28|                state->mode = BAD;
  271|     28|                break;
  272|     28|            }
  273|  1.47M|        }
  274|  95.5k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 90.8k, False: 4.71k]
  ------------------
  275|  90.8k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|  90.8k|            goto dolen;
  277|  90.8k|        }
  278|  4.71k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 4.70k, False: 4]
  ------------------
  279|  4.70k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|  4.70k|            state->mode = TYPE;
  281|  4.70k|            break;
  282|  4.70k|        }
  283|      4|        else {
  284|      4|            strm->msg = (z_const char *)"invalid literal/length code";
  285|      4|            state->mode = BAD;
  286|      4|            break;
  287|      4|        }
  288|  3.21M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 3.01M, False: 101k]
  |  Branch (288:27): [True: 3.01M, False: 559]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|   106k|    len = bits >> 3;
  292|   106k|    in -= len;
  293|   106k|    bits -= len << 3;
  294|   106k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|   106k|    strm->next_in = in;
  298|   106k|    strm->next_out = out;
  299|   106k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 69.8k, False: 36.5k]
  ------------------
  300|   106k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 105k, False: 579]
  ------------------
  301|   105k|                                 257 + (end - out) : 257 - (out - end));
  302|   106k|    state->hold = hold;
  303|   106k|    state->bits = bits;
  304|   106k|    return;
  305|   106k|}

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

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

zcalloc:
  303|  7.47k|voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
  304|  7.47k|    (void)opaque;
  305|  7.47k|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (305:12): [True: 7.47k, Folded]
  ------------------
  306|  7.47k|                              (voidpf)calloc(items, size);
  307|  7.47k|}
zcfree:
  309|  7.47k|void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
  310|  7.47k|    (void)opaque;
  311|  7.47k|    free(ptr);
  312|  7.47k|}

