static int png_decode_idat(PNGDecContext *s, int length)

{

    int ret;

    s->zstream.avail_in = FFMIN(length, bytestream2_get_bytes_left(&s->gb));

    s->zstream.next_in  = (unsigned char *)s->gb.buffer;

    bytestream2_skip(&s->gb, length);



    /* decode one line if possible */

    while (s->zstream.avail_in > 0) {

        ret = inflate(&s->zstream, Z_PARTIAL_FLUSH);

        if (ret != Z_OK && ret != Z_STREAM_END) {

            av_log(s->avctx, AV_LOG_ERROR, "inflate returned error %d\n", ret);

            return AVERROR_EXTERNAL;

        }

        if (s->zstream.avail_out == 0) {

            if (!(s->state & PNG_ALLIMAGE)) {

                png_handle_row(s);

            }

            s->zstream.avail_out = s->crow_size;

            s->zstream.next_out  = s->crow_buf;

        }

        if (ret == Z_STREAM_END && s->zstream.avail_in > 0) {

            av_log(NULL, AV_LOG_WARNING,

                   "%d undecompressed bytes left in buffer\n", s->zstream.avail_in);

            return 0;

        }

    }

    return 0;

}

static int png_decode_idat(PNGDecContext *s, int length)

{

    int ret;

    s->zstream.avail_in = FFMIN(length, bytestream2_get_bytes_left(&s->gb));

    s->zstream.next_in  = (unsigned char *)s->gb.buffer;

    bytestream2_skip(&s->gb, length);



    

    while (s->zstream.avail_in > 0) {

        ret = inflate(&s->zstream, Z_PARTIAL_FLUSH);

        if (ret != Z_OK && ret != Z_STREAM_END) {

            av_log(s->avctx, AV_LOG_ERROR, "inflate returned error %d\n", ret);

            return AVERROR_EXTERNAL;

        }

        if (s->zstream.avail_out == 0) {

            if (!(s->state & PNG_ALLIMAGE)) {

                png_handle_row(s);

            }

            s->zstream.avail_out = s->crow_size;

            s->zstream.next_out  = s->crow_buf;

        }

        if (ret == Z_STREAM_END && s->zstream.avail_in > 0) {

            av_log(NULL, AV_LOG_WARNING,

                   "%d undecompressed bytes left in buffer\n", s->zstream.avail_in);

            return 0;

        }

    }

    return 0;

}

            if (!(s->state & PNG_ALLIMAGE)) {
static int FUNC_0(PNGDecContext *VAR_0, int VAR_1)

{

    int VAR_2;

    VAR_0->zstream.avail_in = FFMIN(VAR_1, bytestream2_get_bytes_left(&VAR_0->gb));

    VAR_0->zstream.next_in  = (unsigned char *)VAR_0->gb.buffer;

    bytestream2_skip(&VAR_0->gb, VAR_1);



    

    while (VAR_0->zstream.avail_in > 0) {

        VAR_2 = inflate(&VAR_0->zstream, Z_PARTIAL_FLUSH);

        if (VAR_2 != Z_OK && VAR_2 != Z_STREAM_END) {

            av_log(VAR_0->avctx, AV_LOG_ERROR, "inflate returned error %d\n", VAR_2);

            return AVERROR_EXTERNAL;

        }

        if (VAR_0->zstream.avail_out == 0) {

            if (!(VAR_0->state & PNG_ALLIMAGE)) {

                png_handle_row(VAR_0);

            }

            VAR_0->zstream.avail_out = VAR_0->crow_size;

            VAR_0->zstream.next_out  = VAR_0->crow_buf;

        }

        if (VAR_2 == Z_STREAM_END && VAR_0->zstream.avail_in > 0) {

            av_log(NULL, AV_LOG_WARNING,

                   "%d undecompressed bytes left in buffer\n", VAR_0->zstream.avail_in);

            return 0;

        }

    }

    return 0;

}

static int FUNC_0(PNGDecContext *VAR_0, int VAR_1)
{ int VAR_2; VAR_0->zstream.avail_in = FFMIN(VAR_1, bytestream2_get_bytes_left(&VAR_0->gb)); VAR_0->zstream.next_in  = (unsigned char *)VAR_0->gb.buffer; bytestream2_skip(&VAR_0->gb, VAR_1); while (VAR_0->zstream.avail_in > 0) { VAR_2 = inflate(&VAR_0->zstream, Z_PARTIAL_FLUSH); if (VAR_2 != Z_OK && VAR_2 != Z_STREAM_END) { av_log(VAR_0->avctx, AV_LOG_ERROR, "inflate returned error %d\n", VAR_2); return AVERROR_EXTERNAL; } if (VAR_0->zstream.avail_out == 0) { if (!(VAR_0->state & PNG_ALLIMAGE)) { png_handle_row(VAR_0); } VAR_0->zstream.avail_out = VAR_0->crow_size; VAR_0->zstream.next_out  = VAR_0->crow_buf; } if (VAR_2 == Z_STREAM_END && VAR_0->zstream.avail_in > 0) { av_log(NULL, AV_LOG_WARNING,
"%d undecompressed bytes left in buffer\n", VAR_0->zstream.avail_in); return 0; } } return 0; }