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

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

_ZN4qpdf10BaseHandleD2Ev:
  131|  44.3M|        ~BaseHandle() = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|  6.27k|        {
   68|  6.27k|            return obj == other.obj;
   69|  6.27k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  7.96k|        {
   83|  7.96k|            return size() == 0;
   84|  7.96k|        }
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  1.68M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  12.9M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|  4.31M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  3.80M|        BaseHandle(BaseHandle const&) = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|  3.77M|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  19.6M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   387k|        BaseHandle& operator=(BaseHandle const&) = default;

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

_ZN5QIntC11range_checkIxEEvRKT_S3_:
  274|  99.4k|    {
  275|  99.4k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (275:13): [True: 90.4k, False: 9.03k]
  ------------------
  276|  90.4k|            return;
  277|  90.4k|        }
  278|  9.03k|        QIntC::range_check_error<T>(cur, delta);
  279|  9.03k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  257|  9.03k|    {
  258|  9.03k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (258:13): [True: 9.03k, False: 0]
  |  Branch (258:28): [True: 24, False: 9.01k]
  ------------------
  259|     24|            std::ostringstream msg;
  260|     24|            msg.imbue(std::locale::classic());
  261|     24|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  262|     24|            throw std::range_error(msg.str());
  263|  9.01k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (263:20): [True: 0, False: 9.01k]
  |  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|  9.03k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  215|  2.73M|    {
  216|  2.73M|        return IntConverter<T, size_t>::convert(i);
  217|  2.73M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  119|  2.73M|        {
  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.73M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  2.73M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 2.73M]
  |  Branch (124:28): [True: 0, False: 2.73M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  2.73M|            return static_cast<To>(i);
  128|  2.73M|        }
_ZN5QIntC9to_offsetImEExRKT_:
  222|  3.91M|    {
  223|  3.91M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  224|  3.91M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  147|  3.91M|        {
  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|  3.91M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  3.91M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 3.91M]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  3.91M|            return static_cast<To>(i);
  155|  3.91M|        }
_ZN5QIntC7to_sizeIlEEmRKT_:
  215|   486k|    {
  216|   486k|        return IntConverter<T, size_t>::convert(i);
  217|   486k|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  119|   486k|        {
  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|   486k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   486k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 486k]
  |  Branch (124:28): [True: 0, False: 486k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   486k|            return static_cast<To>(i);
  128|   486k|        }
_ZN5QIntC6to_intImEEiRKT_:
  201|  15.2k|    {
  202|  15.2k|        return IntConverter<T, int>::convert(i);
  203|  15.2k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  147|  15.2k|        {
  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.2k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  15.2k|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 15.2k]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  15.2k|            return static_cast<To>(i);
  155|  15.2k|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  215|  22.7k|    {
  216|  22.7k|        return IntConverter<T, size_t>::convert(i);
  217|  22.7k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  119|   143M|        {
  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|   143M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   143M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 143M]
  |  Branch (124:28): [True: 0, False: 143M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   143M|            return static_cast<To>(i);
  128|   143M|        }
_ZN5QIntC6to_intIxEEiRKT_:
  201|  5.09M|    {
  202|  5.09M|        return IntConverter<T, int>::convert(i);
  203|  5.09M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   94|  5.09M|        {
   95|       |            // From and To are both signed.
   96|  5.09M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 935, False: 5.09M]
  |  Branch (96:57): [True: 1.08k, False: 5.09M]
  ------------------
   97|  2.01k|                error(i);
   98|  2.01k|            }
   99|  5.09M|            return static_cast<To>(i);
  100|  5.09M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  104|  2.01k|        {
  105|  2.01k|            std::ostringstream msg;
  106|  2.01k|            msg.imbue(std::locale::classic());
  107|  2.01k|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  108|  2.01k|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  109|  2.01k|            throw std::range_error(msg.str());
  110|  2.01k|        }
_ZN5QIntC7to_sizeImEEmRKT_:
  215|     38|    {
  216|     38|        return IntConverter<T, size_t>::convert(i);
  217|     38|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   69|   109k|        {
   70|       |            // From and To are both unsigned.
   71|   109k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 109k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   109k|            return static_cast<To>(i);
   75|   109k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  208|  24.7k|    {
  209|  24.7k|        return IntConverter<T, unsigned int>::convert(i);
  210|  24.7k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  119|  24.7k|        {
  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|  24.7k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  24.7k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 24.7k]
  |  Branch (124:28): [True: 0, False: 24.7k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  24.7k|            return static_cast<To>(i);
  128|  24.7k|        }
_ZN5QIntC6to_intIlEEiRKT_:
  201|  7.16k|    {
  202|  7.16k|        return IntConverter<T, int>::convert(i);
  203|  7.16k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   94|  7.16k|        {
   95|       |            // From and To are both signed.
   96|  7.16k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 0, False: 7.16k]
  |  Branch (96:57): [True: 0, False: 7.16k]
  ------------------
   97|      0|                error(i);
   98|      0|            }
   99|  7.16k|            return static_cast<To>(i);
  100|  7.16k|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  215|  9.23k|    {
  216|  9.23k|        return IntConverter<T, size_t>::convert(i);
  217|  9.23k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   69|  9.23k|        {
   70|       |            // From and To are both unsigned.
   71|  9.23k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 9.23k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  9.23k|            return static_cast<To>(i);
   75|  9.23k|        }
_ZN5QIntC8to_ulongIcEEmRKT_:
  236|  2.41M|    {
  237|  2.41M|        return IntConverter<T, unsigned long>::convert(i);
  238|  2.41M|    }
_ZN5QIntC12IntConverterIcmLb1ELb0EE7convertERKc:
  119|  2.41M|        {
  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.41M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  2.41M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 2.41M]
  |  Branch (124:28): [True: 0, False: 2.41M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  2.41M|            return static_cast<To>(i);
  128|  2.41M|        }
_ZN5QIntC8to_ulongIhEEmRKT_:
  236|   415M|    {
  237|   415M|        return IntConverter<T, unsigned long>::convert(i);
  238|   415M|    }
_ZN5QIntC12IntConverterIhmLb0ELb0EE7convertERKh:
   69|   415M|        {
   70|       |            // From and To are both unsigned.
   71|   415M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 415M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   415M|            return static_cast<To>(i);
   75|   415M|        }
_ZN5QIntC8to_ulongIiEEmRKT_:
  236|   143M|    {
  237|   143M|        return IntConverter<T, unsigned long>::convert(i);
  238|   143M|    }
_ZN5QIntC9to_ushortIiEEtRKT_:
  194|  20.9M|    {
  195|  20.9M|        return IntConverter<T, unsigned short>::convert(i);
  196|  20.9M|    }
_ZN5QIntC12IntConverterIitLb1ELb0EE7convertERKi:
  119|  20.9M|        {
  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|  20.9M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  20.9M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 20.9M]
  |  Branch (124:28): [True: 0, False: 20.9M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  20.9M|            return static_cast<To>(i);
  128|  20.9M|        }
_ZN5QIntC7to_sizeIjEEmRKT_:
  215|  4.98k|    {
  216|  4.98k|        return IntConverter<T, size_t>::convert(i);
  217|  4.98k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   69|  4.98k|        {
   70|       |            // From and To are both unsigned.
   71|  4.98k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 4.98k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  4.98k|            return static_cast<To>(i);
   75|  4.98k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  208|  3.68M|    {
  209|  3.68M|        return IntConverter<T, unsigned int>::convert(i);
  210|  3.68M|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   69|  3.68M|        {
   70|       |            // From and To are both unsigned.
   71|  3.68M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 3.68M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  3.68M|            return static_cast<To>(i);
   75|  3.68M|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  236|   109k|    {
  237|   109k|        return IntConverter<T, unsigned long>::convert(i);
  238|   109k|    }

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

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

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

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

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

_ZN10QPDFObjGenC2Eii:
   40|  1.61M|        obj(obj),
   41|  1.61M|        gen(gen)
   42|  1.61M|    {
   43|  1.61M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  50.5M|    {
   47|  50.5M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 29.4M, False: 21.0M]
  |  Branch (47:36): [True: 4.24M, False: 16.8M]
  |  Branch (47:54): [True: 177k, False: 4.07M]
  ------------------
   48|  50.5M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   100k|    {
   52|   100k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 95.6k, False: 4.85k]
  |  Branch (52:34): [True: 95.4k, False: 143]
  ------------------
   53|   100k|    }
_ZNK10QPDFObjGenneERKS_:
   56|  84.7k|    {
   57|  84.7k|        return !(*this == rhs);
   58|  84.7k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  1.54M|    {
   62|  1.54M|        return obj;
   63|  1.54M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  2.58k|    {
   67|  2.58k|        return gen;
   68|  2.58k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  4.35M|    {
   72|  4.35M|        return obj != 0;
   73|  4.35M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|   187k|    {
   77|   187k|        return std::to_string(obj) + separator + std::to_string(gen);
   78|   187k|    }
_ZN10QPDFObjGen3set3addES_:
  111|   142k|        {
  112|   142k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 59.5k, False: 83.3k]
  ------------------
  113|  59.5k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 9.74k, False: 49.8k]
  ------------------
  114|  9.74k|                    return false;
  115|  9.74k|                }
  116|  49.8k|                emplace(og);
  117|  49.8k|            }
  118|   133k|            return true;
  119|   142k|        }
_ZN10QPDFObjGenC2Ev:
   38|  16.9M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  4.37k|            llx(llx),
  244|  4.37k|            lly(lly),
  245|  4.37k|            urx(urx),
  246|  4.37k|            ury(ury)
  247|  4.37k|        {
  248|  4.37k|        }
_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|  1.29M|        qpdf::BaseHandle(obj)
 1316|  1.29M|    {
 1317|  1.29M|    }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  12.8M|        qpdf::BaseHandle(std::move(obj))
 1320|  12.8M|    {
 1321|  12.8M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|  9.60k|    {
 1325|  9.60k|        return obj;
 1326|  9.60k|    }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  2.25M|    {
 1560|  2.25M|        return static_cast<bool>(obj);
 1561|  2.25M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   132k|    {
 1566|   132k|        return {obj};
 1567|   132k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|  4.25M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleC2ERKS_:
  290|  3.65M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|  3.77M|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  19.6M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   379k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  10.2k|        TokenFilter() = default;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

_ZN11InputSource13setLastOffsetEx:
   15|  16.8M|{
   16|  16.8M|    this->last_offset = offset;
   17|  16.8M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  17.4M|{
   22|  17.4M|    return this->last_offset;
   23|  17.4M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  11.8k|{
   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|  11.8k|    read(str, count, at);
   34|  11.8k|    auto eol = str.find_first_of("\n\r"sv);
   35|  11.8k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 9.20k, False: 2.61k]
  ------------------
   36|  9.20k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  9.20k|        str.resize(eol);
   38|  9.20k|        if (eol != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 9.20k, False: 0]
  ------------------
   39|  9.20k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  9.20k|            return eol;
   41|  9.20k|        }
   42|  9.20k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  2.61k|    seek(last_offset, SEEK_SET);
   45|  2.61k|    findAndSkipNextEOL();
   46|  2.61k|    return eol;
   47|  11.8k|}
_ZN11InputSource8readLineEm:
   51|  11.8k|{
   52|  11.8k|    return read_line(max_line_length);
   53|  11.8k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|  66.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|  66.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|  66.2k|    size_t size = sizeof(buf) - 1;
   79|  66.2k|    util::assertion(
   80|  66.2k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 66.2k]
  |  Branch (80:38): [True: 0, False: 66.2k]
  ------------------
   81|  66.2k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|  66.2k|    );
   83|       |
   84|  66.2k|    char* p = nullptr;
   85|  66.2k|    qpdf_offset_t buf_offset = offset;
   86|  66.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|   525k|    while (true) {
  ------------------
  |  Branch (91:12): [True: 525k, 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|   525k|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 66.2k, False: 459k]
  |  Branch (97:31): [True: 170k, False: 288k]
  ------------------
   98|   236k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 170k, False: 66.2k]
  ------------------
   99|   170k|                QTC::TC(
  100|   170k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 167k, False: 3.36k]
  ------------------
  101|   170k|                buf_offset += (p - buf);
  102|   170k|            }
  103|   236k|            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|   236k|            bytes_read = this->read(buf, size);
  108|   236k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 39.2k, False: 197k]
  ------------------
  109|  39.2k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 32.5k, False: 6.66k]
  ------------------
  110|  39.2k|                return false;
  111|  39.2k|            }
  112|   197k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   197k|            p = buf;
  114|   197k|        }
  115|       |
  116|       |        // Search for the first character.
  117|   486k|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 319k, False: 167k]
  ------------------
  118|       |                 // line-break
  119|   486k|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|   319k|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 3.83k, False: 315k]
  ------------------
  121|  3.83k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  3.83k|            }
  123|       |            // Found first letter.
  124|   319k|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 18.4k, False: 300k]
  ------------------
  125|       |                // Make sure it's in range.
  126|  18.4k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  18.4k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 1.12k, False: 17.3k]
  ------------------
  128|       |                    // out of range
  129|  1.12k|                    QTC::TC("libtests", "InputSource out of range");
  130|  1.12k|                    return false;
  131|  1.12k|                }
  132|  18.4k|            }
  133|   318k|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 2.49k, False: 315k]
  ------------------
  134|       |                // If there are not enough bytes left in the file for start_chars, we will detect
  135|       |                // this on the next pass as EOF and return.
  136|  2.49k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  2.49k|                continue;
  138|  2.49k|            }
  139|       |
  140|       |            // See if p points to a sequence matching start_chars. We already checked above to make
  141|       |            // sure we are not going to overrun memory.
  142|   315k|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 36.3k, False: 279k]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  36.3k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  36.3k|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 25.9k, False: 10.4k]
  ------------------
  146|  25.9k|                    return true;
  147|  25.9k|                } else {
  148|  10.4k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  10.4k|                }
  150|   279k|            } else {
  151|   279k|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|   279k|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|   289k|            ++p;
  156|   289k|        } else {
  157|       |            // Trigger reading the next block
  158|   167k|            p = buf + bytes_read;
  159|   167k|        }
  160|   486k|    }
  161|  66.2k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  20.1k|{
  166|  20.1k|    bool found = false;
  167|  20.1k|    qpdf_offset_t after_found_offset = 0;
  168|  20.1k|    qpdf_offset_t cur_offset = offset;
  169|  20.1k|    size_t cur_len = len;
  170|  26.3k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 6.16k, False: 20.1k]
  ------------------
  171|  6.16k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 352, False: 5.81k]
  ------------------
  172|    352|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  5.81k|        } else {
  174|  5.81k|            found = true;
  175|  5.81k|        }
  176|  6.16k|        after_found_offset = this->tell();
  177|  6.16k|        cur_offset = after_found_offset;
  178|  6.16k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  6.16k|    }
  180|  20.1k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 5.81k, False: 14.3k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  5.81k|    }
  183|  20.1k|    return found;
  184|  20.1k|}
_ZN11InputSource9read_lineEmx:
   57|  11.8k|{
   58|  11.8k|    std::string result(count, '\0');
   59|  11.8k|    read_line(result, count, at);
   60|  11.8k|    return result;
   61|  11.8k|}

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

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

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

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

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

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|    673|    Pipeline(identifier, next)
   13|    673|{
   14|    673|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|    673|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|    787|{
   20|    787|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 0, False: 787]
  ------------------
   21|      0|        return;
   22|      0|    }
   23|   338k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 337k, False: 554]
  ------------------
   24|   337k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 6.48k, False: 331k]
  ------------------
   25|  1.33k|        case ' ':
  ------------------
  |  Branch (25:9): [True: 1.33k, False: 336k]
  ------------------
   26|  1.81k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 485, False: 337k]
  ------------------
   27|  2.22k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 412, False: 337k]
  ------------------
   28|  2.51k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 287, False: 337k]
  ------------------
   29|  5.44k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 2.92k, False: 335k]
  ------------------
   30|  6.48k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 1.04k, False: 336k]
  ------------------
   31|  6.48k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  6.48k|            continue;
   34|   337k|        }
   35|   331k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 7, False: 331k]
  ------------------
   36|      7|            break;
   37|   331k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 28, False: 331k]
  ------------------
   38|     28|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|     28|            flush();
   40|     28|            eod = 2;
   41|   331k|        } else {
   42|   331k|            switch (buf[i]) {
   43|     26|            case '~':
  ------------------
  |  Branch (43:13): [True: 26, False: 331k]
  ------------------
   44|     26|                eod = 1;
   45|     26|                break;
   46|       |
   47|    783|            case 'z':
  ------------------
  |  Branch (47:13): [True: 783, False: 330k]
  ------------------
   48|    783|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 20, False: 763]
  ------------------
   49|     20|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     20|                }
   51|    763|                unsigned char zeroes[4];
   52|    763|                memset(zeroes, '\0', 4);
   53|    763|                next()->write(zeroes, 4);
   54|    763|                break;
   55|       |
   56|   330k|            default:
  ------------------
  |  Branch (56:13): [True: 330k, False: 809]
  ------------------
   57|   330k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 49, False: 330k]
  |  Branch (57:36): [True: 95, False: 330k]
  ------------------
   58|    144|                    error = true;
   59|    144|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   330k|                } else {
   61|   330k|                    this->inbuf[this->pos++] = buf[i];
   62|   330k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 65.9k, False: 264k]
  ------------------
   63|  65.9k|                        flush();
   64|  65.9k|                    }
   65|   330k|                }
   66|   330k|                break;
   67|   331k|            }
   68|   331k|        }
   69|   331k|    }
   70|    787|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|  66.4k|{
   75|  66.4k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 217, False: 66.2k]
  ------------------
   76|    217|        return;
   77|    217|    }
   78|  66.2k|    unsigned long lval = 0;
   79|   397k|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 331k, False: 66.2k]
  ------------------
   80|   331k|        lval *= 85;
   81|   331k|        lval += (this->inbuf[i] - 33U);
   82|   331k|    }
   83|       |
   84|  66.2k|    unsigned char outbuf[4];
   85|  66.2k|    memset(outbuf, 0, 4);
   86|   331k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 264k, False: 66.2k]
  ------------------
   87|   264k|        outbuf[i] = lval & 0xff;
   88|   264k|        lval >>= 8;
   89|   264k|    }
   90|       |
   91|  66.2k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 65.9k, False: 259]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|  66.2k|    auto t = this->pos - 1;
   94|  66.2k|    this->pos = 0;
   95|  66.2k|    memset(this->inbuf, 117, 5);
   96|       |
   97|  66.2k|    next()->write(outbuf, t);
   98|  66.2k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|    593|{
  103|    593|    if (error) {
  ------------------
  |  Branch (103:9): [True: 125, False: 468]
  ------------------
  104|    125|        return;
  105|    125|    }
  106|    468|    flush();
  107|    468|    next()->finish();
  108|    468|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|    422|    Pipeline(identifier, next)
   14|    422|{
   15|    422|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|    422|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|    753|{
   21|    753|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 235, False: 518]
  ------------------
   22|    235|        return;
   23|    235|    }
   24|  4.74k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 4.36k, False: 380]
  ------------------
   25|  4.36k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  4.36k|        switch (ch) {
   27|    287|        case ' ':
  ------------------
  |  Branch (27:9): [True: 287, False: 4.07k]
  ------------------
   28|    546|        case '\f':
  ------------------
  |  Branch (28:9): [True: 259, False: 4.10k]
  ------------------
   29|    839|        case '\v':
  ------------------
  |  Branch (29:9): [True: 293, False: 4.07k]
  ------------------
   30|  1.11k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 278, False: 4.08k]
  ------------------
   31|  1.41k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 297, False: 4.06k]
  ------------------
   32|  1.73k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 318, False: 4.04k]
  ------------------
   33|  1.73k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  1.73k|            break;
   36|       |
   37|     42|        case '>':
  ------------------
  |  Branch (37:9): [True: 42, False: 4.32k]
  ------------------
   38|     42|            eod = true;
   39|     42|            flush();
   40|     42|            break;
   41|       |
   42|  2.59k|        default:
  ------------------
  |  Branch (42:9): [True: 2.59k, False: 1.77k]
  ------------------
   43|  2.59k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 2.53k, False: 57]
  |  Branch (43:31): [True: 1.89k, False: 639]
  |  Branch (43:46): [True: 637, False: 59]
  |  Branch (43:59): [True: 602, False: 35]
  ------------------
   44|  2.49k|                inbuf[pos++] = ch;
   45|  2.49k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 1.19k, False: 1.30k]
  ------------------
   46|  1.19k|                    flush();
   47|  1.19k|                }
   48|  2.49k|            } else {
   49|     94|                char t[2];
   50|     94|                t[0] = ch;
   51|     94|                t[1] = 0;
   52|     94|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|     94|            }
   54|  2.49k|            break;
   55|  4.36k|        }
   56|  4.26k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 42, False: 4.22k]
  ------------------
   57|     42|            break;
   58|     42|        }
   59|  4.26k|    }
   60|    518|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  1.57k|{
   65|  1.57k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 281, False: 1.29k]
  ------------------
   66|    281|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|    281|        return;
   68|    281|    }
   69|  1.29k|    int b[2];
   70|  3.88k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 2.59k, False: 1.29k]
  ------------------
   71|  2.59k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 602, False: 1.98k]
  ------------------
   72|    602|            b[i] = inbuf[i] - 'A' + 10;
   73|  1.98k|        } else {
   74|  1.98k|            b[i] = inbuf[i] - '0';
   75|  1.98k|        }
   76|  2.59k|    }
   77|  1.29k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  1.29k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 1.19k, False: 98]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  1.29k|    pos = 0;
   82|  1.29k|    inbuf[0] = '0';
   83|  1.29k|    inbuf[1] = '0';
   84|  1.29k|    inbuf[2] = '\0';
   85|       |
   86|  1.29k|    next()->write(&ch, 1);
   87|  1.29k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|    337|{
   92|    337|    flush();
   93|    337|    next()->finish();
   94|    337|}

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

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

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

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

_ZN10Pl_OStreamC2EPKcRNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
   19|      2|    Pipeline(identifier, nullptr),
   20|      2|    m(std::make_unique<Members>(os))
   21|      2|{
   22|      2|}
_ZN10Pl_OStreamD2Ev:
   25|      2|Pl_OStream::~Pl_OStream() = default;
_ZN10Pl_OStream5writeEPKhm:
   29|  1.93M|{
   30|  1.93M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   31|  1.93M|}
_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.94k|    Pipeline(identifier, next),
   31|  1.94k|    action(action)
   32|  1.94k|{
   33|  1.94k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  1.94k|    util::no_ci_rt_error_if(
   35|  1.94k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  1.94k|    util::no_ci_rt_error_if(
   37|  1.94k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 136, False: 1.81k]
  |  Branch (37:35): [True: 69, False: 1.74k]
  |  Branch (37:59): [True: 69, False: 1.67k]
  ------------------
   38|  1.67k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 1.58k, False: 85]
  |  Branch (38:35): [True: 66, False: 19]
  ------------------
   39|  1.94k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  1.94k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  1.94k|    util::no_ci_rt_error_if(
   42|  1.94k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  1.94k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  1.94k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   45|  1.94k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   46|  1.94k|    util::no_ci_rt_error_if(
   47|  1.94k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (47:9): [True: 22, False: 1.92k]
  |  Branch (47:21): [True: 3, False: 1.92k]
  ------------------
   48|  1.94k|    util::no_ci_rt_error_if(
   49|  1.94k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (49:9): [True: 1.92k, False: 25]
  |  Branch (49:29): [True: 29, False: 1.89k]
  ------------------
   50|  1.94k|    bytes_per_row = static_cast<uint32_t>(bpr);
   51|  1.94k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   52|  1.94k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   53|  1.94k|    memset(buf1.get(), 0, bytes_per_row + 1);
   54|  1.94k|    memset(buf2.get(), 0, bytes_per_row + 1);
   55|  1.94k|    cur_row = buf1.get();
   56|  1.94k|    prev_row = buf2.get();
   57|       |
   58|       |    // number of bytes per incoming row
   59|  1.94k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (59:17): [True: 0, False: 1.94k]
  ------------------
   60|  1.94k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   70|   367k|{
   71|   367k|    size_t left = incoming - pos;
   72|   367k|    size_t offset = 0;
   73|  1.33M|    while (len >= left) {
  ------------------
  |  Branch (73:12): [True: 963k, False: 367k]
  ------------------
   74|       |        // finish off current row
   75|   963k|        memcpy(cur_row + pos, data + offset, left);
   76|   963k|        offset += left;
   77|   963k|        len -= left;
   78|       |
   79|   963k|        processRow();
   80|       |
   81|       |        // Swap rows
   82|   963k|        unsigned char* t = prev_row;
   83|   963k|        prev_row = cur_row;
   84|   963k|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (84:19): [True: 963k, False: 3]
  ------------------
   85|   963k|        memset(cur_row, 0, bytes_per_row + 1);
   86|   963k|        left = incoming;
   87|   963k|        pos = 0;
   88|   963k|    }
   89|   367k|    if (len) {
  ------------------
  |  Branch (89:9): [True: 366k, False: 726]
  ------------------
   90|   366k|        memcpy(cur_row + pos, data + offset, len);
   91|   366k|    }
   92|   367k|    pos += len;
   93|   367k|}
_ZN12Pl_PNGFilter10processRowEv:
   97|   964k|{
   98|   964k|    if (action == a_encode) {
  ------------------
  |  Branch (98:9): [True: 0, False: 964k]
  ------------------
   99|      0|        encodeRow();
  100|   964k|    } else {
  101|   964k|        decodeRow();
  102|   964k|    }
  103|   964k|}
_ZN12Pl_PNGFilter9decodeRowEv:
  107|   964k|{
  108|   964k|    int filter = cur_row[0];
  109|   964k|    if (prev_row) {
  ------------------
  |  Branch (109:9): [True: 964k, False: 0]
  ------------------
  110|   964k|        switch (filter) {
  111|   202k|        case 0:
  ------------------
  |  Branch (111:9): [True: 202k, False: 762k]
  ------------------
  112|   202k|            break;
  113|   187k|        case 1:
  ------------------
  |  Branch (113:9): [True: 187k, False: 777k]
  ------------------
  114|   187k|            decodeSub();
  115|   187k|            break;
  116|   436k|        case 2:
  ------------------
  |  Branch (116:9): [True: 436k, False: 528k]
  ------------------
  117|   436k|            decodeUp();
  118|   436k|            break;
  119|  1.27k|        case 3:
  ------------------
  |  Branch (119:9): [True: 1.27k, False: 963k]
  ------------------
  120|  1.27k|            decodeAverage();
  121|  1.27k|            break;
  122|    868|        case 4:
  ------------------
  |  Branch (122:9): [True: 868, False: 963k]
  ------------------
  123|    868|            decodePaeth();
  124|    868|            break;
  125|   136k|        default:
  ------------------
  |  Branch (125:9): [True: 136k, False: 828k]
  ------------------
  126|       |            // ignore
  127|   136k|            break;
  128|   964k|        }
  129|   964k|    }
  130|       |
  131|   964k|    next()->write(cur_row + 1, bytes_per_row);
  132|   964k|}
_ZN12Pl_PNGFilter9decodeSubEv:
  136|   187k|{
  137|   187k|    unsigned char* buffer = cur_row + 1;
  138|   187k|    unsigned int bpp = bytes_per_pixel;
  139|       |
  140|  2.91M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (140:30): [True: 2.72M, False: 187k]
  ------------------
  141|  2.72M|        unsigned char left = 0;
  142|       |
  143|  2.72M|        if (i >= bpp) {
  ------------------
  |  Branch (143:13): [True: 2.40M, False: 322k]
  ------------------
  144|  2.40M|            left = buffer[i - bpp];
  145|  2.40M|        }
  146|       |
  147|  2.72M|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  148|  2.72M|    }
  149|   187k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  153|   436k|{
  154|   436k|    unsigned char* buffer = cur_row + 1;
  155|   436k|    unsigned char* above_buffer = prev_row + 1;
  156|       |
  157|  2.68M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (157:30): [True: 2.25M, False: 436k]
  ------------------
  158|  2.25M|        unsigned char up = above_buffer[i];
  159|  2.25M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  160|  2.25M|    }
  161|   436k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  165|  1.27k|{
  166|  1.27k|    unsigned char* buffer = cur_row + 1;
  167|  1.27k|    unsigned char* above_buffer = prev_row + 1;
  168|  1.27k|    auto bpp = bytes_per_pixel;
  169|       |
  170|   700k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (170:30): [True: 699k, False: 1.27k]
  ------------------
  171|   699k|        int left = 0;
  172|   699k|        int up = 0;
  173|       |
  174|   699k|        if (i >= bpp) {
  ------------------
  |  Branch (174:13): [True: 345k, False: 353k]
  ------------------
  175|   345k|            left = buffer[i - bpp];
  176|   345k|        }
  177|       |
  178|   699k|        up = above_buffer[i];
  179|   699k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  180|   699k|    }
  181|  1.27k|}
_ZN12Pl_PNGFilter11decodePaethEv:
  185|    868|{
  186|    868|    unsigned char* buffer = cur_row + 1;
  187|    868|    unsigned char* above_buffer = prev_row + 1;
  188|    868|    auto bpp = bytes_per_pixel;
  189|       |
  190|   526k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (190:30): [True: 525k, False: 868]
  ------------------
  191|   525k|        int left = 0;
  192|   525k|        int up = above_buffer[i];
  193|   525k|        int upper_left = 0;
  194|       |
  195|   525k|        if (i >= bpp) {
  ------------------
  |  Branch (195:13): [True: 411k, False: 113k]
  ------------------
  196|   411k|            left = buffer[i - bpp];
  197|   411k|            upper_left = above_buffer[i - bpp];
  198|   411k|        }
  199|       |
  200|   525k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  201|   525k|    }
  202|    868|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  206|   525k|{
  207|   525k|    int p = a + b - c;
  208|   525k|    int pa = abs_diff(p, a);
  209|   525k|    int pb = abs_diff(p, b);
  210|   525k|    int pc = abs_diff(p, c);
  211|       |
  212|   525k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (212:9): [True: 523k, False: 1.27k]
  |  Branch (212:21): [True: 523k, False: 322]
  ------------------
  213|   523k|        return a;
  214|   523k|    }
  215|  1.59k|    if (pb <= pc) {
  ------------------
  |  Branch (215:9): [True: 1.25k, False: 334]
  ------------------
  216|  1.25k|        return b;
  217|  1.25k|    }
  218|    334|    return c;
  219|  1.59k|}
_ZN12Pl_PNGFilter6finishEv:
  239|  1.87k|{
  240|  1.87k|    if (pos) {
  ------------------
  |  Branch (240:9): [True: 891, False: 979]
  ------------------
  241|       |        // write partial row
  242|    891|        processRow();
  243|    891|    }
  244|  1.87k|    prev_row = nullptr;
  245|  1.87k|    cur_row = buf1.get();
  246|  1.87k|    pos = 0;
  247|  1.87k|    memset(cur_row, 0, bytes_per_row + 1);
  248|       |
  249|  1.87k|    next()->finish();
  250|  1.87k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|  1.57M|{
   20|  1.57M|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 679k, False: 896k]
  ------------------
   21|  1.57M|}

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

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

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

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

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

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

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   364k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 304k, False: 59.8k]
  ------------------
   10|   364k|    error_code(error_code),
   11|   364k|    filename(filename),
   12|   364k|    object(object),
   13|   364k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 304k, False: 59.8k]
  ------------------
   14|   364k|    message(message)
   15|   364k|{
   16|   364k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   338k|    std::runtime_error(
   26|   338k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 338k, False: 100]
  |  Branch (26:49): [True: 100, False: 0]
  ------------------
   27|   338k|    error_code(error_code),
   28|   338k|    filename(filename),
   29|   338k|    object(object),
   30|   338k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 338k, False: 100]
  |  Branch (30:22): [True: 100, False: 0]
  ------------------
   31|   338k|    message(message)
   32|   338k|{
   33|   338k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|   702k|{
   42|   702k|    std::string result;
   43|   702k|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 649k, False: 53.6k]
  ------------------
   44|   649k|        result += filename;
   45|   649k|    }
   46|   702k|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 144k, False: 558k]
  |  Branch (46:29): [True: 103k, False: 40.6k]
  ------------------
   47|   599k|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 545k, False: 53.4k]
  ------------------
   48|   545k|            result += " (";
   49|   545k|        }
   50|   599k|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 558k, False: 40.6k]
  ------------------
   51|   558k|            result += object;
   52|   558k|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 499k, False: 59.2k]
  ------------------
   53|   499k|                result += ", ";
   54|   499k|            }
   55|   558k|        }
   56|   599k|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 540k, False: 59.2k]
  ------------------
   57|   540k|            result += "offset " + std::to_string(offset);
   58|   540k|        }
   59|   599k|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 545k, False: 53.4k]
  ------------------
   60|   545k|            result += ")";
   61|   545k|        }
   62|   599k|    }
   63|   702k|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 702k, False: 238]
  ------------------
   64|   702k|        result += ": ";
   65|   702k|    }
   66|   702k|    result += message;
   67|   702k|    return result;
   68|   702k|}

