create_iovec(QEMUIOVector *qiov, char **argv, int nr_iov, int pattern)

{

	size_t *sizes = calloc(nr_iov, sizeof(size_t));

	size_t count = 0;

	void *buf, *p;

	int i;



	for (i = 0; i < nr_iov; i++) {

		char *arg = argv[i];

		long long len;



		len = cvtnum(arg);

		if (len < 0) {

			printf("non-numeric length argument -- %s\n", arg);

			return NULL;

		}



		/* should be SIZE_T_MAX, but that doesn't exist */

		if (len > UINT_MAX) {

			printf("too large length argument -- %s\n", arg);

			return NULL;

		}



		if (len & 0x1ff) {

			printf("length argument %lld is not sector aligned\n",

				len);

			return NULL;

		}



		sizes[i] = len;

		count += len;

	}



	qemu_iovec_init(qiov, nr_iov);



	buf = p = qemu_io_alloc(count, pattern);



	for (i = 0; i < nr_iov; i++) {

		qemu_iovec_add(qiov, p, sizes[i]);

		p += sizes[i];

	}



	free(sizes);

	return buf;

}

create_iovec(QEMUIOVector *qiov, char **argv, int nr_iov, int pattern)

{

	size_t *sizes = calloc(nr_iov, sizeof(size_t));

	size_t count = 0;

	void *buf, *p;

	int i;



	for (i = 0; i < nr_iov; i++) {

		char *arg = argv[i];

		long long len;



		len = cvtnum(arg);

		if (len < 0) {

			printf("non-numeric length argument -- %s\n", arg);

			return NULL;

		}



		

		if (len > UINT_MAX) {

			printf("too large length argument -- %s\n", arg);

			return NULL;

		}



		if (len & 0x1ff) {

			printf("length argument %lld is not sector aligned\n",

				len);

			return NULL;

		}



		sizes[i] = len;

		count += len;

	}



	qemu_iovec_init(qiov, nr_iov);



	buf = p = qemu_io_alloc(count, pattern);



	for (i = 0; i < nr_iov; i++) {

		qemu_iovec_add(qiov, p, sizes[i]);

		p += sizes[i];

	}



	free(sizes);

	return buf;

}

	void *buf, *p; 			return NULL; 			return NULL; 			return NULL;
FUNC_0(QEMUIOVector *VAR_0, char **VAR_1, int VAR_2, int VAR_3)

{

	size_t *sizes = calloc(VAR_2, sizeof(size_t));

	size_t count = 0;

	void *VAR_4, *VAR_5;

	int VAR_6;



	for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) {

		char *VAR_7 = VAR_1[VAR_6];

		long long VAR_8;



		VAR_8 = cvtnum(VAR_7);

		if (VAR_8 < 0) {

			printf("non-numeric length argument -- %s\n", VAR_7);

			return NULL;

		}



		

		if (VAR_8 > UINT_MAX) {

			printf("too large length argument -- %s\n", VAR_7);

			return NULL;

		}



		if (VAR_8 & 0x1ff) {

			printf("length argument %lld is not sector aligned\n",

				VAR_8);

			return NULL;

		}



		sizes[VAR_6] = VAR_8;

		count += VAR_8;

	}



	qemu_iovec_init(VAR_0, VAR_2);



	VAR_4 = VAR_5 = qemu_io_alloc(count, VAR_3);



	for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) {

		qemu_iovec_add(VAR_0, VAR_5, sizes[VAR_6]);

		VAR_5 += sizes[VAR_6];

	}



	free(sizes);

	return VAR_4;

}

FUNC_0(QEMUIOVector *VAR_0, char **VAR_1, int VAR_2, int VAR_3)
{ size_t *sizes = calloc(VAR_2, sizeof(size_t)); size_t count = 0; void *VAR_4, *VAR_5; int VAR_6; for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) { char *VAR_7 = VAR_1[VAR_6]; long long VAR_8; VAR_8 = cvtnum(VAR_7); if (VAR_8 < 0) { printf("non-numeric length argument -- %s\n", VAR_7); return NULL; } if (VAR_8 > UINT_MAX) { printf("too large length argument -- %s\n", VAR_7); return NULL; } if (VAR_8 & 0x1ff) { printf("length argument %lld is not sector aligned\n",
VAR_8); return NULL; } sizes[VAR_6] = VAR_8; count += VAR_8; } qemu_iovec_init(VAR_0, VAR_2); VAR_4 = VAR_5 = qemu_io_alloc(count, VAR_3); for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) { qemu_iovec_add(VAR_0, VAR_5, sizes[VAR_6]); VAR_5 += sizes[VAR_6]; } free(sizes); return VAR_4; }