static int ram_decompress_buf(RamDecompressState *s, uint8_t *buf, int len)

{

    int ret, clen;



    s->zstream.avail_out = len;

    s->zstream.next_out = buf;

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

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

            if (qemu_get_be16(s->f) != RAM_CBLOCK_MAGIC)

                return -1;

            clen = qemu_get_be16(s->f);

            if (clen > IOBUF_SIZE)

                return -1;

            qemu_get_buffer(s->f, s->buf, clen);

            s->zstream.avail_in = clen;

            s->zstream.next_in = s->buf;

        }

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

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

            return -1;

        }

    }

    return 0;

}

static int ram_decompress_buf(RamDecompressState *s, uint8_t *buf, int len)

{

    int ret, clen;



    s->zstream.avail_out = len;

    s->zstream.next_out = buf;

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

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

            if (qemu_get_be16(s->f) != RAM_CBLOCK_MAGIC)

                return -1;

            clen = qemu_get_be16(s->f);

            if (clen > IOBUF_SIZE)

                return -1;

            qemu_get_buffer(s->f, s->buf, clen);

            s->zstream.avail_in = clen;

            s->zstream.next_in = s->buf;

        }

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

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

            return -1;

        }

    }

    return 0;

}

    return 0; static int ram_decompress_buf(RamDecompressState *s, uint8_t *buf, int len)     int ret, clen;     s->zstream.avail_out = len;     s->zstream.next_out = buf;     while (s->zstream.avail_out > 0) {         if (s->zstream.avail_in == 0) {             if (qemu_get_be16(s->f) != RAM_CBLOCK_MAGIC)                 return -1;             clen = qemu_get_be16(s->f);             if (clen > IOBUF_SIZE)                 return -1;             qemu_get_buffer(s->f, s->buf, clen);             s->zstream.avail_in = clen;             s->zstream.next_in = s->buf;         ret = inflate(&s->zstream, Z_PARTIAL_FLUSH);         if (ret != Z_OK && ret != Z_STREAM_END) {             return -1;     return 0;     return 0;
static int FUNC_0(RamDecompressState *VAR_0, uint8_t *VAR_1, int VAR_2)

{

    int VAR_3, VAR_4;



    VAR_0->zstream.avail_out = VAR_2;

    VAR_0->zstream.next_out = VAR_1;

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

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

            if (qemu_get_be16(VAR_0->f) != RAM_CBLOCK_MAGIC)

                return -1;

            VAR_4 = qemu_get_be16(VAR_0->f);

            if (VAR_4 > IOBUF_SIZE)

                return -1;

            qemu_get_buffer(VAR_0->f, VAR_0->VAR_1, VAR_4);

            VAR_0->zstream.avail_in = VAR_4;

            VAR_0->zstream.next_in = VAR_0->VAR_1;

        }

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

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

            return -1;

        }

    }

    return 0;

}

static int FUNC_0(RamDecompressState *VAR_0, uint8_t *VAR_1, int VAR_2)
{ int VAR_3, VAR_4; VAR_0->zstream.avail_out = VAR_2; VAR_0->zstream.next_out = VAR_1; while (VAR_0->zstream.avail_out > 0) { if (VAR_0->zstream.avail_in == 0) { if (qemu_get_be16(VAR_0->f) != RAM_CBLOCK_MAGIC)
return -1; VAR_4 = qemu_get_be16(VAR_0->f); if (VAR_4 > IOBUF_SIZE)
return -1; qemu_get_buffer(VAR_0->f, VAR_0->VAR_1, VAR_4); VAR_0->zstream.avail_in = VAR_4; VAR_0->zstream.next_in = VAR_0->VAR_1; } VAR_3 = inflate(&VAR_0->zstream, Z_PARTIAL_FLUSH); if (VAR_3 != Z_OK && VAR_3 != Z_STREAM_END) { return -1; } } return 0; }