#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 */
struct iovec {
  int iov_len;
  struct iovec *iov_base;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EBADF;
int EINVAL;
void *SIZE_MAX;
int errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ puts(char *);
int read(int, struct iovec *, int);
int readv(int, struct iovec *, int);
char *strerror(int);
int writev(int, struct iovec *, int);
int doErrorTest(void) {
  FILE *fp;
  int fd;
  struct iovec vec[4];
  int rc;
  fp = fopen("testfile1.tst", "wt");
  if (fp == NULL) {
    printf("fopen for error 1: %d=%s\n", errno, strerror(errno));
    return 0;
  }
  fd = fileno(fp);
  fclose(fp);
  puts("writev bad file descriptor -- EBADF");
  rc = writev(fd, vec, 4);
  if ((rc != -1) || (errno != EBADF)) {
    printf("writev error 1: %d=%s\n", errno, strerror(errno));
    return 0;
  }
  puts("readv bad file descriptor -- EBADF");
  rc = read(fd, vec, 4);
  if ((rc != -1) || (errno != EBADF)) {
    printf("readv error 1: %d=%s\n", errno, strerror(errno));
    return 0;
  }
  fp = fopen("testfile1.tst", "w+");
  if (fp == NULL) {
    printf("fopen for error 2: %d=%s\n", errno, strerror(errno));
    return 0;
  }
  fd = fileno(fp);
  puts("writev bad iovec pointer -- EINVAL");
  rc = writev(fd, NULL, 4);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("writev error 2: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  puts("readv bad iovec pointer -- EINVAL");
  rc = readv(fd, NULL, 4);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("readv error 2: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  puts("readv bad iovcnt of 0 -- EINVAL");
  rc = writev(fd, vec, 0);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("writev error 3: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  puts("readv bad iovcnt of 0 -- EINVAL");
  rc = readv(fd, vec, 0);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("readv error 3: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  puts("writev bad iovcnt negative -- EINVAL");
  rc = writev(fd, vec, -2);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("writev error 4: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  puts("readv bad iovcnt negative -- EINVAL");
  rc = readv(fd, vec, -100);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("readv error 4: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  vec[0].iov_base = vec;
  vec[0].iov_len = 100;
  vec[1].iov_base = NULL;
  vec[1].iov_len = 100;
  puts("writev bad iov[i].iov_base -- EINVAL");
  rc = writev(fd, vec, 2);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("writev error 5: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  vec[0].iov_base = vec;
  vec[0].iov_len = 100;
  vec[1].iov_base = NULL;
  vec[1].iov_len = 100;
  puts("readv bad iov[i].iov_base -- EINVAL");
  rc = readv(fd, vec, 2);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("readv error 5: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  vec[0].iov_base = vec;
  vec[0].iov_len = 100;
  vec[1].iov_base = vec;
  vec[1].iov_len = -10;
  puts("writev bad iov[i].iov_len < 0 -- EINVAL");
  rc = writev(fd, vec, 2);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("writev error 6: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  vec[0].iov_base = vec;
  vec[0].iov_len = 100;
  vec[1].iov_base = vec;
  vec[1].iov_len = -1024;
  puts("readv bad iov[i].iov_len = 0 -- EINVAL");
  rc = readv(fd, vec, 2);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("readv error 6: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  vec[0].iov_base = vec;
  vec[0].iov_len = SIZE_MAX;
  vec[1].iov_base = vec;
  vec[1].iov_len = SIZE_MAX;
  vec[2].iov_base = vec;
  vec[2].iov_len = SIZE_MAX;
  puts("writev iov_len total overflows -- EINVAL");
  rc = writev(fd, vec, 3);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("writev error 7: rc=%d %d=%s\n", rc, errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  vec[0].iov_base = vec;
  vec[0].iov_len = SIZE_MAX;
  vec[1].iov_base = vec;
  vec[1].iov_len = SIZE_MAX;
  puts("readv iov_len total overflows -- EINVAL");
  rc = readv(fd, vec, 2);
  if ((rc != -1) || (errno != EINVAL)) {
    printf("read error 7: rc=%d %d=%s\n", rc, errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  vec[0].iov_base = vec;
  vec[0].iov_len = 0;
  vec[1].iov_base = vec;
  vec[1].iov_len = 0;
  puts("writev iov_len works with no effect -- OK");
  rc = writev(fd, vec, 2);
  if ((rc != 0)) {
    printf("writev error 8: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  vec[0].iov_base = vec;
  vec[0].iov_len = 0;
  vec[1].iov_base = vec;
  vec[1].iov_len = 0;
  puts("readv iov_len works with no effect -- OK");
  rc = readv(fd, vec, 2);
  if ((rc != 0)) {
    printf("readv error 8: %d=%s\n", errno, strerror(errno));
    fclose(fp);
    return 0;
  }
  fclose(fp);
  return 1;
}


x86 assembly (clang, -O0):
<doErrorTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
lea    0xe5e(%rip),%rdi
lea    0xe65(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11f7 <doErrorTest+0x67>
mov    0x2e1c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    0x2e10(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x68(%rbp),%esi
mov    %rax,%rdx
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
mov    -0x10(%rbp),%rdi
call   1080 <fileno@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
lea    0xe18(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x4,%edx
call   1030 <writev@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    124e <doErrorTest+0xbe>
mov    0x2da3(%rip),%rax
mov    (%rax),%eax
mov    0x2d8a(%rip),%rcx
cmp    (%rcx),%eax
je     1288 <doErrorTest+0xf8>
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x6c(%rbp),%esi
mov    %rax,%rdx
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    0xdd7(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x4,%edx
call   1070 <read@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    12ca <doErrorTest+0x13a>
mov    0x2d27(%rip),%rax
mov    (%rax),%eax
mov    0x2d0e(%rip),%rcx
cmp    (%rcx),%eax
je     1304 <doErrorTest+0x174>
mov    0x2d0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    0x2d03(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x70(%rbp),%esi
mov    %rax,%rdx
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    0xcf5(%rip),%rdi
lea    0xd8d(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1360 <doErrorTest+0x1d0>
mov    0x2cb3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x74(%rbp),%esi
mov    %rax,%rdx
lea    0xd55(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
mov    -0x10(%rbp),%rdi
call   1080 <fileno@plt>
mov    %eax,-0x14(%rbp)
lea    0xd49(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x4,%edx
call   1030 <writev@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    13ae <doErrorTest+0x21e>
mov    0x2c43(%rip),%rax
mov    (%rax),%eax
mov    0x2c32(%rip),%rcx
cmp    (%rcx),%eax
je     13f1 <doErrorTest+0x261>
mov    0x2c2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
mov    0x2c1f(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x78(%rbp),%esi
mov    %rax,%rdx
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    0xcfe(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x4,%edx
call   1090 <readv@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    1433 <doErrorTest+0x2a3>
mov    0x2bbe(%rip),%rax
mov    (%rax),%eax
mov    0x2bad(%rip),%rcx
cmp    (%rcx),%eax
je     1476 <doErrorTest+0x2e6>
mov    0x2ba6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7c(%rbp)
mov    0x2b9a(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x7c(%rbp),%esi
mov    %rax,%rdx
lea    0xcbe(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    0xcb1(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
xor    %edx,%edx
call   1030 <writev@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    14b5 <doErrorTest+0x325>
mov    0x2b3c(%rip),%rax
mov    (%rax),%eax
mov    0x2b2b(%rip),%rcx
cmp    (%rcx),%eax
je     14f8 <doErrorTest+0x368>
mov    0x2b24(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x80(%rbp)
mov    0x2b18(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x80(%rbp),%esi
mov    %rax,%rdx
lea    0xc72(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    0xc2f(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
xor    %edx,%edx
call   1090 <readv@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    1537 <doErrorTest+0x3a7>
mov    0x2aba(%rip),%rax
mov    (%rax),%eax
mov    0x2aa9(%rip),%rcx
cmp    (%rcx),%eax
je     1580 <doErrorTest+0x3f0>
mov    0x2aa2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x2a93(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x84(%rbp),%esi
mov    %rax,%rdx
lea    0xc01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    0xbf4(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0xfffffffe,%edx
call   1030 <writev@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    15c2 <doErrorTest+0x432>
mov    0x2a2f(%rip),%rax
mov    (%rax),%eax
mov    0x2a1e(%rip),%rcx
cmp    (%rcx),%eax
je     160b <doErrorTest+0x47b>
mov    0x2a17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x88(%rbp)
mov    0x2a08(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x88(%rbp),%esi
mov    %rax,%rdx
lea    0xbb1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    0xba5(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0xffffff9c,%edx
call   1090 <readv@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    164d <doErrorTest+0x4bd>
mov    0x29a4(%rip),%rax
mov    (%rax),%eax
mov    0x2993(%rip),%rcx
cmp    (%rcx),%eax
je     1696 <doErrorTest+0x506>
mov    0x298c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    0x297d(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x8c(%rbp),%esi
mov    %rax,%rdx
lea    0xb61(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
movl   $0x64,-0x60(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x64,-0x50(%rbp)
lea    0xb36(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x2,%edx
call   1030 <writev@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    16f6 <doErrorTest+0x566>
mov    0x28fb(%rip),%rax
mov    (%rax),%eax
mov    0x28ea(%rip),%rcx
cmp    (%rcx),%eax
je     173f <doErrorTest+0x5af>
mov    0x28e3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x90(%rbp)
mov    0x28d4(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x90(%rbp),%esi
mov    %rax,%rdx
lea    0xaf3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
movl   $0x64,-0x60(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x64,-0x50(%rbp)
lea    0xac9(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x2,%edx
call   1090 <readv@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    179f <doErrorTest+0x60f>
mov    0x2852(%rip),%rax
mov    (%rax),%eax
mov    0x2841(%rip),%rcx
cmp    (%rcx),%eax
je     17e8 <doErrorTest+0x658>
mov    0x283a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    0x282b(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x94(%rbp),%esi
mov    %rax,%rdx
lea    0xa85(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
movl   $0x64,-0x60(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0xfffffff6,-0x50(%rbp)
lea    0xa5a(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x2,%edx
call   1030 <writev@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    1848 <doErrorTest+0x6b8>
mov    0x27a9(%rip),%rax
mov    (%rax),%eax
mov    0x2798(%rip),%rcx
cmp    (%rcx),%eax
je     1891 <doErrorTest+0x701>
mov    0x2791(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x98(%rbp)
mov    0x2782(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x98(%rbp),%esi
mov    %rax,%rdx
lea    0xa1a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
movl   $0x64,-0x60(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0xfffffc00,-0x50(%rbp)
lea    0x9f0(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x2,%edx
call   1090 <readv@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    18f1 <doErrorTest+0x761>
mov    0x2700(%rip),%rax
mov    (%rax),%eax
mov    0x26ef(%rip),%rcx
cmp    (%rcx),%eax
je     193a <doErrorTest+0x7aa>
mov    0x26e8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    0x26d9(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x9c(%rbp),%esi
mov    %rax,%rdx
lea    0x9af(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2677(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x60(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    0x2662(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x50(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    0x264d(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x40(%rbp)
lea    0x963(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x3,%edx
call   1030 <writev@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    19bb <doErrorTest+0x82b>
mov    0x2636(%rip),%rax
mov    (%rax),%eax
mov    0x2625(%rip),%rcx
cmp    (%rcx),%eax
je     1a13 <doErrorTest+0x883>
mov    -0x64(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    0x2615(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa0(%rbp)
mov    0x2606(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0xa4(%rbp),%esi
mov    -0xa0(%rbp),%edx
mov    %rax,%rcx
lea    0x915(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x259e(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x60(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    0x2589(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x50(%rbp)
lea    0x8e5(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x2,%edx
call   1090 <readv@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0xffffffff,-0x64(%rbp)
jne    1a7f <doErrorTest+0x8ef>
mov    0x2572(%rip),%rax
mov    (%rax),%eax
mov    0x2561(%rip),%rcx
cmp    (%rcx),%eax
je     1ad7 <doErrorTest+0x947>
mov    -0x64(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    0x2551(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa8(%rbp)
mov    0x2542(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0xac(%rbp),%esi
mov    -0xa8(%rbp),%edx
mov    %rax,%rcx
lea    0x896(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x60(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x50(%rbp)
lea    0x870(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x2,%edx
call   1030 <writev@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x0,-0x64(%rbp)
je     1b68 <doErrorTest+0x9d8>
mov    0x24ba(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xb0(%rbp)
mov    0x24ab(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0xb0(%rbp),%esi
mov    %rax,%rdx
lea    0x84a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
lea    -0x60(%rbp),%rax
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x60(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x50(%rbp)
lea    0x820(%rip),%rdi
call   1040 <puts@plt>
mov    -0x14(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0x2,%edx
call   1090 <readv@plt>
mov    %eax,-0x64(%rbp)
cmpl   $0x0,-0x64(%rbp)
je     1bf9 <doErrorTest+0xa69>
mov    0x2429(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xb4(%rbp)
mov    0x241a(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0xb4(%rbp),%esi
mov    %rax,%rdx
lea    0x7f9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    1c09 <doErrorTest+0xa79>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doErrorTest>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xe5b(%rip),%rdi
lea    0xe62(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     15e0 <doErrorTest+0x450>
mov    %rax,%rbp
mov    %rax,%rdi
call   1080 <fileno@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1050 <fclose@plt>
lea    0xe55(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1030 <writev@plt>
mov    0x2ded(%rip),%r15
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    15f9 <doErrorTest+0x469>
mov    0x2dca(%rip),%r14
cmp    (%r14),%ebp
jne    15f9 <doErrorTest+0x469>
lea    0xe50(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1070 <read@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    1609 <doErrorTest+0x479>
cmp    (%r14),%ebp
jne    1609 <doErrorTest+0x479>
lea    0xdb8(%rip),%rdi
lea    0xe50(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     1619 <doErrorTest+0x489>
mov    %rax,%r13
mov    %rax,%rdi
call   1080 <fileno@plt>
mov    %eax,%r14d
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
mov    %r14d,%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <writev@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    1649 <doErrorTest+0x4b9>
mov    0x2d3d(%rip),%r12
cmp    (%r12),%ebp
jne    1649 <doErrorTest+0x4b9>
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
mov    %r14d,%edi
xor    %esi,%esi
mov    $0x4,%edx
call   1090 <readv@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    165c <doErrorTest+0x4cc>
cmp    (%r12),%ebp
jne    165c <doErrorTest+0x4cc>
lea    0xe4f(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rsi
xor    %ebx,%ebx
mov    %r14d,%edi
xor    %edx,%edx
call   1030 <writev@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    166f <doErrorTest+0x4df>
cmp    (%r12),%ebp
jne    166f <doErrorTest+0x4df>
lea    0xe1c(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rsi
xor    %ebx,%ebx
mov    %r14d,%edi
xor    %edx,%edx
call   1090 <readv@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    167f <doErrorTest+0x4ef>
cmp    (%r12),%ebp
jne    167f <doErrorTest+0x4ef>
lea    0xe36(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0xfffffffe,%edx
call   1030 <writev@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    168f <doErrorTest+0x4ff>
cmp    (%r12),%ebp
jne    168f <doErrorTest+0x4ff>
lea    0xe3e(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rbx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0xffffff9c,%edx
call   1090 <readv@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    169f <doErrorTest+0x50f>
cmp    (%r12),%ebp
jne    169f <doErrorTest+0x50f>
mov    %rbx,0x18(%rsp)
movl   $0x64,0x10(%rsp)
movq   $0x0,0x28(%rsp)
movl   $0x64,0x20(%rsp)
lea    0xe23(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <writev@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    16af <doErrorTest+0x51f>
cmp    (%r12),%ebp
jne    16af <doErrorTest+0x51f>
mov    %rbx,0x18(%rsp)
movl   $0x64,0x10(%rsp)
movq   $0x0,0x28(%rsp)
movl   $0x64,0x20(%rsp)
lea    0xe0f(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1090 <readv@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    16bf <doErrorTest+0x52f>
cmp    (%r12),%ebp
jne    16bf <doErrorTest+0x52f>
mov    %rbx,0x18(%rsp)
movl   $0x64,0x10(%rsp)
mov    %rbx,0x28(%rsp)
movl   $0xfffffff6,0x20(%rsp)
ff
lea    0xdfd(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <writev@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    16cf <doErrorTest+0x53f>
cmp    (%r12),%ebp
jne    16cf <doErrorTest+0x53f>
mov    %rbx,0x18(%rsp)
movl   $0x64,0x10(%rsp)
mov    %rbx,0x28(%rsp)
movl   $0xfffffc00,0x20(%rsp)
ff
lea    0xdf0(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1090 <readv@plt>
mov    (%r15),%ebp
cmp    $0xffffffff,%eax
jne    16df <doErrorTest+0x54f>
cmp    (%r12),%ebp
jne    16df <doErrorTest+0x54f>
mov    %rbx,0x18(%rsp)
mov    0x2ad3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    %rbx,0x28(%rsp)
mov    %eax,0x20(%rsp)
mov    %rbx,0x38(%rsp)
mov    %eax,0x30(%rsp)
lea    0xdd7(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <writev@plt>
mov    (%r15),%ebp
mov    %eax,0xc(%rsp)
cmp    $0xffffffff,%eax
jne    1708 <doErrorTest+0x578>
cmp    (%r12),%ebp
jne    1708 <doErrorTest+0x578>
mov    %rbx,0x18(%rsp)
mov    0x2a79(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    %rbx,0x28(%rsp)
mov    %eax,0x20(%rsp)
lea    0xdcc(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1090 <readv@plt>
mov    (%r15),%ebp
mov    %eax,0xc(%rsp)
cmp    $0xffffffff,%eax
jne    1718 <doErrorTest+0x588>
cmp    (%r12),%ebp
jne    1718 <doErrorTest+0x588>
mov    %rbx,0x18(%rsp)
movl   $0x0,0x10(%rsp)
mov    %rbx,0x28(%rsp)
movl   $0x0,0x20(%rsp)
lea    0xdbf(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <writev@plt>
test   %eax,%eax
je     173a <doErrorTest+0x5aa>
mov    (%r15),%ebp
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xdbb(%rip),%rdi
jmp    16ed <doErrorTest+0x55d>
mov    0x29f9(%rip),%rax
mov    (%rax),%ebp
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xa1a(%rip),%rdi
jmp    162a <doErrorTest+0x49a>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xa48(%rip),%rdi
jmp    162a <doErrorTest+0x49a>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xa72(%rip),%rdi
jmp    162a <doErrorTest+0x49a>
mov    (%r15),%ebp
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xa78(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xa88(%rip),%rdi
jmp    16ef <doErrorTest+0x55f>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xaae(%rip),%rdi
jmp    16ef <doErrorTest+0x55f>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xad1(%rip),%rdi
jmp    16ef <doErrorTest+0x55f>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xad8(%rip),%rdi
jmp    16ef <doErrorTest+0x55f>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xb03(%rip),%rdi
jmp    16ed <doErrorTest+0x55d>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xb2e(%rip),%rdi
jmp    16ed <doErrorTest+0x55d>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xb59(%rip),%rdi
jmp    16ed <doErrorTest+0x55d>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xb84(%rip),%rdi
jmp    16ed <doErrorTest+0x55d>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xbb2(%rip),%rdi
jmp    16ed <doErrorTest+0x55d>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xbe0(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r13,%rdi
call   1050 <fclose@plt>
jmp    1638 <doErrorTest+0x4a8>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xbf6(%rip),%rdi
jmp    1726 <doErrorTest+0x596>
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xc2b(%rip),%rdi
xor    %ebx,%ebx
mov    0xc(%rsp),%esi
mov    %ebp,%edx
mov    %rax,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    16fb <doErrorTest+0x56b>
mov    %rbx,0x18(%rsp)
movl   $0x0,0x10(%rsp)
mov    %rbx,0x28(%rsp)
movl   $0x0,0x20(%rsp)
lea    0xc52(%rip),%rdi
call   1040 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1090 <readv@plt>
test   %eax,%eax
je     178a <doErrorTest+0x5fa>
mov    (%r15),%ebp
mov    %ebp,%edi
call   10b0 <strerror@plt>
lea    0xc51(%rip),%rdi
jmp    16ed <doErrorTest+0x55d>
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    $0x1,%ebx
jmp    1638 <doErrorTest+0x4a8>

LLVM IR (-O0):
%struct.iovec = type { i32, %struct.iovec* }
@.str = [14 x i8] c"testfile1.tst\00"
@.str.1 = [3 x i8] c"wt\00"
@.str.2 = [26 x i8] c"fopen for error 1: %d=%s\0A\00"
@errno = global i32 0
@.str.3 = [36 x i8] c"writev bad file descriptor -- EBADF\00"
@EBADF = global i32 0
@.str.4 = [23 x i8] c"writev error 1: %d=%s\0A\00"
@.str.5 = [35 x i8] c"readv bad file descriptor -- EBADF\00"
@.str.6 = [22 x i8] c"readv error 1: %d=%s\0A\00"
@.str.7 = [3 x i8] c"w+\00"
@.str.8 = [26 x i8] c"fopen for error 2: %d=%s\0A\00"
@.str.9 = [35 x i8] c"writev bad iovec pointer -- EINVAL\00"
@EINVAL = global i32 0
@.str.10 = [23 x i8] c"writev error 2: %d=%s\0A\00"
@.str.11 = [34 x i8] c"readv bad iovec pointer -- EINVAL\00"
@.str.12 = [22 x i8] c"readv error 2: %d=%s\0A\00"
@.str.13 = [32 x i8] c"readv bad iovcnt of 0 -- EINVAL\00"
@.str.14 = [23 x i8] c"writev error 3: %d=%s\0A\00"
@.str.15 = [22 x i8] c"readv error 3: %d=%s\0A\00"
@.str.16 = [37 x i8] c"writev bad iovcnt negative -- EINVAL\00"
@.str.17 = [23 x i8] c"writev error 4: %d=%s\0A\00"
@.str.18 = [36 x i8] c"readv bad iovcnt negative -- EINVAL\00"
@.str.19 = [22 x i8] c"readv error 4: %d=%s\0A\00"
@.str.20 = [37 x i8] c"writev bad iov[i].iov_base -- EINVAL\00"
@.str.21 = [23 x i8] c"writev error 5: %d=%s\0A\00"
@.str.22 = [36 x i8] c"readv bad iov[i].iov_base -- EINVAL\00"
@.str.23 = [22 x i8] c"readv error 5: %d=%s\0A\00"
@.str.24 = [40 x i8] c"writev bad iov[i].iov_len < 0 -- EINVAL\00"
@.str.25 = [23 x i8] c"writev error 6: %d=%s\0A\00"
@.str.26 = [39 x i8] c"readv bad iov[i].iov_len = 0 -- EINVAL\00"
@.str.27 = [22 x i8] c"readv error 6: %d=%s\0A\00"
@SIZE_MAX = global i8* null
@.str.28 = [41 x i8] c"writev iov_len total overflows -- EINVAL\00"
@.str.29 = [29 x i8] c"writev error 7: rc=%d %d=%s\0A\00"
@.str.30 = [40 x i8] c"readv iov_len total overflows -- EINVAL\00"
@.str.31 = [27 x i8] c"read error 7: rc=%d %d=%s\0A\00"
@.str.32 = [42 x i8] c"writev iov_len works with no effect -- OK\00"
@.str.33 = [23 x i8] c"writev error 8: %d=%s\0A\00"
@.str.34 = [41 x i8] c"readv iov_len works with no effect -- OK\00"
@.str.35 = [22 x i8] c"readv error 8: %d=%s\0A\00"
define i32 @doErrorTest() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca [4 x %struct.iovec]
%5 = alloca i32
%6 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load i32, i32* @errno
%11 = load i32, i32* @errno
%12 = call i8* @strerror(i32 %11)
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %10, i8* %12)
store i32 0, i32* %1
br label %401
14: ; preds = %0
%15 = load i32*, i32** %2
%16 = call i32 @fileno(i32* %15)
store i32 %16, i32* %3
%17 = load i32*, i32** %2
%18 = call i32 @fclose(i32* %17)
%19 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* %3
%21 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%22 = call i32 @writev(i32 %20, %struct.iovec* %21, i32 4)
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = icmp ne i32 %23, -1
br i1 %24, label %29, label %25
25: ; preds = %14
%26 = load i32, i32* @errno
%27 = load i32, i32* @EBADF
%28 = icmp ne i32 %26, %27
br i1 %28, label %29, label %34
29: ; preds = %25, %14
%30 = load i32, i32* @errno
%31 = load i32, i32* @errno
%32 = call i8* @strerror(i32 %31)
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %30, i8* %32)
store i32 0, i32* %1
br label %401
34: ; preds = %25
%35 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%36 = load i32, i32* %3
%37 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%38 = call i32 @read(i32 %36, %struct.iovec* %37, i32 4)
store i32 %38, i32* %5
%39 = load i32, i32* %5
%40 = icmp ne i32 %39, -1
br i1 %40, label %45, label %41
41: ; preds = %34
%42 = load i32, i32* @errno
%43 = load i32, i32* @EBADF
%44 = icmp ne i32 %42, %43
br i1 %44, label %45, label %50
45: ; preds = %41, %34
%46 = load i32, i32* @errno
%47 = load i32, i32* @errno
%48 = call i8* @strerror(i32 %47)
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %46, i8* %48)
store i32 0, i32* %1
br label %401
50: ; preds = %41
%51 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
store i32* %51, i32** %2
%52 = load i32*, i32** %2
%53 = icmp eq i32* %52, null
br i1 %53, label %54, label %59
54: ; preds = %50
%55 = load i32, i32* @errno
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %55, i8* %57)
store i32 0, i32* %1
br label %401
59: ; preds = %50
%60 = load i32*, i32** %2
%61 = call i32 @fileno(i32* %60)
store i32 %61, i32* %3
%62 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%63 = load i32, i32* %3
%64 = call i32 @writev(i32 %63, %struct.iovec* null, i32 4)
store i32 %64, i32* %5
%65 = load i32, i32* %5
%66 = icmp ne i32 %65, -1
br i1 %66, label %71, label %67
67: ; preds = %59
%68 = load i32, i32* @errno
%69 = load i32, i32* @EINVAL
%70 = icmp ne i32 %68, %69
br i1 %70, label %71, label %78
71: ; preds = %67, %59
%72 = load i32, i32* @errno
%73 = load i32, i32* @errno
%74 = call i8* @strerror(i32 %73)
%75 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %72, i8* %74)
%76 = load i32*, i32** %2
%77 = call i32 @fclose(i32* %76)
store i32 0, i32* %1
br label %401
78: ; preds = %67
%79 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0))
%80 = load i32, i32* %3
%81 = call i32 @readv(i32 %80, %struct.iovec* null, i32 4)
store i32 %81, i32* %5
%82 = load i32, i32* %5
%83 = icmp ne i32 %82, -1
br i1 %83, label %88, label %84
84: ; preds = %78
%85 = load i32, i32* @errno
%86 = load i32, i32* @EINVAL
%87 = icmp ne i32 %85, %86
br i1 %87, label %88, label %95
88: ; preds = %84, %78
%89 = load i32, i32* @errno
%90 = load i32, i32* @errno
%91 = call i8* @strerror(i32 %90)
%92 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %89, i8* %91)
%93 = load i32*, i32** %2
%94 = call i32 @fclose(i32* %93)
store i32 0, i32* %1
br label %401
95: ; preds = %84
%96 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0))
%97 = load i32, i32* %3
%98 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%99 = call i32 @writev(i32 %97, %struct.iovec* %98, i32 0)
store i32 %99, i32* %5
%100 = load i32, i32* %5
%101 = icmp ne i32 %100, -1
br i1 %101, label %106, label %102
102: ; preds = %95
%103 = load i32, i32* @errno
%104 = load i32, i32* @EINVAL
%105 = icmp ne i32 %103, %104
br i1 %105, label %106, label %113
106: ; preds = %102, %95
%107 = load i32, i32* @errno
%108 = load i32, i32* @errno
%109 = call i8* @strerror(i32 %108)
%110 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %107, i8* %109)
%111 = load i32*, i32** %2
%112 = call i32 @fclose(i32* %111)
store i32 0, i32* %1
br label %401
113: ; preds = %102
%114 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0))
%115 = load i32, i32* %3
%116 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%117 = call i32 @readv(i32 %115, %struct.iovec* %116, i32 0)
store i32 %117, i32* %5
%118 = load i32, i32* %5
%119 = icmp ne i32 %118, -1
br i1 %119, label %124, label %120
120: ; preds = %113
%121 = load i32, i32* @errno
%122 = load i32, i32* @EINVAL
%123 = icmp ne i32 %121, %122
br i1 %123, label %124, label %131
124: ; preds = %120, %113
%125 = load i32, i32* @errno
%126 = load i32, i32* @errno
%127 = call i8* @strerror(i32 %126)
%128 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0), i32 %125, i8* %127)
%129 = load i32*, i32** %2
%130 = call i32 @fclose(i32* %129)
store i32 0, i32* %1
br label %401
131: ; preds = %120
%132 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.16, i64 0, i64 0))
%133 = load i32, i32* %3
%134 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%135 = call i32 @writev(i32 %133, %struct.iovec* %134, i32 -2)
store i32 %135, i32* %5
%136 = load i32, i32* %5
%137 = icmp ne i32 %136, -1
br i1 %137, label %142, label %138
138: ; preds = %131
%139 = load i32, i32* @errno
%140 = load i32, i32* @EINVAL
%141 = icmp ne i32 %139, %140
br i1 %141, label %142, label %149
142: ; preds = %138, %131
%143 = load i32, i32* @errno
%144 = load i32, i32* @errno
%145 = call i8* @strerror(i32 %144)
%146 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0), i32 %143, i8* %145)
%147 = load i32*, i32** %2
%148 = call i32 @fclose(i32* %147)
store i32 0, i32* %1
br label %401
149: ; preds = %138
%150 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0))
%151 = load i32, i32* %3
%152 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%153 = call i32 @readv(i32 %151, %struct.iovec* %152, i32 -100)
store i32 %153, i32* %5
%154 = load i32, i32* %5
%155 = icmp ne i32 %154, -1
br i1 %155, label %160, label %156
156: ; preds = %149
%157 = load i32, i32* @errno
%158 = load i32, i32* @EINVAL
%159 = icmp ne i32 %157, %158
br i1 %159, label %160, label %167
160: ; preds = %156, %149
%161 = load i32, i32* @errno
%162 = load i32, i32* @errno
%163 = call i8* @strerror(i32 %162)
%164 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.19, i64 0, i64 0), i32 %161, i8* %163)
%165 = load i32*, i32** %2
%166 = call i32 @fclose(i32* %165)
store i32 0, i32* %1
br label %401
167: ; preds = %156
%168 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%169 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%170 = getelementptr inbounds %struct.iovec, %struct.iovec* %169, i32 0, i32 1
store %struct.iovec* %168, %struct.iovec** %170
%171 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%172 = getelementptr inbounds %struct.iovec, %struct.iovec* %171, i32 0, i32 0
store i32 100, i32* %172
%173 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%174 = getelementptr inbounds %struct.iovec, %struct.iovec* %173, i32 0, i32 1
store %struct.iovec* null, %struct.iovec** %174
%175 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%176 = getelementptr inbounds %struct.iovec, %struct.iovec* %175, i32 0, i32 0
store i32 100, i32* %176
%177 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.20, i64 0, i64 0))
%178 = load i32, i32* %3
%179 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%180 = call i32 @writev(i32 %178, %struct.iovec* %179, i32 2)
store i32 %180, i32* %5
%181 = load i32, i32* %5
%182 = icmp ne i32 %181, -1
br i1 %182, label %187, label %183
183: ; preds = %167
%184 = load i32, i32* @errno
%185 = load i32, i32* @EINVAL
%186 = icmp ne i32 %184, %185
br i1 %186, label %187, label %194
187: ; preds = %183, %167
%188 = load i32, i32* @errno
%189 = load i32, i32* @errno
%190 = call i8* @strerror(i32 %189)
%191 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0), i32 %188, i8* %190)
%192 = load i32*, i32** %2
%193 = call i32 @fclose(i32* %192)
store i32 0, i32* %1
br label %401
194: ; preds = %183
%195 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%196 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%197 = getelementptr inbounds %struct.iovec, %struct.iovec* %196, i32 0, i32 1
store %struct.iovec* %195, %struct.iovec** %197
%198 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%199 = getelementptr inbounds %struct.iovec, %struct.iovec* %198, i32 0, i32 0
store i32 100, i32* %199
%200 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%201 = getelementptr inbounds %struct.iovec, %struct.iovec* %200, i32 0, i32 1
store %struct.iovec* null, %struct.iovec** %201
%202 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%203 = getelementptr inbounds %struct.iovec, %struct.iovec* %202, i32 0, i32 0
store i32 100, i32* %203
%204 = call i32 @puts(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.22, i64 0, i64 0))
%205 = load i32, i32* %3
%206 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%207 = call i32 @readv(i32 %205, %struct.iovec* %206, i32 2)
store i32 %207, i32* %5
%208 = load i32, i32* %5
%209 = icmp ne i32 %208, -1
br i1 %209, label %214, label %210
210: ; preds = %194
%211 = load i32, i32* @errno
%212 = load i32, i32* @EINVAL
%213 = icmp ne i32 %211, %212
br i1 %213, label %214, label %221
214: ; preds = %210, %194
%215 = load i32, i32* @errno
%216 = load i32, i32* @errno
%217 = call i8* @strerror(i32 %216)
%218 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.23, i64 0, i64 0), i32 %215, i8* %217)
%219 = load i32*, i32** %2
%220 = call i32 @fclose(i32* %219)
store i32 0, i32* %1
br label %401
221: ; preds = %210
%222 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%223 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%224 = getelementptr inbounds %struct.iovec, %struct.iovec* %223, i32 0, i32 1
store %struct.iovec* %222, %struct.iovec** %224
%225 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%226 = getelementptr inbounds %struct.iovec, %struct.iovec* %225, i32 0, i32 0
store i32 100, i32* %226
%227 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%228 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%229 = getelementptr inbounds %struct.iovec, %struct.iovec* %228, i32 0, i32 1
store %struct.iovec* %227, %struct.iovec** %229
%230 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%231 = getelementptr inbounds %struct.iovec, %struct.iovec* %230, i32 0, i32 0
store i32 -10, i32* %231
%232 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.24, i64 0, i64 0))
%233 = load i32, i32* %3
%234 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%235 = call i32 @writev(i32 %233, %struct.iovec* %234, i32 2)
store i32 %235, i32* %5
%236 = load i32, i32* %5
%237 = icmp ne i32 %236, -1
br i1 %237, label %242, label %238
238: ; preds = %221
%239 = load i32, i32* @errno
%240 = load i32, i32* @EINVAL
%241 = icmp ne i32 %239, %240
br i1 %241, label %242, label %249
242: ; preds = %238, %221
%243 = load i32, i32* @errno
%244 = load i32, i32* @errno
%245 = call i8* @strerror(i32 %244)
%246 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.25, i64 0, i64 0), i32 %243, i8* %245)
%247 = load i32*, i32** %2
%248 = call i32 @fclose(i32* %247)
store i32 0, i32* %1
br label %401
249: ; preds = %238
%250 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%251 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%252 = getelementptr inbounds %struct.iovec, %struct.iovec* %251, i32 0, i32 1
store %struct.iovec* %250, %struct.iovec** %252
%253 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%254 = getelementptr inbounds %struct.iovec, %struct.iovec* %253, i32 0, i32 0
store i32 100, i32* %254
%255 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%256 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%257 = getelementptr inbounds %struct.iovec, %struct.iovec* %256, i32 0, i32 1
store %struct.iovec* %255, %struct.iovec** %257
%258 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%259 = getelementptr inbounds %struct.iovec, %struct.iovec* %258, i32 0, i32 0
store i32 -1024, i32* %259
%260 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.26, i64 0, i64 0))
%261 = load i32, i32* %3
%262 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%263 = call i32 @readv(i32 %261, %struct.iovec* %262, i32 2)
store i32 %263, i32* %5
%264 = load i32, i32* %5
%265 = icmp ne i32 %264, -1
br i1 %265, label %270, label %266
266: ; preds = %249
%267 = load i32, i32* @errno
%268 = load i32, i32* @EINVAL
%269 = icmp ne i32 %267, %268
br i1 %269, label %270, label %277
270: ; preds = %266, %249
%271 = load i32, i32* @errno
%272 = load i32, i32* @errno
%273 = call i8* @strerror(i32 %272)
%274 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.27, i64 0, i64 0), i32 %271, i8* %273)
%275 = load i32*, i32** %2
%276 = call i32 @fclose(i32* %275)
store i32 0, i32* %1
br label %401
277: ; preds = %266
%278 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%279 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%280 = getelementptr inbounds %struct.iovec, %struct.iovec* %279, i32 0, i32 1
store %struct.iovec* %278, %struct.iovec** %280
%281 = load i8*, i8** @SIZE_MAX
%282 = ptrtoint i8* %281 to i32
%283 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%284 = getelementptr inbounds %struct.iovec, %struct.iovec* %283, i32 0, i32 0
store i32 %282, i32* %284
%285 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%286 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%287 = getelementptr inbounds %struct.iovec, %struct.iovec* %286, i32 0, i32 1
store %struct.iovec* %285, %struct.iovec** %287
%288 = load i8*, i8** @SIZE_MAX
%289 = ptrtoint i8* %288 to i32
%290 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%291 = getelementptr inbounds %struct.iovec, %struct.iovec* %290, i32 0, i32 0
store i32 %289, i32* %291
%292 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%293 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 2
%294 = getelementptr inbounds %struct.iovec, %struct.iovec* %293, i32 0, i32 1
store %struct.iovec* %292, %struct.iovec** %294
%295 = load i8*, i8** @SIZE_MAX
%296 = ptrtoint i8* %295 to i32
%297 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 2
%298 = getelementptr inbounds %struct.iovec, %struct.iovec* %297, i32 0, i32 0
store i32 %296, i32* %298
%299 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.28, i64 0, i64 0))
%300 = load i32, i32* %3
%301 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%302 = call i32 @writev(i32 %300, %struct.iovec* %301, i32 3)
store i32 %302, i32* %5
%303 = load i32, i32* %5
%304 = icmp ne i32 %303, -1
br i1 %304, label %309, label %305
305: ; preds = %277
%306 = load i32, i32* @errno
%307 = load i32, i32* @EINVAL
%308 = icmp ne i32 %306, %307
br i1 %308, label %309, label %317
309: ; preds = %305, %277
%310 = load i32, i32* %5
%311 = load i32, i32* @errno
%312 = load i32, i32* @errno
%313 = call i8* @strerror(i32 %312)
%314 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.29, i64 0, i64 0), i32 %310, i32 %311, i8* %313)
%315 = load i32*, i32** %2
%316 = call i32 @fclose(i32* %315)
store i32 0, i32* %1
br label %401
317: ; preds = %305
%318 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%319 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%320 = getelementptr inbounds %struct.iovec, %struct.iovec* %319, i32 0, i32 1
store %struct.iovec* %318, %struct.iovec** %320
%321 = load i8*, i8** @SIZE_MAX
%322 = ptrtoint i8* %321 to i32
%323 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%324 = getelementptr inbounds %struct.iovec, %struct.iovec* %323, i32 0, i32 0
store i32 %322, i32* %324
%325 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%326 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%327 = getelementptr inbounds %struct.iovec, %struct.iovec* %326, i32 0, i32 1
store %struct.iovec* %325, %struct.iovec** %327
%328 = load i8*, i8** @SIZE_MAX
%329 = ptrtoint i8* %328 to i32
%330 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%331 = getelementptr inbounds %struct.iovec, %struct.iovec* %330, i32 0, i32 0
store i32 %329, i32* %331
%332 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.30, i64 0, i64 0))
%333 = load i32, i32* %3
%334 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%335 = call i32 @readv(i32 %333, %struct.iovec* %334, i32 2)
store i32 %335, i32* %5
%336 = load i32, i32* %5
%337 = icmp ne i32 %336, -1
br i1 %337, label %342, label %338
338: ; preds = %317
%339 = load i32, i32* @errno
%340 = load i32, i32* @EINVAL
%341 = icmp ne i32 %339, %340
br i1 %341, label %342, label %350
342: ; preds = %338, %317
%343 = load i32, i32* %5
%344 = load i32, i32* @errno
%345 = load i32, i32* @errno
%346 = call i8* @strerror(i32 %345)
%347 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.31, i64 0, i64 0), i32 %343, i32 %344, i8* %346)
%348 = load i32*, i32** %2
%349 = call i32 @fclose(i32* %348)
store i32 0, i32* %1
br label %401
350: ; preds = %338
%351 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%352 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%353 = getelementptr inbounds %struct.iovec, %struct.iovec* %352, i32 0, i32 1
store %struct.iovec* %351, %struct.iovec** %353
%354 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%355 = getelementptr inbounds %struct.iovec, %struct.iovec* %354, i32 0, i32 0
store i32 0, i32* %355
%356 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%357 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%358 = getelementptr inbounds %struct.iovec, %struct.iovec* %357, i32 0, i32 1
store %struct.iovec* %356, %struct.iovec** %358
%359 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%360 = getelementptr inbounds %struct.iovec, %struct.iovec* %359, i32 0, i32 0
store i32 0, i32* %360
%361 = call i32 @puts(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.32, i64 0, i64 0))
%362 = load i32, i32* %3
%363 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%364 = call i32 @writev(i32 %362, %struct.iovec* %363, i32 2)
store i32 %364, i32* %5
%365 = load i32, i32* %5
%366 = icmp ne i32 %365, 0
br i1 %366, label %367, label %374
367: ; preds = %350
%368 = load i32, i32* @errno
%369 = load i32, i32* @errno
%370 = call i8* @strerror(i32 %369)
%371 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.33, i64 0, i64 0), i32 %368, i8* %370)
%372 = load i32*, i32** %2
%373 = call i32 @fclose(i32* %372)
store i32 0, i32* %1
br label %401
374: ; preds = %350
%375 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%376 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%377 = getelementptr inbounds %struct.iovec, %struct.iovec* %376, i32 0, i32 1
store %struct.iovec* %375, %struct.iovec** %377
%378 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%379 = getelementptr inbounds %struct.iovec, %struct.iovec* %378, i32 0, i32 0
store i32 0, i32* %379
%380 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%381 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%382 = getelementptr inbounds %struct.iovec, %struct.iovec* %381, i32 0, i32 1
store %struct.iovec* %380, %struct.iovec** %382
%383 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 1
%384 = getelementptr inbounds %struct.iovec, %struct.iovec* %383, i32 0, i32 0
store i32 0, i32* %384
%385 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.34, i64 0, i64 0))
%386 = load i32, i32* %3
%387 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %4, i64 0, i64 0
%388 = call i32 @readv(i32 %386, %struct.iovec* %387, i32 2)
store i32 %388, i32* %5
%389 = load i32, i32* %5
%390 = icmp ne i32 %389, 0
br i1 %390, label %391, label %398
391: ; preds = %374
%392 = load i32, i32* @errno
%393 = load i32, i32* @errno
%394 = call i8* @strerror(i32 %393)
%395 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.35, i64 0, i64 0), i32 %392, i8* %394)
%396 = load i32*, i32** %2
%397 = call i32 @fclose(i32* %396)
store i32 0, i32* %1
br label %401
398: ; preds = %374
%399 = load i32*, i32** %2
%400 = call i32 @fclose(i32* %399)
store i32 1, i32* %1
br label %401
401: ; preds = %398, %391, %367, %342, %309, %270, %242, %214, %187, %160, %142, %124, %106, %88, %71, %54, %45, %29, %9
%402 = load i32, i32* %1
ret i32 %402
}

LLVM IR (-O2):
%struct.iovec = type { i32, %struct.iovec* }
@.str = [14 x i8] c"testfile1.tst\00"
@.str.1 = [3 x i8] c"wt\00"
@.str.2 = [26 x i8] c"fopen for error 1: %d=%s\0A\00"
@errno = global i32 0
@.str.3 = [36 x i8] c"writev bad file descriptor -- EBADF\00"
@EBADF = global i32 0
@.str.4 = [23 x i8] c"writev error 1: %d=%s\0A\00"
@.str.5 = [35 x i8] c"readv bad file descriptor -- EBADF\00"
@.str.6 = [22 x i8] c"readv error 1: %d=%s\0A\00"
@.str.7 = [3 x i8] c"w+\00"
@.str.8 = [26 x i8] c"fopen for error 2: %d=%s\0A\00"
@.str.9 = [35 x i8] c"writev bad iovec pointer -- EINVAL\00"
@EINVAL = global i32 0
@.str.10 = [23 x i8] c"writev error 2: %d=%s\0A\00"
@.str.11 = [34 x i8] c"readv bad iovec pointer -- EINVAL\00"
@.str.12 = [22 x i8] c"readv error 2: %d=%s\0A\00"
@.str.13 = [32 x i8] c"readv bad iovcnt of 0 -- EINVAL\00"
@.str.14 = [23 x i8] c"writev error 3: %d=%s\0A\00"
@.str.15 = [22 x i8] c"readv error 3: %d=%s\0A\00"
@.str.16 = [37 x i8] c"writev bad iovcnt negative -- EINVAL\00"
@.str.17 = [23 x i8] c"writev error 4: %d=%s\0A\00"
@.str.18 = [36 x i8] c"readv bad iovcnt negative -- EINVAL\00"
@.str.19 = [22 x i8] c"readv error 4: %d=%s\0A\00"
@.str.20 = [37 x i8] c"writev bad iov[i].iov_base -- EINVAL\00"
@.str.21 = [23 x i8] c"writev error 5: %d=%s\0A\00"
@.str.22 = [36 x i8] c"readv bad iov[i].iov_base -- EINVAL\00"
@.str.23 = [22 x i8] c"readv error 5: %d=%s\0A\00"
@.str.24 = [40 x i8] c"writev bad iov[i].iov_len < 0 -- EINVAL\00"
@.str.25 = [23 x i8] c"writev error 6: %d=%s\0A\00"
@.str.26 = [39 x i8] c"readv bad iov[i].iov_len = 0 -- EINVAL\00"
@.str.27 = [22 x i8] c"readv error 6: %d=%s\0A\00"
@SIZE_MAX = global i8* null
@.str.28 = [41 x i8] c"writev iov_len total overflows -- EINVAL\00"
@.str.29 = [29 x i8] c"writev error 7: rc=%d %d=%s\0A\00"
@.str.30 = [40 x i8] c"readv iov_len total overflows -- EINVAL\00"
@.str.31 = [27 x i8] c"read error 7: rc=%d %d=%s\0A\00"
@.str.32 = [42 x i8] c"writev iov_len works with no effect -- OK\00"
@.str.33 = [23 x i8] c"writev error 8: %d=%s\0A\00"
@.str.34 = [41 x i8] c"readv iov_len works with no effect -- OK\00"
@.str.35 = [22 x i8] c"readv error 8: %d=%s\0A\00"
define i32 @doErrorTest() {
%1 = alloca [4 x %struct.iovec]
%2 = bitcast [4 x %struct.iovec]* %1 to i8*
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i32, i32* @errno
%7 = tail call i8* @strerror(i32 %6)
%8 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %6, i8* %7)
br label %218
9: ; preds = %0
%10 = tail call i32 @fileno(i32* %3)
%11 = tail call i32 @fclose(i32* %3)
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%13 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %1, i64 0, i64 0
%14 = call i32 @writev(i32 %10, %struct.iovec* %13, i32 4)
%15 = icmp eq i32 %14, -1
%16 = load i32, i32* @errno
%17 = load i32, i32* @EBADF
%18 = icmp eq i32 %16, %17
%19 = select i1 %15, i1 %18, i1 false
br i1 %19, label %23, label %20
20: ; preds = %9
%21 = call i8* @strerror(i32 %16)
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %16, i8* %21)
br label %218
23: ; preds = %9
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
%25 = call i32 @read(i32 %10, %struct.iovec* %13, i32 4)
%26 = icmp eq i32 %25, -1
%27 = load i32, i32* @errno
%28 = load i32, i32* @EBADF
%29 = icmp eq i32 %27, %28
%30 = select i1 %26, i1 %29, i1 false
br i1 %30, label %34, label %31
31: ; preds = %23
%32 = call i8* @strerror(i32 %27)
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %27, i8* %32)
br label %218
34: ; preds = %23
%35 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %41
37: ; preds = %34
%38 = load i32, i32* @errno
%39 = call i8* @strerror(i32 %38)
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %38, i8* %39)
br label %218
41: ; preds = %34
%42 = call i32 @fileno(i32* %35)
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%44 = call i32 @writev(i32 %42, %struct.iovec* null, i32 4)
%45 = icmp eq i32 %44, -1
%46 = load i32, i32* @errno
%47 = load i32, i32* @EINVAL
%48 = icmp eq i32 %46, %47
%49 = select i1 %45, i1 %48, i1 false
br i1 %49, label %54, label %50
50: ; preds = %41
%51 = call i8* @strerror(i32 %46)
%52 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i64 0, i64 0), i32 %46, i8* %51)
%53 = call i32 @fclose(i32* %35)
br label %218
54: ; preds = %41
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0))
%56 = call i32 @readv(i32 %42, %struct.iovec* null, i32 4)
%57 = icmp eq i32 %56, -1
%58 = load i32, i32* @errno
%59 = load i32, i32* @EINVAL
%60 = icmp eq i32 %58, %59
%61 = select i1 %57, i1 %60, i1 false
br i1 %61, label %66, label %62
62: ; preds = %54
%63 = call i8* @strerror(i32 %58)
%64 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i32 %58, i8* %63)
%65 = call i32 @fclose(i32* %35)
br label %218
66: ; preds = %54
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0))
%68 = call i32 @writev(i32 %42, %struct.iovec* %13, i32 0)
%69 = icmp eq i32 %68, -1
%70 = load i32, i32* @errno
%71 = load i32, i32* @EINVAL
%72 = icmp eq i32 %70, %71
%73 = select i1 %69, i1 %72, i1 false
br i1 %73, label %78, label %74
74: ; preds = %66
%75 = call i8* @strerror(i32 %70)
%76 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0), i32 %70, i8* %75)
%77 = call i32 @fclose(i32* %35)
br label %218
78: ; preds = %66
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0))
%80 = call i32 @readv(i32 %42, %struct.iovec* %13, i32 0)
%81 = icmp eq i32 %80, -1
%82 = load i32, i32* @errno
%83 = load i32, i32* @EINVAL
%84 = icmp eq i32 %82, %83
%85 = select i1 %81, i1 %84, i1 false
br i1 %85, label %90, label %86
86: ; preds = %78
%87 = call i8* @strerror(i32 %82)
%88 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.15, i64 0, i64 0), i32 %82, i8* %87)
%89 = call i32 @fclose(i32* %35)
br label %218
90: ; preds = %78
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.16, i64 0, i64 0))
%92 = call i32 @writev(i32 %42, %struct.iovec* %13, i32 -2)
%93 = icmp eq i32 %92, -1
%94 = load i32, i32* @errno
%95 = load i32, i32* @EINVAL
%96 = icmp eq i32 %94, %95
%97 = select i1 %93, i1 %96, i1 false
br i1 %97, label %102, label %98
98: ; preds = %90
%99 = call i8* @strerror(i32 %94)
%100 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0), i32 %94, i8* %99)
%101 = call i32 @fclose(i32* %35)
br label %218
102: ; preds = %90
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0))
%104 = call i32 @readv(i32 %42, %struct.iovec* %13, i32 -100)
%105 = icmp eq i32 %104, -1
%106 = load i32, i32* @errno
%107 = load i32, i32* @EINVAL
%108 = icmp eq i32 %106, %107
%109 = select i1 %105, i1 %108, i1 false
br i1 %109, label %114, label %110
110: ; preds = %102
%111 = call i8* @strerror(i32 %106)
%112 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.19, i64 0, i64 0), i32 %106, i8* %111)
%113 = call i32 @fclose(i32* %35)
br label %218
114: ; preds = %102
%115 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %1, i64 0, i64 0, i32 1
store %struct.iovec* %13, %struct.iovec** %115
%116 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %1, i64 0, i64 0, i32 0
store i32 100, i32* %116
%117 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %1, i64 0, i64 1, i32 1
store %struct.iovec* null, %struct.iovec** %117
%118 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %1, i64 0, i64 1, i32 0
store i32 100, i32* %118
%119 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.20, i64 0, i64 0))
%120 = call i32 @writev(i32 %42, %struct.iovec* %13, i32 2)
%121 = icmp eq i32 %120, -1
%122 = load i32, i32* @errno
%123 = load i32, i32* @EINVAL
%124 = icmp eq i32 %122, %123
%125 = select i1 %121, i1 %124, i1 false
br i1 %125, label %130, label %126
126: ; preds = %114
%127 = call i8* @strerror(i32 %122)
%128 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0), i32 %122, i8* %127)
%129 = call i32 @fclose(i32* %35)
br label %218
130: ; preds = %114
store %struct.iovec* %13, %struct.iovec** %115
store i32 100, i32* %116
store %struct.iovec* null, %struct.iovec** %117
store i32 100, i32* %118
%131 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.22, i64 0, i64 0))
%132 = call i32 @readv(i32 %42, %struct.iovec* %13, i32 2)
%133 = icmp eq i32 %132, -1
%134 = load i32, i32* @errno
%135 = load i32, i32* @EINVAL
%136 = icmp eq i32 %134, %135
%137 = select i1 %133, i1 %136, i1 false
br i1 %137, label %142, label %138
138: ; preds = %130
%139 = call i8* @strerror(i32 %134)
%140 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.23, i64 0, i64 0), i32 %134, i8* %139)
%141 = call i32 @fclose(i32* %35)
br label %218
142: ; preds = %130
store %struct.iovec* %13, %struct.iovec** %115
store i32 100, i32* %116
store %struct.iovec* %13, %struct.iovec** %117
store i32 -10, i32* %118
%143 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.24, i64 0, i64 0))
%144 = call i32 @writev(i32 %42, %struct.iovec* %13, i32 2)
%145 = icmp eq i32 %144, -1
%146 = load i32, i32* @errno
%147 = load i32, i32* @EINVAL
%148 = icmp eq i32 %146, %147
%149 = select i1 %145, i1 %148, i1 false
br i1 %149, label %154, label %150
150: ; preds = %142
%151 = call i8* @strerror(i32 %146)
%152 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.25, i64 0, i64 0), i32 %146, i8* %151)
%153 = call i32 @fclose(i32* %35)
br label %218
154: ; preds = %142
store %struct.iovec* %13, %struct.iovec** %115
store i32 100, i32* %116
store %struct.iovec* %13, %struct.iovec** %117
store i32 -1024, i32* %118
%155 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.26, i64 0, i64 0))
%156 = call i32 @readv(i32 %42, %struct.iovec* %13, i32 2)
%157 = icmp eq i32 %156, -1
%158 = load i32, i32* @errno
%159 = load i32, i32* @EINVAL
%160 = icmp eq i32 %158, %159
%161 = select i1 %157, i1 %160, i1 false
br i1 %161, label %166, label %162
162: ; preds = %154
%163 = call i8* @strerror(i32 %158)
%164 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.27, i64 0, i64 0), i32 %158, i8* %163)
%165 = call i32 @fclose(i32* %35)
br label %218
166: ; preds = %154
store %struct.iovec* %13, %struct.iovec** %115
%167 = load i8*, i8** @SIZE_MAX
%168 = ptrtoint i8* %167 to i64
%169 = trunc i64 %168 to i32
store i32 %169, i32* %116
store %struct.iovec* %13, %struct.iovec** %117
store i32 %169, i32* %118
%170 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %1, i64 0, i64 2, i32 1
store %struct.iovec* %13, %struct.iovec** %170
%171 = getelementptr inbounds [4 x %struct.iovec], [4 x %struct.iovec]* %1, i64 0, i64 2, i32 0
store i32 %169, i32* %171
%172 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.28, i64 0, i64 0))
%173 = call i32 @writev(i32 %42, %struct.iovec* %13, i32 3)
%174 = icmp eq i32 %173, -1
%175 = load i32, i32* @errno
%176 = load i32, i32* @EINVAL
%177 = icmp eq i32 %175, %176
%178 = select i1 %174, i1 %177, i1 false
br i1 %178, label %183, label %179
179: ; preds = %166
%180 = call i8* @strerror(i32 %175)
%181 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.29, i64 0, i64 0), i32 %173, i32 %175, i8* %180)
%182 = call i32 @fclose(i32* %35)
br label %218
183: ; preds = %166
store %struct.iovec* %13, %struct.iovec** %115
%184 = load i8*, i8** @SIZE_MAX
%185 = ptrtoint i8* %184 to i64
%186 = trunc i64 %185 to i32
store i32 %186, i32* %116
store %struct.iovec* %13, %struct.iovec** %117
store i32 %186, i32* %118
%187 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.30, i64 0, i64 0))
%188 = call i32 @readv(i32 %42, %struct.iovec* %13, i32 2)
%189 = icmp eq i32 %188, -1
%190 = load i32, i32* @errno
%191 = load i32, i32* @EINVAL
%192 = icmp eq i32 %190, %191
%193 = select i1 %189, i1 %192, i1 false
br i1 %193, label %198, label %194
194: ; preds = %183
%195 = call i8* @strerror(i32 %190)
%196 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.31, i64 0, i64 0), i32 %188, i32 %190, i8* %195)
%197 = call i32 @fclose(i32* %35)
br label %218
198: ; preds = %183
store %struct.iovec* %13, %struct.iovec** %115
store i32 0, i32* %116
store %struct.iovec* %13, %struct.iovec** %117
store i32 0, i32* %118
%199 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.32, i64 0, i64 0))
%200 = call i32 @writev(i32 %42, %struct.iovec* %13, i32 2)
%201 = icmp eq i32 %200, 0
br i1 %201, label %207, label %202
202: ; preds = %198
%203 = load i32, i32* @errno
%204 = call i8* @strerror(i32 %203)
%205 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.33, i64 0, i64 0), i32 %203, i8* %204)
%206 = call i32 @fclose(i32* %35)
br label %218
207: ; preds = %198
store %struct.iovec* %13, %struct.iovec** %115
store i32 0, i32* %116
store %struct.iovec* %13, %struct.iovec** %117
store i32 0, i32* %118
%208 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.34, i64 0, i64 0))
%209 = call i32 @readv(i32 %42, %struct.iovec* %13, i32 2)
%210 = icmp eq i32 %209, 0
br i1 %210, label %216, label %211
211: ; preds = %207
%212 = load i32, i32* @errno
%213 = call i8* @strerror(i32 %212)
%214 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.35, i64 0, i64 0), i32 %212, i8* %213)
%215 = call i32 @fclose(i32* %35)
br label %218
216: ; preds = %207
%217 = call i32 @fclose(i32* %35)
br label %218
218: ; preds = %216, %211, %202, %194, %179, %162, %150, %138, %126, %110, %98, %86, %74, %62, %50, %37, %31, %20, %5
%219 = phi i32 [ 0, %5 ], [ 0, %20 ], [ 0, %31 ], [ 0, %37 ], [ 0, %50 ], [ 0, %62 ], [ 0, %74 ], [ 0, %86 ], [ 0, %98 ], [ 0, %110 ], [ 0, %126 ], [ 0, %138 ], [ 0, %150 ], [ 0, %162 ], [ 0, %179 ], [ 0, %194 ], [ 0, %202 ], [ 0, %211 ], [ 1, %216 ]
ret i32 %219
}