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

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

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

_ZN8PipelineC2EPKcPS_:
    9|    158|{
   10|    158|}
_ZN8Pipeline7getNextEb:
   14|     79|{
   15|     79|    if ((this->next == nullptr) && (!allow_null)) {
  ------------------
  |  Branch (15:9): [True: 0, False: 79]
  |  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|     79|    return this->next;
   20|     79|}
_ZN8Pipeline11writeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   36|     79|{
   37|     79|    this->write(str.c_str(), str.length());
   38|     79|}
_ZN8Pipeline5writeEPKcm:
  112|     79|{
  113|     79|    this->write(reinterpret_cast<unsigned char const*>(data), len);
  114|     79|}

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

_ZN12Pl_RunLength7MembersC2ENS_8action_eE:
   10|     79|{
   11|     79|}
_ZN12Pl_RunLengthC2EPKcP8PipelineNS_8action_eE:
   16|     79|{
   17|     79|}
_ZN12Pl_RunLengthD2Ev:
   20|     79|{
   21|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   22|     79|}
_ZN12Pl_RunLength5writeEPKhm:
   26|     79|{
   27|     79|    if (m->action == a_encode) {
  ------------------
  |  Branch (27:9): [True: 0, False: 79]
  ------------------
   28|      0|        encode(data, len);
   29|     79|    } else {
   30|     79|        decode(data, len);
   31|     79|    }
   32|     79|}
_ZN12Pl_RunLength6decodeEPKhm:
   68|     79|{
   69|     79|    m->out.reserve(len);
   70|  4.19M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (70:24): [True: 4.19M, False: 79]
  ------------------
   71|  4.19M|        unsigned char const& ch = data[i];
   72|  4.19M|        switch (m->state) {
  ------------------
  |  Branch (72:17): [True: 0, False: 4.19M]
  ------------------
   73|  1.18M|        case st_top:
  ------------------
  |  Branch (73:9): [True: 1.18M, False: 3.00M]
  ------------------
   74|  1.18M|            if (ch < 128) {
  ------------------
  |  Branch (74:17): [True: 1.15M, False: 28.8k]
  ------------------
   75|       |                // length represents remaining number of bytes to copy
   76|  1.15M|                m->length = 1U + ch;
   77|  1.15M|                m->state = st_copying;
   78|  1.15M|            } else if (ch > 128) {
  ------------------
  |  Branch (78:24): [True: 28.3k, False: 425]
  ------------------
   79|       |                // length represents number of copies of next byte
   80|  28.3k|                m->length = 257U - ch;
   81|  28.3k|                m->state = st_run;
   82|  28.3k|            } else // ch == 128
   83|    425|            {
   84|       |                // EOD; stay in this state
   85|    425|            }
   86|  1.18M|            break;
   87|       |
   88|  2.97M|        case st_copying:
  ------------------
  |  Branch (88:9): [True: 2.97M, False: 1.21M]
  ------------------
   89|  2.97M|            m->out.append(1, static_cast<char>(ch));
   90|  2.97M|            if (--m->length == 0) {
  ------------------
  |  Branch (90:17): [True: 1.15M, False: 1.82M]
  ------------------
   91|  1.15M|                m->state = st_top;
   92|  1.15M|            }
   93|  2.97M|            break;
   94|       |
   95|  28.3k|        case st_run:
  ------------------
  |  Branch (95:9): [True: 28.3k, False: 4.16M]
  ------------------
   96|  28.3k|            m->out.append(m->length, static_cast<char>(ch));
   97|  28.3k|            m->state = st_top;
   98|  28.3k|            break;
   99|  4.19M|        }
  100|  4.19M|    }
  101|     79|}
_ZN12Pl_RunLength6finishEv:
  135|     79|{
  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|     79|    auto next = getNext();
  140|     79|    if (m->action == a_encode) {
  ------------------
  |  Branch (140:9): [True: 0, False: 79]
  ------------------
  141|      0|        flush_encode();
  142|      0|        unsigned char ch = 128;
  143|      0|        next->write(&ch, 1);
  144|     79|    } else {
  145|     79|        next->writeString(m->out);
  146|     79|    }
  147|     79|    next->finish();
  148|     79|}

