#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 timespec {
  int dummy;
};
struct iocb {
  int aio_fildes;
  unsigned long aio_buf;
  int aio_nbytes;
  scalar_t__ aio_offset;
  int /*<<< orphan*/ aio_lio_opcode;
};
struct io_event {
  int dummy;
};
typedef int /*<<< orphan*/ cb;
typedef int aio_context_t;

/* Variables and functions */
int /*<<< orphan*/ IOCB_CMD_PWRITE;
int O_CREAT;
int O_RDWR;
int /*<<< orphan*/ __io_cancel(int, struct iocb *, struct io_event *);
int __io_destroy(int);
int __io_getevents(int, int, int, struct io_event *, struct timespec *);
int __io_setup(int, int *);
int __io_submit(int, int, struct iocb **);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ memset(struct iocb *, int /*<<< orphan*/, int);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  aio_context_t ctx;
  struct iocb cb;
  struct iocb *cbs[1];
  char data[8];
  struct io_event events[1];
  int ret;
  int fd;
  fd = open("testfile", O_RDWR | O_CREAT, 0644);
  ctx = 0;
  ret = __io_setup(128, &ctx);
  if (ret < 0) {
    perror("io_setup failed");
    return -1;
  }
  strcpy(data, "testdata");
  memset(&cb, 0, sizeof(cb));
  cb.aio_fildes = fd;
  cb.aio_lio_opcode = IOCB_CMD_PWRITE;
  cb.aio_buf = (unsigned long)data;
  cb.aio_offset = 0;
  cb.aio_nbytes = 8;
  cbs[0] = &cb;
  ret = __io_submit(ctx, 1, cbs);
  if (ret != 1) {
    perror("io_sumbit failed");
    return -1;
  }
  ret = __io_getevents(ctx, 1, 1, events, NULL);
  printf("%d\n", ret);
  ret = __io_destroy(ctx);
  if (ret < 0) {
    perror("io_destroy failed");
    return -1;
  }
  __io_setup((unsigned)-1, &ctx);
  __io_setup(1, (aio_context_t *)-1);
  __io_submit((aio_context_t)-1, 1, cbs);
  __io_submit(0, (long)-1, cbs);
  __io_submit(0, 1, (struct iocb **)-1);
  __io_getevents((aio_context_t)-1, 1, 1, events, NULL);
  __io_getevents(0, (long)-1, 1, events, NULL);
  __io_getevents(0, 1, (long)-1, events, NULL);
  __io_getevents(0, 1, 1, (struct io_event *)-1, NULL);
  __io_getevents(0, 1, 1, events, (struct timespec *)-1);
  __io_cancel(1, (struct iocb *)1, (struct io_event *)1);
  __io_cancel((aio_context_t)-1, (struct iocb *)1, (struct io_event *)1);
  __io_cancel(1, (struct iocb *)-1, (struct io_event *)1);
  __io_cancel(1, (struct iocb *)1, (struct io_event *)-1);
  __io_destroy((aio_context_t)-1);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e12(%rip),%rax
