int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size)

{

    int pending = size;

    int done = 0;



    while (pending > 0) {

        int res;



        res = qemu_peek_buffer(f, buf, pending, 0);

        if (res == 0) {

            return done;

        }

        qemu_file_skip(f, res);

        buf += res;

        pending -= res;

        done += res;

    }

    return done;

}

int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size)

{

    int pending = size;

    int done = 0;



    while (pending > 0) {

        int res;



        res = qemu_peek_buffer(f, buf, pending, 0);

        if (res == 0) {

            return done;

        }

        qemu_file_skip(f, res);

        buf += res;

        pending -= res;

        done += res;

    }

    return done;

}

        res = qemu_peek_buffer(f, buf, pending, 0);
int FUNC_0(QEMUFile *VAR_0, uint8_t *VAR_1, int VAR_2)

{

    int VAR_3 = VAR_2;

    int VAR_4 = 0;



    while (VAR_3 > 0) {

        int VAR_5;



        VAR_5 = qemu_peek_buffer(VAR_0, VAR_1, VAR_3, 0);

        if (VAR_5 == 0) {

            return VAR_4;

        }

        qemu_file_skip(VAR_0, VAR_5);

        VAR_1 += VAR_5;

        VAR_3 -= VAR_5;

        VAR_4 += VAR_5;

    }

    return VAR_4;

}

int FUNC_0(QEMUFile *VAR_0, uint8_t *VAR_1, int VAR_2)
{ int VAR_3 = VAR_2; int VAR_4 = 0; while (VAR_3 > 0) { int VAR_5; VAR_5 = qemu_peek_buffer(VAR_0, VAR_1, VAR_3, 0); if (VAR_5 == 0) { return VAR_4; } qemu_file_skip(VAR_0, VAR_5); VAR_1 += VAR_5; VAR_3 -= VAR_5; VAR_4 += VAR_5; } return VAR_4; }