static ssize_t qemu_fill_buffer(QEMUFile *f)

{

    int len;

    int pending;



    assert(!qemu_file_is_writable(f));



    pending = f->buf_size - f->buf_index;

    if (pending > 0) {

        memmove(f->buf, f->buf + f->buf_index, pending);

    }

    f->buf_index = 0;

    f->buf_size = pending;



    len = f->ops->get_buffer(f->opaque, f->buf + pending, f->pos,

                        IO_BUF_SIZE - pending);

    if (len > 0) {

        f->buf_size += len;

        f->pos += len;

    } else if (len == 0) {

        qemu_file_set_error(f, -EIO);

    } else if (len != -EAGAIN) {

        qemu_file_set_error(f, len);

    }



    return len;

}

static ssize_t qemu_fill_buffer(QEMUFile *f)

{

    int len;

    int pending;



    assert(!qemu_file_is_writable(f));



    pending = f->buf_size - f->buf_index;

    if (pending > 0) {

        memmove(f->buf, f->buf + f->buf_index, pending);

    }

    f->buf_index = 0;

    f->buf_size = pending;



    len = f->ops->get_buffer(f->opaque, f->buf + pending, f->pos,

                        IO_BUF_SIZE - pending);

    if (len > 0) {

        f->buf_size += len;

        f->pos += len;

    } else if (len == 0) {

        qemu_file_set_error(f, -EIO);

    } else if (len != -EAGAIN) {

        qemu_file_set_error(f, len);

    }



    return len;

}

static ssize_t FUNC_0(QEMUFile *f)

{

    int VAR_0;

    int VAR_1;



    assert(!qemu_file_is_writable(f));



    VAR_1 = f->buf_size - f->buf_index;

    if (VAR_1 > 0) {

        memmove(f->buf, f->buf + f->buf_index, VAR_1);

    }

    f->buf_index = 0;

    f->buf_size = VAR_1;



    VAR_0 = f->ops->get_buffer(f->opaque, f->buf + VAR_1, f->pos,

                        IO_BUF_SIZE - VAR_1);

    if (VAR_0 > 0) {

        f->buf_size += VAR_0;

        f->pos += VAR_0;

    } else if (VAR_0 == 0) {

        qemu_file_set_error(f, -EIO);

    } else if (VAR_0 != -EAGAIN) {

        qemu_file_set_error(f, VAR_0);

    }



    return VAR_0;

}

static ssize_t FUNC_0(QEMUFile *f)
{ int VAR_0; int VAR_1; assert(!qemu_file_is_writable(f)); VAR_1 = f->buf_size - f->buf_index; if (VAR_1 > 0) { memmove(f->buf, f->buf + f->buf_index, VAR_1); } f->buf_index = 0; f->buf_size = VAR_1; VAR_0 = f->ops->get_buffer(f->opaque, f->buf + VAR_1, f->pos,
IO_BUF_SIZE - VAR_1); if (VAR_0 > 0) { f->buf_size += VAR_0; f->pos += VAR_0; } else if (VAR_0 == 0) { qemu_file_set_error(f, -EIO); } else if (VAR_0 != -EAGAIN) { qemu_file_set_error(f, VAR_0); } return VAR_0; }