void qemu_iovec_concat_iov(QEMUIOVector *dst,
                           struct iovec *src_iov, unsigned int src_cnt,
                           size_t soffset, size_t sbytes)
{
    int i;
    size_t done;
    assert(dst->nalloc != -1);
    for (i = 0, done = 0; done < sbytes && i < src_cnt; i++) {
        if (soffset < src_iov[i].iov_len) {
            size_t len = MIN(src_iov[i].iov_len - soffset, sbytes - done);
            qemu_iovec_add(dst, src_iov[i].iov_base + soffset, len);
            done += len;
            soffset = 0;
        } else {
            soffset -= src_iov[i].iov_len;
    assert(soffset == 0); /* offset beyond end of src */
void qemu_iovec_concat_iov(QEMUIOVector *dst,
                           struct iovec *src_iov, unsigned int src_cnt,
                           size_t soffset, size_t sbytes)
{
    int i;
    size_t done;
    assert(dst->nalloc != -1);
    for (i = 0, done = 0; done < sbytes && i < src_cnt; i++) {
        if (soffset < src_iov[i].iov_len) {
            size_t len = MIN(src_iov[i].iov_len - soffset, sbytes - done);
            qemu_iovec_add(dst, src_iov[i].iov_base + soffset, len);
            done += len;
            soffset = 0;
        } else {
            soffset -= src_iov[i].iov_len;
    assert(soffset == 0); 
void FUNC_0(QEMUIOVector *VAR_0,
                           struct iovec *VAR_1, unsigned int VAR_2,
                           size_t VAR_3, size_t VAR_4)
{
    int VAR_5;
    size_t done;
    assert(VAR_0->nalloc != -1);
    for (VAR_5 = 0, done = 0; done < VAR_4 && VAR_5 < VAR_2; VAR_5++) {
        if (VAR_3 < VAR_1[VAR_5].iov_len) {
            size_t len = MIN(VAR_1[VAR_5].iov_len - VAR_3, VAR_4 - done);
            qemu_iovec_add(VAR_0, VAR_1[VAR_5].iov_base + VAR_3, len);
            done += len;
            VAR_3 = 0;
        } else {
            VAR_3 -= VAR_1[VAR_5].iov_len;
    assert(VAR_3 == 0); 
void FUNC_0(QEMUIOVector *VAR_0,
struct iovec *VAR_1, unsigned int VAR_2,
size_t VAR_3, size_t VAR_4)
{ int VAR_5; size_t done; assert(VAR_0->nalloc != -1); for (VAR_5 = 0, done = 0; done < VAR_4 && VAR_5 < VAR_2; VAR_5++) { if (VAR_3 < VAR_1[VAR_5].iov_len) { size_t len = MIN(VAR_1[VAR_5].iov_len - VAR_3, VAR_4 - done); qemu_iovec_add(VAR_0, VAR_1[VAR_5].iov_base + VAR_3, len); done += len; VAR_3 = 0; } else { VAR_3 -= VAR_1[VAR_5].iov_len; assert(VAR_3 == 0);