_ZN10FuzzHelperC2EPKhm:
   22|     77|{
   23|     77|}
_ZN10FuzzHelper8doChecksEv:
   27|     77|{
   28|     77|    Pl_Discard discard;
   29|     77|    Pl_RunLength p("decode", &discard, Pl_RunLength::a_decode);
   30|     77|    p.write(const_cast<unsigned char*>(data), size);
   31|     77|    p.finish();
   32|     77|}
_ZN10FuzzHelper3runEv:
   36|     77|{
   37|     77|    try {
   38|     77|        doChecks();
   39|     77|    } catch (std::runtime_error const& e) {
   40|      0|        std::cerr << "runtime_error: " << e.what() << std::endl;
   41|      0|    }
   42|     77|}
LLVMFuzzerTestOneInput:
   46|     77|{
   47|     77|    FuzzHelper f(data, size);
   48|     77|    f.run();
   49|     77|    return 0;
   50|     77|}

_ZN8PipelineD2Ev:
   53|    154|    virtual ~Pipeline() = default;

_ZN12Pl_RunLength7MembersD2Ev:
   55|     77|        ~Members() = default;

_ZN8PipelineC2EPKcPS_:
    9|    154|{
   10|    154|}
_ZN8Pipeline7getNextEb:
   14|     77|{
   15|     77|    if ((this->next == nullptr) && (!allow_null)) {
  ------------------
  |  Branch (15:9): [True: 0, False: 77]
  |  Branch (15:36): [True: 0, False: 0]
  ------------------
   16|      0|        throw std::logic_error(
   17|      0|            this->identifier + ": Pipeline::getNext() called on pipeline with no next");
   18|      0|    }
   19|     77|    return this->next;
   20|     77|}
_ZN8Pipeline11writeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   36|     77|{
   37|     77|    this->write(str.c_str(), str.length());
   38|     77|}
_ZN8Pipeline5writeEPKcm:
  112|     77|{
  113|     77|    this->write(reinterpret_cast<unsigned char const*>(data), len);
  114|     77|}

_ZN10Pl_DiscardC2Ev:
    7|     77|{
    8|     77|}
_ZN10Pl_DiscardD2Ev:
   11|     77|{
   12|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   13|     77|}
_ZN10Pl_Discard5writeEPKhm:
   17|     77|{
   18|     77|}
_ZN10Pl_Discard6finishEv:
   22|     77|{
   23|     77|}

_ZN12Pl_RunLength7MembersC2ENS_8action_eE:
   10|     77|{
   11|     77|}
_ZN12Pl_RunLengthC2EPKcP8PipelineNS_8action_eE:
   16|     77|{
   17|     77|}
_ZN12Pl_RunLengthD2Ev:
   20|     77|{
   21|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   22|     77|}
_ZN12Pl_RunLength5writeEPKhm:
   26|     77|{
   27|     77|    if (m->action == a_encode) {
  ------------------
  |  Branch (27:9): [True: 0, False: 77]
  ------------------
   28|      0|        encode(data, len);
   29|     77|    } else {
   30|     77|        decode(data, len);
   31|     77|    }
   32|     77|}
_ZN12Pl_RunLength6decodeEPKhm:
   68|     77|{
   69|     77|    m->out.reserve(len);
   70|  4.19M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (70:24): [True: 4.19M, False: 77]
  ------------------
   71|  4.19M|        unsigned char const& ch = data[i];
   72|  4.19M|        switch (m->state) {
  ------------------
  |  Branch (72:17): [True: 0, False: 4.19M]
  ------------------
   73|   232k|        case st_top:
  ------------------
  |  Branch (73:9): [True: 232k, False: 3.96M]
  ------------------
   74|   232k|            if (ch < 128) {
  ------------------
  |  Branch (74:17): [True: 159k, False: 73.0k]
  ------------------
   75|       |                // length represents remaining number of bytes to copy
   76|   159k|                m->length = 1U + ch;
   77|   159k|                m->state = st_copying;
   78|   159k|            } else if (ch > 128) {
  ------------------
  |  Branch (78:24): [True: 72.7k, False: 342]
  ------------------
   79|       |                // length represents number of copies of next byte
   80|  72.7k|                m->length = 257U - ch;
   81|  72.7k|                m->state = st_run;
   82|  72.7k|            } else // ch == 128
   83|    342|            {
   84|       |                // EOD; stay in this state
   85|    342|            }
   86|   232k|            break;
   87|       |
   88|  3.89M|        case st_copying:
  ------------------
  |  Branch (88:9): [True: 3.89M, False: 304k]
  ------------------
   89|  3.89M|            m->out.append(1, static_cast<char>(ch));
   90|  3.89M|            if (--m->length == 0) {
  ------------------
  |  Branch (90:17): [True: 159k, False: 3.73M]
  ------------------
   91|   159k|                m->state = st_top;
   92|   159k|            }
   93|  3.89M|            break;
   94|       |
   95|  72.7k|        case st_run:
  ------------------
  |  Branch (95:9): [True: 72.7k, False: 4.12M]
  ------------------
   96|  72.7k|            m->out.append(m->length, static_cast<char>(ch));
   97|  72.7k|            m->state = st_top;
   98|  72.7k|            break;
   99|  4.19M|        }
  100|  4.19M|    }
  101|     77|}
_ZN12Pl_RunLength6finishEv:
  135|     77|{
  136|       |    // When decoding, we might have read a length byte not followed by data, which means the stream
  137|       |    // was terminated early, but we will just ignore this case since this is the only sensible thing
  138|       |    // to do.
  139|     77|    auto next = getNext();
  140|     77|    if (m->action == a_encode) {
  ------------------
  |  Branch (140:9): [True: 0, False: 77]
  ------------------
  141|      0|        flush_encode();
  142|      0|        unsigned char ch = 128;
  143|      0|        next->write(&ch, 1);
  144|     77|    } else {
  145|     77|        next->writeString(m->out);
  146|     77|    }
  147|     77|    next->finish();
  148|     77|}