_ZN10QPDFLogger7MembersC2Ev:
   47|      1|    p_discard(new Pl_Discard()),
   48|      1|    p_real_stdout(new Pl_OStream("standard output", std::cout)),
   49|      1|    p_stdout(new Pl_Track("track stdout", p_real_stdout.get())),
   50|      1|    p_stderr(new Pl_OStream("standard error", std::cerr)),
   51|      1|    p_info(p_stdout),
   52|      1|    p_warn(nullptr),
   53|      1|    p_error(p_stderr),
   54|      1|    p_save(nullptr)
   55|      1|{
   56|      1|}
_ZN10QPDFLogger7MembersD2Ev:
   59|      1|{
   60|      1|    p_stdout->finish();
   61|      1|    p_stderr->finish();
   62|      1|}
_ZN10QPDFLoggerC2Ev:
   65|      1|    m(new Members())
   66|      1|{
   67|      1|}
_ZN10QPDFLogger6createEv:
   71|      1|{
   72|      1|    return std::shared_ptr<QPDFLogger>(new QPDFLogger);
   73|      1|}
_ZN10QPDFLogger13defaultLoggerEv:
   77|  29.3k|{
   78|  29.3k|    static auto l = create();
   79|  29.3k|    return l;
   80|  29.3k|}
_ZN10QPDFLogger4warnEPKc:
  102|     18|{
  103|     18|    getWarn(false)->writeCStr(s);
  104|     18|}
_ZN10QPDFLogger7getWarnEb:
  114|   639k|{
  115|   639k|    if (m->p_warn) {
  ------------------
  |  Branch (115:9): [True: 0, False: 639k]
  ------------------
  116|      0|        return m->p_warn;
  117|      0|    }
  118|   639k|    return getError(null_okay);
  119|   639k|}
_ZN10QPDFLogger8getErrorEb:
  135|   648k|{
  136|   648k|    return throwIfNull(m->p_error, null_okay);
  137|   648k|}
_ZN10QPDFLogger11throwIfNullENSt3__110shared_ptrI8PipelineEEb:
  254|   648k|{
  255|   648k|    if (!(null_okay || p)) {
  ------------------
  |  Branch (255:11): [True: 0, False: 648k]
  |  Branch (255:24): [True: 648k, False: 0]
  ------------------
  256|      0|        throw std::logic_error("QPDFLogger: requested a null pipeline without null_okay == true");
  257|      0|    }
  258|   648k|    return p;
  259|   648k|}
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|  55.2k|{
    6|  55.2k|    qpdf_offset_t shift = (getTypeCode() == ::ot_dictionary) ? 2
  ------------------
  |  Branch (6:27): [True: 37.0k, False: 18.2k]
  ------------------
    7|  55.2k|        : (getTypeCode() == ::ot_array)                      ? 1
  ------------------
  |  Branch (7:11): [True: 57, False: 18.1k]
  ------------------
    8|  18.2k|                                                             : 0;
    9|       |
   10|  55.2k|    if (object_description) {
  ------------------
  |  Branch (10:9): [True: 50.1k, False: 5.12k]
  ------------------
   11|  50.1k|        switch (object_description->index()) {
  ------------------
  |  Branch (11:17): [True: 50.1k, False: 0]
  ------------------
   12|  47.2k|        case 0:
  ------------------
  |  Branch (12:9): [True: 47.2k, False: 2.92k]
  ------------------
   13|  47.2k|            {
   14|       |                // Simple template string
   15|  47.2k|                auto description = std::get<0>(*object_description);
   16|       |
   17|  47.2k|                if (auto pos = description.find("$OG"); pos != std::string::npos) {
  ------------------
  |  Branch (17:57): [True: 0, False: 47.2k]
  ------------------
   18|      0|                    description.replace(pos, 3, og.unparse(' '));
   19|      0|                }
   20|  47.2k|                if (auto pos = description.find("$PO"); pos != std::string::npos) {
  ------------------
  |  Branch (20:57): [True: 47.0k, False: 227]
  ------------------
   21|  47.0k|                    description.replace(pos, 3, std::to_string(parsed_offset + shift));
   22|  47.0k|                }
   23|  47.2k|                return description;
   24|      0|            }
   25|      0|        case 1:
  ------------------
  |  Branch (25:9): [True: 0, False: 50.1k]
  ------------------
   26|      0|            {
   27|       |                // QPDF::JSONReactor generated description
   28|      0|                auto j_descr = std::get<1>(*object_description);
   29|      0|                return (
   30|      0|                    *j_descr.input + (j_descr.object.empty() ? "" : ", " + j_descr.object) +
  ------------------
  |  Branch (30:39): [True: 0, False: 0]
  ------------------
   31|      0|                    " at offset " + std::to_string(parsed_offset));
   32|      0|            }
   33|  1.61k|        case 2:
  ------------------
  |  Branch (33:9): [True: 1.61k, False: 48.5k]
  ------------------
   34|  1.61k|            {
   35|       |                // Child object description
   36|  1.61k|                auto j_descr = std::get<2>(*object_description);
   37|  1.61k|                std::string result;
   38|  1.61k|                if (auto p = j_descr.parent.lock()) {
  ------------------
  |  Branch (38:26): [True: 1.61k, False: 0]
  ------------------
   39|  1.61k|                    result = p->getDescription();
   40|  1.61k|                }
   41|  1.61k|                result += j_descr.static_descr;
   42|  1.61k|                if (auto pos = result.find("$VD"); pos != std::string::npos) {
  ------------------
  |  Branch (42:52): [True: 1.61k, False: 0]
  ------------------
   43|  1.61k|                    result.replace(pos, 3, j_descr.var_descr);
   44|  1.61k|                }
   45|  1.61k|                return result;
   46|      0|            }
   47|  1.31k|        case 3:
  ------------------
  |  Branch (47:9): [True: 1.31k, False: 48.8k]
  ------------------
   48|  1.31k|            auto [stream_id, obj_id] = std::get<3>(*object_description);
   49|  1.31k|            std::string result = qpdf ? qpdf->getFilename() : "";
  ------------------
  |  Branch (49:34): [True: 1.31k, False: 0]
  ------------------
   50|  1.31k|            result += " object stream " + std::to_string(stream_id) + ", object " +
   51|  1.31k|                std::to_string(obj_id) + " 0 at offset " + std::to_string(parsed_offset + shift);
   52|  1.31k|            return result;
   53|  50.1k|        }
   54|       |
   55|  50.1k|    } else if (og.isIndirect()) {
  ------------------
  |  Branch (55:16): [True: 4.88k, False: 238]
  ------------------
   56|  4.88k|        return "object " + og.unparse(' ');
   57|  4.88k|    }
   58|    238|    return {};
   59|  55.2k|}

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   34|   134k|{
   35|   134k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (35:12): [True: 134k, False: 0]
  ------------------
   36|   134k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   46|  20.1k|    supports_retry(supports_retry)
   47|  20.1k|{
   48|  20.1k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   51|  20.1k|{
   52|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   53|  20.1k|}
_ZNK4qpdf10BaseHandle4copyEb:
  252|  87.9k|{
  253|  87.9k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (253:13): [True: 87.9k, False: 0]
  ------------------
  254|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (254:5): [True: 0, False: 87.9k]
  ------------------
  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: 87.9k]
  ------------------
  258|      0|        return QPDFObject::create<QPDF_Reserved>();
  259|    573|    case ::ot_null:
  ------------------
  |  Branch (259:5): [True: 573, False: 87.3k]
  ------------------
  260|    573|        return QPDFObject::create<QPDF_Null>();
  261|    163|    case ::ot_boolean:
  ------------------
  |  Branch (261:5): [True: 163, False: 87.7k]
  ------------------
  262|    163|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  263|  1.12k|    case ::ot_integer:
  ------------------
  |  Branch (263:5): [True: 1.12k, False: 86.8k]
  ------------------
  264|  1.12k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  265|    492|    case ::ot_real:
  ------------------
  |  Branch (265:5): [True: 492, False: 87.4k]
  ------------------
  266|    492|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  267|  1.74k|    case ::ot_string:
  ------------------
  |  Branch (267:5): [True: 1.74k, False: 86.1k]
  ------------------
  268|  1.74k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  269|  82.9k|    case ::ot_name:
  ------------------
  |  Branch (269:5): [True: 82.9k, False: 4.96k]
  ------------------
  270|  82.9k|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  271|    320|    case ::ot_array:
  ------------------
  |  Branch (271:5): [True: 320, False: 87.6k]
  ------------------
  272|    320|        {
  273|    320|            auto const& a = std::get<QPDF_Array>(obj->value);
  274|    320|            if (shallow) {
  ------------------
  |  Branch (274:17): [True: 0, False: 320]
  ------------------
  275|      0|                return QPDFObject::create<QPDF_Array>(a);
  276|    320|            } else {
  277|    320|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (277:52): [True: 23, False: 297]
  ------------------
  278|    320|                if (a.sp) {
  ------------------
  |  Branch (278:21): [True: 23, False: 297]
  ------------------
  279|     23|                    QPDF_Array result;
  280|     23|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  281|     23|                    result.sp->size = a.sp->size;
  282|  5.10k|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (282:47): [True: 5.10k, False: 23]
  ------------------
  283|  5.10k|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (283:52): [True: 96, False: 5.01k]
  ------------------
  284|  5.10k|                    }
  285|     23|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  286|    297|                } else {
  287|    297|                    std::vector<QPDFObjectHandle> result;
  288|    297|                    result.reserve(a.elements.size());
  289|  82.1k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (289:45): [True: 82.1k, False: 297]
  ------------------
  290|  82.1k|                        result.emplace_back(
  291|  82.1k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (291:29): [True: 82.1k, False: 0]
  |  Branch (291:40): [True: 1.36k, False: 80.7k]
  ------------------
  292|  82.1k|                    }
  293|    297|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  294|    297|                }
  295|    320|            }
  296|    320|        }
  297|    548|    case ::ot_dictionary:
  ------------------
  |  Branch (297:5): [True: 548, False: 87.3k]
  ------------------
  298|    548|        {
  299|    548|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  300|    548|            if (shallow) {
  ------------------
  |  Branch (300:17): [True: 0, False: 548]
  ------------------
  301|      0|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  302|    548|            } else {
  303|    548|                std::map<std::string, QPDFObjectHandle> new_items;
  304|  2.41k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (304:44): [True: 2.41k, False: 548]
  ------------------
  305|  2.41k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (305:38): [True: 430, False: 1.98k]
  ------------------
  306|  2.41k|                }
  307|    548|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  308|    548|            }
  309|    548|        }
  310|      0|    case ::ot_stream:
  ------------------
  |  Branch (310:5): [True: 0, False: 87.9k]
  ------------------
  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: 87.9k]
  ------------------
  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: 87.9k]
  ------------------
  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: 87.9k]
  ------------------
  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: 87.9k]
  ------------------
  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: 87.9k]
  ------------------
  325|      0|        return referenced_object().obj_sp();
  326|  87.9k|    }
  327|      0|    return {}; // unreachable
  328|  87.9k|}
_ZN4qpdf10BaseHandle10disconnectEb:
  683|  4.11M|{
  684|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  685|  4.11M|    if (only_direct && indirect()) {
  ------------------
  |  Branch (685:9): [True: 3.84M, False: 269k]
  |  Branch (685:24): [True: 91.3k, False: 3.75M]
  ------------------
  686|  91.3k|        return;
  687|  91.3k|    }
  688|       |
  689|  4.02M|    switch (raw_type_code()) {
  690|  42.4k|    case ::ot_array:
  ------------------
  |  Branch (690:5): [True: 42.4k, False: 3.98M]
  ------------------
  691|  42.4k|        {
  692|  42.4k|            auto& a = std::get<QPDF_Array>(obj->value);
  693|  42.4k|            if (a.sp) {
  ------------------
  |  Branch (693:17): [True: 221, False: 42.2k]
  ------------------
  694|  1.99M|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (694:32): [True: 1.99M, False: 221]
  ------------------
  695|  1.99M|                    item.second.disconnect();
  696|  1.99M|                }
  697|  42.2k|            } else {
  698|  1.54M|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (698:30): [True: 1.54M, False: 42.2k]
  ------------------
  699|  1.54M|                    oh.disconnect();
  700|  1.54M|                }
  701|  42.2k|            }
  702|  42.4k|        }
  703|  42.4k|        break;
  704|  81.4k|    case ::ot_dictionary:
  ------------------
  |  Branch (704:5): [True: 81.4k, False: 3.94M]
  ------------------
  705|   281k|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (705:24): [True: 281k, False: 81.4k]
  ------------------
  706|   281k|            iter.second.disconnect();
  707|   281k|        }
  708|  81.4k|        break;
  709|  16.9k|    case ::ot_stream:
  ------------------
  |  Branch (709:5): [True: 16.9k, False: 4.00M]
  ------------------
  710|  16.9k|        {
  711|  16.9k|            auto& s = std::get<QPDF_Stream>(obj->value);
  712|  16.9k|            s.m->stream_provider = nullptr;
  713|  16.9k|            s.m->stream_dict.disconnect();
  714|  16.9k|        }
  715|  16.9k|        break;
  716|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (716:5): [True: 0, False: 4.02M]
  ------------------
  717|      0|        return;
  718|  3.88M|    default:
  ------------------
  |  Branch (718:5): [True: 3.88M, False: 140k]
  ------------------
  719|  3.88M|        break;
  720|  4.02M|    }
  721|  4.02M|    obj->qpdf = nullptr;
  722|  4.02M|    obj->og = QPDFObjGen();
  723|  4.02M|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  727|    160|{
  728|    160|    return obj == rhs.obj;
  729|    160|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  739|  4.92k|{
  740|  4.92k|    static constexpr std::array<char const*, 16> tn{
  741|  4.92k|        "uninitialized",
  742|  4.92k|        "reserved",
  743|  4.92k|        "null",
  744|  4.92k|        "boolean",
  745|  4.92k|        "integer",
  746|  4.92k|        "real",
  747|  4.92k|        "string",
  748|  4.92k|        "name",
  749|  4.92k|        "array",
  750|  4.92k|        "dictionary",
  751|  4.92k|        "stream",
  752|  4.92k|        "operator",
  753|  4.92k|        "inline-image",
  754|  4.92k|        "unresolved",
  755|  4.92k|        "destroyed",
  756|  4.92k|        "reference"};
  757|  4.92k|    return tn[type_code()];
  758|  4.92k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  774|  4.46k|{
  775|  4.46k|    return type_code() == ::ot_boolean;
  776|  4.46k|}
_ZNK16QPDFObjectHandle6isNullEv:
  788|  2.29k|{
  789|  2.29k|    return type_code() == ::ot_null;
  790|  2.29k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  794|   131k|{
  795|   131k|    return type_code() == ::ot_integer;
  796|   131k|}
_ZNK16QPDFObjectHandle6isRealEv:
  800|  15.0k|{
  801|  15.0k|    return type_code() == ::ot_real;
  802|  15.0k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  806|  19.6k|{
  807|  19.6k|    return (isInteger() || isReal());
  ------------------
  |  Branch (807:13): [True: 5.08k, False: 14.5k]
  |  Branch (807:28): [True: 14.4k, False: 134]
  ------------------
  808|  19.6k|}
_ZNK16QPDFObjectHandle6isNameEv:
  836|  17.1k|{
  837|  17.1k|    return type_code() == ::ot_name;
  838|  17.1k|}
_ZNK16QPDFObjectHandle8isStringEv:
  842|  11.1k|{
  843|  11.1k|    return type_code() == ::ot_string;
  844|  11.1k|}
_ZNK16QPDFObjectHandle7isArrayEv:
  860|   143k|{
  861|   143k|    return type_code() == ::ot_array;
  862|   143k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  866|   434k|{
  867|   434k|    return type_code() == ::ot_dictionary;
  868|   434k|}
_ZNK16QPDFObjectHandle8isScalarEv:
  884|  3.46k|{
  885|  3.46k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (885:12): [True: 12, False: 3.45k]
  |  Branch (885:24): [True: 192, False: 3.25k]
  |  Branch (885:39): [True: 2.83k, False: 424]
  |  Branch (885:51): [True: 0, False: 424]
  |  Branch (885:63): [True: 88, False: 336]
  |  Branch (885:75): [True: 15, False: 321]
  ------------------
  886|  3.46k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  890|  1.40k|{
  891|  1.40k|    return Name(*this) == name;
  892|  1.40k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  896|   146k|{
  897|   146k|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (897:12): [True: 55.3k, False: 90.9k]
  |  Branch (897:31): [True: 0, False: 55.3k]
  |  Branch (897:47): [True: 10.1k, False: 45.1k]
  ------------------
  898|  10.1k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (898:10): [True: 10.1k, False: 55]
  |  Branch (898:29): [True: 18, False: 37]
  ------------------
  899|   146k|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  903|  55.5k|{
  904|  55.5k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (904:14): [True: 23.0k, False: 32.5k]
  ------------------
  905|  23.0k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (905:16): [True: 23.0k, False: 0]
  |  Branch (905:27): [True: 0, False: 23.0k]
  |  Branch (905:43): [True: 16.2k, False: 6.72k]
  ------------------
  906|  16.2k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (906:14): [True: 16.2k, False: 0]
  |  Branch (906:33): [True: 0, False: 0]
  ------------------
  907|  23.0k|    }
  908|  32.5k|    return false;
  909|  55.5k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  915|      4|{
  916|      4|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (916:14): [True: 4, False: 0]
  ------------------
  917|      4|        return boolean->val;
  918|      4|    } else {
  919|      0|        typeWarning("boolean", "returning false");
  920|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  921|      0|        return false;
  922|      0|    }
  923|      4|}
_ZN4qpdf7IntegerC2Ex:
  938|  1.78k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  939|  1.78k|{
  940|  1.78k|}
_ZNK4qpdf7Integer5valueEv:
  950|   115k|{
  951|   115k|    auto* i = as<QPDF_Integer>();
  952|   115k|    if (!i) {
  ------------------
  |  Branch (952:9): [True: 1.59k, False: 114k]
  ------------------
  953|  1.59k|        throw invalid_error("Integer");
  954|  1.59k|    }
  955|   114k|    return i->val;
  956|   115k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  960|  34.0k|{
  961|  34.0k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (961:20): [True: 34.0k, False: 0]
  ------------------
  962|  34.0k|        return integer;
  963|  34.0k|    } else {
  964|      0|        typeWarning("integer", "returning 0");
  965|      0|        return 0;
  966|      0|    }
  967|  34.0k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  971|  8.66k|{
  972|  8.66k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (972:20): [True: 8.62k, False: 40]
  ------------------
  973|  8.62k|        value = integer;
  974|  8.62k|        return true;
  975|  8.62k|    }
  976|     40|    return false;
  977|  8.66k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  981|  49.4k|{
  982|  49.4k|    try {
  983|  49.4k|        return Integer(*this).value<int>();
  984|  49.4k|    } catch (std::invalid_argument&) {
  985|     20|        typeWarning("integer", "returning 0");
  986|     20|        return 0;
  987|     20|    }
  988|  49.4k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
  992|  2.23k|{
  993|  2.23k|    if (!isInteger()) {
  ------------------
  |  Branch (993:9): [True: 46, False: 2.18k]
  ------------------
  994|     46|        return false;
  995|     46|    }
  996|  2.18k|    value = getIntValueAsInt();
  997|  2.18k|    return true;
  998|  2.23k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1002|  14.0k|{
 1003|  14.0k|    try {
 1004|  14.0k|        return Integer(*this).value<unsigned long long>();
 1005|  14.0k|    } catch (std::invalid_argument&) {
 1006|  1.17k|        typeWarning("integer", "returning 0");
 1007|  1.17k|        return 0;
 1008|  1.17k|    }
 1009|  14.0k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1023|  9.37k|{
 1024|  9.37k|    try {
 1025|  9.37k|        return Integer(*this).value<unsigned int>();
 1026|  9.37k|    } catch (std::invalid_argument&) {
 1027|    401|        typeWarning("integer", "returning 0");
 1028|    401|        return 0;
 1029|    401|    }
 1030|  9.37k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1034|  2.50k|{
 1035|  2.50k|    if (!isInteger()) {
  ------------------
  |  Branch (1035:9): [True: 259, False: 2.24k]
  ------------------
 1036|    259|        return false;
 1037|    259|    }
 1038|  2.24k|    value = getUIntValueAsUInt();
 1039|  2.24k|    return true;
 1040|  2.50k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1078|  11.6k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1079|  11.6k|{
 1080|  11.6k|}
_ZNK4qpdf4Name5valueEv:
 1084|  67.3k|{
 1085|  67.3k|    auto* n = as<QPDF_Name>();
 1086|  67.3k|    if (!n) {
  ------------------
  |  Branch (1086:9): [True: 0, False: 67.3k]
  ------------------
 1087|      0|        throw invalid_error("Name");
 1088|      0|    }
 1089|  67.3k|    return n->name;
 1090|  67.3k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1094|  5.65k|{
 1095|  5.65k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1095:15): [True: 5.65k, False: 0]
  ------------------
 1096|  5.65k|        return name->name;
 1097|  5.65k|    }
 1098|      0|    typeWarning("name", "returning dummy name");
 1099|      0|    return "/QPDFFakeName";
 1100|  5.65k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1116|     20|{
 1117|     20|    return {QPDFObject::create<QPDF_String>(str)};
 1118|     20|}
_ZN16QPDFObjectHandle16newUnicodeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1122|  2.70k|{
 1123|  2.70k|    return {String::utf16(utf8_str).obj_sp()};
 1124|  2.70k|}
_ZN4qpdf6StringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1127|  2.06k|    BaseHandle(QPDFObject::create<QPDF_String>(str))
 1128|  2.06k|{
 1129|  2.06k|}
_ZN4qpdf6StringC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1132|    641|    BaseHandle(QPDFObject::create<QPDF_String>(std::move(str)))
 1133|    641|{
 1134|    641|}
_ZN4qpdf6String5utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1138|  2.70k|{
 1139|  2.70k|    std::string result;
 1140|  2.70k|    if (QUtil::utf8_to_pdf_doc(utf8_str, result, '?')) {
  ------------------
  |  Branch (1140:9): [True: 2.06k, False: 641]
  ------------------
 1141|  2.06k|        return String(result);
 1142|  2.06k|    }
 1143|    641|    return String(QUtil::utf8_to_utf16(utf8_str));
 1144|  2.70k|}
_ZNK4qpdf6String5valueEv:
 1148|  3.75k|{
 1149|  3.75k|    auto* s = as<QPDF_String>();
 1150|  3.75k|    if (!s) {
  ------------------
  |  Branch (1150:9): [True: 0, False: 3.75k]
  ------------------
 1151|      0|        throw invalid_error("String");
 1152|      0|    }
 1153|  3.75k|    return s->val;
 1154|  3.75k|}
_ZNK4qpdf6String10utf8_valueEv:
 1158|   701k|{
 1159|   701k|    auto* s = as<QPDF_String>();
 1160|   701k|    if (!s) {
  ------------------
  |  Branch (1160:9): [True: 0, False: 701k]
  ------------------
 1161|      0|        throw invalid_error("String");
 1162|      0|    }
 1163|   701k|    if (util::is_utf16(s->val)) {
  ------------------
  |  Branch (1163:9): [True: 43.6k, False: 658k]
  ------------------
 1164|  43.6k|        return QUtil::utf16_to_utf8(s->val);
 1165|  43.6k|    }
 1166|   658k|    if (util::is_explicit_utf8(s->val)) {
  ------------------
  |  Branch (1166:9): [True: 4.20k, False: 654k]
  ------------------
 1167|       |        // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
 1168|       |        // of U+FEFF.
 1169|  4.20k|        return s->val.substr(3);
 1170|  4.20k|    }
 1171|   654k|    return QUtil::pdf_doc_to_utf8(s->val);
 1172|   658k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1176|  3.75k|{
 1177|  3.75k|    try {
 1178|  3.75k|        return String(obj).value();
 1179|  3.75k|    } catch (std::invalid_argument&) {
 1180|      0|        typeWarning("string", "returning empty string");
 1181|      0|        return {};
 1182|      0|    }
 1183|  3.75k|}
_ZNK16QPDFObjectHandle12getUTF8ValueEv:
 1198|   701k|{
 1199|   701k|    try {
 1200|   701k|        return String(obj).utf8_value();
 1201|   701k|    } catch (std::invalid_argument&) {
 1202|      0|        typeWarning("string", "returning empty string");
 1203|      0|        return {};
 1204|      0|    }
 1205|   701k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1280|    405|{
 1281|    405|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1281:9): [True: 0, False: 405]
  ------------------
 1282|      0|        return true;
 1283|    405|    } else if (isArray()) {
  ------------------
  |  Branch (1283:16): [True: 55, False: 350]
  ------------------
 1284|    869|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1284:24): [True: 869, False: 24]
  ------------------
 1285|    869|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1285:17): [True: 31, False: 838]
  ------------------
 1286|     31|                return true;
 1287|     31|            }
 1288|    869|        }
 1289|     55|    }
 1290|    374|    return false;
 1291|    405|}
_ZN16QPDFObjectHandle7newNullEv:
 1886|  19.8k|{
 1887|  19.8k|    return {QPDFObject::create<QPDF_Null>()};
 1888|  19.8k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1898|  17.4k|{
 1899|  17.4k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1900|  17.4k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1922|  4.37k|{
 1923|  4.37k|    return {QPDFObject::create<QPDF_Array>(items)};
 1924|  4.37k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1928|  4.37k|{
 1929|  4.37k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1930|  4.37k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1976|  5.87k|{
 1977|  5.87k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1978|  5.87k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1982|  5.87k|{
 1983|  5.87k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1984|  5.87k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2027|  53.6k|{
 2028|  53.6k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2028:12): [True: 53.6k, False: 0]
  ------------------
 2029|  53.6k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2042|  24.9k|{
 2043|  24.9k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2043:12): [True: 24.9k, False: 0]
  |  Branch (2043:19): [True: 24.9k, False: 0]
  ------------------
 2044|  24.9k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2048|    154|{
 2049|    154|    if (!obj) {
  ------------------
  |  Branch (2049:9): [True: 0, False: 154]
  ------------------
 2050|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2051|      0|    }
 2052|    154|    return {copy()};
 2053|    154|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2128|  1.59k|{
 2129|  1.59k|    return std::invalid_argument(method + " operation attempted on invalid object");
 2130|  1.59k|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2140|  4.92k|{
 2141|  4.92k|    return {
 2142|  4.92k|        qpdf_e_object,
 2143|  4.92k|        "",
 2144|  4.92k|        description(),
 2145|  4.92k|        0,
 2146|  4.92k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2147|  4.92k|            message};
 2148|  4.92k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2152|  4.92k|{
 2153|  4.92k|    if (!obj) {
  ------------------
  |  Branch (2153:9): [True: 0, False: 4.92k]
  ------------------
 2154|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2155|      0|    }
 2156|  4.92k|    warn(type_error(expected_type, message));
 2157|  4.92k|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2329|  53.6k|{
 2330|  53.6k|    if (!qpdf()) {
  ------------------
  |  Branch (2330:9): [True: 238, False: 53.4k]
  ------------------
 2331|    238|        throw std::move(e);
 2332|    238|    }
 2333|  53.4k|    qpdf()->warn(std::move(e));
 2334|  53.4k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2338|  57.9k|{
 2339|  57.9k|    if (qpdf()) {
  ------------------
  |  Branch (2339:9): [True: 48.7k, False: 9.15k]
  ------------------
 2340|  48.7k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2341|  48.7k|    } else {
 2342|  9.15k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2343|  9.15k|    }
 2344|  57.9k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2513|  36.5k|{
 2514|  36.5k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2514:12): [True: 36.5k, False: 0]
  ------------------
 2515|  36.5k|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2519|  25.1k|{
 2520|  25.1k|    return getObjGen().getObj();
 2521|  25.1k|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2531|  19.6k|{
 2532|  19.6k|    return getObjectID() != 0;
 2533|  19.6k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2538|  61.4k|{
 2539|  61.4k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2539:12): [True: 61.4k, False: 0]
  ------------------
 2540|  61.4k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2553|     20|{
 2554|     20|    if (obj) {
  ------------------
  |  Branch (2554:9): [True: 20, False: 0]
  ------------------
 2555|     20|        obj->setParsedOffset(offset);
 2556|     20|    }
 2557|     20|}

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

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  8.26k|{
   24|  8.26k|    return !dh.m->seen.add(og);
   25|  8.26k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  1.87k|    QPDFDocumentHelper(qpdf),
   29|  1.87k|    m(std::make_shared<Members>())
   30|  1.87k|{
   31|  1.87k|    validate();
   32|  1.87k|}
_ZN25QPDFOutlineDocumentHelper3getER4QPDF:
   36|  1.87k|{
   37|  1.87k|    return qpdf.doc().outlines();
   38|  1.87k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  1.87k|{
   43|  1.87k|    m->outlines.clear();
   44|  1.87k|    m->names_dest = nullptr;
   45|       |
   46|  1.87k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  1.87k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 252, False: 1.62k]
  ------------------
   48|    252|        return;
   49|    252|    }
   50|  1.62k|    auto outlines = root.getKey("/Outlines");
   51|  1.62k|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 15, False: 1.60k]
  |  Branch (51:11): [True: 1.61k, False: 6]
  |  Branch (51:38): [True: 1.60k, False: 9]
  ------------------
   52|     15|        return;
   53|     15|    }
   54|  1.60k|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|  1.60k|    QPDFObjGen::set seen;
   56|  4.04k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 2.50k, False: 1.54k]
  ------------------
   57|  2.50k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 63, False: 2.43k]
  ------------------
   58|     63|            cur.warn("Loop detected loop in /Outlines tree");
   59|     63|            return;
   60|     63|        }
   61|  2.43k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  2.43k|        cur = cur.getKey("/Next");
   63|  2.43k|    }
   64|  1.60k|}
_ZN25QPDFOutlineDocumentHelper19getTopLevelOutlinesEv:
   74|  1.87k|{
   75|  1.87k|    return m->outlines;
   76|  1.87k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  3.41k|{
  108|  3.41k|    QPDFObjectHandle result;
  109|  3.41k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 227, False: 3.18k]
  ------------------
  110|    227|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 82, False: 145]
  ------------------
  111|     82|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     82|        }
  113|    227|        result = m->dest_dict.getKeyIfDict(name.getName());
  114|  3.18k|    } else if (name.isString()) {
  ------------------
  |  Branch (114:16): [True: 3.18k, False: 0]
  ------------------
  115|  3.18k|        if (!m->names_dest) {
  ------------------
  |  Branch (115:13): [True: 1.64k, False: 1.54k]
  ------------------
  116|  1.64k|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|  1.64k|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 1.34k, False: 302]
  ------------------
  118|  1.34k|                m->names_dest = std::make_unique<QPDFNameTreeObjectHelper>(
  119|  1.34k|                    dests,
  120|  1.34k|                    qpdf,
  121|  1.34k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  1.34k|                        return o.isArray() || o.contains("/D");
  123|  1.34k|                    },
  124|  1.34k|                    true);
  125|  1.34k|                m->names_dest->validate();
  126|  1.34k|            }
  127|  1.64k|        }
  128|  3.18k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 2.70k, False: 485]
  ------------------
  129|  2.70k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 533, False: 2.17k]
  ------------------
  130|    533|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    533|            }
  132|  2.70k|        }
  133|  3.18k|    }
  134|  3.41k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 2.43k, False: 984]
  ------------------
  135|  2.43k|        return QPDFObjectHandle::newNull();
  136|  2.43k|    }
  137|    984|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 309, False: 675]
  ------------------
  138|    309|        return result.getKey("/D");
  139|    309|    }
  140|    675|    return result;
  141|    984|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  1.87k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  1.87k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|   132k|                    [](QPDFObjectHandle const& o) -> bool {
  122|   132k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 125k, False: 6.72k]
  |  Branch (122:47): [True: 5.51k, False: 1.21k]
  ------------------
  123|   132k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  8.26k|    dh(dh)
    9|  8.26k|{
   10|  8.26k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  8.26k|    QPDFObjectHelper(a_oh),
   15|  8.26k|    m(new Members(dh))
   16|  8.26k|{
   17|  8.26k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 8.26k]
  ------------------
   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.26k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 4.65k, False: 3.60k]
  ------------------
   23|  4.65k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  4.65k|        return;
   25|  4.65k|    }
   26|       |
   27|  3.60k|    QPDFObjGen::set children;
   28|  3.60k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  9.42k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 6.20k, False: 3.22k]
  |  Branch (29:27): [True: 6.12k, False: 76]
  ------------------
   30|  6.12k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 301, False: 5.82k]
  ------------------
   31|    301|            cur.warn("Loop detected loop in /Outlines tree");
   32|    301|            break;
   33|    301|        }
   34|  5.82k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  5.82k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  5.82k|        m->kids.emplace_back(new_ooh);
   37|  5.82k|        cur = cur.getKey("/Next");
   38|  5.82k|    }
   39|  3.60k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  7.96k|{
   50|  7.96k|    return m->kids;
   51|  7.96k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  8.18k|{
   56|  8.18k|    auto dest = get("/Dest");
   57|  8.18k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 7.07k, False: 1.10k]
  ------------------
   58|  7.07k|        auto const& A = get("/A");
   59|  7.07k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 2.97k, False: 4.10k]
  ------------------
   60|  2.97k|            dest = A["/D"];
   61|  2.97k|        }
   62|  7.07k|    }
   63|  8.18k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 4.17k, False: 4.01k]
  ------------------
   64|  4.17k|        return QPDFObjectHandle::newNull();
   65|  4.17k|    }
   66|  4.01k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 227, False: 3.78k]
  |  Branch (66:26): [True: 3.18k, False: 594]
  ------------------
   67|  3.41k|        return m->dh.resolveNamedDest(dest);
   68|  3.41k|    }
   69|    594|    return dest;
   70|  4.01k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  8.18k|{
   75|  8.18k|    QPDFObjectHandle dest = getDest();
   76|  8.18k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 1.12k, False: 7.06k]
  |  Branch (76:26): [True: 745, False: 382]
  ------------------
   77|    745|        return dest.getArrayItem(0);
   78|    745|    }
   79|  7.44k|    return QPDFObjectHandle::newNull();
   80|  8.18k|}

