static int buf_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)

{

    QEMUBuffer *s = opaque;

    ssize_t len = qsb_get_length(s->qsb) - pos;



    if (len <= 0) {

        return 0;

    }



    if (len > size) {

        len = size;

    }

    return qsb_get_buffer(s->qsb, pos, len, buf);

}

static int buf_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size)

{

    QEMUBuffer *s = opaque;

    ssize_t len = qsb_get_length(s->qsb) - pos;



    if (len <= 0) {

        return 0;

    }



    if (len > size) {

        len = size;

    }

    return qsb_get_buffer(s->qsb, pos, len, buf);

}

static int FUNC_0(void *VAR_0, uint8_t *VAR_1, int64_t VAR_2, int VAR_3)

{

    QEMUBuffer *s = VAR_0;

    ssize_t len = qsb_get_length(s->qsb) - VAR_2;



    if (len <= 0) {

        return 0;

    }



    if (len > VAR_3) {

        len = VAR_3;

    }

    return qsb_get_buffer(s->qsb, VAR_2, len, VAR_1);

}

static int FUNC_0(void *VAR_0, uint8_t *VAR_1, int64_t VAR_2, int VAR_3)
{ QEMUBuffer *s = VAR_0; ssize_t len = qsb_get_length(s->qsb) - VAR_2; if (len <= 0) { return 0; } if (len > VAR_3) { len = VAR_3; } return qsb_get_buffer(s->qsb, VAR_2, len, VAR_1); }