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

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ tmpfname;
struct timespec {
  int member_1;
  int /*<<< orphan*/ member_0;
};
struct aiocb {
  int aio_fildes;
  char *aio_buf;
  int aio_nbytes;
};
typedef int /*<<< orphan*/ aiocb_write;
typedef int /*<<< orphan*/ aiocb_fsync;

/* Variables and functions */
int EINPROGRESS;
int O_CREAT;
int O_EXCL;
int O_RDWR;
int /*<<< orphan*/ O_SYNC;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ _SC_ASYNCHRONOUS_IO;
int aio_error(struct aiocb *);
scalar_t__ aio_fsync(int /*<<< orphan*/, struct aiocb *);
int aio_write(struct aiocb *);
int /*<<< orphan*/ close(int);
int errno;
int /*<<< orphan*/ exit(int);
int getpid();
int /*<<< orphan*/ memset(struct aiocb *, int /*<<< orphan*/, int);
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
int open(char *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
char *strerror(int);
long sysconf(int /*<<< orphan*/);
int /*<<< orphan*/ unlink(char *);
int main(void) {
  char tmpfname[256];
  char buf[1024];
  int fd;
  struct aiocb aiocb_write;
  struct aiocb aiocb_fsync;
  int ret, err;
  struct timespec completion_wait_ts = {0, 10000000};
  if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
    return 4;
  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_fsync_5_1_%d", getpid());
  unlink(tmpfname);
  fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
  if (fd == -1) {
    printf("aio_fsync/5-1.c"
           " Error at open(): %s\n",
           strerror(errno));
    exit(2);
  }
  unlink(tmpfname);
  memset(&aiocb_write, 0, sizeof(aiocb_write));
  aiocb_write.aio_fildes = fd;
  aiocb_write.aio_buf = buf;
  aiocb_write.aio_nbytes = 1024;
  if (aio_write(&aiocb_write) == -1) {
    printf("aio_fsync/5-1.c"
           " Error at aio_write(): %s\n",
           strerror(errno));
    exit(1);
  }
  memset(&aiocb_fsync, 0, sizeof(aiocb_fsync));
  aiocb_fsync.aio_fildes = fd;
  if (aio_fsync(O_SYNC, &aiocb_fsync) != 0) {
    printf("aio_fsync/5-1.c"
           " Error at aio_fsync(): %s\n",
           strerror(errno));
    exit(1);
  }
  ret = 5;
  if (aio_error(&aiocb_fsync) == EINPROGRESS)
    ret = 0;
  do {
    nanosleep(&completion_wait_ts, NULL);
    err = aio_error(&aiocb_fsync);
  } while (err == EINPROGRESS);
  if (err < 0) {
    printf("aio_fsync/5-1.c"
           " Error at aio_error() : %s\n",
           strerror(ret));
    exit(1);
  }
  close(fd);
  if (ret == 0)
    printf("Test PASSED\n");
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x560,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe07(%rip),%rax
mov    %rax,-0x558(%rbp)
mov    0x2dc1(%rip),%rax
mov    (%rax),%edi
call   10e0 <sysconf@plt>
cmp    $0x30db0,%rax
jge    1226 <main+0x46>
movl   $0x4,-0x4(%rbp)
jmp    148b <main+0x2ab>
lea    -0x110(%rbp),%rax
mov    %rax,-0x560(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x560(%rbp),%rdi
mov    %eax,%ecx
mov    $0x100,%esi
lea    0xdb8(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <unlink@plt>
lea    -0x110(%rbp),%rdi
mov    0x2d89(%rip),%rax
mov    (%rax),%esi
mov    0x2d68(%rip),%rax
or     (%rax),%esi
mov    0x2d2f(%rip),%rax
or     (%rax),%esi
mov    0x2d16(%rip),%rax
mov    (%rax),%edx
mov    0x2d2d(%rip),%rax
or     (%rax),%edx
call   10d0 <open@plt>
mov    %eax,-0x514(%rbp)
cmpl   $0xffffffff,-0x514(%rbp)
jne    12d6 <main+0xf6>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %rax,%rsi
lea    0xd5d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x2,%edi
call   10f0 <exit@plt>
lea    -0x110(%rbp),%rdi
call   1030 <unlink@plt>
lea    -0x530(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    -0x514(%rbp),%eax
mov    %eax,-0x530(%rbp)
lea    -0x510(%rbp),%rax
mov    %rax,-0x528(%rbp)
movl   $0x400,-0x520(%rbp)
lea    -0x530(%rbp),%rdi
call   1050 <aio_write@plt>
cmp    $0xffffffff,%eax
jne    1357 <main+0x177>
mov    0x2c73(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %rax,%rsi
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
lea    -0x548(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    -0x514(%rbp),%eax
mov    %eax,-0x548(%rbp)
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
lea    -0x548(%rbp),%rsi
call   10c0 <aio_fsync@plt>
cmp    $0x0,%rax
je     13be <main+0x1de>
mov    0x2c0c(%rip),%rax
mov    (%rax),%edi
call   1100 <strerror@plt>
mov    %rax,%rsi
lea    0xcc4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
movl   $0x5,-0x54c(%rbp)
lea    -0x548(%rbp),%rdi
call   10b0 <aio_error@plt>
mov    0x2bf5(%rip),%rcx
cmp    (%rcx),%eax
jne    13ed <main+0x20d>
movl   $0x0,-0x54c(%rbp)
jmp    13f2 <main+0x212>
lea    -0x558(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <nanosleep@plt>
lea    -0x548(%rbp),%rdi
call   10b0 <aio_error@plt>
mov    %eax,-0x550(%rbp)
mov    -0x550(%rbp),%eax
mov    0x2baf(%rip),%rcx
cmp    (%rcx),%eax
je     13f2 <main+0x212>
cmpl   $0x0,-0x550(%rbp)
jge    145c <main+0x27c>
mov    -0x54c(%rbp),%edi
call   1100 <strerror@plt>
mov    %rax,%rsi
lea    0xc50(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    -0x514(%rbp),%edi
call   10a0 <close@plt>
cmpl   $0x0,-0x54c(%rbp)
jne    1482 <main+0x2a2>
lea    0xc4b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x54c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x560,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x548,%rsp
movabs $0x98968000000000,%rax
mov    %rax,0x8(%rsp)
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
call   10f0 <sysconf@plt>
mov    %rax,%rcx
mov    $0x4,%eax
cmp    $0x30db0,%rcx
jl     137f <main+0x18f>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xdbf(%rip),%rdx
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    0x2d94(%rip),%rax
mov    0x2d75(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d3a(%rip),%rax
or     (%rax),%esi
mov    0x2d21(%rip),%rax
mov    0x2d3a(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
call   10e0 <open@plt>
cmp    $0xffffffff,%eax
je     1391 <main+0x1a1>
mov    %eax,%r15d
lea    0x40(%rsp),%rdi
call   1030 <unlink@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10a0 <memset@plt>
mov    %r15d,0x10(%rsp)
lea    0x140(%rsp),%rax
mov    %rax,0x18(%rsp)
movl   $0x400,0x20(%rsp)
mov    %rbx,%rdi
call   1060 <aio_write@plt>
cmp    $0xffffffff,%eax
je     13ba <main+0x1ca>
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10a0 <memset@plt>
mov    %r15d,0x28(%rsp)
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   10d0 <aio_fsync@plt>
test   %rax,%rax
jne    13d1 <main+0x1e1>
lea    0x28(%rsp),%r13
mov    %r13,%rdi
call   10c0 <aio_error@plt>
mov    %eax,%r14d
mov    0x2c9f(%rip),%rbp
mov    0x0(%rbp),%r12d
lea    0x8(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %esi,%esi
call   1090 <nanosleep@plt>
mov    %r13,%rdi
call   10c0 <aio_error@plt>
cmp    0x0(%rbp),%eax
je     1340 <main+0x150>
test   %eax,%eax
js     13e8 <main+0x1f8>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    $0x5,%eax
cmp    %r12d,%r14d
jne    137f <main+0x18f>
lea    0xd46(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x548,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
lea    0xc74(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
mov    0x2be7(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
lea    0xc70(%rip),%rdi
jmp    13ff <main+0x20f>
mov    0x2bd0(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
lea    0xc83(%rip),%rdi
jmp    13ff <main+0x20f>
xor    %eax,%eax
cmp    %r12d,%r14d
setne  %al
lea    (%rax,%rax,4),%edi
call   1110 <strerror@plt>
lea    0xc94(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
%struct.aiocb = type { i32, i8*, i32 }
@__const.main.completion_wait_ts = %struct.timespec { i32 0, i32 10000000 }
@_SC_ASYNCHRONOUS_IO = global i32 0
@.str = [26 x i8] c"/tmp/pts_aio_fsync_5_1_%d\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@O_EXCL = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [37 x i8] c"aio_fsync/5-1.c Error at open(): %s\0A\00"
@errno = global i32 0
@.str.2 = [42 x i8] c"aio_fsync/5-1.c Error at aio_write(): %s\0A\00"
@O_SYNC = global i32 0
@.str.3 = [42 x i8] c"aio_fsync/5-1.c Error at aio_fsync(): %s\0A\00"
@EINPROGRESS = global i32 0
@.str.4 = [43 x i8] c"aio_fsync/5-1.c Error at aio_error() : %s\0A\00"
@.str.5 = [13 x i8] c"Test PASSED\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca [1024 x i8]
%4 = alloca i32
%5 = alloca %struct.aiocb
%6 = alloca %struct.aiocb
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.timespec
store i32 0, i32* %1
%10 = bitcast %struct.timespec* %9 to i8*
%11 = load i32, i32* @_SC_ASYNCHRONOUS_IO
%12 = call i64 @sysconf(i32 %11)
%13 = icmp slt i64 %12, 200112
br i1 %13, label %14, label %15
14: ; preds = %0
store i32 4, i32* %1
br label %96
15: ; preds = %0
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%17 = call i32 (...) @getpid()
%18 = call i32 @snprintf(i8* %16, i32 256, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%20 = call i32 @unlink(i8* %19)
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%22 = load i32, i32* @O_CREAT
%23 = load i32, i32* @O_RDWR
%24 = or i32 %22, %23
%25 = load i32, i32* @O_EXCL
%26 = or i32 %24, %25
%27 = load i32, i32* @S_IRUSR
%28 = load i32, i32* @S_IWUSR
%29 = or i32 %27, %28
%30 = call i32 @open(i8* %21, i32 %26, i32 %29)
store i32 %30, i32* %4
%31 = load i32, i32* %4
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %38
33: ; preds = %15
%34 = load i32, i32* @errno
%35 = call i8* @strerror(i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 2)
unreachable
38: ; preds = %15
%39 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%40 = call i32 @unlink(i8* %39)
%41 = call i32 @memset(%struct.aiocb* %5, i32 0, i32 24)
%42 = load i32, i32* %4
%43 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %5, i32 0, i32 0
store i32 %42, i32* %43
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%45 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %5, i32 0, i32 1
store i8* %44, i8** %45
%46 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %5, i32 0, i32 2
store i32 1024, i32* %46
%47 = call i32 @aio_write(%struct.aiocb* %5)
%48 = icmp eq i32 %47, -1
br i1 %48, label %49, label %54
49: ; preds = %38
%50 = load i32, i32* @errno
%51 = call i8* @strerror(i32 %50)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %51)
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %38
%55 = call i32 @memset(%struct.aiocb* %6, i32 0, i32 24)
%56 = load i32, i32* %4
%57 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %6, i32 0, i32 0
store i32 %56, i32* %57
%58 = load i32, i32* @O_SYNC
%59 = call i64 @aio_fsync(i32 %58, %struct.aiocb* %6)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %66
61: ; preds = %54
%62 = load i32, i32* @errno
%63 = call i8* @strerror(i32 %62)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %63)
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %54
store i32 5, i32* %7
%67 = call i32 @aio_error(%struct.aiocb* %6)
%68 = load i32, i32* @EINPROGRESS
%69 = icmp eq i32 %67, %68
br i1 %69, label %70, label %71
70: ; preds = %66
store i32 0, i32* %7
br label %71
71: ; preds = %70, %66
br label %72
72: ; preds = %75, %71
%73 = call i32 @nanosleep(%struct.timespec* %9, i32* null)
%74 = call i32 @aio_error(%struct.aiocb* %6)
store i32 %74, i32* %8
br label %75
75: ; preds = %72
%76 = load i32, i32* %8
%77 = load i32, i32* @EINPROGRESS
%78 = icmp eq i32 %76, %77
br i1 %78, label %72, label %79
79: ; preds = %75
%80 = load i32, i32* %8
%81 = icmp slt i32 %80, 0
br i1 %81, label %82, label %87
82: ; preds = %79
%83 = load i32, i32* %7
%84 = call i8* @strerror(i32 %83)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %84)
%86 = call i32 @exit(i32 1)
unreachable
87: ; preds = %79
%88 = load i32, i32* %4
%89 = call i32 @close(i32 %88)
%90 = load i32, i32* %7
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %94
92: ; preds = %87
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
br label %94
94: ; preds = %92, %87
%95 = load i32, i32* %7
store i32 %95, i32* %1
br label %96
96: ; preds = %94, %14
%97 = load i32, i32* %1
ret i32 %97
}

LLVM IR (-O2):
%struct.aiocb = type { i32, i8*, i32 }
%struct.timespec = type { i32, i32 }
@_SC_ASYNCHRONOUS_IO = global i32 0
@.str = [26 x i8] c"/tmp/pts_aio_fsync_5_1_%d\00"
@O_CREAT = global i32 0
@O_RDWR = global i32 0
@O_EXCL = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [37 x i8] c"aio_fsync/5-1.c Error at open(): %s\0A\00"
@errno = global i32 0
@.str.2 = [42 x i8] c"aio_fsync/5-1.c Error at aio_write(): %s\0A\00"
@O_SYNC = global i32 0
@.str.3 = [42 x i8] c"aio_fsync/5-1.c Error at aio_fsync(): %s\0A\00"
@EINPROGRESS = global i32 0
@.str.4 = [43 x i8] c"aio_fsync/5-1.c Error at aio_error() : %s\0A\00"
@str = [12 x i8] c"Test PASSED\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [1024 x i8]
%3 = alloca %struct.aiocb
%4 = alloca %struct.aiocb
%5 = alloca i64
%6 = bitcast i64* %5 to %struct.timespec*
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%9 = bitcast %struct.aiocb* %3 to i8*
%10 = bitcast %struct.aiocb* %4 to i8*
%11 = bitcast i64* %5 to i8*
store i64 42949672960000000, i64* %5
%12 = load i32, i32* @_SC_ASYNCHRONOUS_IO
%13 = tail call i64 @sysconf(i32 %12)
%14 = icmp slt i64 %13, 200112
br i1 %14, label %78, label %15
15: ; preds = %0
%16 = tail call i32 (...) @getpid()
%17 = call i32 @snprintf(i8* %7, i32 256, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = call i32 @unlink(i8* %7)
%19 = load i32, i32* @O_CREAT
%20 = load i32, i32* @O_RDWR
%21 = or i32 %20, %19
%22 = load i32, i32* @O_EXCL
%23 = or i32 %21, %22
%24 = load i32, i32* @S_IRUSR
%25 = load i32, i32* @S_IWUSR
%26 = or i32 %25, %24
%27 = call i32 @open(i8* %7, i32 %23, i32 %26)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %34
29: ; preds = %15
%30 = load i32, i32* @errno
%31 = call i8* @strerror(i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = call i32 @exit(i32 2)
unreachable
34: ; preds = %15
%35 = call i32 @unlink(i8* %7)
%36 = call i32 @memset(%struct.aiocb* %3, i32 0, i32 24)
%37 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %3, i64 0, i32 0
store i32 %27, i32* %37
%38 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %3, i64 0, i32 1
store i8* %8, i8** %38
%39 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %3, i64 0, i32 2
store i32 1024, i32* %39
%40 = call i32 @aio_write(%struct.aiocb* %3)
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %47
42: ; preds = %34
%43 = load i32, i32* @errno
%44 = call i8* @strerror(i32 %43)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %34
%48 = call i32 @memset(%struct.aiocb* %4, i32 0, i32 24)
%49 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %4, i64 0, i32 0
store i32 %27, i32* %49
%50 = load i32, i32* @O_SYNC
%51 = call i64 @aio_fsync(i32 %50, %struct.aiocb* %4)
%52 = icmp eq i64 %51, 0
br i1 %52, label %58, label %53
53: ; preds = %47
%54 = load i32, i32* @errno
%55 = call i8* @strerror(i32 %54)
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %55)
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %47
%59 = call i32 @aio_error(%struct.aiocb* %4)
%60 = load i32, i32* @EINPROGRESS
br label %61
61: ; preds = %61, %58
%62 = call i32 @nanosleep(%struct.timespec* %6, i32* null)
%63 = call i32 @aio_error(%struct.aiocb* %4)
%64 = load i32, i32* @EINPROGRESS
%65 = icmp eq i32 %63, %64
br i1 %65, label %61, label %66
66: ; preds = %61
%67 = icmp eq i32 %59, %60
%68 = icmp slt i32 %63, 0
br i1 %68, label %69, label %74
69: ; preds = %66
%70 = select i1 %67, i32 0, i32 5
%71 = call i8* @strerror(i32 %70)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %71)
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %66
%75 = call i32 @close(i32 %27)
br i1 %67, label %76, label %78
76: ; preds = %74
%77 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %78
78: ; preds = %74, %76, %0
%79 = phi i32 [ 4, %0 ], [ 0, %76 ], [ 5, %74 ]
ret i32 %79
}