_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   101k|{
  130|   101k|    return Parser(
  131|   101k|               input,
  132|   101k|               make_description(input.getName(), object_description),
  133|   101k|               object_description,
  134|   101k|               tokenizer,
  135|   101k|               decrypter,
  136|   101k|               &context,
  137|   101k|               true,
  138|   101k|               0,
  139|   101k|               0,
  140|   101k|               sanity_checks)
  141|   101k|        .parse();
  142|   101k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  22.3k|{
  148|  22.3k|    return Parser(
  149|  22.3k|               input,
  150|  22.3k|               std::make_shared<QPDFObject::Description>(
  151|  22.3k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  22.3k|               "",
  153|  22.3k|               tokenizer,
  154|  22.3k|               nullptr,
  155|  22.3k|               &context,
  156|  22.3k|               true,
  157|  22.3k|               stream_id,
  158|  22.3k|               obj_id)
  159|  22.3k|        .parse();
  160|  22.3k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|   124k|{
  165|   124k|    try {
  166|   124k|        return parse_first(content_stream);
  167|   124k|    } catch (Error&) {
  168|  8.45k|        return {};
  169|  8.45k|    } catch (QPDFExc& e) {
  170|  3.37k|        throw e;
  171|  3.37k|    } catch (std::logic_error& e) {
  172|      1|        throw e;
  173|  1.09k|    } catch (std::exception& e) {
  174|  1.09k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  1.09k|        return {};
  176|  1.09k|    }
  177|   124k|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|   124k|{
  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|   124k|    QPDF::Doc::ParseGuard pg(context_);
  188|   124k|    start_ = input_.tell();
  189|   124k|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 1.68k, False: 122k]
  ------------------
  190|  1.68k|        warn(tokenizer_.getErrorMessage());
  191|  1.68k|    }
  192|       |
  193|   124k|    switch (tokenizer_.getType()) {
  194|    554|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 554, False: 123k]
  ------------------
  195|    554|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 0, False: 554]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|      0|            empty_ = true;
  198|      0|            return {};
  199|      0|        }
  200|    554|        warn("unexpected EOF");
  201|    554|        return {};
  202|       |
  203|  1.54k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 1.54k, False: 122k]
  ------------------
  204|  1.54k|        return {};
  205|       |
  206|    171|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 171, False: 123k]
  ------------------
  207|    280|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 109, False: 123k]
  ------------------
  208|    280|        warn("treating unexpected brace token as null");
  209|    280|        return {};
  210|       |
  211|    461|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 461, False: 123k]
  ------------------
  212|    461|        warn("treating unexpected array close token as null");
  213|    461|        return {};
  214|       |
  215|    297|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 297, False: 123k]
  ------------------
  216|    297|        warn("unexpected dictionary close token");
  217|    297|        return {};
  218|       |
  219|  10.1k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 10.1k, False: 113k]
  ------------------
  220|  98.0k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 87.8k, False: 36.2k]
  ------------------
  221|  98.0k|        stack_.clear();
  222|  98.0k|        stack_.emplace_back(
  223|  98.0k|            input_,
  224|  98.0k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 10.1k, False: 87.8k]
  ------------------
  225|  98.0k|        frame_ = &stack_.back();
  226|  98.0k|        return parse_remainder(content_stream);
  227|       |
  228|    413|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 413, False: 123k]
  ------------------
  229|    413|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|     86|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 86, False: 123k]
  ------------------
  232|     86|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|  8.35k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 8.35k, False: 115k]
  ------------------
  235|  8.35k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|  1.97k|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 1.97k, False: 122k]
  ------------------
  238|  1.97k|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  1.88k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 1.88k, False: 122k]
  ------------------
  241|  1.88k|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  9.50k|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 9.50k, False: 114k]
  ------------------
  244|  9.50k|        {
  245|  9.50k|            auto const& value = tokenizer_.getValue();
  246|  9.50k|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 0, False: 9.50k]
  ------------------
  247|      0|                return with_description<QPDF_Operator>(value);
  248|  9.50k|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 226, False: 9.28k]
  ------------------
  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|    226|                empty_ = true;
  254|    226|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    226|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 226, False: 0]
  ------------------
  256|    226|                    warn("empty object treated as null");
  257|    226|                }
  258|    226|                return {};
  259|  9.28k|            } else {
  260|  9.28k|                warn("unknown token while reading object; treating as string");
  261|  9.28k|                return with_description<QPDF_String>(value);
  262|  9.28k|            }
  263|  9.50k|        }
  264|       |
  265|    546|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 546, False: 123k]
  ------------------
  266|    546|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 155, False: 391]
  ------------------
  267|    155|            std::string s{tokenizer_.getValue()};
  268|    155|            decrypter_->decryptString(s);
  269|    155|            return with_description<QPDF_String>(s);
  270|    391|        } else {
  271|    391|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|    391|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 124k]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|   124k|    }
  278|   124k|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|  98.0k|{
  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|  98.0k|    bad_count_ = 0;
  289|  98.0k|    bool b_contents = false;
  290|       |
  291|  13.9M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 13.9M, Folded]
  ------------------
  292|  13.9M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 34.8k, False: 13.9M]
  ------------------
  293|  34.8k|            warn(tokenizer_.getErrorMessage());
  294|  34.8k|        }
  295|  13.9M|        ++good_count_; // optimistically
  296|       |
  297|  13.9M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 7.27M, False: 6.70M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  7.27M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 6.87M, False: 396k]
  ------------------
  301|  6.87M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 6.59M, False: 284k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|  6.59M|                    add_int(int_count_);
  304|  6.59M|                }
  305|  6.87M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  6.87M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  6.87M|                continue;
  308|       |
  309|  6.87M|            } else if (
  310|   396k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 284k, False: 112k]
  |  Branch (310:36): [True: 251k, False: 32.9k]
  ------------------
  311|   251k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 236k, False: 14.7k]
  ------------------
  312|   236k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 236k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   236k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   236k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   236k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 1.82k, False: 234k]
  |  Branch (319:33): [True: 444, False: 234k]
  |  Branch (319:44): [True: 357, False: 233k]
  ------------------
  320|   233k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   233k|                } else {
  322|  2.62k|                    add_bad_null(
  323|  2.62k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  2.62k|                        std::to_string(gen) + " R) as null");
  325|  2.62k|                }
  326|   236k|                int_count_ = 0;
  327|   236k|                continue;
  328|       |
  329|   236k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 160k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   160k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 47.6k, False: 112k]
  ------------------
  332|  47.6k|                    add_int(int_count_ - 1);
  333|  47.6k|                }
  334|   160k|                add_int(int_count_);
  335|   160k|                int_count_ = 0;
  336|   160k|            }
  337|  7.27M|        }
  338|       |
  339|  6.86M|        switch (tokenizer_.getType()) {
  340|  6.80k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 6.80k, False: 6.85M]
  ------------------
  341|  6.80k|            warn("parse error while reading object");
  342|  6.80k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 0, False: 6.80k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|      0|                return {};
  345|      0|            }
  346|  6.80k|            warn("unexpected EOF");
  347|  6.80k|            return {};
  348|       |
  349|  27.8k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 27.8k, False: 6.83M]
  ------------------
  350|  27.8k|            check_too_many_bad_tokens();
  351|  27.8k|            add_null();
  352|  27.8k|            continue;
  353|       |
  354|  1.51k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 1.51k, False: 6.86M]
  ------------------
  355|  3.64k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 2.13k, False: 6.86M]
  ------------------
  356|  3.64k|            add_bad_null("treating unexpected brace token as null");
  357|  3.64k|            continue;
  358|       |
  359|  65.0k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 65.0k, False: 6.79M]
  ------------------
  360|  65.0k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 63.0k, False: 1.93k]
  ------------------
  361|  63.0k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 596, False: 62.4k]
  ------------------
  362|  63.0k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|  63.0k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|  63.0k|                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|  63.0k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 1.90k, False: 61.1k]
  ------------------
  370|  1.90k|                    return object;
  371|  1.90k|                }
  372|  61.1k|                stack_.pop_back();
  373|  61.1k|                frame_ = &stack_.back();
  374|  61.1k|                add(std::move(object));
  375|  61.1k|            } else {
  376|  1.93k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 1.21k, False: 721]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  1.21k|                    warn("unexpected array close token; giving up on reading object");
  380|  1.21k|                    return {};
  381|  1.21k|                }
  382|    721|                add_bad_null("treating unexpected array close token as null");
  383|    721|            }
  384|  61.8k|            continue;
  385|       |
  386|   113k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 113k, False: 6.74M]
  ------------------
  387|   113k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 112k, False: 917]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   112k|                auto& dict = frame_->dict;
  390|       |
  391|   112k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 8.60k, False: 104k]
  ------------------
  392|  8.60k|                    warn(
  393|  8.60k|                        frame_->offset,
  394|  8.60k|                        "dictionary ended prematurely; using null as value for last key");
  395|  8.60k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  8.60k|                }
  397|   112k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 36.2k, False: 76.4k]
  ------------------
  398|  36.2k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 32.6k, False: 3.61k]
  ------------------
  399|  32.6k|                        warn(
  400|  32.6k|                            frame_->offset,
  401|  32.6k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  32.6k|                    } else {
  403|  3.61k|                        fix_missing_keys();
  404|  3.61k|                    }
  405|  36.2k|                }
  406|       |
  407|   112k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 238, False: 112k]
  |  Branch (407:21): [True: 20, False: 112k]
  |  Branch (407:57): [True: 135, False: 103]
  ------------------
  408|    135|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 40, False: 95]
  |  Branch (408:62): [True: 30, False: 10]
  ------------------
  409|     30|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 20, False: 10]
  |  Branch (409:51): [True: 20, False: 0]
  ------------------
  410|     20|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     20|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     20|                }
  413|   112k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   112k|                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|   112k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 74.9k, False: 37.7k]
  ------------------
  420|  74.9k|                    return object;
  421|  74.9k|                }
  422|  37.7k|                stack_.pop_back();
  423|  37.7k|                frame_ = &stack_.back();
  424|  37.7k|                add(std::move(object));
  425|  37.7k|            } else {
  426|    917|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 582, False: 335]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|    582|                    warn("unexpected dictionary close token; giving up on reading object");
  430|    582|                    return {};
  431|    582|                }
  432|    335|                add_bad_null("unexpected dictionary close token");
  433|    335|            }
  434|  38.1k|            continue;
  435|       |
  436|   157k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 157k, False: 6.70M]
  ------------------
  437|   220k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 63.1k, False: 6.80M]
  ------------------
  438|   220k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 115, False: 220k]
  ------------------
  439|    115|                limits_error(
  440|    115|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|    115|            }
  442|   220k|            b_contents = false;
  443|   220k|            stack_.emplace_back(
  444|   220k|                input_,
  445|   220k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 157k, False: 63.2k]
  ------------------
  446|   220k|                                                                       : st_dictionary_key);
  447|   220k|            frame_ = &stack_.back();
  448|   220k|            continue;
  449|       |
  450|  9.22k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 9.22k, False: 6.85M]
  ------------------
  451|  9.22k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  9.22k|            continue;
  453|       |
  454|  79.4k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 79.4k, False: 6.78M]
  ------------------
  455|  79.4k|            add_null();
  456|  79.4k|            continue;
  457|       |
  458|   396k|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 396k, False: 6.46M]
  ------------------
  459|   396k|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 396k, False: 0]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   396k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   396k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   396k|                int_count_ = 1;
  464|   396k|            } else {
  465|      0|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|      0|            }
  467|   396k|            continue;
  468|       |
  469|  38.5k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 38.5k, False: 6.82M]
  ------------------
  470|  38.5k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|  38.5k|            continue;
  472|       |
  473|  5.61M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 5.61M, False: 1.24M]
  ------------------
  474|  5.61M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 409k, False: 5.20M]
  ------------------
  475|   409k|                frame_->key = tokenizer_.getValue();
  476|   409k|                frame_->state = st_dictionary_value;
  477|   409k|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 25.4k, False: 384k]
  |  Branch (477:44): [True: 477, False: 25.0k]
  ------------------
  478|   409k|                continue;
  479|  5.20M|            } else {
  480|  5.20M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  5.20M|            }
  482|  5.20M|            continue;
  483|       |
  484|  5.20M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 157k, False: 6.70M]
  ------------------
  485|   157k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 0, False: 157k]
  ------------------
  486|      0|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|      0|                continue;
  488|      0|            }
  489|       |
  490|   157k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 149k, False: 8.05k]
  ------------------
  491|   149k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 909, False: 148k]
  |  Branch (491:58): [True: 305, 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.21k|                    warn(
  495|  1.21k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  1.21k|                        "reading object");
  497|  1.21k|                    return {};
  498|  1.21k|                }
  499|       |
  500|   148k|                add_bad_null("unknown token while reading object; treating as null");
  501|   148k|                continue;
  502|   149k|            }
  503|       |
  504|  8.05k|            warn("unknown token while reading object; treating as string");
  505|  8.05k|            check_too_many_bad_tokens();
  506|  8.05k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  8.05k|            continue;
  509|       |
  510|   126k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 126k, False: 6.73M]
  ------------------
  511|   126k|            {
  512|   126k|                auto const& val = tokenizer_.getValue();
  513|   126k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 16.0k, False: 110k]
  ------------------
  514|  16.0k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 432, False: 15.6k]
  ------------------
  515|    432|                        frame_->contents_string = val;
  516|    432|                        frame_->contents_offset = input_.getLastOffset();
  517|    432|                        b_contents = false;
  518|    432|                    }
  519|  16.0k|                    std::string s{val};
  520|  16.0k|                    decrypter_->decryptString(s);
  521|  16.0k|                    add_scalar<QPDF_String>(s);
  522|   110k|                } else {
  523|   110k|                    add_scalar<QPDF_String>(val);
  524|   110k|                }
  525|   126k|            }
  526|   126k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 6.86M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  6.86M|        }
  531|  6.86M|    }
  532|  98.0k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  12.5M|{
  537|  12.5M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 12.1M, False: 370k]
  ------------------
  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|  12.1M|        frame_->olist.emplace_back(std::move(obj));
  541|  12.1M|    } else {
  542|   370k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 7.03k, False: 363k]
  ------------------
  543|  7.03k|            warn_duplicate_key();
  544|  7.03k|        }
  545|   370k|        frame_->state = st_dictionary_key;
  546|   370k|    }
  547|  12.5M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   254k|{
  552|   254k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   254k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 229k, False: 24.7k]
  ------------------
  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|   229k|        frame_->olist.emplace_back(null_obj);
  558|   229k|    } else {
  559|  24.7k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 2.31k, False: 22.4k]
  ------------------
  560|  2.31k|            warn_duplicate_key();
  561|  2.31k|        }
  562|  24.7k|        frame_->state = st_dictionary_key;
  563|  24.7k|    }
  564|   254k|    ++frame_->null_count;
  565|   254k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   155k|{
  570|   155k|    warn(msg);
  571|   155k|    check_too_many_bad_tokens();
  572|   155k|    add_null();
  573|   155k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|  6.80M|{
  578|  6.80M|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|  6.80M|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|  6.80M|    add(std::move(obj));
  581|  6.80M|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   175k|{
  611|   175k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 175k, False: 0]
  ------------------
  612|   175k|        obj->setDescription(context_, description_, parsed_offset);
  613|   175k|    }
  614|   175k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  3.61k|{
  619|  3.61k|    std::set<std::string> names;
  620|  11.6k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 11.6k, False: 3.61k]
  ------------------
  621|  11.6k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 644, False: 11.0k]
  ------------------
  622|    644|            names.insert(obj.getName());
  623|    644|        }
  624|  11.6k|    }
  625|  3.61k|    int next_fake_key = 1;
  626|  11.2k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 11.2k, False: 3.61k]
  ------------------
  627|  11.3k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 11.3k, Folded]
  ------------------
  628|  11.3k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  11.3k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 11.3k, False: 68]
  |  Branch (629:68): [True: 11.2k, False: 18]
  ------------------
  630|  11.3k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 11.2k, False: 86]
  ------------------
  631|  11.3k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 11.2k, False: 86]
  ------------------
  632|  11.2k|                warn(
  633|  11.2k|                    frame_->offset,
  634|  11.2k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  11.2k|                frame_->dict[key] = item;
  636|  11.2k|                break;
  637|  11.2k|            }
  638|  11.3k|        }
  639|  11.2k|    }
  640|  3.61k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   199k|{
  645|   199k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 152k, False: 46.7k]
  |  Branch (645:66): [True: 43.6k, False: 3.17k]
  ------------------
  646|   199k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 601, False: 198k]
  |  Branch (646:42): [True: 0, False: 198k]
  ------------------
  647|    601|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 510, False: 91]
  ------------------
  648|    510|            limits_error(
  649|    510|                "parser-max-container-size-damaged",
  650|    510|                "encountered errors while parsing an array or dictionary with more than " +
  651|    510|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    510|        }
  653|    601|        limits_error(
  654|    601|            "parser-max-container-size",
  655|    601|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    601|                " elements during xref recovery; giving up on reading object");
  657|    601|    }
  658|   199k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 198k, False: 601]
  |  Branch (658:27): [True: 1.45k, False: 197k]
  ------------------
  659|  1.45k|        limits_error(
  660|  1.45k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  1.45k|    }
  662|   199k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 62.9k, False: 136k]
  ------------------
  663|  62.9k|        good_count_ = 0;
  664|  62.9k|        bad_count_ = 1;
  665|  62.9k|        return;
  666|  62.9k|    }
  667|   136k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 6.28k, False: 129k]
  ------------------
  668|   129k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 82.9k, False: 46.9k]
  |  Branch (668:39): [True: 2.14k, False: 80.8k]
  ------------------
  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.37k|        warn("too many errors; giving up on reading object");
  672|  6.37k|        throw Error();
  673|  6.37k|    }
  674|   129k|    good_count_ = 0;
  675|   129k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.16k|{
  680|  2.16k|    Limits::error();
  681|  2.16k|    warn("limits error("s + limit + "): " + msg);
  682|  2.16k|    throw Error();
  683|  2.16k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   298k|{
  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|   298k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 298k, False: 0]
  ------------------
  692|   298k|        context_->warn(e);
  693|   298k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   298k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  9.34k|{
  701|  9.34k|    warn(
  702|  9.34k|        frame_->offset,
  703|  9.34k|        "dictionary has duplicated key " + frame_->key +
  704|  9.34k|            "; last occurrence overrides earlier ones");
  705|  9.34k|    check_too_many_bad_tokens();
  706|  9.34k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   298k|{
  711|   298k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 16.6k, False: 282k]
  ------------------
  712|  16.6k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  713|  16.6k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  714|  16.6k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  715|   282k|    } else {
  716|   282k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   282k|    }
  718|   298k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   236k|{
  723|   236k|    warn(input_.getLastOffset(), msg);
  724|   236k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|   124k|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 124k, False: 0]
  ------------------
   27|   124k|    {
   28|   124k|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 124k, False: 0]
  ------------------
   29|   124k|            objects->inParse(true);
   30|   124k|        }
   31|   124k|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|   124k|    {
   41|   124k|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 124k, False: 0]
  ------------------
   42|   124k|            objects->inParse(false);
   43|   124k|        }
   44|   124k|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   233k|    {
   36|   233k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   233k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|    413|{
  603|    413|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    413|    obj->setDescription(context_, description_, start_);
  605|    413|    return {obj};
  606|    413|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|  8.00k|{
  603|  8.00k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  8.00k|    obj->setDescription(context_, description_, start_);
  605|  8.00k|    return {obj};
  606|  8.00k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.97k|{
  603|  1.97k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.97k|    obj->setDescription(context_, description_, start_);
  605|  1.97k|    return {obj};
  606|  1.97k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.88k|{
  603|  1.88k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.88k|    obj->setDescription(context_, description_, start_);
  605|  1.88k|    return {obj};
  606|  1.88k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  9.21k|{
  603|  9.21k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  9.21k|    obj->setDescription(context_, description_, start_);
  605|  9.21k|    return {obj};
  606|  9.21k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    153|{
  603|    153|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    153|    obj->setDescription(context_, description_, start_);
  605|    153|    return {obj};
  606|    153|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_BoolJbEEEvDpOT0_:
  586|  9.22k|{
  587|  9.22k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 6.89k, False: 2.33k]
  |  Branch (587:66): [True: 1.39k, False: 945]
  ------------------
  588|  9.22k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 70, False: 9.15k]
  |  Branch (588:42): [True: 0, False: 9.15k]
  ------------------
  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|  9.22k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  9.22k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  9.22k|    add(std::move(obj));
  597|  9.22k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  38.5k|{
  587|  38.5k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 10.3k, False: 28.1k]
  |  Branch (587:66): [True: 26.7k, False: 1.41k]
  ------------------
  588|  38.5k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 115, False: 38.4k]
  |  Branch (588:42): [True: 0, False: 38.4k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    115|        max_bad_count_ = 1;
  592|    115|        check_too_many_bad_tokens(); // always throws Error()
  593|    115|    }
  594|  38.5k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  38.5k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  38.5k|    add(std::move(obj));
  597|  38.5k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  5.20M|{
  587|  5.20M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 2.18M, False: 3.01M]
  |  Branch (587:66): [True: 350k, False: 2.66M]
  ------------------
  588|  5.20M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 286, False: 5.20M]
  |  Branch (588:42): [True: 0, False: 5.20M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    286|        max_bad_count_ = 1;
  592|    286|        check_too_many_bad_tokens(); // always throws Error()
  593|    286|    }
  594|  5.20M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  5.20M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  5.20M|    add(std::move(obj));
  597|  5.20M|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   118k|{
  587|   118k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 99.0k, False: 19.4k]
  |  Branch (587:66): [True: 16.1k, False: 3.33k]
  ------------------
  588|   118k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 98, False: 118k]
  |  Branch (588:42): [True: 0, False: 118k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     98|        max_bad_count_ = 1;
  592|     98|        check_too_many_bad_tokens(); // always throws Error()
  593|     98|    }
  594|   118k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   118k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   118k|    add(std::move(obj));
  597|   118k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  16.0k|{
  587|  16.0k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 11.0k, False: 5.04k]
  |  Branch (587:66): [True: 5.01k, False: 37]
  ------------------
  588|  16.0k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 10, False: 16.0k]
  |  Branch (588:42): [True: 0, False: 16.0k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     10|        max_bad_count_ = 1;
  592|     10|        check_too_many_bad_tokens(); // always throws Error()
  593|     10|    }
  594|  16.0k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  16.0k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  16.0k|    add(std::move(obj));
  597|  16.0k|}

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

_ZN4qpdf9Tokenizer5resetEv:
   85|  18.8M|{
   86|  18.8M|    state = st_before_token;
   87|  18.8M|    type = tt::tt_bad;
   88|  18.8M|    val.clear();
   89|  18.8M|    raw_val.clear();
   90|  18.8M|    error_message = "";
   91|  18.8M|    before_token = true;
   92|  18.8M|    in_token = false;
   93|  18.8M|    char_to_unread = '\0';
   94|  18.8M|    inline_image_bytes = 0;
   95|  18.8M|    string_depth = 0;
   96|  18.8M|    bad = false;
   97|  18.8M|}
_ZN4qpdf9TokenizerC2Ev:
  119|  20.1k|{
  120|  20.1k|    reset();
  121|  20.1k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  20.1k|{
  132|  20.1k|    allow_eof = true;
  133|  20.1k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  39.2M|{
  150|  39.2M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 12.8M, False: 26.3M]
  |  Branch (150:27): [True: 9.93M, False: 16.4M]
  ------------------
  151|  39.2M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   135M|{
  156|   135M|    return is_delimiter(ch);
  157|   135M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  16.9k|{
  168|  16.9k|    handleCharacter(ch);
  169|       |
  170|  16.9k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 16.9k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  16.9k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   269M|{
  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|   269M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 269M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|      0|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 0, False: 269M]
  ------------------
  187|      0|        inSpace(ch);
  188|      0|        return;
  189|       |
  190|  1.24M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 1.24M, False: 267M]
  ------------------
  191|  1.24M|        inComment(ch);
  192|  1.24M|        return;
  193|       |
  194|   231k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 231k, False: 268M]
  ------------------
  195|   231k|        inLt(ch);
  196|   231k|        return;
  197|       |
  198|   157k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 157k, False: 269M]
  ------------------
  199|   157k|        inGt(ch);
  200|   157k|        return;
  201|       |
  202|  76.9M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 76.9M, False: 192M]
  ------------------
  203|  76.9M|        inString(ch);
  204|  76.9M|        return;
  205|       |
  206|  82.8M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 82.8M, False: 186M]
  ------------------
  207|  82.8M|        inName(ch);
  208|  82.8M|        return;
  209|       |
  210|  23.9M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 23.9M, False: 245M]
  ------------------
  211|  23.9M|        inNumber(ch);
  212|  23.9M|        return;
  213|       |
  214|   145k|    case st_real:
  ------------------
  |  Branch (214:5): [True: 145k, False: 269M]
  ------------------
  215|   145k|        inReal(ch);
  216|   145k|        return;
  217|       |
  218|   136k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 136k, False: 269M]
  ------------------
  219|   136k|        inStringAfterCR(ch);
  220|   136k|        return;
  221|       |
  222|  23.1k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 23.1k, False: 269M]
  ------------------
  223|  23.1k|        inStringEscape(ch);
  224|  23.1k|        return;
  225|       |
  226|  6.22k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 6.22k, False: 269M]
  ------------------
  227|  6.22k|        inCharCode(ch);
  228|  6.22k|        return;
  229|       |
  230|  43.9M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 43.9M, False: 225M]
  ------------------
  231|  43.9M|        inLiteral(ch);
  232|  43.9M|        return;
  233|       |
  234|      0|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 0, False: 269M]
  ------------------
  235|      0|        inInlineImage(ch);
  236|      0|        return;
  237|       |
  238|  2.17M|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 2.17M, False: 267M]
  ------------------
  239|  2.17M|        inHexstring(ch);
  240|  2.17M|        return;
  241|       |
  242|  84.1k|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 84.1k, False: 269M]
  ------------------
  243|  84.1k|        inHexstring2nd(ch);
  244|  84.1k|        return;
  245|       |
  246|  21.8k|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 21.8k, False: 269M]
  ------------------
  247|  21.8k|        inNameHex1(ch);
  248|  21.8k|        return;
  249|       |
  250|  8.42k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 8.42k, False: 269M]
  ------------------
  251|  8.42k|        inNameHex2(ch);
  252|  8.42k|        return;
  253|       |
  254|  20.6k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 20.6k, False: 269M]
  ------------------
  255|  20.6k|        inSign(ch);
  256|  20.6k|        return;
  257|       |
  258|  9.25k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 9.25k, False: 269M]
  ------------------
  259|  9.25k|        inDecimal(ch);
  260|  9.25k|        return;
  261|       |
  262|  37.1M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 37.1M, False: 232M]
  ------------------
  263|  37.1M|        inBeforeToken(ch);
  264|  37.1M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 269M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 269M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   269M|    }
  273|   269M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  37.1M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  37.1M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 20.6M, False: 16.4M]
  ------------------
  287|  20.6M|        before_token = !include_ignorable;
  288|  20.6M|        in_token = include_ignorable;
  289|  20.6M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 0, False: 20.6M]
  ------------------
  290|      0|            state = st_in_space;
  291|      0|        }
  292|  20.6M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 17.1k, False: 16.4M]
  ------------------
  293|  17.1k|        before_token = !include_ignorable;
  294|  17.1k|        in_token = include_ignorable;
  295|  17.1k|        state = st_in_comment;
  296|  16.4M|    } else {
  297|  16.4M|        before_token = false;
  298|  16.4M|        in_token = true;
  299|  16.4M|        inTop(ch);
  300|  16.4M|    }
  301|  37.1M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  16.4M|{
  306|  16.4M|    switch (ch) {
  307|   123k|    case '(':
  ------------------
  |  Branch (307:5): [True: 123k, False: 16.3M]
  ------------------
  308|   123k|        string_depth = 1;
  309|   123k|        state = st_in_string;
  310|   123k|        return;
  311|       |
  312|   231k|    case '<':
  ------------------
  |  Branch (312:5): [True: 231k, False: 16.2M]
  ------------------
  313|   231k|        state = st_lt;
  314|   231k|        return;
  315|       |
  316|   157k|    case '>':
  ------------------
  |  Branch (316:5): [True: 157k, False: 16.2M]
  ------------------
  317|   157k|        state = st_gt;
  318|   157k|        return;
  319|       |
  320|  19.0k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 19.0k, False: 16.4M]
  ------------------
  321|  19.0k|        type = tt::tt_bad;
  322|  19.0k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|  19.0k|        error_message = "unexpected )";
  324|  19.0k|        state = st_token_ready;
  325|  19.0k|        return;
  326|       |
  327|   170k|    case '[':
  ------------------
  |  Branch (327:5): [True: 170k, False: 16.2M]
  ------------------
  328|   170k|        type = tt::tt_array_open;
  329|   170k|        state = st_token_ready;
  330|   170k|        return;
  331|       |
  332|  75.1k|    case ']':
  ------------------
  |  Branch (332:5): [True: 75.1k, False: 16.3M]
  ------------------
  333|  75.1k|        type = tt::tt_array_close;
  334|  75.1k|        state = st_token_ready;
  335|  75.1k|        return;
  336|       |
  337|  3.01k|    case '{':
  ------------------
  |  Branch (337:5): [True: 3.01k, False: 16.4M]
  ------------------
  338|  3.01k|        type = tt::tt_brace_open;
  339|  3.01k|        state = st_token_ready;
  340|  3.01k|        return;
  341|       |
  342|  3.24k|    case '}':
  ------------------
  |  Branch (342:5): [True: 3.24k, False: 16.4M]
  ------------------
  343|  3.24k|        type = tt::tt_brace_close;
  344|  3.24k|        state = st_token_ready;
  345|  3.24k|        return;
  346|       |
  347|  5.74M|    case '/':
  ------------------
  |  Branch (347:5): [True: 5.74M, False: 10.6M]
  ------------------
  348|  5.74M|        state = st_name;
  349|  5.74M|        val += ch;
  350|  5.74M|        return;
  351|       |
  352|   633k|    case '0':
  ------------------
  |  Branch (352:5): [True: 633k, False: 15.7M]
  ------------------
  353|  2.01M|    case '1':
  ------------------
  |  Branch (353:5): [True: 1.38M, False: 15.0M]
  ------------------
  354|  2.65M|    case '2':
  ------------------
  |  Branch (354:5): [True: 642k, False: 15.7M]
  ------------------
  355|  3.05M|    case '3':
  ------------------
  |  Branch (355:5): [True: 393k, False: 16.0M]
  ------------------
  356|  3.59M|    case '4':
  ------------------
  |  Branch (356:5): [True: 547k, False: 15.8M]
  ------------------
  357|  4.42M|    case '5':
  ------------------
  |  Branch (357:5): [True: 824k, False: 15.6M]
  ------------------
  358|  6.18M|    case '6':
  ------------------
  |  Branch (358:5): [True: 1.76M, False: 14.6M]
  ------------------
  359|  7.78M|    case '7':
  ------------------
  |  Branch (359:5): [True: 1.59M, False: 14.8M]
  ------------------
  360|  8.19M|    case '8':
  ------------------
  |  Branch (360:5): [True: 404k, False: 16.0M]
  ------------------
  361|  8.32M|    case '9':
  ------------------
  |  Branch (361:5): [True: 134k, False: 16.2M]
  ------------------
  362|  8.32M|        state = st_number;
  363|  8.32M|        return;
  364|       |
  365|  2.40k|    case '+':
  ------------------
  |  Branch (365:5): [True: 2.40k, False: 16.4M]
  ------------------
  366|  20.6k|    case '-':
  ------------------
  |  Branch (366:5): [True: 18.2k, False: 16.4M]
  ------------------
  367|  20.6k|        state = st_sign;
  368|  20.6k|        return;
  369|       |
  370|  8.94k|    case '.':
  ------------------
  |  Branch (370:5): [True: 8.94k, False: 16.4M]
  ------------------
  371|  8.94k|        state = st_decimal;
  372|  8.94k|        return;
  373|       |
  374|  1.54M|    default:
  ------------------
  |  Branch (374:5): [True: 1.54M, False: 14.8M]
  ------------------
  375|  1.54M|        state = st_literal;
  376|  1.54M|        return;
  377|  16.4M|    }
  378|  16.4M|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  1.24M|{
  395|  1.24M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 3.83k, False: 1.23M]
  |  Branch (395:25): [True: 12.3k, False: 1.22M]
  ------------------
  396|  16.1k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 0, False: 16.1k]
  ------------------
  397|      0|            type = tt::tt_comment;
  398|      0|            in_token = false;
  399|      0|            char_to_unread = ch;
  400|      0|            state = st_token_ready;
  401|  16.1k|        } else {
  402|  16.1k|            state = st_before_token;
  403|  16.1k|        }
  404|  16.1k|    }
  405|  1.24M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|  77.0M|{
  410|  77.0M|    switch (ch) {
  411|  23.2k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 23.2k, False: 77.0M]
  ------------------
  412|  23.2k|        state = st_string_escape;
  413|  23.2k|        return;
  414|       |
  415|  74.7k|    case '(':
  ------------------
  |  Branch (415:5): [True: 74.7k, False: 76.9M]
  ------------------
  416|  74.7k|        val += ch;
  417|  74.7k|        ++string_depth;
  418|  74.7k|        return;
  419|       |
  420|   166k|    case ')':
  ------------------
  |  Branch (420:5): [True: 166k, False: 76.8M]
  ------------------
  421|   166k|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 117k, False: 48.7k]
  ------------------
  422|   117k|            type = tt::tt_string;
  423|   117k|            state = st_token_ready;
  424|   117k|            return;
  425|   117k|        }
  426|       |
  427|  48.7k|        val += ch;
  428|  48.7k|        return;
  429|       |
  430|   136k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 136k, False: 76.9M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   136k|        val += '\n';
  433|   136k|        state = st_string_after_cr;
  434|   136k|        return;
  435|       |
  436|   303k|    case '\n':
  ------------------
  |  Branch (436:5): [True: 303k, False: 76.7M]
  ------------------
  437|   303k|        val += ch;
  438|   303k|        return;
  439|       |
  440|  76.3M|    default:
  ------------------
  |  Branch (440:5): [True: 76.3M, False: 705k]
  ------------------
  441|  76.3M|        val += ch;
  442|  76.3M|        return;
  443|  77.0M|    }
  444|  77.0M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|  82.9M|{
  449|  82.9M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 5.73M, False: 77.1M]
  ------------------
  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|  5.73M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 158, False: 5.73M]
  ------------------
  457|  5.73M|        in_token = false;
  458|  5.73M|        char_to_unread = ch;
  459|  5.73M|        state = st_token_ready;
  460|  77.1M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 21.8k, False: 77.1M]
  ------------------
  461|  21.8k|        char_code = 0;
  462|  21.8k|        state = st_name_hex1;
  463|  77.1M|    } else {
  464|  77.1M|        val += ch;
  465|  77.1M|    }
  466|  82.9M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  21.8k|{
  471|  21.8k|    hex_char = ch;
  472|       |
  473|  21.8k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 8.43k, False: 13.3k]
  ------------------
  474|  8.43k|        char_code = int(hval) << 4;
  475|  8.43k|        state = st_name_hex2;
  476|  13.3k|    } else {
  477|  13.3k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  13.3k|        error_message = "name with stray # will not work with PDF >= 1.2";
  479|       |        // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
  480|  13.3k|        val += '\0';
  481|  13.3k|        state = st_name;
  482|  13.3k|        inName(ch);
  483|  13.3k|    }
  484|  21.8k|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  8.42k|{
  489|  8.42k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 1.14k, False: 7.28k]
  ------------------
  490|  1.14k|        char_code |= int(hval);
  491|  7.28k|    } else {
  492|  7.28k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  7.28k|        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.28k|        val += '\0';
  496|  7.28k|        val += hex_char;
  497|  7.28k|        state = st_name;
  498|  7.28k|        inName(ch);
  499|  7.28k|        return;
  500|  7.28k|    }
  501|  1.14k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 555, False: 587]
  ------------------
  502|    555|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|    555|        error_message = "null character not allowed in name token";
  504|    555|        val += "#00";
  505|    555|        state = st_name;
  506|    555|        bad = true;
  507|    587|    } else {
  508|    587|        val += char(char_code);
  509|    587|        state = st_name;
  510|    587|    }
  511|  1.14k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|  20.6k|{
  516|  20.6k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 14.6k, False: 5.98k]
  ------------------
  517|  14.6k|        state = st_number;
  518|  14.6k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 308, False: 5.67k]
  ------------------
  519|    308|        state = st_decimal;
  520|  5.67k|    } else {
  521|  5.67k|        state = st_literal;
  522|  5.67k|        inLiteral(ch);
  523|  5.67k|    }
  524|  20.6k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|  9.25k|{
  529|  9.25k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 6.25k, False: 2.99k]
  ------------------
  530|  6.25k|        state = st_real;
  531|  6.25k|    } else {
  532|  2.99k|        state = st_literal;
  533|  2.99k|        inLiteral(ch);
  534|  2.99k|    }
  535|  9.25k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  23.9M|{
  540|  23.9M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 15.6M, False: 8.29M]
  ------------------
  541|  15.6M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 40.5k, False: 8.25M]
  ------------------
  542|  40.5k|        state = st_real;
  543|  8.25M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 8.21M, False: 37.0k]
  ------------------
  544|  8.21M|        type = tt::tt_integer;
  545|  8.21M|        state = st_token_ready;
  546|  8.21M|        in_token = false;
  547|  8.21M|        char_to_unread = ch;
  548|  8.21M|    } else {
  549|  37.0k|        state = st_literal;
  550|  37.0k|    }
  551|  23.9M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|   145k|{
  556|   145k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 98.4k, False: 46.7k]
  ------------------
  557|  98.4k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 45.2k, False: 1.59k]
  ------------------
  558|  45.2k|        type = tt::tt_real;
  559|  45.2k|        state = st_token_ready;
  560|  45.2k|        in_token = false;
  561|  45.2k|        char_to_unread = ch;
  562|  45.2k|    } else {
  563|  1.59k|        state = st_literal;
  564|  1.59k|    }
  565|   145k|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|  23.1k|{
  569|  23.1k|    state = st_in_string;
  570|  23.1k|    switch (ch) {
  571|  1.56k|    case '0':
  ------------------
  |  Branch (571:5): [True: 1.56k, False: 21.6k]
  ------------------
  572|  2.01k|    case '1':
  ------------------
  |  Branch (572:5): [True: 451, False: 22.7k]
  ------------------
  573|  2.69k|    case '2':
  ------------------
  |  Branch (573:5): [True: 677, False: 22.5k]
  ------------------
  574|  3.58k|    case '3':
  ------------------
  |  Branch (574:5): [True: 895, False: 22.3k]
  ------------------
  575|  4.16k|    case '4':
  ------------------
  |  Branch (575:5): [True: 576, False: 22.6k]
  ------------------
  576|  4.48k|    case '5':
  ------------------
  |  Branch (576:5): [True: 317, False: 22.8k]
  ------------------
  577|  4.85k|    case '6':
  ------------------
  |  Branch (577:5): [True: 372, False: 22.8k]
  ------------------
  578|  5.19k|    case '7':
  ------------------
  |  Branch (578:5): [True: 345, False: 22.8k]
  ------------------
  579|  5.19k|        state = st_char_code;
  580|  5.19k|        char_code = 0;
  581|  5.19k|        digit_count = 0;
  582|  5.19k|        inCharCode(ch);
  583|  5.19k|        return;
  584|       |
  585|  3.56k|    case 'n':
  ------------------
  |  Branch (585:5): [True: 3.56k, False: 19.6k]
  ------------------
  586|  3.56k|        val += '\n';
  587|  3.56k|        return;
  588|       |
  589|    853|    case 'r':
  ------------------
  |  Branch (589:5): [True: 853, False: 22.3k]
  ------------------
  590|    853|        val += '\r';
  591|    853|        return;
  592|       |
  593|    240|    case 't':
  ------------------
  |  Branch (593:5): [True: 240, False: 22.9k]
  ------------------
  594|    240|        val += '\t';
  595|    240|        return;
  596|       |
  597|    223|    case 'b':
  ------------------
  |  Branch (597:5): [True: 223, False: 22.9k]
  ------------------
  598|    223|        val += '\b';
  599|    223|        return;
  600|       |
  601|    330|    case 'f':
  ------------------
  |  Branch (601:5): [True: 330, False: 22.8k]
  ------------------
  602|    330|        val += '\f';
  603|    330|        return;
  604|       |
  605|    238|    case '\n':
  ------------------
  |  Branch (605:5): [True: 238, False: 22.9k]
  ------------------
  606|    238|        return;
  607|       |
  608|    281|    case '\r':
  ------------------
  |  Branch (608:5): [True: 281, False: 22.9k]
  ------------------
  609|    281|        state = st_string_after_cr;
  610|    281|        return;
  611|       |
  612|  12.2k|    default:
  ------------------
  |  Branch (612:5): [True: 12.2k, False: 10.9k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|  12.2k|        val += ch;
  615|  12.2k|        return;
  616|  23.1k|    }
  617|  23.1k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   136k|{
  622|   136k|    state = st_in_string;
  623|   136k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 63.6k, False: 73.1k]
  ------------------
  624|  63.6k|        inString(ch);
  625|  63.6k|    }
  626|   136k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   231k|{
  631|   231k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 204k, False: 26.2k]
  ------------------
  632|   204k|        type = tt::tt_dict_open;
  633|   204k|        state = st_token_ready;
  634|   204k|        return;
  635|   204k|    }
  636|       |
  637|  26.2k|    state = st_in_hexstring;
  638|  26.2k|    inHexstring(ch);
  639|  26.2k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   157k|{
  644|   157k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 146k, False: 11.2k]
  ------------------
  645|   146k|        type = tt::tt_dict_close;
  646|   146k|        state = st_token_ready;
  647|   146k|    } else {
  648|  11.2k|        type = tt::tt_bad;
  649|  11.2k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  11.2k|        error_message = "unexpected >";
  651|  11.2k|        in_token = false;
  652|  11.2k|        char_to_unread = ch;
  653|  11.2k|        state = st_token_ready;
  654|  11.2k|    }
  655|   157k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|  43.9M|{
  660|  43.9M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 1.50M, False: 42.4M]
  ------------------
  661|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  662|       |        // the whitespace character even though it is ignored since it may be the newline after a
  663|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  664|       |        // though not on any files in the test suite as of this writing.
  665|       |
  666|  1.50M|        in_token = false;
  667|  1.50M|        char_to_unread = ch;
  668|  1.50M|        state = st_token_ready;
  669|  1.50M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 9.35k, False: 1.49M]
  |  Branch (669:39): [True: 1.44k, False: 1.48M]
  ------------------
  670|  1.50M|            ? tt::tt_bool
  671|  1.50M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 80.1k, False: 1.40M]
  ------------------
  672|  1.50M|    }
  673|  43.9M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|  2.20M|{
  678|  2.20M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 78.5k, False: 2.12M]
  ------------------
  679|  78.5k|        char_code = int(hval) << 4;
  680|  78.5k|        state = st_in_hexstring_2nd;
  681|       |
  682|  2.12M|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 7.56k, False: 2.11M]
  ------------------
  683|  7.56k|        type = tt::tt_string;
  684|  7.56k|        state = st_token_ready;
  685|       |
  686|  2.11M|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 2.10M, False: 11.5k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  2.10M|    } else {
  690|  11.5k|        type = tt::tt_bad;
  691|  11.5k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  11.5k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  11.5k|        state = st_token_ready;
  694|  11.5k|    }
  695|  2.20M|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|  84.1k|{
  700|  84.1k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 71.5k, False: 12.5k]
  ------------------
  701|  71.5k|        val += char(char_code) | hval;
  702|  71.5k|        state = st_in_hexstring;
  703|       |
  704|  71.5k|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 4.15k, False: 8.42k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  4.15k|        val += char(char_code);
  707|  4.15k|        type = tt::tt_string;
  708|  4.15k|        state = st_token_ready;
  709|       |
  710|  8.42k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 5.81k, False: 2.60k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  5.81k|    } else {
  714|  2.60k|        type = tt::tt_bad;
  715|  2.60k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  2.60k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  2.60k|        state = st_token_ready;
  718|  2.60k|    }
  719|  84.1k|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|  11.4k|{
  724|  11.4k|    bool handled = false;
  725|  11.4k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 10.3k, False: 1.08k]
  |  Branch (725:24): [True: 6.70k, False: 3.62k]
  ------------------
  726|  6.70k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|  6.70k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 6.39k, False: 312]
  ------------------
  728|  6.39k|            return;
  729|  6.39k|        }
  730|    312|        handled = true;
  731|    312|    }
  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.02k|    val += char(char_code % 256);
  735|  5.02k|    state = st_in_string;
  736|  5.02k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 4.71k, False: 312]
  ------------------
  737|  4.71k|        inString(ch);
  738|  4.71k|    }
  739|  5.02k|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|  35.9k|{
  761|  35.9k|    switch (state) {
  762|  1.78k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 1.78k, False: 34.1k]
  ------------------
  763|  1.92k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 146, False: 35.7k]
  ------------------
  764|  2.06k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 139, False: 35.7k]
  ------------------
  765|  7.63k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 5.56k, False: 30.3k]
  ------------------
  766|  7.88k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 250, False: 35.6k]
  ------------------
  767|  8.07k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 189, False: 35.7k]
  ------------------
  768|  8.21k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 147, False: 35.7k]
  ------------------
  769|  16.9k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 8.71k, False: 27.2k]
  ------------------
  770|  16.9k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  16.9k|        presentCharacter('\f');
  773|  16.9k|        in_token = true;
  774|  16.9k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 35.9k]
  ------------------
  777|  14.7k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 14.7k, False: 21.1k]
  ------------------
  778|  14.7k|        type = tt::tt_eof;
  779|  14.7k|        break;
  780|       |
  781|      0|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 0, False: 35.9k]
  ------------------
  782|      0|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  ------------------
  783|      0|        break;
  784|       |
  785|    958|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 958, False: 34.9k]
  ------------------
  786|    958|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 0, False: 958]
  ------------------
  787|    958|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 35.9k]
  ------------------
  790|      0|        break;
  791|       |
  792|  3.27k|    default:
  ------------------
  |  Branch (792:5): [True: 3.27k, False: 32.6k]
  ------------------
  793|  3.27k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  3.27k|        type = tt::tt_bad;
  795|  3.27k|        error_message = "EOF while reading token";
  796|  35.9k|    }
  797|  35.9k|    state = st_token_ready;
  798|  35.9k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  2.34M|{
  917|  2.34M|    bool ready = (state == st_token_ready);
  918|  2.34M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 2.06M, False: 281k]
  |  Branch (918:32): [True: 2.05M, False: 8.18k]
  ------------------
  919|  2.34M|    ch = char_to_unread;
  920|  2.34M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 2.34M, False: 0]
  ------------------
  921|  2.34M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 118k, False: 2.22M]
  |  Branch (921:43): [True: 2.38k, False: 2.22M]
  ------------------
  922|  2.34M|            ? Token(type, raw_val, raw_val, error_message)
  923|  2.34M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  2.34M|        reset();
  926|  2.34M|    }
  927|  2.34M|    return ready;
  928|  2.34M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  2.34M|{
  959|  2.34M|    nextToken(input, context, max_len);
  960|       |
  961|  2.34M|    Token token;
  962|  2.34M|    bool unread_char;
  963|  2.34M|    char char_to_unread;
  964|  2.34M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  2.34M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 171k, False: 2.17M]
  ------------------
  967|   171k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 171k, False: 0]
  ------------------
  968|   171k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   171k|        } 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|   171k|    }
  978|  2.34M|    return token;
  979|  2.34M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  16.4M|{
  984|  16.4M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 16.4M, False: 0]
  ------------------
  985|  16.4M|        reset();
  986|  16.4M|    }
  987|  16.4M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   285M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 269M, False: 16.4M]
  ------------------
  990|   269M|        char ch;
  991|   269M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 35.9k, False: 269M]
  ------------------
  992|  35.9k|            presentEOF();
  993|       |
  994|  35.9k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 14.7k, False: 21.1k]
  |  Branch (994:41): [True: 0, False: 14.7k]
  ------------------
  995|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  996|       |                // case is not exercised.
  997|      0|                type = tt::tt_bad;
  998|      0|                error_message = "unexpected EOF";
  999|      0|                offset = input.getLastOffset();
 1000|      0|            }
 1001|   269M|        } else {
 1002|   269M|            handleCharacter(ch);
 1003|   269M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 21.9M, False: 247M]
  ------------------
 1004|  21.9M|                ++offset;
 1005|  21.9M|            }
 1006|   269M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 231M, False: 37.4M]
  ------------------
 1007|   231M|                raw_val += ch;
 1008|   231M|            }
 1009|   269M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 11.3M, False: 257M]
  |  Branch (1009:28): [True: 152k, False: 11.2M]
  |  Branch (1009:61): [True: 152k, False: 891]
  ------------------
 1010|       |                // terminate this token now
 1011|   152k|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|   152k|                type = tt::tt_bad;
 1013|   152k|                state = st_token_ready;
 1014|   152k|                error_message = "exceeded allowable length while reading token";
 1015|   152k|            }
 1016|   269M|        }
 1017|   269M|    }
 1018|       |
 1019|  16.4M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 15.5M, False: 938k]
  |  Branch (1019:35): [True: 15.4M, False: 15.7k]
  ------------------
 1020|       |
 1021|  16.4M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 16.4M, False: 14.7k]
  ------------------
 1022|  16.4M|        input.setLastOffset(offset);
 1023|  16.4M|    }
 1024|       |
 1025|  16.4M|    return error_message.empty();
 1026|  16.4M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   135M|{
   26|   135M|    return (
   27|   135M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 8.66M, False: 126M]
  |  Branch (27:22): [True: 745k, False: 125M]
  |  Branch (27:36): [True: 5.34M, False: 120M]
  |  Branch (27:49): [True: 24.0k, False: 120M]
  |  Branch (27:62): [True: 39.9k, False: 120M]
  |  Branch (27:75): [True: 6.84k, False: 120M]
  |  Branch (27:88): [True: 6.81k, False: 120M]
  ------------------
   28|   120M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 90.6k, False: 120M]
  |  Branch (28:22): [True: 69.7k, False: 120M]
  |  Branch (28:35): [True: 83.3k, False: 120M]
  |  Branch (28:48): [True: 53.9k, False: 120M]
  |  Branch (28:61): [True: 10.3k, False: 120M]
  |  Branch (28:74): [True: 28.1k, False: 119M]
  |  Branch (28:88): [True: 162k, False: 119M]
  ------------------
   29|   119M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 11.2k, False: 119M]
  |  Branch (29:23): [True: 52.1k, False: 119M]
  |  Branch (29:37): [True: 103k, False: 119M]
  ------------------
   30|   135M|}

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|    893|{
   40|    893|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 596, False: 297]
  ------------------
   41|    596|        sp = std::make_unique<Sparse>();
   42|  3.46M|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 3.46M, False: 596]
  ------------------
   43|  3.46M|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 3.38M, False: 75.4k]
  |  Branch (43:54): [True: 211, False: 75.2k]
  ------------------
   44|  3.38M|                sp->elements[sp->size] = std::move(item);
   45|  3.38M|            }
   46|  3.46M|            ++sp->size;
   47|  3.46M|        }
   48|    596|    } else {
   49|    297|        elements = std::move(v);
   50|    297|    }
   51|    893|}
