#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_offset;
  int aio_nbytes;
};

/* Variables and functions */
int EINPROGRESS;
int EINVAL;
int O_CREAT;
int O_EXCL;
int O_RDWR;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ _SC_ASYNCHRONOUS_IO;
int aio_error(struct aiocb *);
int aio_read(struct aiocb *);
int aio_return(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 write(int, char *, int);
int main(void) {
  char tmpfname[256];
  char buf[111];
  int fd;
  struct aiocb aiocb;
  if (sysconf(_SC_ASYNCHRONOUS_IO) < 200112L)
    return 4;
  snprintf(tmpfname, sizeof(tmpfname), "/tmp/pts_aio_read_11_1_%d", getpid());
  unlink(tmpfname);
  fd = open(tmpfname, O_CREAT | O_RDWR | O_EXCL, S_IRUSR | S_IWUSR);
  if (fd == -1) {
    printf("aio_read/11-1.c"
           " Error at open(): %s\n",
           strerror(errno));
    exit(2);
  }
  unlink(tmpfname);
  if (write(fd, buf, 111) != 111) {
    printf("aio_read/11-1.c"
           " Error at write(): %s\n",
           strerror(errno));
    exit(2);
  }
  memset(&aiocb, 0, sizeof(struct aiocb));
  aiocb.aio_fildes = fd;
  aiocb.aio_buf = buf;
  aiocb.aio_offset = -1;
  aiocb.aio_nbytes = 111;
  if (aio_read(&aiocb) != -1) {
    struct timespec completion_wait_ts = {0, 10000000};
    int err;
    do {
      nanosleep(&completion_wait_ts, NULL);
      err = aio_error(&aiocb);
    } while (err == EINPROGRESS);
    int ret = aio_return(&aiocb);
    if (ret != -1) {
      printf("aio_read/11-1.c"
             " bad aio_read return value\n");
      close(fd);
      exit(1);
    } else if (err != EINVAL) {
      printf("aio_read/11-1.c"
             " error code is not EINVAL %s\n",
             strerror(errno));
      close(fd);
      exit(1);
    }
  } else {
    if (errno != EINVAL) {
      printf("aio_read/11-1.c"
             " errno is not EINVAL %s\n",
             strerror(errno));
      close(fd);
      exit(1);
    }
  }
  close(fd);
  printf("Test PASSED\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
call   10f0 <sysconf@plt>
cmp    $0x30db0,%rax
jge    1228 <main+0x38>
movl   $0x4,-0x4(%rbp)
jmp    14ce <main+0x2de>
lea    -0x110(%rbp),%rax
mov    %rax,-0x1b8(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0x1b8(%rbp),%rdi
mov    %eax,%ecx
mov    $0x100,%esi
lea    0xdae(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0x110(%rbp),%rdi
call   1030 <unlink@plt>
lea    -0x110(%rbp),%rdi
mov    0x2d87(%rip),%rax
mov    (%rax),%esi
mov    0x2d66(%rip),%rax
or     (%rax),%esi
mov    0x2d35(%rip),%rax
or     (%rax),%esi
mov    0x2d1c(%rip),%rax
mov    (%rax),%edx
mov    0x2d33(%rip),%rax
or     (%rax),%edx
call   10e0 <open@plt>
mov    %eax,-0x184(%rbp)
cmpl   $0xffffffff,-0x184(%rbp)
jne    12d8 <main+0xe8>
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xd53(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
lea    -0x110(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x184(%rbp),%edi
lea    -0x180(%rbp),%rsi
mov    $0x6f,%edx
call   1040 <write@plt>
cmp    $0x6f,%eax
je     132d <main+0x13d>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x2,%edi
call   1100 <exit@plt>
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    -0x184(%rbp),%eax
mov    %eax,-0x1a0(%rbp)
lea    -0x180(%rbp),%rax
mov    %rax,-0x198(%rbp)
movl   $0xffffffff,-0x190(%rbp)
ff ff ff
movl   $0x6f,-0x18c(%rbp)
lea    -0x1a0(%rbp),%rdi
call   10b0 <aio_read@plt>
cmp    $0xffffffff,%eax
je     145d <main+0x26d>
mov    0xd6a(%rip),%rax
mov    %rax,-0x1a8(%rbp)
lea    -0x1a8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <nanosleep@plt>
lea    -0x1a0(%rbp),%rdi
call   10c0 <aio_error@plt>
mov    %eax,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
mov    0x2c18(%rip),%rcx
cmp    (%rcx),%eax
je     1391 <main+0x1a1>
lea    -0x1a0(%rbp),%rdi
call   10d0 <aio_return@plt>
mov    %eax,-0x1b0(%rbp)
cmpl   $0xffffffff,-0x1b0(%rbp)
je     140a <main+0x21a>
lea    0xc77(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x184(%rbp),%edi
call   10a0 <close@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x1ac(%rbp),%eax
mov    0x2b89(%rip),%rcx
cmp    (%rcx),%eax
je     1453 <main+0x263>
mov    0x2b8a(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xc59(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x184(%rbp),%edi
call   10a0 <close@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
jmp    1458 <main+0x268>
jmp    14ae <main+0x2be>
mov    0x2b4c(%rip),%rax
mov    (%rax),%eax
mov    0x2b33(%rip),%rcx
cmp    (%rcx),%eax
je     14a9 <main+0x2b9>
mov    0x2b34(%rip),%rax
mov    (%rax),%edi
call   1110 <strerror@plt>
mov    %rax,%rsi
lea    0xc30(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x184(%rbp),%edi
call   10a0 <close@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
jmp    14ae <main+0x2be>
mov    -0x184(%rbp),%edi
call   10a0 <close@plt>
lea    0xc25(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x190,%rsp
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
call   1100 <sysconf@plt>
mov    %rax,%rcx
mov    $0x4,%eax
cmp    $0x30db0,%rcx
jl     13ab <main+0x1ab>
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xdc0(%rip),%rdx
lea    0x90(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
mov    %eax,%ecx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
mov    0x2d92(%rip),%rax
mov    0x2d73(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d40(%rip),%rax
or     (%rax),%esi
mov    0x2d27(%rip),%rax
mov    0x2d40(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rbx,%rdi
call   10f0 <open@plt>
cmp    $0xffffffff,%eax
je     13bb <main+0x1bb>
mov    %eax,%r14d
lea    0x90(%rsp),%rdi
call   1030 <unlink@plt>
lea    0x20(%rsp),%rbx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x6f,%edx
call   1050 <write@plt>
cmp    $0x6f,%eax
jne    13d2 <main+0x1d2>
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10a0 <memset@plt>
mov    %r14d,0x8(%rsp)
mov    %rbx,0x10(%rsp)
movabs $0x6fffffffff,%rax
mov    %rax,0x18(%rsp)
mov    %rbp,%rdi
call   10c0 <aio_read@plt>
cmp    $0xffffffff,%eax
je     1381 <main+0x181>
movabs $0x98968000000000,%rax
mov    %rax,(%rsp)
mov    %rsp,%r15
lea    0x8(%rsp),%r12
mov    0x2cb6(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %esi,%esi
call   1090 <nanosleep@plt>
mov    %r12,%rdi
call   10d0 <aio_error@plt>
cmp    0x0(%rbp),%eax
je     1330 <main+0x130>
mov    %eax,%ebx
lea    0x8(%rsp),%rdi
call   10e0 <aio_return@plt>
cmp    $0xffffffff,%eax
jne    13fb <main+0x1fb>
mov    0x2c3d(%rip),%rax
cmp    (%rax),%ebx
je     1395 <main+0x195>
mov    0x2c42(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xce9(%rip),%rdi
jmp    1415 <main+0x215>
mov    0x2c28(%rip),%rax
mov    (%rax),%edi
mov    0x2c0f(%rip),%rax
cmp    (%rax),%edi
jne    1409 <main+0x209>
mov    %r14d,%edi
call   10b0 <close@plt>
lea    0xd16(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2bee(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xc4a(%rip),%rdi
jmp    13e7 <main+0x1e7>
mov    0x2bd7(%rip),%rax
mov    (%rax),%edi
call   1120 <strerror@plt>
lea    0xc58(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x2,%edi
call   1110 <exit@plt>
lea    0xcc4(%rip),%rdi
call   1040 <puts@plt>
jmp    141f <main+0x21f>
call   1120 <strerror@plt>
lea    0xc7d(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14d,%edi
call   10b0 <close@plt>
mov    $0x1,%edi
call   1110 <exit@plt>

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

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