mov    (%rax),%esi
mov    0x2e29(%rip),%rax
or     (%rax),%esi
lea    0xe28(%rip),%rdi
mov    $0x1a4,%edx
call   10c0 <open@plt>
mov    %eax,-0x50(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x80,%edi
lea    -0x8(%rbp),%rsi
call   1030 <__io_setup@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jge    121f <main+0x6f>
lea    0xdfb(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    143c <main+0x28c>
lea    -0x40(%rbp),%rdi
lea    0xdef(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1070 <memset@plt>
mov    -0x50(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2da4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x8,-0x20(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x38(%rbp),%rdx
mov    $0x1,%esi
call   1050 <__io_submit@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x1,-0x4c(%rbp)
je     12a6 <main+0xf6>
lea    0xd8d(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    143c <main+0x28c>
mov    -0x8(%rbp),%edi
lea    -0x48(%rbp),%rcx
mov    $0x1,%edx
xor    %eax,%eax
mov    %eax,%r8d
mov    %edx,%esi
call   10a0 <__io_getevents@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%esi
lea    0xd68(%rip),%rdi
call   1060 <printf@plt>
mov    -0x8(%rbp),%edi
call   1090 <__io_destroy@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jge    12fd <main+0x14d>
lea    0xd4b(%rip),%rdi
call   10d0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    143c <main+0x28c>
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
call   1030 <__io_setup@plt>
mov    $0x1,%edi
mov    $0xffffffffffffffff,%rsi
call   1030 <__io_setup@plt>
lea    -0x38(%rbp),%rdx
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1050 <__io_submit@plt>
lea    -0x38(%rbp),%rdx
xor    %edi,%edi
mov    $0xffffffff,%esi
call   1050 <__io_submit@plt>
xor    %edi,%edi
mov    $0x1,%esi
mov    $0xffffffffffffffff,%rdx
call   1050 <__io_submit@plt>
lea    -0x48(%rbp),%rcx
mov    $0xffffffff,%edi
mov    $0x1,%edx
xor    %eax,%eax
mov    %eax,%r8d
mov    %edx,%esi
call   10a0 <__io_getevents@plt>
lea    -0x48(%rbp),%rcx
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0x1,%edx
xor    %eax,%eax
mov    %eax,%r8d
call   10a0 <__io_getevents@plt>
lea    -0x48(%rbp),%rcx
xor    %edi,%edi
mov    $0x1,%esi
mov    $0xffffffff,%edx
xor    %eax,%eax
mov    %eax,%r8d
call   10a0 <__io_getevents@plt>
xor    %edi,%edi
mov    $0x1,%edx
mov    $0xffffffffffffffff,%rcx
xor    %eax,%eax
mov    %eax,%r8d
mov    %edx,%esi
call   10a0 <__io_getevents@plt>
lea    -0x48(%rbp),%rcx
xor    %edi,%edi
mov    $0x1,%edx
mov    $0xffffffffffffffff,%r8
mov    %edx,%esi
call   10a0 <__io_getevents@plt>
mov    $0x1,%edi
mov    $0x1,%edx
mov    %rdx,%rsi
call   10b0 <__io_cancel@plt>
mov    $0xffffffff,%edi
mov    $0x1,%edx
mov    %rdx,%rsi
call   10b0 <__io_cancel@plt>
mov    $0x1,%edi
mov    $0xffffffffffffffff,%rsi
mov    $0x1,%edx
call   10b0 <__io_cancel@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0xffffffffffffffff,%rdx
call   10b0 <__io_cancel@plt>
mov    $0xffffffff,%edi
call   1090 <__io_destroy@plt>
mov    -0x50(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    0x2e17(%rip),%rax
mov    0x2e30(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe2d(%rip),%rdi
mov    $0x1a4,%edx
call   10c0 <open@plt>
mov    %eax,%r15d
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x80,%edi
call   1030 <__io_setup@plt>
test   %eax,%eax
js     13fd <main+0x24d>
lea    0xe13(%rip),%rsi
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
lea    0x18(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1070 <memset@plt>
mov    %r15d,0x18(%rsp)
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x38(%rsp)
mov    %rbx,0x20(%rsp)
movq   $0x0,0x30(%rsp)
movl   $0x8,0x28(%rsp)
mov    %rbp,0x10(%rsp)
mov    0x4(%rsp),%edi
lea    0x10(%rsp),%rdx
mov    $0x1,%esi
call   1050 <__io_submit@plt>
cmp    $0x1,%eax
jne    1406 <main+0x256>
mov    0x4(%rsp),%edi
xor    %r14d,%r14d
lea    0x8(%rsp),%rcx
mov    $0x1,%esi
mov    $0x1,%edx
xor    %r8d,%r8d
call   10a0 <__io_getevents@plt>
lea    0xd9e(%rip),%rdi
mov    %eax,%esi
call   1060 <printf@plt>
mov    0x4(%rsp),%edi
call   1090 <__io_destroy@plt>
test   %eax,%eax
js     140f <main+0x25f>
lea    0x4(%rsp),%rsi
mov    $0xffffffff,%edi
call   1030 <__io_setup@plt>
mov    $0x1,%edi
mov    $0xffffffffffffffff,%rsi
call   1030 <__io_setup@plt>
lea    0x10(%rsp),%rbx
mov    $0xffffffff,%edi
mov    $0x1,%esi
mov    %rbx,%rdx
call   1050 <__io_submit@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    %rbx,%rdx
call   1050 <__io_submit@plt>
xor    %edi,%edi
mov    $0x1,%esi
mov    $0xffffffffffffffff,%rdx
call   1050 <__io_submit@plt>
lea    0x8(%rsp),%rbx
mov    $0xffffffff,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   10a0 <__io_getevents@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   10a0 <__io_getevents@plt>
xor    %edi,%edi
mov    $0x1,%esi
mov    $0xffffffff,%edx
mov    %rbx,%rcx
xor    %r8d,%r8d
call   10a0 <__io_getevents@plt>
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0xffffffffffffffff,%rcx
xor    %r8d,%r8d
call   10a0 <__io_getevents@plt>
xor    %edi,%edi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
mov    $0xffffffffffffffff,%r8
call   10a0 <__io_getevents@plt>
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0x1,%edi
call   10b0 <__io_cancel@plt>
mov    $0x1,%esi
mov    $0x1,%edx
mov    $0xffffffff,%edi
call   10b0 <__io_cancel@plt>
mov    $0x1,%edx
mov    $0x1,%edi
mov    $0xffffffffffffffff,%rsi
call   10b0 <__io_cancel@plt>
mov    $0x1,%esi
mov    $0x1,%edi
mov    $0xffffffffffffffff,%rdx
call   10b0 <__io_cancel@plt>
mov    $0xffffffff,%edi
call   1090 <__io_destroy@plt>
mov    %r15d,%edi
call   1080 <close@plt>
mov    %r14d,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc05(%rip),%rdi
jmp    1416 <main+0x266>
lea    0xc15(%rip),%rdi
jmp    1416 <main+0x266>
lea    0xc21(%rip),%rdi
call   10d0 <perror@plt>
mov    $0xffffffff,%r14d
jmp    13ef <main+0x23f>

LLVM IR (-O0):
%struct.iocb = type { i32, i64, i32, i64, i32 }
%struct.io_event = type { i32 }
%struct.timespec = type { i32 }
@.str = [9 x i8] c"testfile\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.1 = [16 x i8] c"io_setup failed\00"
@.str.2 = [9 x i8] c"testdata\00"
@IOCB_CMD_PWRITE = global i32 0
@.str.3 = [17 x i8] c"io_sumbit failed\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [18 x i8] c"io_destroy failed\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.iocb
%4 = alloca [1 x %struct.iocb*]
%5 = alloca [8 x i8]
%6 = alloca [1 x %struct.io_event]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = load i32, i32* @O_RDWR
%10 = load i32, i32* @O_CREAT
%11 = or i32 %9, %10
%12 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %11, i32 420)
store i32 %12, i32* %8
store i32 0, i32* %2
%13 = call i32 @__io_setup(i32 128, i32* %2)
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %75
18: ; preds = %0
%19 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @memset(%struct.iocb* %3, i32 0, i32 40)
%22 = load i32, i32* %8
%23 = getelementptr inbounds %struct.iocb, %struct.iocb* %3, i32 0, i32 0
store i32 %22, i32* %23
%24 = load i32, i32* @IOCB_CMD_PWRITE
%25 = getelementptr inbounds %struct.iocb, %struct.iocb* %3, i32 0, i32 4
store i32 %24, i32* %25
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %5, i64 0, i64 0
%27 = ptrtoint i8* %26 to i64
%28 = getelementptr inbounds %struct.iocb, %struct.iocb* %3, i32 0, i32 1
store i64 %27, i64* %28
%29 = getelementptr inbounds %struct.iocb, %struct.iocb* %3, i32 0, i32 3
store i64 0, i64* %29
%30 = getelementptr inbounds %struct.iocb, %struct.iocb* %3, i32 0, i32 2
store i32 8, i32* %30
%31 = getelementptr inbounds [1 x %struct.iocb*], [1 x %struct.iocb*]* %4, i64 0, i64 0
store %struct.iocb* %3, %struct.iocb** %31
%32 = load i32, i32* %2
%33 = getelementptr inbounds [1 x %struct.iocb*], [1 x %struct.iocb*]* %4, i64 0, i64 0
%34 = call i32 @__io_submit(i32 %32, i32 1, %struct.iocb** %33)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = icmp ne i32 %35, 1
br i1 %36, label %37, label %39
37: ; preds = %18
%38 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %75
39: ; preds = %18
%40 = load i32, i32* %2
%41 = getelementptr inbounds [1 x %struct.io_event], [1 x %struct.io_event]* %6, i64 0, i64 0
%42 = call i32 @__io_getevents(i32 %40, i32 1, i32 1, %struct.io_event* %41, %struct.timespec* null)
store i32 %42, i32* %7
%43 = load i32, i32* %7
%44 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %2
%46 = call i32 @__io_destroy(i32 %45)
store i32 %46, i32* %7
%47 = load i32, i32* %7
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %39
%50 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %1
br label %75
51: ; preds = %39
%52 = call i32 @__io_setup(i32 -1, i32* %2)
%53 = call i32 @__io_setup(i32 1, i32* inttoptr (i64 -1 to i32*))
%54 = getelementptr inbounds [1 x %struct.iocb*], [1 x %struct.iocb*]* %4, i64 0, i64 0
%55 = call i32 @__io_submit(i32 -1, i32 1, %struct.iocb** %54)
%56 = getelementptr inbounds [1 x %struct.iocb*], [1 x %struct.iocb*]* %4, i64 0, i64 0
%57 = call i32 @__io_submit(i32 0, i32 -1, %struct.iocb** %56)
%58 = call i32 @__io_submit(i32 0, i32 1, %struct.iocb** inttoptr (i64 -1 to %struct.iocb**))
%59 = getelementptr inbounds [1 x %struct.io_event], [1 x %struct.io_event]* %6, i64 0, i64 0
%60 = call i32 @__io_getevents(i32 -1, i32 1, i32 1, %struct.io_event* %59, %struct.timespec* null)
%61 = getelementptr inbounds [1 x %struct.io_event], [1 x %struct.io_event]* %6, i64 0, i64 0
%62 = call i32 @__io_getevents(i32 0, i32 -1, i32 1, %struct.io_event* %61, %struct.timespec* null)
%63 = getelementptr inbounds [1 x %struct.io_event], [1 x %struct.io_event]* %6, i64 0, i64 0
%64 = call i32 @__io_getevents(i32 0, i32 1, i32 -1, %struct.io_event* %63, %struct.timespec* null)
%65 = call i32 @__io_getevents(i32 0, i32 1, i32 1, %struct.io_event* inttoptr (i64 -1 to %struct.io_event*), %struct.timespec* null)
%66 = getelementptr inbounds [1 x %struct.io_event], [1 x %struct.io_event]* %6, i64 0, i64 0
%67 = call i32 @__io_getevents(i32 0, i32 1, i32 1, %struct.io_event* %66, %struct.timespec* inttoptr (i64 -1 to %struct.timespec*))
%68 = call i32 @__io_cancel(i32 1, %struct.iocb* inttoptr (i64 1 to %struct.iocb*), %struct.io_event* inttoptr (i64 1 to %struct.io_event*))
%69 = call i32 @__io_cancel(i32 -1, %struct.iocb* inttoptr (i64 1 to %struct.iocb*), %struct.io_event* inttoptr (i64 1 to %struct.io_event*))
%70 = call i32 @__io_cancel(i32 1, %struct.iocb* inttoptr (i64 -1 to %struct.iocb*), %struct.io_event* inttoptr (i64 1 to %struct.io_event*))
%71 = call i32 @__io_cancel(i32 1, %struct.iocb* inttoptr (i64 1 to %struct.iocb*), %struct.io_event* inttoptr (i64 -1 to %struct.io_event*))
%72 = call i32 @__io_destroy(i32 -1)
%73 = load i32, i32* %8
%74 = call i32 @close(i32 %73)
store i32 0, i32* %1
br label %75
75: ; preds = %51, %49, %37, %16
%76 = load i32, i32* %1
ret i32 %76
}

LLVM IR (-O2):
%struct.iocb = type { i32, i64, i32, i64, i32 }
%struct.io_event = type { i32 }
%struct.timespec = type { i32 }
@.str = [9 x i8] c"testfile\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@.str.1 = [16 x i8] c"io_setup failed\00"
@.str.2 = [9 x i8] c"testdata\00"
@IOCB_CMD_PWRITE = global i32 0
@.str.3 = [17 x i8] c"io_sumbit failed\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [18 x i8] c"io_destroy failed\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.iocb
%3 = alloca [1 x %struct.iocb*]
%4 = alloca [8 x i8]
%5 = alloca [1 x %struct.io_event]
%6 = bitcast i32* %1 to i8*
%7 = bitcast %struct.iocb* %2 to i8*
%8 = bitcast [1 x %struct.iocb*]* %3 to i8*
%9 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%10 = bitcast [1 x %struct.io_event]* %5 to i8*
%11 = load i32, i32* @O_RDWR
%12 = load i32, i32* @O_CREAT
%13 = or i32 %12, %11
%14 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %13, i32 420)
store i32 0, i32* %1
%15 = call i32 @__io_setup(i32 128, i32* %1)
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %62
19: ; preds = %0
%20 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @memset(%struct.iocb* %2, i32 0, i32 40)
%22 = getelementptr inbounds %struct.iocb, %struct.iocb* %2, i64 0, i32 0
store i32 %14, i32* %22
%23 = load i32, i32* @IOCB_CMD_PWRITE
%24 = getelementptr inbounds %struct.iocb, %struct.iocb* %2, i64 0, i32 4
store i32 %23, i32* %24
%25 = ptrtoint [8 x i8]* %4 to i64
%26 = getelementptr inbounds %struct.iocb, %struct.iocb* %2, i64 0, i32 1
store i64 %25, i64* %26
%27 = getelementptr inbounds %struct.iocb, %struct.iocb* %2, i64 0, i32 3
store i64 0, i64* %27
%28 = getelementptr inbounds %struct.iocb, %struct.iocb* %2, i64 0, i32 2
store i32 8, i32* %28
%29 = getelementptr inbounds [1 x %struct.iocb*], [1 x %struct.iocb*]* %3, i64 0, i64 0
store %struct.iocb* %2, %struct.iocb** %29
%30 = load i32, i32* %1
%31 = call i32 @__io_submit(i32 %30, i32 1, %struct.iocb** %29)
%32 = icmp eq i32 %31, 1
br i1 %32, label %35, label %33
33: ; preds = %19
%34 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %62
35: ; preds = %19
%36 = load i32, i32* %1
%37 = getelementptr inbounds [1 x %struct.io_event], [1 x %struct.io_event]* %5, i64 0, i64 0
%38 = call i32 @__io_getevents(i32 %36, i32 1, i32 1, %struct.io_event* %37, %struct.timespec* null)
%39 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %1
%41 = call i32 @__io_destroy(i32 %40)
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %35
%44 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
br label %62
45: ; preds = %35
%46 = call i32 @__io_setup(i32 -1, i32* %1)
%47 = call i32 @__io_setup(i32 1, i32* inttoptr (i64 -1 to i32*))
%48 = call i32 @__io_submit(i32 -1, i32 1, %struct.iocb** %29)
%49 = call i32 @__io_submit(i32 0, i32 -1, %struct.iocb** %29)
%50 = call i32 @__io_submit(i32 0, i32 1, %struct.iocb** inttoptr (i64 -1 to %struct.iocb**))
%51 = call i32 @__io_getevents(i32 -1, i32 1, i32 1, %struct.io_event* %37, %struct.timespec* null)
%52 = call i32 @__io_getevents(i32 0, i32 -1, i32 1, %struct.io_event* %37, %struct.timespec* null)
%53 = call i32 @__io_getevents(i32 0, i32 1, i32 -1, %struct.io_event* %37, %struct.timespec* null)
%54 = call i32 @__io_getevents(i32 0, i32 1, i32 1, %struct.io_event* inttoptr (i64 -1 to %struct.io_event*), %struct.timespec* null)
%55 = call i32 @__io_getevents(i32 0, i32 1, i32 1, %struct.io_event* %37, %struct.timespec* inttoptr (i64 -1 to %struct.timespec*))
%56 = call i32 @__io_cancel(i32 1, %struct.iocb* inttoptr (i64 1 to %struct.iocb*), %struct.io_event* inttoptr (i64 1 to %struct.io_event*))
%57 = call i32 @__io_cancel(i32 -1, %struct.iocb* inttoptr (i64 1 to %struct.iocb*), %struct.io_event* inttoptr (i64 1 to %struct.io_event*))
%58 = call i32 @__io_cancel(i32 1, %struct.iocb* inttoptr (i64 -1 to %struct.iocb*), %struct.io_event* inttoptr (i64 1 to %struct.io_event*))
%59 = call i32 @__io_cancel(i32 1, %struct.iocb* inttoptr (i64 1 to %struct.iocb*), %struct.io_event* inttoptr (i64 -1 to %struct.io_event*))
%60 = call i32 @__io_destroy(i32 -1)
%61 = call i32 @close(i32 %14)
br label %62
62: ; preds = %45, %43, %33, %17
%63 = phi i32 [ -1, %17 ], [ -1, %33 ], [ -1, %43 ], [ 0, %45 ]
ret i32 %63
}