_ZNK4qpdf5Array5arrayEv:
   55|   114k|{
   56|   114k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 114k, False: 0]
  ------------------
   57|   114k|        return a;
   58|   114k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|   114k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  2.94k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  2.94k|{
   67|  2.94k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  7.55k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  7.55k|{
   72|  7.55k|}
_ZN4qpdf5Array5emptyEv:
   76|  1.54k|{
   77|  1.54k|    return Array(std::vector<QPDFObjectHandle>());
   78|  1.54k|}
_ZN4qpdf5Array5beginEv:
   82|  33.0k|{
   83|  33.0k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 16.6k, False: 16.4k]
  ------------------
   84|  16.6k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 16.1k, False: 437]
  ------------------
   85|  16.1k|            return a->elements.begin();
   86|  16.1k|        }
   87|    437|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 437, False: 0]
  ------------------
   88|    437|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    437|        }
   90|    437|        return sp_elements->begin();
   91|  16.6k|    }
   92|  16.4k|    return {};
   93|  33.0k|}
_ZN4qpdf5Array3endEv:
   97|  33.0k|{
   98|  33.0k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 16.6k, False: 16.4k]
  ------------------
   99|  16.6k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 16.1k, False: 437]
  ------------------
  100|  16.1k|            return a->elements.end();
  101|  16.1k|        }
  102|    437|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 437]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    437|        return sp_elements->end();
  106|  16.6k|    }
  107|  16.4k|    return {};
  108|  33.0k|}
