#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ sigev_notify;
};
struct aiocb {
  int aio_fildes;
  int aio_nbytes;
  char *aio_buf;
  int /*<<< orphan*/ aio_offset;
  TYPE_1__ aio_sigevent;
  int /*<<< orphan*/ aio_lio_opcode;
  scalar_t__ aio_reqprio;
};

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ LIO_WAIT;
int /*<<< orphan*/ LIO_WRITE;
int O_CREAT;
int O_RDONLY;
int O_WRONLY;
int /*<<< orphan*/ SIGEV_NONE;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ lio_listio(int /*<<< orphan*/, struct aiocb **, int,
                              int /*<<< orphan*/ *);
int open(char *, int, int);
int read(int, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  int fdr, fdw;
  int rd = 0, offset = 0;
  int i;
  char buf[10];
  struct aiocb a[10];
  struct aiocb *list[10];
  if (argc != 3 || !strcmp(argv[1], "-h")) {
    fprintf(stderr, "usage: %s SRC_FILE DEST_FILE\n", argv[0]);
    return EXIT_FAILURE;
  }
  fdr = open(argv[1], O_RDONLY, 0600);
  fdw = open(argv[2], O_WRONLY | O_CREAT, 0600);
  for (i = 0; i < 10; i++) {
    a[i].aio_fildes = fdw;
    a[i].aio_nbytes = 1;
    a[i].aio_reqprio = 0;
    a[i].aio_lio_opcode = LIO_WRITE;
    a[i].aio_sigevent.sigev_notify = SIGEV_NONE;
    list[i] = &(a[i]);
  }
  while ((rd = read(fdr, buf, 10)) > 0) {
    for (i = 0; i < rd; i++) {
      a[i].aio_offset = offset++;
      a[i].aio_buf = &buf[rd - i - 1];
    }
    lio_listio(LIO_WAIT, list, rd, NULL);
  }
  close(fdr);
  close(fdw);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11ae <main+0x4e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe60(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11db <main+0x7b>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe3e(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13ab <main+0x24b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2de6(%rip),%rax
mov    (%rax),%esi
mov    $0x180,%edx
call   1070 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2d90(%rip),%rax
mov    (%rax),%esi
mov    0x2de7(%rip),%rax
or     (%rax),%esi
mov    $0x180,%edx
call   1070 <open@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0xa,-0x24(%rbp)
jge    12e3 <main+0x183>
mov    -0x18(%rbp),%ecx
movslq -0x24(%rbp),%rdx
lea    -0x1c0(%rbp),%rax
imul   $0x28,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,(%rax)
movslq -0x24(%rbp),%rcx
lea    -0x1c0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movl   $0x1,0x4(%rax)
movslq -0x24(%rbp),%rcx
lea    -0x1c0(%rbp),%rax
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movq   $0x0,0x20(%rax)
mov    0x2d46(%rip),%rax
mov    (%rax),%ecx
movslq -0x24(%rbp),%rdx
lea    -0x1c0(%rbp),%rax
imul   $0x28,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x18(%rax)
mov    0x2d50(%rip),%rax
mov    (%rax),%ecx
movslq -0x24(%rbp),%rdx
lea    -0x1c0(%rbp),%rax
imul   $0x28,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x14(%rax)
movslq -0x24(%rbp),%rax
lea    -0x1c0(%rbp),%rcx
imul   $0x28,%rax,%rax
add    %rax,%rcx
movslq -0x24(%rbp),%rax
mov    %rcx,-0x210(%rbp,%rax,8)
ff
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1227 <main+0xc7>
jmp    12e8 <main+0x188>
mov    -0x14(%rbp),%edi
lea    -0x2e(%rbp),%rsi
mov    $0xa,%edx
call   1040 <read@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jle    138f <main+0x22f>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    136e <main+0x20e>
mov    -0x20(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movslq -0x24(%rbp),%rdx
lea    -0x1c0(%rbp),%rax
imul   $0x28,%rdx,%rdx
add    %rdx,%rax
mov    %ecx,0x10(%rax)
mov    -0x1c(%rbp),%eax
sub    -0x24(%rbp),%eax
sub    $0x1,%eax
cltq
lea    -0x2e(%rbp),%rcx
add    %rax,%rcx
movslq -0x24(%rbp),%rdx
lea    -0x1c0(%rbp),%rax
imul   $0x28,%rdx,%rdx
add    %rdx,%rax
mov    %rcx,0x8(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    130c <main+0x1ac>
mov    0x2c63(%rip),%rax
mov    (%rax),%edi
lea    -0x210(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1080 <lio_listio@plt>
jmp    12e8 <main+0x188>
mov    -0x14(%rbp),%edi
call   1030 <close@plt>
mov    -0x18(%rbp),%edi
call   1030 <close@plt>
mov    0x2c02(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f8,%rsp
mov    %rsi,%rbp
cmp    $0x3,%edi
jne    150f <main+0x3af>
mov    0x8(%rbp),%rbx
lea    0xe78(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     150f <main+0x3af>
mov    0x2e31(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
mov    $0x180,%edx
call   1070 <open@plt>
mov    %eax,%r14d
mov    0x10(%rbp),%rdi
mov    0x2ddc(%rip),%rax
mov    0x2e35(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    $0x180,%edx
call   1070 <open@plt>
mov    0x2df0(%rip),%rcx
mov    (%rcx),%esi
mov    0x2e0f(%rip),%rcx
mov    (%rcx),%ecx
mov    %eax,0x10(%rsp)
movl   $0x1,0x14(%rsp)
movq   $0x0,0x30(%rsp)
mov    %esi,0x28(%rsp)
mov    %ecx,0x24(%rsp)
lea    0x10(%rsp),%rdx
mov    %rdx,0x1a0(%rsp)
lea    0x38(%rsp),%rdx
mov    %eax,0x38(%rsp)
movl   $0x1,0x3c(%rsp)
movq   $0x0,0x58(%rsp)
mov    %esi,0x50(%rsp)
mov    %ecx,0x4c(%rsp)
mov    %rdx,0x1a8(%rsp)
lea    0x60(%rsp),%rdx
mov    %eax,0x60(%rsp)
movl   $0x1,0x64(%rsp)
movq   $0x0,0x80(%rsp)
mov    %esi,0x78(%rsp)
mov    %ecx,0x74(%rsp)
mov    %rdx,0x1b0(%rsp)
lea    0x88(%rsp),%rdx
mov    %eax,0x88(%rsp)
movl   $0x1,0x8c(%rsp)
movq   $0x0,0xa8(%rsp)
mov    %esi,0xa0(%rsp)
mov    %ecx,0x9c(%rsp)
mov    %rdx,0x1b8(%rsp)
lea    0xb0(%rsp),%rdx
mov    %eax,0xb0(%rsp)
movl   $0x1,0xb4(%rsp)
movq   $0x0,0xd0(%rsp)
mov    %esi,0xc8(%rsp)
mov    %ecx,0xc4(%rsp)
mov    %rdx,0x1c0(%rsp)
lea    0xd8(%rsp),%rdx
mov    %eax,0xd8(%rsp)
movl   $0x1,0xdc(%rsp)
movq   $0x0,0xf8(%rsp)
mov    %esi,0xf0(%rsp)
mov    %ecx,0xec(%rsp)
mov    %rdx,0x1c8(%rsp)
lea    0x100(%rsp),%rdx
mov    %eax,0x100(%rsp)
movl   $0x1,0x104(%rsp)
movq   $0x0,0x120(%rsp)
mov    %esi,0x118(%rsp)
mov    %ecx,0x114(%rsp)
mov    %rdx,0x1d0(%rsp)
lea    0x128(%rsp),%rdx
mov    %eax,0x128(%rsp)
movl   $0x1,0x12c(%rsp)
movq   $0x0,0x148(%rsp)
mov    %esi,0x140(%rsp)
mov    %ecx,0x13c(%rsp)
mov    %rdx,0x1d8(%rsp)
lea    0x150(%rsp),%rdx
mov    %eax,0x150(%rsp)
movl   $0x1,0x154(%rsp)
movq   $0x0,0x170(%rsp)
mov    %esi,0x168(%rsp)
mov    %ecx,0x164(%rsp)
mov    %rdx,0x1e0(%rsp)
lea    0x178(%rsp),%rdx
mov    %eax,(%rsp)
mov    %eax,0x178(%rsp)
movl   $0x1,0x17c(%rsp)
movq   $0x0,0x198(%rsp)
mov    %esi,0x190(%rsp)
mov    %ecx,0x18c(%rsp)
mov    %rdx,0x1e8(%rsp)
lea    0x6(%rsp),%rsi
mov    %r14d,%edi
mov    $0xa,%edx
call   1040 <read@plt>
test   %eax,%eax
jle    1531 <main+0x3d1>
xor    %r13d,%r13d
mov    0x2ba9(%rip),%rbx
lea    0x1a0(%rsp),%r15
lea    0x6(%rsp),%r12
jmp    1464 <main+0x304>
xchg   %ax,%ax
mov    (%rbx),%edi
mov    %r15,%rsi
xor    %ecx,%ecx
call   1080 <lio_listio@plt>
mov    %r14d,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   1040 <read@plt>
test   %eax,%eax
jle    1531 <main+0x3d1>
mov    %eax,%edx
cmp    $0x1,%eax
jne    1480 <main+0x320>
xor    %eax,%eax
test   $0x1,%dl
je     1440 <main+0x2e0>
jmp    14eb <main+0x38b>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%r8
mov    %edx,%ecx
and    $0xfffffffe,%ecx
lea    -0x2(%rdx),%esi
mov    %r13d,%edi
lea    0x48(%rsp),%rbx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%rdi,%rax,1),%ebp
mov    %ebp,-0x28(%rbx)
lea    0x1(%rsi),%ebp
movslq %ebp,%rbp
add    %rsp,%rbp
add    $0x6,%rbp
mov    %rbp,-0x30(%rbx)
lea    0x1(%rdi,%rax,1),%ebp
mov    %ebp,(%rbx)
movslq %esi,%rsi
lea    (%rsp,%rsi,1),%rbp
add    $0x6,%rbp
mov    %rbp,-0x8(%rbx)
add    $0x2,%rax
add    $0x50,%rbx
add    $0xfffffffe,%esi
cmp    %rax,%rcx
jne    14a0 <main+0x340>
add    %eax,%r13d
mov    %r8,%rbx
test   $0x1,%dl
je     1440 <main+0x2e0>
lea    (%rax,%rax,4),%rcx
mov    %r13d,0x20(%rsp,%rcx,8)
add    $0x1,%r13d
not    %eax
add    %edx,%eax
cltq
add    %rsp,%rax
add    $0x6,%rax
mov    %rax,0x18(%rsp,%rcx,8)
jmp    1440 <main+0x2e0>
mov    0x2aa2(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xae0(%rip),%rsi
call   1060 <fprintf@plt>
mov    0x2a81(%rip),%rax
jmp    1548 <main+0x3e8>
mov    %r14d,%edi
call   1030 <close@plt>
mov    (%rsp),%edi
call   1030 <close@plt>
mov    0x2a60(%rip),%rax
mov    (%rax),%eax
add    $0x1f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.aiocb = type { i32, i32, i8*, i32, %struct.TYPE_2__, i32, i64 }
%struct.TYPE_2__ = type { i32 }
@.str = [3 x i8] c"-h\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"usage: %s SRC_FILE DEST_FILE\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@LIO_WRITE = global i32 0
@SIGEV_NONE = global i32 0
@LIO_WAIT = global i32 0
@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 i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [10 x i8]
%12 = alloca [10 x %struct.aiocb]
%13 = alloca [10 x %struct.aiocb*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %9
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 3
br i1 %15, label %22, label %16
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %29, label %22
22: ; preds = %16, %2
%23 = load i32, i32* @stderr
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
store i32 %28, i32* %3
br label %121
29: ; preds = %16
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = load i32, i32* @O_RDONLY
%34 = call i32 @open(i8* %32, i32 %33, i32 384)
store i32 %34, i32* %6
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 2
%37 = load i8*, i8** %36
%38 = load i32, i32* @O_WRONLY
%39 = load i32, i32* @O_CREAT
%40 = or i32 %38, %39
%41 = call i32 @open(i8* %37, i32 %40, i32 384)
store i32 %41, i32* %7
store i32 0, i32* %10
br label %42
42: ; preds = %76, %29
%43 = load i32, i32* %10
%44 = icmp slt i32 %43, 10
br i1 %44, label %45, label %79
45: ; preds = %42
%46 = load i32, i32* %7
%47 = load i32, i32* %10
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %12, i64 0, i64 %48
%50 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %49, i32 0, i32 0
store i32 %46, i32* %50
%51 = load i32, i32* %10
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %12, i64 0, i64 %52
%54 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %53, i32 0, i32 1
store i32 1, i32* %54
%55 = load i32, i32* %10
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %12, i64 0, i64 %56
%58 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %57, i32 0, i32 6
store i64 0, i64* %58
%59 = load i32, i32* @LIO_WRITE
%60 = load i32, i32* %10
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %12, i64 0, i64 %61
%63 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %62, i32 0, i32 5
store i32 %59, i32* %63
%64 = load i32, i32* @SIGEV_NONE
%65 = load i32, i32* %10
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %12, i64 0, i64 %66
%68 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %67, i32 0, i32 4
%69 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %68, i32 0, i32 0
store i32 %64, i32* %69
%70 = load i32, i32* %10
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %12, i64 0, i64 %71
%73 = load i32, i32* %10
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %13, i64 0, i64 %74
store %struct.aiocb* %72, %struct.aiocb** %75
br label %76
76: ; preds = %45
%77 = load i32, i32* %10
%78 = add nsw i32 %77, 1
store i32 %78, i32* %10
br label %42
79: ; preds = %42
br label %80
80: ; preds = %110, %79
%81 = load i32, i32* %6
%82 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 0, i64 0
%83 = call i32 @read(i32 %81, i8* %82, i32 10)
store i32 %83, i32* %8
%84 = icmp sgt i32 %83, 0
br i1 %84, label %85, label %115
85: ; preds = %80
store i32 0, i32* %10
br label %86
86: ; preds = %107, %85
%87 = load i32, i32* %10
%88 = load i32, i32* %8
%89 = icmp slt i32 %87, %88
br i1 %89, label %90, label %110
90: ; preds = %86
%91 = load i32, i32* %9
%92 = add nsw i32 %91, 1
store i32 %92, i32* %9
%93 = load i32, i32* %10
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %12, i64 0, i64 %94
%96 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %95, i32 0, i32 3
store i32 %91, i32* %96
%97 = load i32, i32* %8
%98 = load i32, i32* %10
%99 = sub nsw i32 %97, %98
%100 = sub nsw i32 %99, 1
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 0, i64 %101
%103 = load i32, i32* %10
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %12, i64 0, i64 %104
%106 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %105, i32 0, i32 2
store i8* %102, i8** %106
br label %107
107: ; preds = %90
%108 = load i32, i32* %10
%109 = add nsw i32 %108, 1
store i32 %109, i32* %10
br label %86
110: ; preds = %86
%111 = load i32, i32* @LIO_WAIT
%112 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %13, i64 0, i64 0
%113 = load i32, i32* %8
%114 = call i32 @lio_listio(i32 %111, %struct.aiocb** %112, i32 %113, i32* null)
br label %80
115: ; preds = %80
%116 = load i32, i32* %6
%117 = call i32 @close(i32 %116)
%118 = load i32, i32* %7
%119 = call i32 @close(i32 %118)
%120 = load i32, i32* @EXIT_SUCCESS
store i32 %120, i32* %3
br label %121
121: ; preds = %115, %22
%122 = load i32, i32* %3
ret i32 %122
}

LLVM IR (-O2):
%struct.aiocb = type { i32, i32, i8*, i32, %struct.TYPE_2__, i32, i64 }
%struct.TYPE_2__ = type { i32 }
@.str = [3 x i8] c"-h\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"usage: %s SRC_FILE DEST_FILE\0A\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@LIO_WRITE = global i32 0
@SIGEV_NONE = global i32 0
@LIO_WAIT = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i8]
%4 = alloca [10 x %struct.aiocb]
%5 = alloca [10 x %struct.aiocb*]
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%7 = bitcast [10 x %struct.aiocb]* %4 to i8*
%8 = bitcast [10 x %struct.aiocb*]* %5 to i8*
%9 = icmp eq i32 %0, 3
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %12, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %10, %2
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %1
%18 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %157
19: ; preds = %10
%20 = load i32, i32* @O_RDONLY
%21 = tail call i32 @open(i8* %12, i32 %20, i32 384)
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = load i32, i32* @O_WRONLY
%25 = load i32, i32* @O_CREAT
%26 = or i32 %25, %24
%27 = tail call i32 @open(i8* %23, i32 %26, i32 384)
%28 = load i32, i32* @LIO_WRITE
%29 = load i32, i32* @SIGEV_NONE
%30 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 0
%31 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 0, i32 0
store i32 %27, i32* %31
%32 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 0, i32 1
store i32 1, i32* %32
%33 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 0, i32 6
store i64 0, i64* %33
%34 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 0, i32 5
store i32 %28, i32* %34
%35 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 0, i32 4, i32 0
store i32 %29, i32* %35
%36 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 0
store %struct.aiocb* %30, %struct.aiocb** %36
%37 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 1
%38 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %37, i64 0, i32 0
store i32 %27, i32* %38
%39 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 1, i32 1
store i32 1, i32* %39
%40 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 1, i32 6
store i64 0, i64* %40
%41 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 1, i32 5
store i32 %28, i32* %41
%42 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 1, i32 4, i32 0
store i32 %29, i32* %42
%43 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 1
store %struct.aiocb* %37, %struct.aiocb** %43
%44 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 2
%45 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %44, i64 0, i32 0
store i32 %27, i32* %45
%46 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 2, i32 1
store i32 1, i32* %46
%47 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 2, i32 6
store i64 0, i64* %47
%48 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 2, i32 5
store i32 %28, i32* %48
%49 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 2, i32 4, i32 0
store i32 %29, i32* %49
%50 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 2
store %struct.aiocb* %44, %struct.aiocb** %50
%51 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 3
%52 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %51, i64 0, i32 0
store i32 %27, i32* %52
%53 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 3, i32 1
store i32 1, i32* %53
%54 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 3, i32 6
store i64 0, i64* %54
%55 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 3, i32 5
store i32 %28, i32* %55
%56 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 3, i32 4, i32 0
store i32 %29, i32* %56
%57 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 3
store %struct.aiocb* %51, %struct.aiocb** %57
%58 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 4
%59 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %58, i64 0, i32 0
store i32 %27, i32* %59
%60 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 4, i32 1
store i32 1, i32* %60
%61 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 4, i32 6
store i64 0, i64* %61
%62 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 4, i32 5
store i32 %28, i32* %62
%63 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 4, i32 4, i32 0
store i32 %29, i32* %63
%64 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 4
store %struct.aiocb* %58, %struct.aiocb** %64
%65 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 5
%66 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %65, i64 0, i32 0
store i32 %27, i32* %66
%67 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 5, i32 1
store i32 1, i32* %67
%68 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 5, i32 6
store i64 0, i64* %68
%69 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 5, i32 5
store i32 %28, i32* %69
%70 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 5, i32 4, i32 0
store i32 %29, i32* %70
%71 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 5
store %struct.aiocb* %65, %struct.aiocb** %71
%72 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 6
%73 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %72, i64 0, i32 0
store i32 %27, i32* %73
%74 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 6, i32 1
store i32 1, i32* %74
%75 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 6, i32 6
store i64 0, i64* %75
%76 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 6, i32 5
store i32 %28, i32* %76
%77 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 6, i32 4, i32 0
store i32 %29, i32* %77
%78 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 6
store %struct.aiocb* %72, %struct.aiocb** %78
%79 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 7
%80 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %79, i64 0, i32 0
store i32 %27, i32* %80
%81 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 7, i32 1
store i32 1, i32* %81
%82 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 7, i32 6
store i64 0, i64* %82
%83 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 7, i32 5
store i32 %28, i32* %83
%84 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 7, i32 4, i32 0
store i32 %29, i32* %84
%85 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 7
store %struct.aiocb* %79, %struct.aiocb** %85
%86 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 8
%87 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %86, i64 0, i32 0
store i32 %27, i32* %87
%88 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 8, i32 1
store i32 1, i32* %88
%89 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 8, i32 6
store i64 0, i64* %89
%90 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 8, i32 5
store i32 %28, i32* %90
%91 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 8, i32 4, i32 0
store i32 %29, i32* %91
%92 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 8
store %struct.aiocb* %86, %struct.aiocb** %92
%93 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 9
%94 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %93, i64 0, i32 0
store i32 %27, i32* %94
%95 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 9, i32 1
store i32 1, i32* %95
%96 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 9, i32 6
store i64 0, i64* %96
%97 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 9, i32 5
store i32 %28, i32* %97
%98 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 9, i32 4, i32 0
store i32 %29, i32* %98
%99 = getelementptr inbounds [10 x %struct.aiocb*], [10 x %struct.aiocb*]* %5, i64 0, i64 9
store %struct.aiocb* %93, %struct.aiocb** %99
%100 = call i32 @read(i32 %21, i8* %6, i32 10)
%101 = icmp sgt i32 %100, 0
br i1 %101, label %102, label %154
102: ; preds = %19, %148
%103 = phi i32 [ %152, %148 ], [ %100, %19 ]
%104 = phi i32 [ %149, %148 ], [ 0, %19 ]
%105 = zext i32 %103 to i64
%106 = and i64 %105, 1
%107 = icmp eq i32 %103, 1
br i1 %107, label %134, label %108
108: ; preds = %102
%109 = and i64 %105, 4294967294
br label %110
110: ; preds = %110, %108
%111 = phi i64 [ 0, %108 ], [ %131, %110 ]
%112 = phi i32 [ %104, %108 ], [ %123, %110 ]
%113 = phi i64 [ 0, %108 ], [ %132, %110 ]
%114 = add nsw i32 %112, 1
%115 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 %111, i32 3
store i32 %112, i32* %115
%116 = trunc i64 %111 to i32
%117 = xor i32 %116, -1
%118 = add i32 %103, %117
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %119
%121 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 %111, i32 2
store i8* %120, i8** %121
%122 = or i64 %111, 1
%123 = add nsw i32 %112, 2
%124 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 %122, i32 3
store i32 %114, i32* %124
%125 = trunc i64 %122 to i32
%126 = xor i32 %125, -1
%127 = add i32 %103, %126
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %128
%130 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 %122, i32 2
store i8* %129, i8** %130
%131 = add nuw nsw i64 %111, 2
%132 = add i64 %113, 2
%133 = icmp eq i64 %132, %109
br i1 %133, label %134, label %110
134: ; preds = %110, %102
%135 = phi i32 [ undef, %102 ], [ %123, %110 ]
%136 = phi i64 [ 0, %102 ], [ %131, %110 ]
%137 = phi i32 [ %104, %102 ], [ %123, %110 ]
%138 = icmp eq i64 %106, 0
br i1 %138, label %148, label %139
139: ; preds = %134
%140 = add nsw i32 %137, 1
%141 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 %136, i32 3
store i32 %137, i32* %141
%142 = trunc i64 %136 to i32
%143 = xor i32 %142, -1
%144 = add i32 %103, %143
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %145
%147 = getelementptr inbounds [10 x %struct.aiocb], [10 x %struct.aiocb]* %4, i64 0, i64 %136, i32 2
store i8* %146, i8** %147
br label %148
148: ; preds = %134, %139
%149 = phi i32 [ %135, %134 ], [ %140, %139 ]
%150 = load i32, i32* @LIO_WAIT
%151 = call i32 @lio_listio(i32 %150, %struct.aiocb** %36, i32 %103, i32* null)
%152 = call i32 @read(i32 %21, i8* %6, i32 10)
%153 = icmp sgt i32 %152, 0
br i1 %153, label %102, label %154
154: ; preds = %148, %19
%155 = call i32 @close(i32 %21)
%156 = call i32 @close(i32 %27)
br label %157
157: ; preds = %154, %15
%158 = phi i32* [ @EXIT_FAILURE, %15 ], [ @EXIT_SUCCESS, %154 ]
%159 = load i32, i32* %158
ret i32 %159
}