#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ xRead;
typedef int /*<<< orphan*/ x;
struct iovec {
  char *iov_base;
  int iov_len;
};
typedef int ssize_t;
typedef int /*<<< orphan*/ cRead;
typedef int /*<<< orphan*/ c;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ SEEK_SET;
int _readv(int, struct iovec *, int);
int _writev(int, struct iovec *, int);
int close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ exitErr(char *);
int /*<<< orphan*/ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
int mkstemp(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ unlink(char *);
int main(__attribute__((unused)) int _argc,
         __attribute__((unused)) char **argv) {
  int fd;
  struct iovec iovIn[3];
  struct iovec iovOut[3];
  ssize_t total, numRequired = 0;
  char c = 'a';
  int x = 10;
  char str[13] = "readv writev";
  char cRead;
  int xRead;
  char strRead[13];
  char tmpFile[] = "/tmp/readv_writev_XXXXXX";
  fd = mkstemp(tmpFile);
  if (fd == -1)
    exitErr("mkstemp");
  unlink(tmpFile);
  iovOut[0].iov_base = &c;
  iovOut[0].iov_len = sizeof(c);
  numRequired += sizeof(c);
  iovOut[1].iov_base = &x;
  iovOut[1].iov_len = sizeof(x);
  numRequired += sizeof(x);
  iovOut[2].iov_base = str;
  iovOut[2].iov_len = 13;
  numRequired += 13;
  total = _writev(fd, iovOut, 3);
  if (total == -1)
    exitErr("_writev");
  if (total != numRequired) {
    printf("Total written is different from required.");
    exit(EXIT_FAILURE);
  }
  iovIn[0].iov_base = &cRead;
  iovIn[0].iov_len = sizeof(cRead);
  iovIn[1].iov_base = &xRead;
  iovIn[1].iov_len = sizeof(xRead);
  iovIn[2].iov_base = strRead;
  iovIn[2].iov_len = 13;
  lseek(fd, 0, SEEK_SET);
  total = _readv(fd, iovIn, 3);
  if (total == -1)
    exitErr("_readv");
  if (total != numRequired) {
    printf("Total read is different from required.");
    exit(EXIT_FAILURE);
  }
  printf("c: %c, x: %d, str: %s\n", cRead, xRead, strRead);
  if (close(fd) == -1)
    exitErr("close");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x88(%rbp)
movb   $0x61,-0x89(%rbp)
movl   $0xa,-0x90(%rbp)
mov    0xe35(%rip),%rax
mov    %rax,-0x9d(%rbp)
mov    0xe30(%rip),%eax
mov    %eax,-0x95(%rbp)
mov    0xe28(%rip),%al
mov    %al,-0x91(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0xc8(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0xe9e(%rip),%al
mov    %al,-0xb8(%rbp)
lea    -0xd0(%rbp),%rdi
call   1090 <mkstemp@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1245 <main+0xb5>
lea    0xdcd(%rip),%rdi
call   1040 <exitErr@plt>
lea    -0xd0(%rbp),%rdi
call   1030 <unlink@plt>
lea    -0x89(%rbp),%rax
mov    %rax,-0x80(%rbp)
movl   $0x1,-0x78(%rbp)
movslq -0x88(%rbp),%rax
add    $0x1,%rax
mov    %eax,-0x88(%rbp)
lea    -0x90(%rbp),%rax
mov    %rax,-0x70(%rbp)
movl   $0x4,-0x68(%rbp)
movslq -0x88(%rbp),%rax
add    $0x4,%rax
mov    %eax,-0x88(%rbp)
lea    -0x9d(%rbp),%rax
mov    %rax,-0x60(%rbp)
movl   $0xd,-0x58(%rbp)
mov    -0x88(%rbp),%eax
add    $0xd,%eax
mov    %eax,-0x88(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x3,%edx
call   10a0 <_writev@plt>
mov    %eax,-0x84(%rbp)
cmpl   $0xffffffff,-0x84(%rbp)
jne    12e8 <main+0x158>
lea    0xd32(%rip),%rdi
call   1040 <exitErr@plt>
mov    -0x84(%rbp),%eax
cmp    -0x88(%rbp),%eax
je     1316 <main+0x186>
lea    0xd1c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2cc9(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
lea    -0x9e(%rbp),%rax
mov    %rax,-0x50(%rbp)
movl   $0x1,-0x48(%rbp)
lea    -0xa4(%rbp),%rax
mov    %rax,-0x40(%rbp)
movl   $0x4,-0x38(%rbp)
lea    -0xb1(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0xd,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2c8a(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <lseek@plt>
mov    -0x14(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x3,%edx
call   1080 <_readv@plt>
mov    %eax,-0x84(%rbp)
cmpl   $0xffffffff,-0x84(%rbp)
jne    138f <main+0x1ff>
lea    0xcbd(%rip),%rdi
call   1040 <exitErr@plt>
mov    -0x84(%rbp),%eax
cmp    -0x88(%rbp),%eax
je     13bd <main+0x22d>
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2c22(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
movsbl -0x9e(%rbp),%esi
mov    -0xa4(%rbp),%edx
lea    -0xb1(%rbp),%rcx
lea    0xc9d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    13fc <main+0x26c>
lea    0xc95(%rip),%rdi
call   1040 <exitErr@plt>
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xb0,%rsp
movb   $0x61,0x7(%rsp)
movl   $0xa,0xc(%rsp)
movabs $0x76657469727720,%rax
mov    %rax,0x15(%rsp)
movabs $0x7277207664616572,%rax
20 77 72
mov    %rax,0x10(%rsp)
movups 0xedf(%rip),%xmm0
movups %xmm0,0x29(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x20(%rsp),%rdi
call   1090 <mkstemp@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    11f8 <main+0x68>
lea    0xe1a(%rip),%rdi
call   1040 <exitErr@plt>
lea    0x20(%rsp),%rdi
call   1030 <unlink@plt>
lea    0x7(%rsp),%rax
mov    %rax,0x50(%rsp)
movl   $0x1,0x58(%rsp)
lea    0xc(%rsp),%rax
mov    %rax,0x60(%rsp)
movl   $0x4,0x68(%rsp)
lea    0x10(%rsp),%rax
mov    %rax,0x70(%rsp)
movl   $0xd,0x78(%rsp)
lea    0x50(%rsp),%rsi
mov    %ebx,%edi
mov    $0x3,%edx
call   10a0 <_writev@plt>
cmp    $0x12,%eax
je     126b <main+0xdb>
cmp    $0xffffffff,%eax
jne    125f <main+0xcf>
lea    0xdbb(%rip),%rdi
call   1040 <exitErr@plt>
lea    0xdb7(%rip),%rdi
jmp    12f6 <main+0x166>
lea    0x6(%rsp),%rax
mov    %rax,0x80(%rsp)
movl   $0x1,0x88(%rsp)
lea    0x8(%rsp),%rax
mov    %rax,0x90(%rsp)
movl   $0x4,0x98(%rsp)
lea    0x43(%rsp),%rax
mov    %rax,0xa0(%rsp)
movl   $0xd,0xa8(%rsp)
mov    0x2d26(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1060 <lseek@plt>
lea    0x80(%rsp),%rsi
mov    %ebx,%edi
mov    $0x3,%edx
call   1080 <_readv@plt>
cmp    $0x12,%eax
je     130b <main+0x17b>
cmp    $0xffffffff,%eax
jne    12ef <main+0x15f>
lea    0xd5d(%rip),%rdi
call   1040 <exitErr@plt>
lea    0xd58(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2cd4(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>
movsbl 0x6(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xd5a(%rip),%rdi
lea    0x43(%rsp),%rcx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    133f <main+0x1af>
lea    0xd52(%rip),%rdi
call   1040 <exitErr@plt>
mov    0x2c8a(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.iovec = type { i8*, i32 }
@__const.main.str = [13 x i8] c"readv writev\00"
@__const.main.tmpFile = [25 x i8] c"/tmp/readv_writev_XXXXXX\00"
@.str = [8 x i8] c"mkstemp\00"
@.str.1 = [8 x i8] c"_writev\00"
@.str.2 = [42 x i8] c"Total written is different from required.\00"
@EXIT_FAILURE = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [7 x i8] c"_readv\00"
@.str.4 = [39 x i8] c"Total read is different from required.\00"
@.str.5 = [23 x i8] c"c: %c, x: %d, str: %s\0A\00"
@.str.6 = [6 x i8] c"close\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [3 x %struct.iovec]
%8 = alloca [3 x %struct.iovec]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8
%12 = alloca i32
%13 = alloca [13 x i8]
%14 = alloca i8
%15 = alloca i32
%16 = alloca [13 x i8]
%17 = alloca [25 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
store i8 97, i8* %11
store i32 10, i32* %12
%18 = bitcast [13 x i8]* %13 to i8*
%19 = bitcast [25 x i8]* %17 to i8*
%20 = getelementptr inbounds [25 x i8], [25 x i8]* %17, i64 0, i64 0
%21 = call i32 @mkstemp(i8* %20)
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %26
24: ; preds = %2
%25 = call i32 @exitErr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %24, %2
%27 = getelementptr inbounds [25 x i8], [25 x i8]* %17, i64 0, i64 0
%28 = call i32 @unlink(i8* %27)
%29 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %8, i64 0, i64 0
%30 = getelementptr inbounds %struct.iovec, %struct.iovec* %29, i32 0, i32 0
store i8* %11, i8** %30
%31 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %8, i64 0, i64 0
%32 = getelementptr inbounds %struct.iovec, %struct.iovec* %31, i32 0, i32 1
store i32 1, i32* %32
%33 = load i32, i32* %10
%34 = sext i32 %33 to i64
%35 = add i64 %34, 1
%36 = trunc i64 %35 to i32
store i32 %36, i32* %10
%37 = bitcast i32* %12 to i8*
%38 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %8, i64 0, i64 1
%39 = getelementptr inbounds %struct.iovec, %struct.iovec* %38, i32 0, i32 0
store i8* %37, i8** %39
%40 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %8, i64 0, i64 1
%41 = getelementptr inbounds %struct.iovec, %struct.iovec* %40, i32 0, i32 1
store i32 4, i32* %41
%42 = load i32, i32* %10
%43 = sext i32 %42 to i64
%44 = add i64 %43, 4
%45 = trunc i64 %44 to i32
store i32 %45, i32* %10
%46 = getelementptr inbounds [13 x i8], [13 x i8]* %13, i64 0, i64 0
%47 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %8, i64 0, i64 2
%48 = getelementptr inbounds %struct.iovec, %struct.iovec* %47, i32 0, i32 0
store i8* %46, i8** %48
%49 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %8, i64 0, i64 2
%50 = getelementptr inbounds %struct.iovec, %struct.iovec* %49, i32 0, i32 1
store i32 13, i32* %50
%51 = load i32, i32* %10
%52 = add nsw i32 %51, 13
store i32 %52, i32* %10
%53 = load i32, i32* %6
%54 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %8, i64 0, i64 0
%55 = call i32 @_writev(i32 %53, %struct.iovec* %54, i32 3)
store i32 %55, i32* %9
%56 = load i32, i32* %9
%57 = icmp eq i32 %56, -1
br i1 %57, label %58, label %60
58: ; preds = %26
%59 = call i32 @exitErr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %60
60: ; preds = %58, %26
%61 = load i32, i32* %9
%62 = load i32, i32* %10
%63 = icmp ne i32 %61, %62
br i1 %63, label %64, label %68
64: ; preds = %60
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %60
%69 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %7, i64 0, i64 0
%70 = getelementptr inbounds %struct.iovec, %struct.iovec* %69, i32 0, i32 0
store i8* %14, i8** %70
%71 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %7, i64 0, i64 0
%72 = getelementptr inbounds %struct.iovec, %struct.iovec* %71, i32 0, i32 1
store i32 1, i32* %72
%73 = bitcast i32* %15 to i8*
%74 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %7, i64 0, i64 1
%75 = getelementptr inbounds %struct.iovec, %struct.iovec* %74, i32 0, i32 0
store i8* %73, i8** %75
%76 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %7, i64 0, i64 1
%77 = getelementptr inbounds %struct.iovec, %struct.iovec* %76, i32 0, i32 1
store i32 4, i32* %77
%78 = getelementptr inbounds [13 x i8], [13 x i8]* %16, i64 0, i64 0
%79 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %7, i64 0, i64 2
%80 = getelementptr inbounds %struct.iovec, %struct.iovec* %79, i32 0, i32 0
store i8* %78, i8** %80
%81 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %7, i64 0, i64 2
%82 = getelementptr inbounds %struct.iovec, %struct.iovec* %81, i32 0, i32 1
store i32 13, i32* %82
%83 = load i32, i32* %6
%84 = load i32, i32* @SEEK_SET
%85 = call i32 @lseek(i32 %83, i32 0, i32 %84)
%86 = load i32, i32* %6
%87 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %7, i64 0, i64 0
%88 = call i32 @_readv(i32 %86, %struct.iovec* %87, i32 3)
store i32 %88, i32* %9
%89 = load i32, i32* %9
%90 = icmp eq i32 %89, -1
br i1 %90, label %91, label %93
91: ; preds = %68
%92 = call i32 @exitErr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %93
93: ; preds = %91, %68
%94 = load i32, i32* %9
%95 = load i32, i32* %10
%96 = icmp ne i32 %94, %95
br i1 %96, label %97, label %101
97: ; preds = %93
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%99 = load i32, i32* @EXIT_FAILURE
%100 = call i32 @exit(i32 %99)
unreachable
101: ; preds = %93
%102 = load i8, i8* %14
%103 = sext i8 %102 to i32
%104 = load i32, i32* %15
%105 = getelementptr inbounds [13 x i8], [13 x i8]* %16, i64 0, i64 0
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %103, i32 %104, i8* %105)
%107 = load i32, i32* %6
%108 = call i32 @close(i32 %107)
%109 = icmp eq i32 %108, -1
br i1 %109, label %110, label %112
110: ; preds = %101
%111 = call i32 @exitErr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %112
112: ; preds = %110, %101
%113 = load i32, i32* @EXIT_SUCCESS
%114 = call i32 @exit(i32 %113)
unreachable
}

LLVM IR (-O2):
%struct.iovec = type { i8*, i32 }
@__const.main.str = [13 x i8] c"readv writev\00"
@__const.main.tmpFile = [25 x i8] c"/tmp/readv_writev_XXXXXX\00"
@.str = [8 x i8] c"mkstemp\00"
@.str.1 = [8 x i8] c"_writev\00"
@.str.2 = [42 x i8] c"Total written is different from required.\00"
@EXIT_FAILURE = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [7 x i8] c"_readv\00"
@.str.4 = [39 x i8] c"Total read is different from required.\00"
@.str.5 = [23 x i8] c"c: %c, x: %d, str: %s\0A\00"
@.str.6 = [6 x i8] c"close\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x %struct.iovec]
%4 = alloca [3 x %struct.iovec]
%5 = alloca i8
%6 = alloca i32
%7 = alloca [13 x i8]
%8 = alloca i8
%9 = alloca i32
%10 = alloca [13 x i8]
%11 = alloca [25 x i8]
%12 = bitcast [3 x %struct.iovec]* %3 to i8*
%13 = bitcast [3 x %struct.iovec]* %4 to i8*
store i8 97, i8* %5
%14 = bitcast i32* %6 to i8*
store i32 10, i32* %6
%15 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%16 = bitcast i32* %9 to i8*
%17 = getelementptr inbounds [13 x i8], [13 x i8]* %10, i64 0, i64 0
%18 = getelementptr inbounds [25 x i8], [25 x i8]* %11, i64 0, i64 0
%19 = call i32 @mkstemp(i8* %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 @exitErr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21, %2
%24 = call i32 @unlink(i8* %18)
%25 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %4, i64 0, i64 0
%26 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %4, i64 0, i64 0, i32 0
store i8* %5, i8** %26
%27 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %4, i64 0, i64 0, i32 1
store i32 1, i32* %27
%28 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %4, i64 0, i64 1
%29 = bitcast %struct.iovec* %28 to i32**
store i32* %6, i32** %29
%30 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %4, i64 0, i64 1, i32 1
store i32 4, i32* %30
%31 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %4, i64 0, i64 2, i32 0
store i8* %15, i8** %31
%32 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %4, i64 0, i64 2, i32 1
store i32 13, i32* %32
%33 = call i32 @_writev(i32 %19, %struct.iovec* %25, i32 3)
switch i32 %33, label %36 [
i32 -1, label %34
i32 18, label %40
]
34: ; preds = %23
%35 = call i32 @exitErr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %36
36: ; preds = %34, %23
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %23
%41 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %3, i64 0, i64 0
%42 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %3, i64 0, i64 0, i32 0
store i8* %8, i8** %42
%43 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %3, i64 0, i64 0, i32 1
store i32 1, i32* %43
%44 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %3, i64 0, i64 1
%45 = bitcast %struct.iovec* %44 to i32**
store i32* %9, i32** %45
%46 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %3, i64 0, i64 1, i32 1
store i32 4, i32* %46
%47 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %3, i64 0, i64 2, i32 0
store i8* %17, i8** %47
%48 = getelementptr inbounds [3 x %struct.iovec], [3 x %struct.iovec]* %3, i64 0, i64 2, i32 1
store i32 13, i32* %48
%49 = load i32, i32* @SEEK_SET
%50 = call i32 @lseek(i32 %19, i32 0, i32 %49)
%51 = call i32 @_readv(i32 %19, %struct.iovec* %41, i32 3)
switch i32 %51, label %54 [
i32 -1, label %52
i32 18, label %58
]
52: ; preds = %40
%53 = call i32 @exitErr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %54
54: ; preds = %52, %40
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%56 = load i32, i32* @EXIT_FAILURE
%57 = call i32 @exit(i32 %56)
unreachable
58: ; preds = %40
%59 = load i8, i8* %8
%60 = sext i8 %59 to i32
%61 = load i32, i32* %9
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i32 %60, i32 %61, i8* %17)
%63 = call i32 @close(i32 %19)
%64 = icmp eq i32 %63, -1
br i1 %64, label %65, label %67
65: ; preds = %58
%66 = call i32 @exitErr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
br label %67
67: ; preds = %65, %58
%68 = load i32, i32* @EXIT_SUCCESS
%69 = call i32 @exit(i32 %68)
unreachable
}