_ZNK4qpdf5Array4sizeEv:
  178|   317k|{
  179|   317k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 272k, False: 45.3k]
  ------------------
  180|   272k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 1.48k, False: 270k]
  ------------------
  181|   272k|    }
  182|  45.3k|    return 0;
  183|   317k|}
_ZNK4qpdf5ArrayixEm:
  187|   623k|{
  188|   623k|    static const QPDFObjectHandle null_obj;
  189|   623k|    auto a = as<QPDF_Array>();
  190|   623k|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 950, False: 622k]
  ------------------
  191|    950|        return null_obj;
  192|    950|    }
  193|   622k|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 1.02k, False: 621k]
  ------------------
  194|  1.02k|        auto const& iter = a->sp->elements.find(n);
  195|  1.02k|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 152, False: 870]
  ------------------
  196|  1.02k|    }
  197|   621k|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 1.59k, False: 619k]
  ------------------
  198|   622k|}
_ZNK4qpdf5ArrayixEi:
  202|   618k|{
  203|   618k|    static const QPDFObjectHandle null_obj;
  204|   618k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 2.26k, False: 615k]
  ------------------
  205|  2.26k|        return null_obj;
  206|  2.26k|    }
  207|   615k|    return (*this)[static_cast<size_t>(n)];
  208|   618k|}
_ZNK4qpdf5Array3getEm:
  212|    154|{
  213|    154|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 154]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|    154|    auto a = array();
  217|    154|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 154, False: 0]
  ------------------
  218|    154|        return a->elements[n];
  219|    154|    }
  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|    154|}
_ZNK4qpdf5Array3getEi:
  226|    154|{
  227|    154|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 154]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|    154|    return get(to_s(n));
  231|    154|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  10.5k|{
  236|  10.5k|    auto a = array();
  237|  10.5k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 475, False: 10.0k]
  ------------------
  238|    475|        std::vector<QPDFObjectHandle> v;
  239|    475|        v.reserve(size());
  240|   537k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 537k, False: 475]
  ------------------
  241|   537k|            v.resize(item.first, null_oh);
  242|   537k|            v.emplace_back(item.second);
  243|   537k|        }
  244|    475|        v.resize(size(), null_oh);
  245|    475|        return v;
  246|  10.0k|    } else {
  247|  10.0k|        return a->elements;
  248|  10.0k|    }
  249|  10.5k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|     13|{
  254|     13|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 13]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|     13|    auto a = array();
  258|     13|    checkOwnership(oh);
  259|     13|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 0, False: 13]
  ------------------
  260|      0|        a->sp->elements[at] = oh;
  261|     13|    } else {
  262|     13|        a->elements[at] = oh;
  263|     13|    }
  264|     13|    return true;
  265|     13|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|     13|{
  270|     13|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 13]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|     13|    return set(to_s(at), oh);
  274|     13|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  32.5k|{
  291|  32.5k|    auto a = array();
  292|  32.5k|    size_t sz = size();
  293|  32.5k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 32.5k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  32.5k|    checkOwnership(item);
  297|  32.5k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 32.5k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  32.5k|        push_back(item);
  300|  32.5k|        return true;
  301|  32.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|  32.5k|{
  325|  32.5k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 32.5k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  32.5k|    return insert(to_s(at_i), item);
  329|  32.5k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|  51.8k|{
  334|  51.8k|    auto a = array();
  335|  51.8k|    checkOwnership(item);
  336|  51.8k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 0, False: 51.8k]
  ------------------
  337|      0|        a->sp->elements[(a->sp->size)++] = item;
  338|  51.8k|    } else {
  339|  51.8k|        a->elements.emplace_back(item);
  340|  51.8k|    }
  341|  51.8k|}
_ZN4qpdf5Array5eraseEm:
  345|  19.0k|{
  346|  19.0k|    auto a = array();
  347|  19.0k|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 19.0k]
  ------------------
  348|      0|        return false;
  349|      0|    }
  350|  19.0k|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 19.0k, False: 0]
  ------------------
  351|  19.0k|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|  19.0k|        return true;
  353|  19.0k|    }
  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|  19.0k|}
_ZN4qpdf5Array5eraseEi:
  373|  19.0k|{
  374|  19.0k|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 19.0k]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|  19.0k|    return erase(to_s(at_i));
  378|  19.0k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|  27.4k|{
  394|  27.4k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 27.4k, False: 0]
  ------------------
  395|  27.4k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 27.4k, False: 49]
  ------------------
  396|  27.4k|            return result;
  397|  27.4k|        }
  398|     49|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 49, False: 0]
  |  Branch (398:23): [True: 49, False: 0]
  ------------------
  399|       |            // sparse array null
  400|     49|            return newNull();
  401|     49|        }
  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.4k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  16.2k|{
  413|  16.2k|    Array array(*this);
  414|  19.6k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 19.6k, False: 16.1k]
  ------------------
  415|  19.6k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 134, False: 19.5k]
  ------------------
  416|    134|            return false;
  417|    134|        }
  418|  19.6k|    }
  419|  16.1k|    return array.size() == 4;
  420|  16.2k|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  10.0k|{
  473|  10.0k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 10.0k, False: 0]
  ------------------
  474|  10.0k|        return array.getAsVector();
  475|  10.0k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  10.0k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|  25.5k|{
  567|  25.5k|    switch (resolved_type_code()) {
  568|  12.2k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 12.2k, False: 13.2k]
  ------------------
  569|  12.2k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 25.5k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 25.5k]
  ------------------
  572|  8.10k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 8.10k, False: 17.4k]
  ------------------
  573|  8.10k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 25.5k]
  ------------------
  574|  8.10k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 25.5k]
  ------------------
  575|  8.10k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 25.5k]
  ------------------
  576|  8.10k|        return 0;
  577|     37|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 37, False: 25.5k]
  ------------------
  578|    113|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 76, False: 25.4k]
  ------------------
  579|    186|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 73, False: 25.4k]
  ------------------
  580|    259|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 73, False: 25.4k]
  ------------------
  581|  5.13k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 4.87k, False: 20.6k]
  ------------------
  582|  5.16k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 35, False: 25.5k]
  ------------------
  583|  5.18k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 20, False: 25.5k]
  ------------------
  584|  5.18k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 25.5k]
  ------------------
  585|  5.18k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 25.5k]
  ------------------
  586|  5.18k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 25.5k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|  25.5k|    }
  591|  25.5k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  1.14k|{
  596|  1.14k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 1.14k, False: 0]
  ------------------
  597|  1.14k|        return Array(obj)[n];
  598|  1.14k|    }
  599|      0|    if (n < size()) {
  ------------------
  |  Branch (599:9): [True: 0, False: 0]
  ------------------
  600|      0|        return *this;
  601|      0|    }
  602|      0|    return {};
  603|      0|}
_ZNK4qpdf10BaseHandleixEi:
  607|  1.14k|{
  608|  1.14k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 1.14k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  1.14k|    return (*this)[static_cast<size_t>(n)];
  612|  1.14k|}
QPDF_Array.cc:_ZL4to_si:
   15|  51.7k|{
   16|  51.7k|    return static_cast<size_t>(n);
   17|  51.7k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|  84.3k|{
   28|  84.3k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 84.3k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|  84.3k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 13, False: 84.3k]
  |  Branch (31:19): [True: 13, False: 0]
  |  Branch (31:34): [True: 0, False: 13]
  ------------------
   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|  84.3k|}
QPDF_Array.cc:_ZL4to_im:
   21|  19.0k|{
   22|  19.0k|    return static_cast<int>(n);
   23|  19.0k|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  11.0k|{
   13|  11.0k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 11.0k, False: 0]
  ------------------
   14|  11.0k|        return d;
   15|  11.0k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  11.0k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|   830k|{
   23|   830k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 820k, False: 10.3k]
  ------------------
   24|   820k|        auto it = d->items.find(key);
   25|   820k|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 630k, False: 189k]
  ------------------
   26|   630k|            return it->second;
   27|   630k|        }
   28|   820k|    }
   29|   200k|    static const QPDFObjectHandle null_obj;
   30|   200k|    return null_obj;
   31|   830k|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|  57.0k|{
   64|  57.0k|    return !(*this)[key].null();
   65|  57.0k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  11.0k|{
  100|  11.0k|    std::set<std::string> result;
  101|  38.3k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 38.3k, False: 11.0k]
  ------------------
  102|  38.3k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 35.1k, False: 3.15k]
  ------------------
  103|  35.1k|            result.insert(iter.first);
  104|  35.1k|        }
  105|  38.3k|    }
  106|  11.0k|    return result;
  107|  11.0k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  15.2k|{
  118|       |    // no-op if key does not exist
  119|  15.2k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 15.2k, False: 0]
  ------------------
  120|  15.2k|        return d->items.erase(key);
  121|  15.2k|    }
  122|      0|    return 0;
  123|  15.2k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|  39.4k|{
  141|  39.4k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 39.4k, False: 0]
  ------------------
  142|  39.4k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 506, False: 38.9k]
  |  Branch (142:29): [True: 506, 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|    506|            d->items.erase(key);
  147|  38.9k|        } else {
  148|       |            // add or replace value
  149|  38.9k|            d->items[key] = value;
  150|  38.9k|        }
  151|  39.4k|        return true;
  152|  39.4k|    }
  153|      0|    return false;
  154|  39.4k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|  39.4k|{
  173|  39.4k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 39.4k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|  39.4k|}
_ZN4qpdf10DictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  179|  1.54k|    BaseDictionary(std::move(dict))
  180|  1.54k|{
  181|  1.54k|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|  45.6k|    BaseDictionary(obj)
  185|  45.6k|{
  186|  45.6k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|  30.7k|{
  197|  30.7k|    auto qpdf = getOwningQPDF();
  198|  30.7k|    auto item_qpdf = item.getOwningQPDF();
  199|  30.7k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 28.8k, False: 1.87k]
  |  Branch (199:17): [True: 5.44k, False: 23.4k]
  |  Branch (199:30): [True: 0, False: 5.44k]
  ------------------
  200|      0|        throw std::logic_error(
  201|      0|            "Attempting to add an object from a different QPDF. Use "
  202|      0|            "QPDF::copyForeignObject to add objects from another file.");
  203|      0|    }
  204|  30.7k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|  35.8k|{
  209|  35.8k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 35.7k, False: 156]
  ------------------
  210|  35.7k|        return dict.contains(key);
  211|  35.7k|    } else {
  212|    156|        typeWarning("dictionary", "returning false for a key containment request");
  213|    156|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    156|        return false;
  215|    156|    }
  216|  35.8k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   234k|{
  221|   234k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 162k, False: 72.1k]
  ------------------
  222|   162k|        return result;
  223|   162k|    }
  224|  72.1k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 71.9k, False: 249]
  ------------------
  225|  71.9k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|  71.9k|        return QPDF_Null::create(obj, msg, key);
  227|  71.9k|    }
  228|    249|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|    249|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|    249|    return QPDF_Null::create(obj, msg, "");
  231|  72.1k|}
_ZNK16QPDFObjectHandle12getKeyIfDictERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  235|  1.87k|{
  236|  1.87k|    return isNull() ? newNull() : getKey(key);
  ------------------
  |  Branch (236:12): [True: 302, False: 1.57k]
  ------------------
  237|  1.87k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  11.2k|{
  242|  11.2k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 11.0k, False: 183]
  ------------------
  243|  11.0k|        return dict.getKeys();
  244|  11.0k|    }
  245|    183|    typeWarning("dictionary", "treating as empty");
  246|    183|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|    183|    return {};
  248|  11.2k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|  33.4k|{
  264|  33.4k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 30.7k, False: 2.74k]
  ------------------
  265|  30.7k|        checkOwnership(value);
  266|  30.7k|        dict.replace(key, value);
  267|  30.7k|        return;
  268|  30.7k|    }
  269|  2.74k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  2.74k|}
_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.1k|    Common(common),
  127|  20.1k|    copier_(std::make_shared<Copier>(*this))
  128|  20.1k|{
  129|  20.1k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  13.0k|{
  226|  13.0k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 13.0k]
  ------------------
  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.0k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 3.12k, False: 9.92k]
  ------------------
  236|  3.12k|        return SF_FlateLzwDecode::flate_factory;
  237|  3.12k|    }
  238|  9.92k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 972, False: 8.95k]
  ------------------
  239|    972|        return []() { return std::make_shared<SF_Crypt>(); };
  240|    972|    }
  241|  8.95k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 573, False: 8.37k]
  ------------------
  242|    573|        return SF_FlateLzwDecode::lzw_factory;
  243|    573|    }
  244|  8.37k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 70, False: 8.30k]
  ------------------
  245|     70|        return SF_RunLengthDecode::factory;
  246|     70|    }
  247|  8.30k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 37, False: 8.27k]
  ------------------
  248|     37|        return SF_DCTDecode::factory;
  249|     37|    }
  250|  8.27k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 552, False: 7.71k]
  ------------------
  251|    552|        return SF_ASCII85Decode::factory;
  252|    552|    }
  253|  7.71k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 8, False: 7.71k]
  ------------------
  254|      8|        return SF_ASCIIHexDecode::factory;
  255|      8|    }
  256|       |    // The PDF specification provides these filter abbreviations for use in inline images, but
  257|       |    // according to table H.1 in the pre-ISO versions of the PDF specification, Adobe Reader
  258|       |    // also accepts them for stream filters.
  259|       |
  260|  7.71k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 2.13k, False: 5.57k]
  ------------------
  261|  2.13k|        return SF_FlateLzwDecode::flate_factory;
  262|  2.13k|    }
  263|  5.57k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 492, False: 5.08k]
  ------------------
  264|    492|        return SF_ASCIIHexDecode::factory;
  265|    492|    }
  266|  5.08k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 236, False: 4.84k]
  ------------------
  267|    236|        return SF_ASCII85Decode::factory;
  268|    236|    }
  269|  4.84k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 3.32k, False: 1.51k]
  ------------------
  270|  3.32k|        return SF_FlateLzwDecode::lzw_factory;
  271|  3.32k|    }
  272|  1.51k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 983, False: 536]
  ------------------
  273|    983|        return SF_RunLengthDecode::factory;
  274|    983|    }
  275|    536|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 159, False: 377]
  ------------------
  276|    159|        return SF_DCTDecode::factory;
  277|    159|    }
  278|    377|    return nullptr;
  279|    536|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  24.9k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  24.9k|{
  285|  24.9k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  24.9k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  24.9k|    obj->setDescription(&qpdf, descr, offset);
  288|  24.9k|    setDictDescription();
  289|  24.9k|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  24.9k|{
  452|  24.9k|    auto s = stream();
  453|  24.9k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 0, False: 24.9k]
  ------------------
  454|      0|        s->stream_dict.setObjectDescription(
  455|      0|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|      0|    }
  457|  24.9k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  10.3k|{
  462|  10.3k|    std::string result;
  463|  10.3k|    pl::String buf(result);
  464|  10.3k|    bool filtered;
  465|  10.3k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  10.3k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 2.25k, False: 8.04k]
  ------------------
  467|  2.25k|        throw QPDFExc(
  468|  2.25k|            qpdf_e_unsupported,
  469|  2.25k|            qpdf()->getFilename(),
  470|  2.25k|            "",
  471|  2.25k|            offset(),
  472|  2.25k|            "getStreamData called on unfilterable stream");
  473|  2.25k|    }
  474|  8.04k|    return result;
  475|  10.3k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  10.2k|{
  496|  10.2k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 10.1k, False: 18]
  ------------------
  497|  10.1k|        return false;
  498|  10.1k|    }
  499|     18|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  10.2k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  10.3k|{
  507|  10.3k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  10.3k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  10.3k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 3.78k, False: 6.51k]
  ------------------
  513|       |        // No filters
  514|  3.78k|        return true;
  515|  3.78k|    }
  516|  6.51k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 31, False: 6.48k]
  ------------------
  517|     31|        global::Limits::error();
  518|     31|        warn(
  519|     31|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|     31|            "not filterable");
  521|     31|        return false;
  522|     31|    }
  523|  6.48k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 4.77k, False: 1.70k]
  ------------------
  524|       |        // One filter
  525|  4.77k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  4.77k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 186, False: 4.59k]
  ------------------
  527|    186|            return false;
  528|    186|        }
  529|  4.59k|        filters.emplace_back(ff());
  530|  4.59k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 1.70k, False: 9]
  ------------------
  531|       |        // Potentially multiple filters
  532|  8.29k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 8.29k, False: 1.48k]
  ------------------
  533|  8.29k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 22, False: 8.27k]
  ------------------
  534|     22|                warn("stream filter type is not name or array");
  535|     22|                return false;
  536|     22|            }
  537|  8.27k|            auto ff = s->filter_factory(item);
  538|  8.27k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 191, False: 8.07k]
  ------------------
  539|    191|                filters.clear();
  540|    191|                return false;
  541|    191|            }
  542|  8.07k|            filters.emplace_back(ff());
  543|  8.07k|        }
  544|  1.70k|    } 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.08k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  6.08k|    auto can_filter = // linebreak
  555|  6.08k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  6.08k|        if (!filter.setDecodeParms(d_obj) ||
  557|  6.08k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  6.08k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  6.08k|            return false;
  560|  6.08k|        }
  561|  6.08k|        return true;
  562|  6.08k|    };
  563|       |
  564|  6.08k|    auto decode_array = decode_obj.as_array(strict);
  565|  6.08k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 6.03k, False: 47]
  |  Branch (565:26): [True: 6, False: 41]
  ------------------
  566|  6.03k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 6, False: 6.03k]
  ------------------
  567|      6|            decode_obj = QPDFObjectHandle::newNull();
  568|      6|        }
  569|       |
  570|  11.5k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 11.5k, False: 5.84k]
  ------------------
  571|  11.5k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 197, False: 11.3k]
  ------------------
  572|    197|                return false;
  573|    197|            }
  574|  11.5k|        }
  575|  6.03k|    } else {
  576|       |        // Ignore /DecodeParms entirely if /Filters is empty.  At least one case of a file whose
  577|       |        // /DecodeParms was [ << >> ] when /Filters was empty has been seen in the wild.
  578|     41|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 38, False: 3]
  |  Branch (578:13): [True: 5, False: 36]
  |  Branch (578:33): [True: 5, False: 33]
  ------------------
  579|      5|            warn("stream /DecodeParms length is inconsistent with filters");
  580|      5|            return false;
  581|      5|        }
  582|       |
  583|     36|        int i = -1;
  584|    154|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 154, False: 27]
  ------------------
  585|    154|            auto d_obj = decode_array.get(++i);
  586|    154|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 9, False: 145]
  ------------------
  587|      9|                return false;
  588|      9|            }
  589|    154|        }
  590|     36|    }
  591|       |
  592|  5.86k|    return true;
  593|  6.08k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  10.3k|{
  604|  10.3k|    auto s = stream();
  605|  10.3k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  10.3k|    bool ignored;
  607|  10.3k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 10.3k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  10.3k|    bool& filter = *filterp;
  611|       |
  612|  10.3k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 10.3k, False: 0]
  |  Branch (612:54): [True: 10.3k, False: 0]
  |  Branch (612:73): [True: 819, False: 9.48k]
  ------------------
  613|  10.3k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 0, False: 10.3k]
  |  Branch (613:54): [True: 0, False: 0]
  ------------------
  614|  10.3k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 819, False: 9.48k]
  |  Branch (614:40): [True: 0, False: 9.48k]
  ------------------
  615|       |
  616|  10.3k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 819, False: 9.48k]
  |  Branch (616:25): [True: 0, False: 9.48k]
  ------------------
  617|    819|        filter = true;
  618|    819|    }
  619|       |
  620|  10.3k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 819, False: 9.48k]
  |  Branch (620:23): [True: 0, False: 9.48k]
  |  Branch (620:39): [True: 9.48k, False: 0]
  ------------------
  621|  10.3k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 10.3k, False: 0]
  ------------------
  622|  10.3k|        filter = filterable(decode_level, filters);
  623|  10.3k|    }
  624|       |
  625|  10.3k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 10.3k]
  ------------------
  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.3k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  10.3k|    ContentNormalizer normalizer;
  637|  10.3k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 9.65k, False: 655]
  ------------------
  638|  9.65k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 9.65k]
  ------------------
  639|      0|            auto new_pipeline =
  640|      0|                std::make_unique<Pl_Flate>("compress stream", pipeline, Pl_Flate::a_deflate);
  641|      0|            pipeline = new_pipeline.get();
  642|      0|            to_delete.push_back(std::move(new_pipeline));
  643|      0|        }
  644|       |
  645|  9.65k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 0, False: 9.65k]
  ------------------
  646|      0|            auto new_pipeline =
  647|      0|                std::make_unique<Pl_QPDFTokenizer>("normalizer", &normalizer, pipeline);
  648|      0|            pipeline = new_pipeline.get();
  649|      0|            to_delete.push_back(std::move(new_pipeline));
  650|      0|        }
  651|       |
  652|  9.65k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 9.65k]
  ------------------
  653|      0|            auto new_pipeline =
  654|      0|                std::make_unique<Pl_QPDFTokenizer>("token filter", (*iter).get(), pipeline);
  655|      0|            pipeline = new_pipeline.get();
  656|      0|            to_delete.push_back(std::move(new_pipeline));
  657|      0|        }
  658|       |
  659|  21.0k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 11.4k, False: 9.65k]
  ------------------
  660|  11.4k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 10.4k, False: 990]
  ------------------
  661|  10.4k|                pipeline = decode_pipeline;
  662|  10.4k|            }
  663|  11.4k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  11.4k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 5.75k, False: 5.65k]
  ------------------
  665|  5.75k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  5.75k|            }
  667|  11.4k|        }
  668|  9.65k|    }
  669|       |
  670|  10.3k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 0, False: 10.3k]
  ------------------
  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.3k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 0, False: 10.3k]
  ------------------
  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.3k|    } else {
  699|  10.3k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 10.3k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  10.3k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 1.61k, False: 8.69k]
  ------------------
  703|  10.3k|                qpdf(),
  704|  10.3k|                id_gen(),
  705|  10.3k|                offset(),
  706|  10.3k|                s->length,
  707|  10.3k|                s->stream_dict,
  708|  10.3k|                isRootMetadata(),
  709|  10.3k|                pipeline,
  710|  10.3k|                suppress_warnings,
  711|  10.3k|                will_retry)) {
  712|  1.61k|            filter = false;
  713|  1.61k|            return false;
  714|  1.61k|        }
  715|  10.3k|    }
  716|       |
  717|  8.69k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 7.89k, False: 795]
  |  Branch (717:19): [True: 7.89k, False: 0]
  |  Branch (717:41): [True: 0, False: 7.89k]
  ------------------
  718|      0|        warn("content normalization encountered bad tokens");
  719|      0|        if (normalizer.lastTokenWasBad()) {
  ------------------
  |  Branch (719:13): [True: 0, False: 0]
  ------------------
  720|      0|            QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize");
  721|      0|            warn(
  722|      0|                "normalized content ended with a bad token; you may be able to resolve this by "
  723|      0|                "coalescing content streams in combination with normalizing content. From the "
  724|      0|                "command line, specify --coalesce-contents");
  725|      0|        }
  726|      0|        warn(
  727|      0|            "Resulting stream data may be corrupted but is may still useful for manual "
  728|      0|            "inspection. For more information on this warning, search for content normalization "
  729|      0|            "in the manual.");
  730|      0|    }
  731|       |
  732|  8.69k|    return true;
  733|  10.3k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  2.40k|{
  790|  2.40k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  2.40k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  23.3k|{
  796|  23.3k|    return as_stream(error).getDict();
  797|  23.3k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  8.13k|{
  832|  8.13k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  8.13k|}
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  11.6k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  11.6k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 189, False: 11.4k]
  |  Branch (556:13): [True: 206, False: 11.4k]
  ------------------
  557|  11.4k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 11.4k, False: 0]
  |  Branch (557:39): [True: 22, False: 11.4k]
  ------------------
  558|  11.4k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 0, False: 11.4k]
  |  Branch (558:47): [True: 0, False: 0]
  ------------------
  559|    206|            return false;
  560|    206|        }
  561|  11.4k|        return true;
  562|  11.6k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  20.1k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  20.1k|        streams(streams)
   69|  20.1k|    {
   70|  20.1k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  20.1k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|    972|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|    972|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|    946|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|    946|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 789, False: 157]
  ------------------
  144|  2.57k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 2.57k, False: 762]
  ------------------
  145|  2.57k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 146, False: 2.43k]
  |  Branch (145:25): [True: 137, False: 2.43k]
  ------------------
  146|    146|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 67, False: 79]
  |  Branch (146:42): [True: 70, False: 9]
  ------------------
  147|    137|                        continue;
  148|    137|                    }
  149|  2.43k|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 70, False: 2.36k]
  ------------------
  150|     70|                        continue;
  151|     70|                    }
  152|  2.36k|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 27, False: 2.34k]
  ------------------
  153|     27|                        return false;
  154|     27|                    }
  155|  2.36k|                }
  156|    762|                return true;
  157|    789|            }
  158|    157|            return decode_parms.null();
  159|    946|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|    909|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|    909|            return nullptr;
  166|    909|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  2.34k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

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

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

_ZN4QPDF3Doc5Pages5cacheEv:
   53|  13.6k|{
   54|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   55|  13.6k|    if (all_pages.empty() && !invalid_page_found) {
  ------------------
  |  Branch (55:9): [True: 11.8k, False: 1.73k]
  |  Branch (55:30): [True: 10.3k, False: 1.48k]
  ------------------
   56|  10.3k|        ever_called_get_all_pages_ = true;
   57|  10.3k|        auto root = qpdf.getRoot();
   58|  10.3k|        QPDFObjGen::set visited;
   59|  10.3k|        QPDFObjGen::set seen;
   60|  10.3k|        QPDFObjectHandle pages = root.getKey("/Pages");
   61|  10.3k|        bool warned = false;
   62|  10.3k|        bool changed_pages = false;
   63|  10.7k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (63:16): [True: 4.38k, False: 6.37k]
  |  Branch (63:16): [True: 457, False: 10.3k]
  |  Branch (63:40): [True: 457, False: 3.92k]
  ------------------
   64|    457|            if (!seen.add(pages)) {
  ------------------
  |  Branch (64:17): [True: 91, False: 366]
  ------------------
   65|       |                // loop -- will be detected again and reported later
   66|     91|                break;
   67|     91|            }
   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|    366|            if (!warned) {
  ------------------
  |  Branch (70:17): [True: 207, False: 159]
  ------------------
   71|    207|                root.warn(
   72|    207|                    "document page tree root (root -> /Pages) doesn't point"
   73|    207|                    " to the root of the page tree; attempting to correct");
   74|    207|                warned = true;
   75|    207|            }
   76|    366|            changed_pages = true;
   77|    366|            pages = pages.getKey("/Parent");
   78|    366|        }
   79|  10.3k|        if (changed_pages) {
  ------------------
  |  Branch (79:13): [True: 206, False: 10.1k]
  ------------------
   80|    206|            root.replaceKey("/Pages", pages);
   81|    206|        }
   82|  10.3k|        seen.clear();
   83|  10.3k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (83:13): [True: 138, False: 10.2k]
  ------------------
   84|       |            // Ensure we actually found a /Pages object.
   85|    138|            throw QPDFExc(
   86|    138|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   87|    138|        }
   88|  10.2k|        try {
   89|  10.2k|            getAllPagesInternal(pages, 0, visited, seen, false, false);
   90|  10.2k|        } catch (...) {
   91|    132|            all_pages.clear();
   92|    132|            invalid_page_found = false;
   93|    132|            throw;
   94|    132|        }
   95|  3.85k|        if (invalid_page_found) {
  ------------------
  |  Branch (95:13): [True: 3.21k, False: 640]
  ------------------
   96|  3.21k|            flattenPagesTree();
   97|  3.21k|            invalid_page_found = false;
   98|  3.21k|        }
   99|  3.85k|    }
  100|  7.06k|    return all_pages;
  101|  13.6k|}
_ZN4QPDF3Doc5Pages19getAllPagesInternalE16QPDFObjectHandlejRN10QPDFObjGen3setES5_bb:
  111|  7.42k|{
  112|  7.42k|    static uint32_t constexpr max_level = 100;
  113|  7.42k|    if (++level > max_level) {
  ------------------
  |  Branch (113:9): [True: 0, False: 7.42k]
  ------------------
  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.42k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (121:9): [True: 28, False: 7.40k]
  ------------------
  122|     28|        throw QPDFExc(
  123|     28|            qpdf_e_pages,
  124|     28|            m->file->getName(),
  125|     28|            "object " + cur_node.getObjGen().unparse(' '),
  126|     28|            0,
  127|     28|            "Loop detected in /Pages structure (getAllPages)");
  128|     28|    }
  129|  7.40k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (129:9): [True: 6.85k, False: 542]
  ------------------
  130|       |        // During fuzzing files were encountered where the root object appeared in the pages tree.
  131|       |        // Unconditionally setting the /Type to /Pages could cause problems, but trying to
  132|       |        // accommodate the possibility may be excessive.
  133|  6.85k|        cur_node.warn("/Type key should be /Pages but is not; overriding");
  134|  6.85k|        cur_node.replaceKey("/Type", Name("/Pages"));
  135|  6.85k|    }
  136|  7.40k|    if (!media_box) {
  ------------------
  |  Branch (136:9): [True: 7.33k, False: 70]
  ------------------
  137|  7.33k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  138|  7.33k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (138:50): [True: 271, False: 7.05k]
  ------------------
  139|  7.33k|    }
  140|  7.40k|    if (!resources) {
  ------------------
  |  Branch (140:9): [True: 7.32k, False: 80]
  ------------------
  141|  7.32k|        resources = cur_node.getKey("/Resources").isDictionary();
  142|  7.32k|    }
  143|  7.40k|    auto kids = cur_node.getKey("/Kids");
  144|  7.40k|    if (!visited.add(kids)) {
  ------------------
  |  Branch (144:9): [True: 38, False: 7.36k]
  ------------------
  145|     38|        throw QPDFExc(
  146|     38|            qpdf_e_pages,
  147|     38|            m->file->getName(),
  148|     38|            "object " + cur_node.getObjGen().unparse(' '),
  149|     38|            0,
  150|     38|            "Loop detected in /Pages structure (getAllPages)");
  151|     38|    }
  152|  7.36k|    int i = -1;
  153|  35.3k|    for (auto& kid: kids.as_array()) {
  ------------------
  |  Branch (153:19): [True: 35.3k, False: 7.36k]
  ------------------
  154|  35.3k|        ++i;
  155|  35.3k|        int errors = 0;
  156|       |
  157|  35.3k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (157:13): [True: 21.8k, False: 13.4k]
  ------------------
  158|  21.8k|            kid.warn("Pages tree includes non-dictionary object; ignoring");
  159|  21.8k|            invalid_page_found = true;
  160|  21.8k|            continue;
  161|  21.8k|        }
  162|  13.4k|        if (!kid.isIndirect()) {
  ------------------
  |  Branch (162:13): [True: 5.05k, False: 8.40k]
  ------------------
  163|  5.05k|            cur_node.warn(
  164|  5.05k|                "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  165|  5.05k|            kid = qpdf.makeIndirectObject(kid);
  166|  5.05k|            ++errors;
  167|  5.05k|        }
  168|  13.4k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (168:13): [True: 3.44k, False: 10.0k]
  ------------------
  169|  3.44k|            getAllPagesInternal(kid, level, visited, seen, media_box, resources);
  170|  10.0k|        } else {
  171|  10.0k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (171:17): [True: 8.90k, False: 1.11k]
  |  Branch (171:17): [True: 4.37k, False: 5.64k]
  |  Branch (171:31): [True: 4.37k, False: 4.53k]
  ------------------
  172|  4.37k|                kid.warn(
  173|  4.37k|                    "kid " + std::to_string(i) +
  174|  4.37k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  175|  4.37k|                kid.replaceKey(
  176|  4.37k|                    "/MediaBox",
  177|  4.37k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  178|  4.37k|                ++errors;
  179|  4.37k|            }
  180|  10.0k|            if (!resources) {
  ------------------
  |  Branch (180:17): [True: 9.07k, False: 940]
  ------------------
  181|  9.07k|                auto res = kid.getKey("/Resources");
  182|       |
  183|  9.07k|                if (!res.isDictionary()) {
  ------------------
  |  Branch (183:21): [True: 4.00k, False: 5.07k]
  ------------------
  184|  4.00k|                    ++errors;
  185|  4.00k|                    kid.warn(
  186|  4.00k|                        "kid " + std::to_string(i) +
  187|  4.00k|                        " (from 0) Resources is missing or invalid; repairing");
  188|  4.00k|                    kid.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
  189|  4.00k|                }
  190|  9.07k|            }
  191|  10.0k|            auto annots = kid.getKey("/Annots");
  192|  10.0k|            if (!annots.null()) {
  ------------------
  |  Branch (192:17): [True: 1.57k, False: 8.43k]
  ------------------
  193|  1.57k|                if (!annots.isArray()) {
  ------------------
  |  Branch (193:21): [True: 21, False: 1.55k]
  ------------------
  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.55k|                } else {
  199|  1.55k|                    QPDFObjGen::set seen_annots;
  200|  48.7k|                    for (auto& annot: annots.as_array()) {
  ------------------
  |  Branch (200:37): [True: 48.7k, False: 1.55k]
  ------------------
  201|  48.7k|                        if (!seen_annots.add(annot)) {
  ------------------
  |  Branch (201:29): [True: 622, False: 48.0k]
  ------------------
  202|    622|                            kid.warn(
  203|    622|                                "kid " + std::to_string(i) +
  204|    622|                                " (from 0) Annots has duplicate entry for annotation " +
  205|    622|                                annot.id_gen().unparse(' '));
  206|    622|                            ++errors;
  207|    622|                        }
  208|  48.7k|                    }
  209|  1.55k|                }
  210|  1.57k|            }
  211|       |
  212|  10.0k|            if (!seen.add(kid)) {
  ------------------
  |  Branch (212:17): [True: 3.89k, False: 6.12k]
  ------------------
  213|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  214|       |                // QPDFPageObjectHelper.
  215|  3.89k|                if (!m->reconstructed_xref) {
  ------------------
  |  Branch (215:21): [True: 161, False: 3.73k]
  ------------------
  216|    161|                    cur_node.warn(
  217|    161|                        "kid " + std::to_string(i) +
  218|    161|                        " (from 0) appears more than once in the pages tree;"
  219|    161|                        " creating a new page object as a copy");
  220|       |                    // This needs to be fixed. shallowCopy does not necessarily produce a valid
  221|       |                    // page.
  222|    161|                    kid = qpdf.makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  223|    161|                    seen.add(kid);
  224|  3.73k|                } else {
  225|  3.73k|                    cur_node.warn(
  226|  3.73k|                        "kid " + std::to_string(i) +
  227|  3.73k|                        " (from 0) appears more than once in the pages tree; ignoring duplicate");
  228|  3.73k|                    invalid_page_found = true;
  229|  3.73k|                    kid = QPDFObjectHandle::newNull();
  230|  3.73k|                    continue;
  231|  3.73k|                }
  232|    161|                if (!kid.getKey("/Parent").isSameObjectAs(cur_node)) {
  ------------------
  |  Branch (232:21): [True: 102, False: 59]
  ------------------
  233|       |                    // Consider fixing and adding an information message.
  234|    102|                    ++errors;
  235|    102|                }
  236|    161|            }
  237|  6.28k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (237:17): [True: 3.46k, False: 2.82k]
  ------------------
  238|  3.46k|                kid.warn("/Type key should be /Page but is not; overriding");
  239|  3.46k|                kid.replaceKey("/Type", Name("/Page"));
  240|  3.46k|                ++errors;
  241|  3.46k|            }
  242|  6.28k|            if (m->reconstructed_xref && errors > 2) {
  ------------------
  |  Branch (242:17): [True: 5.56k, False: 726]
  |  Branch (242:42): [True: 1.96k, False: 3.59k]
  ------------------
  243|  1.96k|                cur_node.warn(
  244|  1.96k|                    "kid " + std::to_string(i) + " (from 0) has too many errors; ignoring page");
  245|  1.96k|                invalid_page_found = true;
  246|  1.96k|                kid = QPDFObjectHandle::newNull();
  247|  1.96k|                continue;
  248|  1.96k|            }
  249|  4.32k|            all_pages.emplace_back(kid);
  250|  4.32k|        }
  251|  13.4k|    }
  252|  7.36k|}
_ZN4QPDF3Doc5Pages16flattenPagesTreeEv:
  274|  3.21k|{
  275|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  276|       |
  277|  3.21k|    if (!pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (277:9): [True: 0, False: 3.21k]
  ------------------
  278|      0|        return;
  279|      0|    }
  280|       |
  281|       |    // Push inherited objects down to the /Page level.  As a side effect all_pages will also be
  282|       |    // generated.
  283|  3.21k|    pushInheritedAttributesToPage(true, true);
  284|       |
  285|  3.21k|    QPDFObjectHandle pages = qpdf.getRoot().getKey("/Pages");
  286|       |
  287|  3.21k|    size_t const len = all_pages.size();
  288|  6.32k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (288:26): [True: 3.10k, False: 3.21k]
  ------------------
  289|       |        // Populate pageobj_to_pages_pos and fix parent pointer. There should be no duplicates at
  290|       |        // this point because pushInheritedAttributesToPage calls getAllPages which resolves
  291|       |        // duplicates.
  292|  3.10k|        insertPageobjToPage(all_pages.at(pos), toI(pos), true);
  293|  3.10k|        all_pages.at(pos).replaceKey("/Parent", pages);
  294|  3.10k|    }
  295|       |
  296|  3.21k|    pages.replaceKey("/Kids", Array(all_pages));
  297|       |    // /Count has not changed
  298|  3.21k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (298:9): [True: 1.84k, False: 1.36k]
  ------------------
  299|  1.84k|        if (invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (299:13): [True: 1.84k, False: 0]
  |  Branch (299:13): [True: 1.78k, False: 66]
  |  Branch (299:35): [True: 1.78k, False: 66]
  ------------------
  300|  1.78k|            pages.replaceKey("/Count", Integer(len));
  301|  1.78k|        } else {
  302|     66|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  303|     66|        }
  304|  1.84k|    }
  305|  3.21k|}
_ZN4QPDF3Doc5Pages29pushInheritedAttributesToPageEbb:
  316|  3.21k|{
  317|       |    // Traverse pages tree pushing all inherited resources down to the page level.
  318|       |
  319|       |    // The record of whether we've done this is cleared by updateAllPagesCache().  If we're warning
  320|       |    // for skipped keys, re-traverse unconditionally.
  321|  3.21k|    if (pushed_inherited_attributes_to_pages && !warn_skipped_keys) {
  ------------------
  |  Branch (321:9): [True: 0, False: 3.21k]
  |  Branch (321:49): [True: 0, False: 0]
  ------------------
  322|      0|        return;
  323|      0|    }
  324|       |
  325|       |    // Calling cache() resolves any duplicated page objects, repairs broken nodes, and detects
  326|       |    // loops, so we don't have to do those activities here.
  327|  3.21k|    (void)cache();
  328|       |
  329|       |    // key_ancestors is a mapping of page attribute keys to a stack of Pages nodes that contain
  330|       |    // values for them.
  331|  3.21k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  332|  3.21k|    pushInheritedAttributesToPageInternal(
  333|  3.21k|        m->trailer.getKey("/Root").getKey("/Pages"),
  334|  3.21k|        key_ancestors,
  335|  3.21k|        allow_changes,
  336|  3.21k|        warn_skipped_keys);
  337|  3.21k|    util::assertion(
  338|  3.21k|        key_ancestors.empty(),
  339|  3.21k|        "key_ancestors not empty after pushing inherited attributes to pages");
  340|  3.21k|    pushed_inherited_attributes_to_pages = true;
  341|  3.21k|    ever_pushed_inherited_attributes_to_pages_ = true;
  342|  3.21k|}
_ZN4QPDF3Doc5Pages37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_6vectorIS2_NS8_IS2_EEEENS3_4lessISA_EENS8_INS3_4pairIKSA_SD_EEEEEEbb:
  350|  6.23k|{
  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.23k|    std::set<std::string> inheritable_keys;
  356|  23.6k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (356:25): [True: 23.6k, False: 6.23k]
  ------------------
  357|  23.6k|        if (key == "/MediaBox" || key == "/CropBox" || key == "/Resources" || key == "/Rotate") {
  ------------------
  |  Branch (357:13): [True: 1.54k, False: 22.1k]
  |  Branch (357:35): [True: 263, False: 21.8k]
  |  Branch (357:56): [True: 1.44k, False: 20.4k]
  |  Branch (357:79): [True: 275, False: 20.1k]
  ------------------
  358|  3.52k|            if (!allow_changes) {
  ------------------
  |  Branch (358:17): [True: 0, False: 3.52k]
  ------------------
  359|      0|                throw QPDFExc(
  360|      0|                    qpdf_e_internal,
  361|      0|                    m->file->getName(),
  362|      0|                    "/Pages object " + cur_pages.id_gen().unparse(' '),
  363|      0|                    cur_pages.offset(),
  364|      0|                    "pushInheritedAttributesToPage detected an inheritable attribute when called "
  365|      0|                    "in no-change mode");
  366|      0|            }
  367|       |
  368|       |            // This is an inheritable resource
  369|  3.52k|            inheritable_keys.insert(key);
  370|  3.52k|            auto oh = cur_pages[key];
  371|  3.52k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.indirect() ? 0 : 1);
  ------------------
  |  Branch (371:63): [True: 58, False: 3.46k]
  ------------------
  372|  3.52k|            if (!oh.indirect()) {
  ------------------
  |  Branch (372:17): [True: 3.46k, False: 58]
  ------------------
  373|  3.46k|                if (!oh.isScalar()) {
  ------------------
  |  Branch (373:21): [True: 321, False: 3.14k]
  ------------------
  374|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  375|       |                    // avoid copying large structures around.
  376|    321|                    cur_pages.replaceKey(key, qpdf.makeIndirectObject(oh));
  377|    321|                    oh = cur_pages[key];
  378|  3.14k|                } else {
  379|       |                    // It's okay to copy scalars.
  380|  3.14k|                }
  381|  3.46k|            }
  382|  3.52k|            key_ancestors[key].emplace_back(oh);
  383|  3.52k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (383:17): [True: 683, False: 2.83k]
  ------------------
  384|    683|            }
  385|       |            // Remove this resource from this node.  It will be reattached at the page level.
  386|  3.52k|            cur_pages.erase(key);
  387|  20.1k|        } else if (!(key == "/Type" || key == "/Parent" || key == "/Kids" || key == "/Count")) {
  ------------------
  |  Branch (387:22): [True: 6.21k, False: 13.9k]
  |  Branch (387:40): [True: 277, False: 13.6k]
  |  Branch (387:60): [True: 6.23k, False: 7.44k]
  |  Branch (387:78): [True: 1.92k, False: 5.52k]
  ------------------
  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.52k|            if (warn_skipped_keys && cur_pages.contains("/Parent")) {
  ------------------
  |  Branch (390:17): [True: 5.52k, False: 0]
  |  Branch (390:17): [True: 1.13k, False: 4.39k]
  |  Branch (390:38): [True: 1.13k, False: 4.39k]
  ------------------
  391|  1.13k|                warn(
  392|  1.13k|                    qpdf_e_pages,
  393|  1.13k|                    "Pages object: object " + cur_pages.id_gen().unparse(' '),
  394|  1.13k|                    cur_pages.offset(),
  395|  1.13k|                    ("Unknown key " + key +
  396|  1.13k|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  397|  1.13k|                     "tree"));
  398|  1.13k|            }
  399|  5.52k|        }
  400|  23.6k|    }
  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|  28.9k|    for (auto& kid: Array(cur_pages["/Kids"])) {
  ------------------
  |  Branch (405:19): [True: 28.9k, False: 6.23k]
  ------------------
  406|  28.9k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (406:13): [True: 3.02k, False: 25.9k]
  ------------------
  407|  3.02k|            pushInheritedAttributesToPageInternal(
  408|  3.02k|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  409|  25.9k|        } else {
  410|       |            // Add all available inheritable attributes not present in this object to this object.
  411|  25.9k|            for (auto const& [key, values]: key_ancestors) {
  ------------------
  |  Branch (411:43): [True: 4.05k, False: 25.9k]
  ------------------
  412|  4.05k|                if (!kid.contains(key)) {
  ------------------
  |  Branch (412:21): [True: 3.95k, False: 101]
  ------------------
  413|  3.95k|                    kid.replaceKey(key, values.back());
  414|  3.95k|                } else {
  415|    101|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  416|    101|                }
  417|  4.05k|            }
  418|  25.9k|        }
  419|  28.9k|    }
  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.23k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (425:9): [True: 1.78k, False: 4.45k]
  ------------------
  426|  3.12k|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (426:29): [True: 3.12k, False: 1.78k]
  ------------------
  427|  3.12k|            key_ancestors[key].pop_back();
  428|  3.12k|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (428:17): [True: 2.44k, False: 681]
  ------------------
  429|  2.44k|                key_ancestors.erase(key);
  430|  2.44k|            }
  431|  3.12k|        }
  432|  4.45k|    } else {
  433|  4.45k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  434|  4.45k|    }
  435|  6.23k|}
_ZN4QPDF3Doc5Pages19insertPageobjToPageERK16QPDFObjectHandleib:
  439|  3.10k|{
  440|  3.10k|    QPDFObjGen og(obj.getObjGen());
  441|  3.10k|    if (check_duplicate) {
  ------------------
  |  Branch (441:9): [True: 3.10k, False: 0]
  ------------------
  442|  3.10k|        if (!pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (442:13): [True: 0, False: 3.10k]
  ------------------
  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.10k|    } else {
  452|      0|        pageobj_to_pages_pos[og] = pos;
  453|      0|    }
  454|  3.10k|}

_ZN5QUtil16double_to_stringEdib:
  355|  17.4k|{
  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.4k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (359:9): [True: 17.4k, False: 0]
  ------------------
  360|  17.4k|        decimal_places = 6;
  361|  17.4k|    }
  362|  17.4k|    std::ostringstream buf;
  363|  17.4k|    buf.imbue(std::locale::classic());
  364|  17.4k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  365|  17.4k|    std::string result = buf.str();
  366|  17.4k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (366:9): [True: 17.4k, False: 0]
  ------------------
  367|   122k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (367:16): [True: 122k, False: 0]
  |  Branch (367:41): [True: 104k, False: 17.4k]
  ------------------
  368|   104k|            result.pop_back();
  369|   104k|        }
  370|  17.4k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (370:13): [True: 17.4k, False: 0]
  |  Branch (370:38): [True: 17.4k, False: 0]
  ------------------
  371|  17.4k|            result.pop_back();
  372|  17.4k|        }
  373|  17.4k|    }
  374|  17.4k|    return result;
  375|  17.4k|}
_ZN5QUtil12string_to_llEPKc:
  379|  8.02M|{
  380|  8.02M|    errno = 0;
  381|       |#ifdef _MSC_VER
  382|       |    long long result = _strtoi64(str, 0, 10);
  383|       |#else
  384|  8.02M|    long long result = strtoll(str, nullptr, 10);
  385|  8.02M|#endif
  386|  8.02M|    if (errno == ERANGE) {
  ------------------
  |  Branch (386:9): [True: 571, False: 8.02M]
  ------------------
  387|    571|        throw std::range_error(
  388|    571|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  389|    571|    }
  390|  8.02M|    return result;
  391|  8.02M|}
_ZN5QUtil13string_to_intEPKc:
  395|   730k|{
  396|       |    // QIntC::to_int does range checking
  397|   730k|    return QIntC::to_int(string_to_ll(str));
  398|   730k|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  447|   127k|{
  448|   127k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  449|   127k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  453|  5.82k|{
  454|  5.82k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  455|  5.82k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  717|  5.82k|{
  718|  5.82k|    auto result = std::make_unique<char[]>(str.length() + 1);
  719|       |    // Use memcpy in case string contains nulls
  720|  5.82k|    result.get()[str.length()] = '\0';
  721|  5.82k|    memcpy(result.get(), str.c_str(), str.length());
  722|  5.82k|    return result;
  723|  5.82k|}
_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|   178M|{
 1005|   178M|    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|   178M|    if (uval > 0x7fffffff) {
  ------------------
  |  Branch (1014:9): [True: 0, False: 178M]
  ------------------
 1015|      0|        throw std::runtime_error("bounds error in QUtil::toUTF8");
 1016|   178M|    } else if (uval < 128) {
  ------------------
  |  Branch (1016:16): [True: 35.0M, False: 143M]
  ------------------
 1017|  35.0M|        result += static_cast<char>(uval);
 1018|   143M|    } else {
 1019|   143M|        unsigned char bytes[7];
 1020|   143M|        bytes[6] = '\0';
 1021|   143M|        unsigned char* cur_byte = &bytes[5];
 1022|       |
 1023|       |        // maximum value that will fit in the current number of bytes
 1024|   143M|        unsigned char maxval = 0x3f; // six bits
 1025|       |
 1026|   415M|        while (uval > QIntC::to_ulong(maxval)) {
  ------------------
  |  Branch (1026:16): [True: 272M, False: 143M]
  ------------------
 1027|       |            // Assign low six bits plus 10000000 to lowest unused byte position, then shift
 1028|   272M|            *cur_byte = static_cast<unsigned char>(0x80 + (uval & 0x3f));
 1029|   272M|            uval >>= 6;
 1030|       |            // Maximum that will fit in high byte now shrinks by one bit
 1031|   272M|            maxval = static_cast<unsigned char>(maxval >> 1);
 1032|       |            // Slide to the left one byte
 1033|   272M|            if (cur_byte <= bytes) {
  ------------------
  |  Branch (1033:17): [True: 0, False: 272M]
  ------------------
 1034|      0|                throw std::logic_error("QUtil::toUTF8: overflow error");
 1035|      0|            }
 1036|   272M|            --cur_byte;
 1037|   272M|        }
 1038|       |        // If maxval is k bits long, the high (7 - k) bits of the resulting byte must be high.
 1039|   143M|        *cur_byte = static_cast<unsigned char>(QIntC::to_ulong(0xff - (1 + (maxval << 1))) + uval);
 1040|       |
 1041|   143M|        result += reinterpret_cast<char*>(cur_byte);
 1042|   143M|    }
 1043|       |
 1044|   178M|    return result;
 1045|   178M|}
_ZN5QUtil7toUTF16Em:
 1049|  3.70M|{
 1050|  3.70M|    std::string result;
 1051|  3.70M|    if ((uval >= 0xd800) && (uval <= 0xdfff)) {
  ------------------
  |  Branch (1051:9): [True: 14.6k, False: 3.69M]
  |  Branch (1051:29): [True: 653, False: 13.9k]
  ------------------
 1052|    653|        result = "\xff\xfd";
 1053|  3.70M|    } else if (uval <= 0xffff) {
  ------------------
  |  Branch (1053:16): [True: 3.70M, False: 3.19k]
  ------------------
 1054|  3.70M|        char out[2];
 1055|  3.70M|        out[0] = static_cast<char>((uval & 0xff00) >> 8);
 1056|  3.70M|        out[1] = static_cast<char>(uval & 0xff);
 1057|  3.70M|        result = std::string(out, 2);
 1058|  3.70M|    } else if (uval <= 0x10ffff) {
  ------------------
  |  Branch (1058:16): [True: 1.64k, False: 1.55k]
  ------------------
 1059|  1.64k|        char out[4];
 1060|  1.64k|        uval -= 0x10000;
 1061|  1.64k|        unsigned short high = static_cast<unsigned short>(((uval & 0xffc00) >> 10) + 0xd800);
 1062|  1.64k|        unsigned short low = static_cast<unsigned short>((uval & 0x3ff) + 0xdc00);
 1063|  1.64k|        out[0] = static_cast<char>((high & 0xff00) >> 8);
 1064|  1.64k|        out[1] = static_cast<char>(high & 0xff);
 1065|  1.64k|        out[2] = static_cast<char>((low & 0xff00) >> 8);
 1066|  1.64k|        out[3] = static_cast<char>(low & 0xff);
 1067|  1.64k|        result = std::string(out, 4);
 1068|  1.64k|    } else {
 1069|  1.55k|        result = "\xff\xfd";
 1070|  1.55k|    }
 1071|       |
 1072|  3.70M|    return result;
 1073|  3.70M|}
_ZN5QUtil21getRandomDataProviderEv:
 1126|    292|{
 1127|    292|    return getRandomDataProviderProvider()->getProvider();
 1128|    292|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1132|    292|{
 1133|    292|    getRandomDataProvider()->provideRandomData(data, len);
 1134|    292|}
_ZN5QUtil23get_next_utf8_codepointERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERmRb:
 1479|  46.2M|{
 1480|  46.2M|    auto o_pos = pos;
 1481|  46.2M|    size_t len = utf8_val.length();
 1482|  46.2M|    unsigned char ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1483|  46.2M|    error = false;
 1484|  46.2M|    if (ch < 128) {
  ------------------
  |  Branch (1484:9): [True: 5.64M, False: 40.5M]
  ------------------
 1485|  5.64M|        return static_cast<unsigned long>(ch);
 1486|  5.64M|    }
 1487|       |
 1488|  40.5M|    size_t bytes_needed = 0;
 1489|  40.5M|    unsigned bit_check = 0x40;
 1490|  40.5M|    unsigned char to_clear = 0x80;
 1491|  66.2M|    while (ch & bit_check) {
  ------------------
  |  Branch (1491:12): [True: 25.7M, False: 40.5M]
  ------------------
 1492|  25.7M|        ++bytes_needed;
 1493|  25.7M|        to_clear = static_cast<unsigned char>(to_clear | bit_check);
 1494|  25.7M|        bit_check >>= 1;
 1495|  25.7M|    }
 1496|  40.5M|    if (((bytes_needed > 5) || (bytes_needed < 1)) || ((pos + bytes_needed) > len)) {
  ------------------
  |  Branch (1496:10): [True: 211k, False: 40.3M]
  |  Branch (1496:32): [True: 27.6M, False: 12.6M]
  |  Branch (1496:55): [True: 382, False: 12.6M]
  ------------------
 1497|  27.8M|        error = true;
 1498|  27.8M|        return 0xfffd;
 1499|  27.8M|    }
 1500|       |
 1501|  12.6M|    auto codepoint = static_cast<unsigned long>(ch & ~to_clear);
 1502|  34.5M|    while (bytes_needed > 0) {
  ------------------
  |  Branch (1502:12): [True: 23.1M, False: 11.3M]
  ------------------
 1503|  23.1M|        --bytes_needed;
 1504|  23.1M|        ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1505|  23.1M|        if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (1505:13): [True: 1.33M, False: 21.8M]
  ------------------
 1506|  1.33M|            --pos;
 1507|  1.33M|            error = true;
 1508|  1.33M|            return 0xfffd;
 1509|  1.33M|        }
 1510|  21.8M|        codepoint <<= 6;
 1511|  21.8M|        codepoint += (ch & 0x3f);
 1512|  21.8M|    }
 1513|  11.3M|    unsigned long lower_bound = 0;
 1514|  11.3M|    switch (pos - o_pos) {
 1515|  1.04M|    case 2:
  ------------------
  |  Branch (1515:5): [True: 1.04M, False: 10.3M]
  ------------------
 1516|  1.04M|        lower_bound = 1 << 7;
 1517|  1.04M|        break;
 1518|  10.3M|    case 3:
  ------------------
  |  Branch (1518:5): [True: 10.3M, False: 1.04M]
  ------------------
 1519|  10.3M|        lower_bound = 1 << 11;
 1520|  10.3M|        break;
 1521|  4.82k|    case 4:
  ------------------
  |  Branch (1521:5): [True: 4.82k, False: 11.3M]
  ------------------
 1522|  4.82k|        lower_bound = 1 << 16;
 1523|  4.82k|        break;
 1524|  1.24k|    case 5:
  ------------------
  |  Branch (1524:5): [True: 1.24k, False: 11.3M]
  ------------------
 1525|  1.24k|        lower_bound = 1 << 12;
 1526|  1.24k|        break;
 1527|    408|    case 6:
  ------------------
  |  Branch (1527:5): [True: 408, False: 11.3M]
  ------------------
 1528|    408|        lower_bound = 1 << 26;
 1529|    408|        break;
 1530|      0|    default:
  ------------------
  |  Branch (1530:5): [True: 0, False: 11.3M]
  ------------------
 1531|      0|        lower_bound = 0;
 1532|  11.3M|    }
 1533|       |
 1534|  11.3M|    if (lower_bound > 0 && codepoint < lower_bound) {
  ------------------
  |  Branch (1534:9): [True: 11.3M, False: 0]
  |  Branch (1534:28): [True: 13.3k, False: 11.3M]
  ------------------
 1535|       |        // Too many bytes were used, but return whatever character was encoded.
 1536|  13.3k|        error = true;
 1537|  13.3k|    }
 1538|  11.3M|    return codepoint;
 1539|  11.3M|}
_ZN5QUtil13utf8_to_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1637|    641|{
 1638|    641|    return transcode_utf8(utf8, e_utf16, 0);
 1639|    641|}
_ZN5QUtil15utf8_to_pdf_docERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_c:
 1685|  2.70k|{
 1686|  2.70k|    return transcode_utf8(utf8, pdfdoc, e_pdfdoc, unknown_char);
 1687|  2.70k|}
_ZN5QUtil8is_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1691|  43.6k|{
 1692|  43.6k|    return util::is_utf16(val);
 1693|  43.6k|}
_ZN5QUtil13utf16_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1703|  43.6k|{
 1704|  43.6k|    std::string result;
 1705|       |    // This code uses unsigned long and unsigned short to hold codepoint values. It requires
 1706|       |    // unsigned long to be at least 32 bits and unsigned short to be at least 16 bits, but it will
 1707|       |    // work fine if they are larger.
 1708|  43.6k|    unsigned long codepoint = 0L;
 1709|  43.6k|    size_t len = val.length();
 1710|  43.6k|    size_t start = 0;
 1711|  43.6k|    bool is_le = false;
 1712|  43.6k|    if (is_utf16(val)) {
  ------------------
  |  Branch (1712:9): [True: 43.6k, False: 0]
  ------------------
 1713|  43.6k|        if (static_cast<unsigned char>(val.at(0)) == 0xff) {
  ------------------
  |  Branch (1713:13): [True: 32.9k, False: 10.6k]
  ------------------
 1714|  32.9k|            is_le = true;
 1715|  32.9k|        }
 1716|  43.6k|        start += 2;
 1717|  43.6k|    }
 1718|       |    // If the string has an odd number of bytes, the last byte is ignored.
 1719|  20.9M|    for (size_t i = start; i + 1 < len; i += 2) {
  ------------------
  |  Branch (1719:28): [True: 20.9M, False: 43.6k]
  ------------------
 1720|       |        // Convert from UTF16-BE.  If we get a malformed codepoint, this code will generate
 1721|       |        // incorrect output without giving a warning.  Specifically, a high codepoint not followed
 1722|       |        // by a low codepoint will be discarded, and a low codepoint not preceded by a high
 1723|       |        // codepoint will just get its low 10 bits output.
 1724|  20.9M|        auto msb = is_le ? i + 1 : i;
  ------------------
  |  Branch (1724:20): [True: 1.65M, False: 19.2M]
  ------------------
 1725|  20.9M|        auto lsb = is_le ? i : i + 1;
  ------------------
  |  Branch (1725:20): [True: 1.65M, False: 19.2M]
  ------------------
 1726|  20.9M|        unsigned short bits = QIntC::to_ushort(
 1727|  20.9M|            (static_cast<unsigned char>(val.at(msb)) << 8) +
 1728|  20.9M|            static_cast<unsigned char>(val.at(lsb)));
 1729|  20.9M|        if ((bits & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (1729:13): [True: 3.89k, False: 20.9M]
  ------------------
 1730|  3.89k|            codepoint = 0x10000U + ((bits & 0x3FFU) << 10U);
 1731|  3.89k|            continue;
 1732|  20.9M|        } else if ((bits & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (1732:20): [True: 5.58k, False: 20.9M]
  ------------------
 1733|  5.58k|            if (codepoint != 0) {
  ------------------
  |  Branch (1733:17): [True: 2.12k, False: 3.45k]
  ------------------
 1734|  2.12k|                QTC::TC("qpdf", "QUtil non-trivial UTF-16");
 1735|  2.12k|            }
 1736|  5.58k|            codepoint += bits & 0x3FF;
 1737|  20.9M|        } else {
 1738|  20.9M|            codepoint = bits;
 1739|  20.9M|        }
 1740|       |
 1741|  20.9M|        result += QUtil::toUTF8(codepoint);
 1742|  20.9M|        codepoint = 0;
 1743|  20.9M|    }
 1744|  43.6k|    return result;
 1745|  43.6k|}
_ZN5QUtil15pdf_doc_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1781|   654k|{
 1782|   654k|    std::string result;
 1783|   654k|    size_t len = val.length();
 1784|   157M|    for (unsigned int i = 0; i < len; ++i) {
  ------------------
  |  Branch (1784:30): [True: 157M, False: 654k]
  ------------------
 1785|   157M|        unsigned char ch = static_cast<unsigned char>(val.at(i));
 1786|   157M|        unsigned short ch_short = ch;
 1787|   157M|        if ((ch >= 127) && (ch <= 160)) {
  ------------------
  |  Branch (1787:13): [True: 127M, False: 29.9M]
  |  Branch (1787:28): [True: 114M, False: 12.9M]
  ------------------
 1788|   114M|            ch_short = pdf_doc_to_unicode[ch - 127];
 1789|   114M|        } else if ((ch >= 24) && (ch <= 31)) {
  ------------------
  |  Branch (1789:20): [True: 36.1M, False: 6.73M]
  |  Branch (1789:34): [True: 556k, False: 35.6M]
  ------------------
 1790|   556k|            ch_short = pdf_doc_low_to_unicode[ch - 24];
 1791|  42.3M|        } else if (ch == 173) {
  ------------------
  |  Branch (1791:20): [True: 15.5k, False: 42.3M]
  ------------------
 1792|  15.5k|            ch_short = 0xfffd;
 1793|  15.5k|        }
 1794|   157M|        result += QUtil::toUTF8(ch_short);
 1795|   157M|    }
 1796|   654k|    return result;
 1797|   654k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1112|    292|{
 1113|       |    // Thread-safe static initializer
 1114|    292|    static RandomDataProviderProvider rdpp;
 1115|    292|    return &rdpp;
 1116|    292|}
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|    292|{
 1101|    292|    return this->current_provider;
 1102|    292|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE10encoding_ec:
 1629|    641|{
 1630|    641|    std::string result;
 1631|    641|    transcode_utf8(utf8_val, result, encoding, unknown);
 1632|    641|    return result;
 1633|    641|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_10encoding_ec:
 1543|  3.34k|{
 1544|  3.34k|    bool okay = true;
 1545|  3.34k|    result.clear();
 1546|  3.34k|    size_t len = utf8_val.length();
 1547|  3.34k|    switch (encoding) {
 1548|    641|    case e_utf16:
  ------------------
  |  Branch (1548:5): [True: 641, False: 2.70k]
  ------------------
 1549|    641|        result += "\xfe\xff";
 1550|    641|        break;
 1551|  2.70k|    case e_pdfdoc:
  ------------------
  |  Branch (1551:5): [True: 2.70k, False: 641]
  ------------------
 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.70k|        if ((len >= 4) && (utf8_val[0] == '\xc3')) {
  ------------------
  |  Branch (1558:13): [True: 2.10k, False: 599]
  |  Branch (1558:27): [True: 1.08k, False: 1.01k]
  ------------------
 1559|  1.08k|            static std::string fe_ff("\xbe\xc3\xbf");
 1560|  1.08k|            static std::string ff_fe("\xbf\xc3\xbe");
 1561|  1.08k|            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.08k|            if ((utf8_val.compare(1, 3, fe_ff) == 0) || (utf8_val.compare(1, 3, ff_fe) == 0) ||
  ------------------
  |  Branch (1564:17): [True: 18, False: 1.06k]
  |  Branch (1564:57): [True: 12, False: 1.05k]
  ------------------
 1565|  1.05k|                (utf8_val.compare(1, 5, ef_bb_bf) == 0)) {
  ------------------
  |  Branch (1565:17): [True: 27, False: 1.03k]
  ------------------
 1566|     57|                result += unknown;
 1567|     57|                okay = false;
 1568|     57|            }
 1569|  1.08k|        }
 1570|  2.70k|        break;
 1571|      0|    default:
  ------------------
  |  Branch (1571:5): [True: 0, False: 3.34k]
  ------------------
 1572|      0|        break;
 1573|  3.34k|    }
 1574|  3.34k|    size_t pos = 0;
 1575|  46.2M|    while (pos < len) {
  ------------------
  |  Branch (1575:12): [True: 46.2M, False: 3.34k]
  ------------------
 1576|  46.2M|        bool error = false;
 1577|  46.2M|        unsigned long codepoint = QUtil::get_next_utf8_codepoint(utf8_val, pos, error);
 1578|  46.2M|        if (error) {
  ------------------
  |  Branch (1578:13): [True: 29.2M, False: 16.9M]
  ------------------
 1579|  29.2M|            okay = false;
 1580|  29.2M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1580:17): [True: 14.6M, False: 14.6M]
  ------------------
 1581|  14.6M|                result += "\xff\xfd";
 1582|  14.6M|            } else {
 1583|  14.6M|                result.append(1, unknown);
 1584|  14.6M|            }
 1585|  29.2M|        } else if (codepoint < 128) {
  ------------------
  |  Branch (1585:20): [True: 5.64M, False: 11.3M]
  ------------------
 1586|  5.64M|            char ch = static_cast<char>(codepoint);
 1587|  5.64M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1587:17): [True: 2.41M, False: 3.22M]
  ------------------
 1588|  2.41M|                result += QUtil::toUTF16(QIntC::to_ulong(ch));
 1589|  3.22M|            } else if ((encoding == e_pdfdoc) && (((ch >= 0x18) && (ch <= 0x1f)) || (ch == 127))) {
  ------------------
  |  Branch (1589:24): [True: 3.22M, False: 0]
  |  Branch (1589:52): [True: 2.57M, False: 653k]
  |  Branch (1589:68): [True: 101k, False: 2.47M]
  |  Branch (1589:85): [True: 15.1k, False: 3.10M]
  ------------------
 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|   116k|                okay = false;
 1594|   116k|                result.append(1, unknown);
 1595|  3.10M|            } else {
 1596|  3.10M|                result.append(1, ch);
 1597|  3.10M|            }
 1598|  11.3M|        } else if (encoding == e_utf16) {
  ------------------
  |  Branch (1598:20): [True: 1.29M, False: 10.0M]
  ------------------
 1599|  1.29M|            result += QUtil::toUTF16(codepoint);
 1600|  10.0M|        } else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) {
  ------------------
  |  Branch (1600:20): [True: 267, False: 10.0M]
  |  Branch (1600:43): [True: 267, False: 0]
  ------------------
 1601|       |            // PDFDocEncoding omits 0x00ad (soft hyphen).
 1602|    267|            okay = false;
 1603|    267|            result.append(1, unknown);
 1604|  10.0M|        } else if (
 1605|  10.0M|            (codepoint > 160) && (codepoint < 256) &&
  ------------------
  |  Branch (1605:13): [True: 10.0M, False: 1.69k]
  |  Branch (1605:34): [True: 723k, False: 9.31M]
  ------------------
 1606|   723k|            ((encoding == e_winansi) || (encoding == e_pdfdoc))) {
  ------------------
  |  Branch (1606:14): [True: 0, False: 723k]
  |  Branch (1606:41): [True: 723k, False: 0]
  ------------------
 1607|   723k|            result.append(1, static_cast<char>(codepoint & 0xff));
 1608|  9.31M|        } else {
 1609|  9.31M|            unsigned char ch = '\0';
 1610|  9.31M|            if (encoding == e_winansi) {
  ------------------
  |  Branch (1610:17): [True: 0, False: 9.31M]
  ------------------
 1611|      0|                ch = encode_winansi(codepoint);
 1612|  9.31M|            } else if (encoding == e_macroman) {
  ------------------
  |  Branch (1612:24): [True: 0, False: 9.31M]
  ------------------
 1613|      0|                ch = encode_macroman(codepoint);
 1614|  9.31M|            } else if (encoding == e_pdfdoc) {
  ------------------
  |  Branch (1614:24): [True: 9.31M, False: 0]
  ------------------
 1615|  9.31M|                ch = encode_pdfdoc(codepoint);
 1616|  9.31M|            }
 1617|  9.31M|            if (ch == '\0') {
  ------------------
  |  Branch (1617:17): [True: 1.28M, False: 8.03M]
  ------------------
 1618|  1.28M|                okay = false;
 1619|  1.28M|                ch = static_cast<unsigned char>(unknown);
 1620|  1.28M|            }
 1621|  9.31M|            result.append(1, static_cast<char>(ch));
 1622|  9.31M|        }
 1623|  46.2M|    }
 1624|  3.34k|    return okay;
 1625|  3.34k|}
QUtil.cc:_ZL13encode_pdfdocm:
 1469|  9.31M|{
 1470|  9.31M|    auto i = unicode_to_pdf_doc.find(codepoint);
 1471|  9.31M|    if (i != unicode_to_pdf_doc.end()) {
  ------------------
  |  Branch (1471:9): [True: 8.03M, False: 1.28M]
  ------------------
 1472|  8.03M|        return i->second;
 1473|  8.03M|    }
 1474|  1.28M|    return '\0';
 1475|  9.31M|}

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

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

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  8.76k|{
   14|  8.76k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 3.79k, False: 4.97k]
  ------------------
   15|  3.79k|        return true;
   16|  3.79k|    }
   17|       |
   18|  4.97k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  4.97k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  11.4k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 11.4k, False: 4.83k]
  ------------------
   22|  11.4k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  11.4k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 3.01k, False: 8.43k]
  ------------------
   24|  3.01k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 3.01k, False: 3]
  ------------------
   25|  3.01k|                predictor = value.getIntValueAsInt();
   26|  3.01k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 70, False: 2.94k]
  |  Branch (26:41): [True: 885, False: 2.05k]
  |  Branch (26:60): [True: 2.02k, False: 39]
  |  Branch (26:79): [True: 1.99k, False: 28]
  ------------------
   27|     67|                    return false;
   28|     67|                }
   29|  3.01k|            } else {
   30|      3|                return false;
   31|      3|            }
   32|  8.43k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 1.73k, False: 6.69k]
  |  Branch (32:41): [True: 627, False: 6.07k]
  |  Branch (32:61): [True: 516, False: 5.55k]
  ------------------
   33|  2.87k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 2.87k, False: 3]
  ------------------
   34|  2.87k|                int val = value.getIntValueAsInt();
   35|  2.87k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 2.87k, False: 0]
  |  Branch (35:37): [True: 18, False: 2.85k]
  ------------------
   36|     18|                    QPDFLogger::defaultLogger()->warn(
   37|     18|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     18|                    return false;
   39|     18|                }
   40|  2.85k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 1.71k, False: 1.13k]
  ------------------
   41|  1.71k|                    columns = val;
   42|  1.71k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 623, False: 515]
  ------------------
   43|    623|                    colors = val;
   44|    623|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 515, False: 0]
  ------------------
   45|    515|                    bits_per_component = val;
   46|    515|                }
   47|  2.85k|            } else {
   48|      3|                return false;
   49|      3|            }
   50|  5.55k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 4.98k, False: 571]
  |  Branch (50:27): [True: 181, False: 4.80k]
  ------------------
   51|    181|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 178, False: 3]
  ------------------
   52|    178|                int earlychange = value.getIntValueAsInt();
   53|    178|                early_code_change = (earlychange == 1);
   54|    178|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 66, False: 112]
  |  Branch (54:43): [True: 66, False: 46]
  ------------------
   55|     46|                    return false;
   56|     46|                }
   57|    178|            } else {
   58|      3|                return false;
   59|      3|            }
   60|    181|        }
   61|  11.4k|    }
   62|       |
   63|  4.83k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 2.87k, False: 1.95k]
  |  Branch (63:26): [True: 3, False: 2.87k]
  ------------------
   64|      3|        return false;
   65|      3|    }
   66|       |
   67|  4.82k|    return true;
   68|  4.83k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  8.55k|{
   73|  8.55k|    std::unique_ptr<Pipeline> pipeline;
   74|  8.55k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 1.94k, False: 6.61k]
  |  Branch (74:28): [True: 1.94k, False: 0]
  ------------------
   75|  1.94k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  1.94k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  1.94k|            "png decode",
   78|  1.94k|            next,
   79|  1.94k|            Pl_PNGFilter::a_decode,
   80|  1.94k|            QIntC::to_uint(columns),
   81|  1.94k|            QIntC::to_uint(colors),
   82|  1.94k|            QIntC::to_uint(bits_per_component));
   83|  1.94k|        next = pipeline.get();
   84|  1.94k|        pipelines.push_back(std::move(pipeline));
   85|  6.61k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 875, False: 5.73k]
  ------------------
   86|    875|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|    875|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|    875|            "tiff decode",
   89|    875|            next,
   90|    875|            Pl_TIFFPredictor::a_decode,
   91|    875|            QIntC::to_uint(columns),
   92|    875|            QIntC::to_uint(colors),
   93|    875|            QIntC::to_uint(bits_per_component));
   94|    875|        next = pipeline.get();
   95|    875|        pipelines.push_back(std::move(pipeline));
   96|    875|    }
   97|       |
   98|  8.55k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 3.49k, False: 5.06k]
  ------------------
   99|  3.49k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  5.06k|    } else {
  101|  5.06k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  5.06k|    }
  103|  8.55k|    next = pipeline.get();
  104|  8.55k|    pipelines.push_back(std::move(pipeline));
  105|  8.55k|    return next;
  106|  8.55k|}

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

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

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

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

_ZNK4qpdf2is12OffsetBuffer7getNameEv:
   48|   777k|        {
   49|   777k|            return description;
   50|   777k|        }
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|  22.9M|        {
   55|  22.9M|            return pos + global_offset;
   56|  22.9M|        }
_ZN4qpdf2is12OffsetBuffer8unreadChEc:
   70|  22.4k|        {
   71|  22.4k|            if (pos > 0) {
  ------------------
  |  Branch (71:17): [True: 22.4k, False: 0]
  ------------------
   72|  22.4k|                --pos;
   73|  22.4k|            }
   74|  22.4k|        }
_ZN4qpdf2is12OffsetBufferD2Ev:
   42|  43.9k|        ~OffsetBuffer() final = default;
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|  44.0k|            description(description),
   22|  44.0k|            view_(view),
   23|  44.0k|            global_offset(global_offset)
   24|  44.0k|        {
   25|  44.0k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 46, False: 43.9k]
  ------------------
   26|     46|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     46|            }
   28|  43.9k|            last_offset = global_offset;
   29|  43.9k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  22.0k|{
   88|  22.0k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 10.2k, False: 11.8k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  10.2k|    }
   91|  22.0k|    str.resize(count);
   92|  22.0k|    str.resize(read(str.data(), count));
   93|  22.0k|    return str.size();
   94|  22.0k|}
_ZN11InputSource4readEmx:
   98|  10.2k|{
   99|  10.2k|    std::string result(count, '\0');
  100|  10.2k|    (void)read(result, count, at);
  101|  10.2k|    return result;
  102|  10.2k|}
_ZN11InputSource10loadBufferEv:
  106|  2.26M|{
  107|  2.26M|    buf_idx = 0;
  108|  2.26M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  2.26M|    buf_start = last_offset;
  111|  2.26M|}
_ZN11InputSource8fastTellEv:
  115|  18.3M|{
  116|  18.3M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 71.1k, False: 18.3M]
  ------------------
  117|  71.1k|        loadBuffer();
  118|  18.3M|    } else {
  119|  18.3M|        auto curr = tell();
  120|  18.3M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 47.8k, False: 18.2M]
  |  Branch (120:33): [True: 2.14M, False: 16.1M]
  ------------------
  121|  2.19M|            loadBuffer();
  122|  16.1M|        } else {
  123|  16.1M|            last_offset = curr;
  124|  16.1M|            buf_idx = curr - buf_start;
  125|  16.1M|        }
  126|  18.3M|    }
  127|  18.3M|    return last_offset;
  128|  18.3M|}
_ZN11InputSource8fastReadERc:
  132|   271M|{
  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|   271M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 269M, False: 1.97M]
  ------------------
  136|   269M|        ch = buffer[buf_idx];
  137|   269M|        ++(buf_idx);
  138|   269M|        ++(last_offset);
  139|   269M|        return true;
  140|       |
  141|   269M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 35.9k, False: 1.94M]
  ------------------
  142|  35.9k|        return false;
  143|  1.94M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  1.94M|        fastTell();
  146|  1.94M|        return fastRead(ch);
  147|  1.94M|    }
  148|   271M|}
_ZN11InputSource10fastUnreadEb:
  152|  16.4M|{
  153|  16.4M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 15.4M, False: 953k]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  16.4M|}

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

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

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

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

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

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

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

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

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

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

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

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|  17.0M|    {
  934|  17.0M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 17.0M, False: 0]
  ------------------
  935|  17.0M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|   264k|    {
  928|   264k|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 264k, False: 0]
  ------------------
  929|   264k|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|  26.2k|    {
  922|  26.2k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 26.2k, False: 0]
  ------------------
  923|  26.2k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  2.51M|    {
  952|  2.51M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 68.2k, False: 2.44M]
  ------------------
  953|  68.2k|            return ::ot_uninitialized;
  954|  68.2k|        }
  955|  2.44M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 113k, False: 2.32M]
  ------------------
  956|   113k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   113k|        }
  958|  2.32M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 2.32M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  2.32M|        return raw_type_code();
  962|  2.32M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|  4.03M|    {
  861|  4.03M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 4.03M, False: 506]
  ------------------
  862|  4.03M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|   224k|    {
  908|   224k|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 48.1k, False: 176k]
  |  Branch (908:24): [True: 51.1k, False: 124k]
  ------------------
  909|   224k|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   383k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 334k, False: 48.7k]
  ------------------
   58|   383k|        {
   59|   383k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|  1.12M|    {
  940|  1.12M|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 42.4k, False: 1.08M]
  ------------------
  941|  42.4k|            return ::ot_uninitialized;
  942|  42.4k|        }
  943|  1.08M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 617, False: 1.07M]
  ------------------
  944|    617|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|    617|        }
  946|  1.07M|        return raw_type_code();
  947|  1.08M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|  1.20M|        obj(oh.obj)
  789|  1.20M|    {
  790|  1.20M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   138k|            BaseDictionary(oh)
  269|   138k|        {
  270|   138k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   138k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 131k, False: 7.38k]
  ------------------
  239|   138k|        {
  240|   138k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|  1.79k|        {
  142|  1.79k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 1.42k, False: 365]
  ------------------
  143|  1.42k|                return d->items.begin();
  144|  1.42k|            }
  145|    365|            return {};
  146|  1.79k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|   899k|    {
  771|   899k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 5.34k, False: 894k]
  ------------------
  772|  5.34k|            return nullptr;
  773|  5.34k|        }
  774|   894k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 888k, False: 5.99k]
  ------------------
  775|   888k|            return &std::get<T>(obj->value);
  776|   888k|        }
  777|  5.99k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 226, False: 5.76k]
  ------------------
  778|    226|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|    226|        }
  780|  5.76k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 5.76k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  5.76k|        return nullptr;
  785|  5.76k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|  1.79k|        {
  151|  1.79k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 1.42k, False: 364]
  ------------------
  152|  1.42k|                return d->items.end();
  153|  1.42k|            }
  154|    364|            return {};
  155|  1.79k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|  11.9k|    {
  855|  11.9k|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 11.9k, False: 0]
  ------------------
  856|  11.9k|    }
_ZNK4qpdf6Stream7getDictEv:
  554|  49.0k|        {
  555|  49.0k|            return {stream()->stream_dict};
  556|  49.0k|        }
_ZNK4qpdf6Stream6streamEv:
  697|   104k|        {
  698|   104k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 104k, False: 0]
  ------------------
  699|   104k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 104k, False: 1]
  ------------------
  700|   104k|                    return ptr;
  701|   104k|                }
  702|      1|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|   104k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|   104k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|   104k|    {
  771|   104k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 104k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   104k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 104k, False: 0]
  ------------------
  775|   104k|            return &std::get<T>(obj->value);
  776|   104k|        }
  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|   576k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 114k, False: 462k]
  ------------------
  320|   576k|        {
  321|   576k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   273k|        {
  331|   273k|            return obj != nullptr;
  332|   273k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|  95.4k|        {
  474|  95.4k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 58.1k, False: 37.3k]
  |  Branch (474:27): [True: 34.0k, False: 24.0k]
  ------------------
  475|  95.4k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   106k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 65.6k, False: 40.5k]
  ------------------
  450|   106k|        {
  451|   106k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|  12.6k|    {
  806|  12.6k|        return {obj};
  807|  12.6k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   297k|{
  989|   297k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   297k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  49.4k|        {
  362|  49.4k|            try {
  363|  49.4k|                return static_cast<T>(*this);
  364|  49.4k|            } catch (std::underflow_error&) {
  365|     79|                if constexpr (std::is_same_v<T, int>) {
  366|     79|                    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|     79|                return std::numeric_limits<T>::min();
  377|     79|            } catch (std::overflow_error&) {
  378|     37|                if constexpr (std::is_same_v<T, int>) {
  379|     37|                    warn("requested value of integer is too big; returning INT_MAX");
  380|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|       |                    warn("requested value of unsigned integer is too big; returning UINT_MAX");
  382|       |                } else {
  383|       |                    warn(
  384|       |                        "overflow while converting integer object; returning largest possible "
  385|       |                        "value");
  386|       |                }
  387|     37|                return std::numeric_limits<T>::max();
  388|     37|            }
  389|  49.4k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  49.4k|        {
  340|  49.4k|            auto v = value();
  341|       |
  342|  49.4k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 37, False: 49.4k]
  ------------------
  343|     37|                throw std::overflow_error("Integer conversion overflow");
  344|     37|            }
  345|  49.4k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 79, False: 49.3k]
  ------------------
  346|     79|                throw std::underflow_error("Integer conversion underflow");
  347|     79|            }
  348|  49.3k|            return static_cast<T>(v);
  349|  49.4k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  16.2k|        {
   37|  16.2k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 16.2k, False: 0]
  ------------------
   38|  16.2k|                obj = other.obj;
   39|  16.2k|            }
   40|  16.2k|            return *this;
   41|  16.2k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|  20.1k|            BaseHandle(obj)
   48|  20.1k|        {
   49|  20.1k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  6.03k|            BaseHandle(std::move(obj))
   53|  6.03k|        {
   54|  6.03k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  50.3k|        {
   64|  50.3k|            assign(::ot_array, oh);
   65|  50.3k|            return *this;
   66|  50.3k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|     17|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 0, False: 17]
  ------------------
   70|     17|        {
   71|     17|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|  1.54k|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|  1.54k|        {
  222|  1.54k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|  45.6k|            BaseHandle(obj)
  226|  45.6k|        {
  227|  45.6k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  1.73k|            BaseHandle(
  244|  1.73k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 1.17k, False: 560]
  ------------------
  245|  1.73k|        {
  246|  1.73k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  43.7k|        {
  275|  43.7k|            assign(::ot_dictionary, oh);
  276|  43.7k|            return *this;
  277|  43.7k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  1.73k|            BaseDictionary(std::move(oh))
  281|  1.73k|        {
  282|  1.73k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|     13|        {
  287|     13|            assign(::ot_dictionary, std::move(oh));
  288|     13|            return *this;
  289|     13|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  9.25k|        {
  462|  9.25k|            return value();
  463|  9.25k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|  54.4k|            BaseHandle(obj)
  516|  54.4k|        {
  517|  54.4k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|  29.4k|            BaseHandle(std::move(obj))
  521|  29.4k|        {
  522|  29.4k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  33.2k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 2.73k, False: 30.5k]
  ------------------
  538|  33.2k|        {
  539|  33.2k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  23.0k|        {
  602|  23.0k|            return {getDict()["/Type"]};
  603|  23.0k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  737|   705k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (737:24): [True: 705k, False: 0]
  ------------------
  738|   705k|        {
  739|   705k|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  799|  80.0k|    {
  800|  80.0k|        return obj;
  801|  80.0k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  838|  94.0k|    {
  839|  94.0k|        if (obj != other.obj) {
  ------------------
  |  Branch (839:13): [True: 43.3k, False: 50.7k]
  ------------------
  840|  43.3k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (840:19): [True: 42.4k, False: 939]
  ------------------
  841|  43.3k|        }
  842|  94.0k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  846|     13|    {
  847|     13|        if (obj != other.obj) {
  ------------------
  |  Branch (847:13): [True: 0, False: 13]
  ------------------
  848|      0|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (848:19): [True: 0, False: 0]
  ------------------
  849|      0|        }
  850|     13|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|   249k|    {
  902|   249k|        return (*this)[key];
  903|   249k|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|  72.1k|{
  975|  72.1k|    auto n = QPDFObject::create<QPDF_Null>();
  976|  72.1k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|  72.1k|    return n;
  978|  72.1k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|  25.0k|{
 1007|  25.0k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 25.0k]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|  25.0k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 8.91k, False: 16.1k]
  |  Branch (1010:37): [True: 10.1k, False: 6.03k]
  ------------------
 1011|  19.0k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 6.03k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|  19.0k|        return qpdf::Array(obj);
 1013|  19.0k|    }
 1014|  6.03k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|  25.0k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|  45.6k|{
 1020|  45.6k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 1.00k, False: 44.6k]
  |  Branch (1020:37): [True: 41.7k, False: 2.92k]
  ------------------
 1021|  42.7k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 2.92k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|  42.7k|        return qpdf::Dictionary(obj);
 1023|  42.7k|    }
 1024|  2.92k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 2.92k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  2.92k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|  45.6k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|  87.0k|{
 1033|  87.0k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 87.0k]
  |  Branch (1033:37): [True: 57.5k, False: 29.4k]
  ------------------
 1034|  54.4k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 29.4k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|  54.4k|        return qpdf::Stream(obj);
 1036|  54.4k|    }
 1037|  32.5k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 0, False: 32.5k]
  ------------------
 1038|      0|        assertType("stream", false);
 1039|      0|    }
 1040|  32.5k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|  87.0k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  5.87k|{
  989|  5.87k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  5.87k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   113k|{
  989|   113k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   113k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|   739k|        obj(std::move(oh.obj))
  794|   739k|    {
  795|   739k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  44.9k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  44.9k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|   114k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|   114k|        BaseDictionary(BaseDictionary const&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    163|{
  989|    163|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    163|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  6.80M|{
  989|  6.80M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  6.80M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    492|{
  989|    492|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    492|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  17.9k|{
  989|  17.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  17.9k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  82.9k|{
  989|  82.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  82.9k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  988|     23|{
  989|     23|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|     23|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    893|{
  989|    893|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    893|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    548|{
  989|    548|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    548|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|      4|    {
  771|      4|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 4]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|      4|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 4, False: 0]
  ------------------
  775|      4|            return &std::get<T>(obj->value);
  776|      4|        }
  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|   115k|    {
  771|   115k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 1.59k, False: 114k]
  ------------------
  772|  1.59k|            return nullptr;
  773|  1.59k|        }
  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|    }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralExEEv:
  339|  42.6k|        {
  340|  42.6k|            auto v = value();
  341|       |
  342|  42.6k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 42.6k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  42.6k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 42.6k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  42.6k|            return static_cast<T>(v);
  349|  42.6k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  14.0k|        {
  362|  14.0k|            try {
  363|  14.0k|                return static_cast<T>(*this);
  364|  14.0k|            } catch (std::underflow_error&) {
  365|       |                if constexpr (std::is_same_v<T, int>) {
  366|       |                    warn("requested value of integer is too small; returning INT_MIN");
  367|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|       |                    warn("unsigned integer value request for negative number; returning 0");
  369|    153|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    153|                    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|    153|                return std::numeric_limits<T>::min();
  377|    153|            } 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|  14.0k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  14.0k|        {
  340|  14.0k|            auto v = value();
  341|       |
  342|  14.0k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 14.0k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  14.0k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 153, False: 13.9k]
  ------------------
  346|    153|                throw std::underflow_error("Integer conversion underflow");
  347|    153|            }
  348|  13.9k|            return static_cast<T>(v);
  349|  14.0k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  9.37k|        {
  362|  9.37k|            try {
  363|  9.37k|                return static_cast<T>(*this);
  364|  9.37k|            } 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|    142|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    142|                    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|    142|                return std::numeric_limits<T>::min();
  377|    154|            } 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|    154|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|    154|                    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|    154|                return std::numeric_limits<T>::max();
  388|    154|            }
  389|  9.37k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  9.37k|        {
  340|  9.37k|            auto v = value();
  341|       |
  342|  9.37k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 154, False: 9.22k]
  ------------------
  343|    154|                throw std::overflow_error("Integer conversion overflow");
  344|    154|            }
  345|  9.22k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 142, False: 9.08k]
  ------------------
  346|    142|                throw std::underflow_error("Integer conversion underflow");
  347|    142|            }
  348|  9.08k|            return static_cast<T>(v);
  349|  9.22k|        }
_ZN10QPDFObject6createI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  5.20M|{
  989|  5.20M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  5.20M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  11.6k|{
  989|  11.6k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  11.6k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|  73.0k|    {
  771|  73.0k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 73.0k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  73.0k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 73.0k, False: 0]
  ------------------
  775|  73.0k|            return &std::get<T>(obj->value);
  776|  73.0k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   129k|{
  989|   129k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   129k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    641|{
  989|    641|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    641|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|   705k|    {
  771|   705k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 705k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   705k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 705k, False: 0]
  ------------------
  775|   705k|            return &std::get<T>(obj->value);
  776|   705k|        }
  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|  40.3k|{
  989|  40.3k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  40.3k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  17.4k|{
  989|  17.4k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  17.4k|}
_ZN9QPDF_RealC2Edib:
  981|  17.4k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  17.4k|{
  983|  17.4k|}
_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|   113k|    items(std::move(items))
  968|   113k|{
  969|   113k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  9.57k|{
  989|  9.57k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  9.57k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  8.00k|{
  989|  8.00k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  8.00k|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  70.0k|{
  989|  70.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  70.0k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|  1.13M|    {
  771|  1.13M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 73.6k, False: 1.05M]
  ------------------
  772|  73.6k|            return nullptr;
  773|  73.6k|        }
  774|  1.05M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1.05M, False: 5.49k]
  ------------------
  775|  1.05M|            return &std::get<T>(obj->value);
  776|  1.05M|        }
  777|  5.49k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 5.49k]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  5.49k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 5.49k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  5.49k|        return nullptr;
  785|  5.49k|    }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  1.78k|            Integer(static_cast<long long>(value))
  308|  1.78k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  1.78k|                              std::numeric_limits<long long>::max())) {
  312|  1.78k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 1.78k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  1.78k|            }
  316|  1.78k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  2.33k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  2.33k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  8.04k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  8.04k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  16.2k|        Array() = default;

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

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

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  14.8M|        {
   65|  14.8M|            return this->type;
   66|  14.8M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  13.6M|        {
   70|  13.6M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 5.61M, False: 8.02M]
  |  Branch (70:61): [True: 127k, False: 7.89M]
  ------------------
   71|  13.6M|                ? this->val
   72|  13.6M|                : this->raw_val;
   73|  13.6M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  36.4k|        {
   82|  36.4k|            return this->error_message;
   83|  36.4k|        }

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

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

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

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

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

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

_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|  3.96M|    {
   37|  3.96M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 3.96M]
  ------------------
   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|  3.96M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|  60.1k|    {
   28|  60.1k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 60.1k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  60.1k|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|  2.31M|    {
  100|  2.31M|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 2.24M, False: 77.6k]
  |  Branch (100:32): [True: 106k, False: 2.13M]
  ------------------
  101|  2.31M|            ? char(digit - '0')
  102|  2.31M|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 18.8k, False: 2.19M]
  ------------------
  103|  2.21M|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 43.3k, False: 2.14M]
  ------------------
  104|  2.31M|    }
_ZN4qpdf4util8is_spaceEc:
  114|  26.6M|    {
  115|  26.6M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 9.35M, False: 17.3M]
  |  Branch (115:29): [True: 474k, False: 16.8M]
  |  Branch (115:43): [True: 115k, False: 16.7M]
  |  Branch (115:57): [True: 68.3k, False: 16.6M]
  |  Branch (115:71): [True: 73.0k, False: 16.5M]
  |  Branch (115:85): [True: 38.0k, False: 16.5M]
  ------------------
  116|  26.6M|    }
_ZN4qpdf4util8is_digitEc:
  120|  24.4M|    {
  121|  24.4M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 16.0M, False: 8.36M]
  |  Branch (121:30): [True: 16.0M, False: 78.8k]
  ------------------
  122|  24.4M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  149|   745k|    {
  150|   745k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (150:16): [True: 21.3k, False: 724k]
  |  Branch (150:47): [True: 65.9k, False: 658k]
  ------------------
  151|   745k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  155|   658k|    {
  156|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  157|   658k|        return str.starts_with("\xef\xbb\xbf");
  158|   658k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|  66.2k|    {
   28|  66.2k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 66.2k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  66.2k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|    673|    {
   28|    673|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 673]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    673|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|    596|    {
   28|    596|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 596]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    596|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  20.1k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  20.1k|                          std::numeric_limits<T>::min())) {
   67|  20.1k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 20.1k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  20.1k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  20.1k|                          std::numeric_limits<T>::max())) {
   74|  20.1k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 20.1k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  20.1k|        }
   78|  20.1k|        return true;
   79|  20.1k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  20.1k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  20.1k|                          std::numeric_limits<T>::min())) {
   67|  20.1k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 20.1k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  20.1k|        }
   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.1k|        return true;
   79|  20.1k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|  86.1k|    {
   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|  86.1k|                          std::numeric_limits<T>::max())) {
   74|  86.1k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 6, False: 86.1k]
  ------------------
   75|      6|                return false;
   76|      6|            }
   77|  86.1k|        }
   78|  86.1k|        return true;
   79|  86.1k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   230k|    {
   28|   230k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 230k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   230k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|   518k|    {
   28|   518k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 518k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   518k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|   173k|    {
   28|   173k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 173k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   173k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  3.49k|    {
   28|  3.49k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.49k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.49k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  3.78k|    {
   28|  3.78k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.78k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.78k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|   248k|    {
   37|   248k|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 1, False: 248k]
  ------------------
   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|   248k|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  2.94k|    {
   28|  2.94k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.94k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.94k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   27|  2.23k|    {
   28|  2.23k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.23k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.23k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   27|  16.2k|    {
   28|  16.2k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 16.2k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  16.2k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  8.40k|    {
   28|  8.40k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 8.40k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  8.40k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|   834k|    {
   49|   834k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 26, False: 834k]
  ------------------
   50|     26|            throw std::runtime_error(std::forward<T>(msg));
   51|     26|        }
   52|   834k|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   27|   255k|    {
   28|   255k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 255k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   255k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|  3.57M|    {
   49|  3.57M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 13, False: 3.57M]
  ------------------
   50|     13|            throw std::runtime_error(std::forward<T>(msg));
   51|     13|        }
   52|  3.57M|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  33.3M|    {
   28|  33.3M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 33.3M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  33.3M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  8.26k|    {
   49|  8.26k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 20, False: 8.24k]
  ------------------
   50|     20|            throw std::runtime_error(std::forward<T>(msg));
   51|     20|        }
   52|  8.26k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|    422|    {
   28|    422|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 422]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    422|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  4.98k|    {
   28|  4.98k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.98k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.98k|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|    172|    {
   28|    172|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 172]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    172|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|  17.0k|    {
   49|  17.0k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 17.0k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  17.0k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  6.93k|    {
   49|  6.93k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 19, False: 6.91k]
  ------------------
   50|     19|            throw std::runtime_error(std::forward<T>(msg));
   51|     19|        }
   52|  6.93k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|   113k|    {
   49|   113k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 113k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|   113k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  8.78k|    {
   49|  8.78k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 8.78k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  8.78k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  2.80k|    {
   49|  2.80k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 6, False: 2.79k]
  ------------------
   50|      6|            throw std::runtime_error(std::forward<T>(msg));
   51|      6|        }
   52|  2.80k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  1.92k|    {
   49|  1.92k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.92k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.92k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  1.92k|    {
   49|  1.92k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 1.92k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  1.92k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  1.92k|    {
   49|  1.92k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 29, False: 1.89k]
  ------------------
   50|     29|            throw std::runtime_error(std::forward<T>(msg));
   51|     29|        }
   52|  1.92k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|  13.5k|    {
   49|  13.5k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 31, False: 13.4k]
  ------------------
   50|     31|            throw std::runtime_error(std::forward<T>(msg));
   51|     31|        }
   52|  13.5k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   27|   123k|    {
   28|   123k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 123k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   123k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|    875|    {
   28|    875|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 875]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    875|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|    875|    {
   49|    875|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 872]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|    875|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|    858|    {
   49|    858|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 858]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|    858|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|    855|    {
   49|    855|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 7, False: 848]
  ------------------
   50|      7|            throw std::runtime_error(std::forward<T>(msg));
   51|      7|        }
   52|    855|    }

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

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

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

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

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

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

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

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

inflate_fast:
   50|   118k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|   118k|    struct inflate_state FAR *state;
   52|   118k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|   118k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|   118k|    unsigned char FAR *out;     /* local strm->next_out */
   55|   118k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|   118k|    unsigned char FAR *end;     /* while out < end, enough space available */
   57|       |#ifdef INFLATE_STRICT
   58|       |    unsigned dmax;              /* maximum distance from zlib header */
   59|       |#endif
   60|   118k|    unsigned wsize;             /* window size or zero if not using window */
   61|   118k|    unsigned whave;             /* valid bytes in the window */
   62|   118k|    unsigned wnext;             /* window write index */
   63|   118k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|   118k|    unsigned long hold;         /* local strm->hold */
   65|   118k|    unsigned bits;              /* local strm->bits */
   66|   118k|    code const FAR *lcode;      /* local strm->lencode */
   67|   118k|    code const FAR *dcode;      /* local strm->distcode */
   68|   118k|    unsigned lmask;             /* mask for first level of length codes */
   69|   118k|    unsigned dmask;             /* mask for first level of distance codes */
   70|   118k|    code const *here;           /* retrieved table entry */
   71|   118k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|   118k|    unsigned len;               /* match length, unused bytes */
   74|   118k|    unsigned dist;              /* match distance */
   75|   118k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|   118k|    state = (struct inflate_state FAR *)strm->state;
   79|   118k|    in = strm->next_in;
   80|   118k|    last = in + (strm->avail_in - 5);
   81|   118k|    out = strm->next_out;
   82|   118k|    beg = out - (start - strm->avail_out);
   83|   118k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|   118k|    wsize = state->wsize;
   88|   118k|    whave = state->whave;
   89|   118k|    wnext = state->wnext;
   90|   118k|    window = state->window;
   91|   118k|    hold = state->hold;
   92|   118k|    bits = state->bits;
   93|   118k|    lcode = state->lencode;
   94|   118k|    dcode = state->distcode;
   95|   118k|    lmask = (1U << state->lenbits) - 1;
   96|   118k|    dmask = (1U << state->distbits) - 1;
   97|       |
   98|       |    /* decode literals and length/distances until end-of-block or not enough
   99|       |       input data or output space */
  100|  2.97M|    do {
  101|  2.97M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 1.32M, False: 1.65M]
  ------------------
  102|  1.32M|            hold += (unsigned long)(*in++) << bits;
  103|  1.32M|            bits += 8;
  104|  1.32M|            hold += (unsigned long)(*in++) << bits;
  105|  1.32M|            bits += 8;
  106|  1.32M|        }
  107|  2.97M|        here = lcode + (hold & lmask);
  108|  3.06M|      dolen:
  109|  3.06M|        op = (unsigned)(here->bits);
  110|  3.06M|        hold >>= op;
  111|  3.06M|        bits -= op;
  112|  3.06M|        op = (unsigned)(here->op);
  113|  3.06M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 1.57M, False: 1.49M]
  ------------------
  114|  1.57M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  1.57M|                    "inflate:         literal '%c'\n" :
  116|  1.57M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  1.57M|            *out++ = (unsigned char)(here->val);
  118|  1.57M|        }
  119|  1.49M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 1.39M, False: 90.8k]
  ------------------
  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: 251k, False: 1.14M]
  ------------------
  123|   251k|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 1.60k, False: 249k]
  ------------------
  124|  1.60k|                    hold += (unsigned long)(*in++) << bits;
  125|  1.60k|                    bits += 8;
  126|  1.60k|                }
  127|   251k|                len += (unsigned)hold & ((1U << op) - 1);
  128|   251k|                hold >>= op;
  129|   251k|                bits -= op;
  130|   251k|            }
  131|  1.39M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  1.39M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 405k, False: 994k]
  ------------------
  133|   405k|                hold += (unsigned long)(*in++) << bits;
  134|   405k|                bits += 8;
  135|   405k|                hold += (unsigned long)(*in++) << bits;
  136|   405k|                bits += 8;
  137|   405k|            }
  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: 74.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.58k, False: 1.39M]
  ------------------
  148|  1.58k|                    hold += (unsigned long)(*in++) << bits;
  149|  1.58k|                    bits += 8;
  150|  1.58k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 1.58k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  1.58k|                }
  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: 111k, False: 1.28M]
  ------------------
  169|   111k|                    op = dist - op;             /* distance back in window */
  170|   111k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 107, False: 111k]
  ------------------
  171|    107|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 107, False: 0]
  ------------------
  172|    107|                            strm->msg = (z_const char *)
  173|    107|                                "invalid distance too far back";
  174|    107|                            state->mode = BAD;
  175|    107|                            break;
  176|    107|                        }
  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|    107|                    }
  197|   111k|                    from = window;
  198|   111k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 5.69k, False: 105k]
  ------------------
  199|  5.69k|                        from += wsize - op;
  200|  5.69k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (200:29): [True: 213, False: 5.48k]
  ------------------
  201|    213|                            len -= op;
  202|  10.9k|                            do {
  203|  10.9k|                                *out++ = *from++;
  204|  10.9k|                            } while (--op);
  ------------------
  |  Branch (204:38): [True: 10.7k, False: 213]
  ------------------
  205|    213|                            from = out - dist;  /* rest from output */
  206|    213|                        }
  207|  5.69k|                    }
  208|   105k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 1.25k, False: 104k]
  ------------------
  209|  1.25k|                        from += wsize + wnext - op;
  210|  1.25k|                        op -= wnext;
  211|  1.25k|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 48, False: 1.21k]
  ------------------
  212|     48|                            len -= op;
  213|    868|                            do {
  214|    868|                                *out++ = *from++;
  215|    868|                            } while (--op);
  ------------------
  |  Branch (215:38): [True: 820, False: 48]
  ------------------
  216|     48|                            from = window;
  217|     48|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (217:33): [True: 9, False: 39]
  ------------------
  218|      9|                                op = wnext;
  219|      9|                                len -= op;
  220|     93|                                do {
  221|     93|                                    *out++ = *from++;
  222|     93|                                } while (--op);
  ------------------
  |  Branch (222:42): [True: 84, False: 9]
  ------------------
  223|      9|                                from = out - dist;      /* rest from output */
  224|      9|                            }
  225|     48|                        }
  226|  1.25k|                    }
  227|   104k|                    else {                      /* contiguous in window */
  228|   104k|                        from += wnext - op;
  229|   104k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 1.37k, False: 103k]
  ------------------
  230|  1.37k|                            len -= op;
  231|  7.25k|                            do {
  232|  7.25k|                                *out++ = *from++;
  233|  7.25k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 5.88k, False: 1.37k]
  ------------------
  234|  1.37k|                            from = out - dist;  /* rest from output */
  235|  1.37k|                        }
  236|   104k|                    }
  237|   510k|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 398k, False: 111k]
  ------------------
  238|   398k|                        *out++ = *from++;
  239|   398k|                        *out++ = *from++;
  240|   398k|                        *out++ = *from++;
  241|   398k|                        len -= 3;
  242|   398k|                    }
  243|   111k|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 65.9k, False: 45.5k]
  ------------------
  244|  65.9k|                        *out++ = *from++;
  245|  65.9k|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 34.8k, False: 31.0k]
  ------------------
  246|  34.8k|                            *out++ = *from++;
  247|  65.9k|                    }
  248|   111k|                }
  249|  1.28M|                else {
  250|  1.28M|                    from = out - dist;          /* copy direct from output */
  251|  18.0M|                    do {                        /* minimum length is three */
  252|  18.0M|                        *out++ = *from++;
  253|  18.0M|                        *out++ = *from++;
  254|  18.0M|                        *out++ = *from++;
  255|  18.0M|                        len -= 3;
  256|  18.0M|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 16.7M, False: 1.28M]
  ------------------
  257|  1.28M|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 749k, False: 538k]
  ------------------
  258|   749k|                        *out++ = *from++;
  259|   749k|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 486k, False: 263k]
  ------------------
  260|   486k|                            *out++ = *from++;
  261|   749k|                    }
  262|  1.28M|                }
  263|  1.39M|            }
  264|  74.3k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 74.3k, False: 18]
  ------------------
  265|  74.3k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|  74.3k|                goto dodist;
  267|  74.3k|            }
  268|     18|            else {
  269|     18|                strm->msg = (z_const char *)"invalid distance code";
  270|     18|                state->mode = BAD;
  271|     18|                break;
  272|     18|            }
  273|  1.47M|        }
  274|  90.8k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 85.8k, False: 5.00k]
  ------------------
  275|  85.8k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|  85.8k|            goto dolen;
  277|  85.8k|        }
  278|  5.00k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 4.99k, False: 6]
  ------------------
  279|  4.99k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|  4.99k|            state->mode = TYPE;
  281|  4.99k|            break;
  282|  4.99k|        }
  283|      6|        else {
  284|      6|            strm->msg = (z_const char *)"invalid literal/length code";
  285|      6|            state->mode = BAD;
  286|      6|            break;
  287|      6|        }
  288|  3.06M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 2.85M, False: 112k]
  |  Branch (288:27): [True: 2.85M, False: 541]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|   118k|    len = bits >> 3;
  292|   118k|    in -= len;
  293|   118k|    bits -= len << 3;
  294|   118k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|   118k|    strm->next_in = in;
  298|   118k|    strm->next_out = out;
  299|   118k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 77.1k, False: 41.0k]
  ------------------
  300|   118k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 117k, False: 565]
  ------------------
  301|   117k|                                 257 + (end - out) : 257 - (out - end));
  302|   118k|    state->hold = hold;
  303|   118k|    state->bits = bits;
  304|   118k|    return;
  305|   118k|}

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

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

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

