#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 aiocb {
  int aio_fildes;
  int aio_nbytes;
  scalar_t__ aio_offset;
  void *aio_buf;
};

/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
int ps_test_aio_read(struct aiocb *);
int ps_test_aio_read_start(const int d, struct aiocb *aiorp, void *buf,
                           const int count) {
  int rv = 0;
  memset((void *)aiorp, 0, sizeof(struct aiocb));
  aiorp->aio_fildes = d;
  aiorp->aio_buf = buf;
  aiorp->aio_nbytes = count;
  aiorp->aio_offset = 0;
  rv = ps_test_aio_read(aiorp);
  return rv;
}


x86 assembly (clang, -O0):
<ps_test_aio_read_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x10(%rbp),%rdi
call   1040 <ps_test_aio_read@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ps_test_aio_read_start>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %edi,%ebx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1030 <memset@plt>
mov    %ebx,0x0(%rbp)
mov    %r15,0x10(%rbp)
mov    %r14d,0x4(%rbp)
movq   $0x0,0x8(%rbp)
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <ps_test_aio_read@plt>

LLVM IR (-O0):
%struct.aiocb = type { i32, i32, i64, i8* }
define i32 @ps_test_aio_read_start(i32 %0, %struct.aiocb* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.aiocb*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store %struct.aiocb* %1, %struct.aiocb** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
store i32 0, i32* %9
%10 = load %struct.aiocb*, %struct.aiocb** %6
%11 = bitcast %struct.aiocb* %10 to i8*
%12 = call i32 @memset(i8* %11, i32 0, i32 24)
%13 = load i32, i32* %5
%14 = load %struct.aiocb*, %struct.aiocb** %6
%15 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %14, i32 0, i32 0
store i32 %13, i32* %15
%16 = load i8*, i8** %7
%17 = load %struct.aiocb*, %struct.aiocb** %6
%18 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %17, i32 0, i32 3
store i8* %16, i8** %18
%19 = load i32, i32* %8
%20 = load %struct.aiocb*, %struct.aiocb** %6
%21 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %20, i32 0, i32 1
store i32 %19, i32* %21
%22 = load %struct.aiocb*, %struct.aiocb** %6
%23 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %22, i32 0, i32 2
store i64 0, i64* %23
%24 = load %struct.aiocb*, %struct.aiocb** %6
%25 = call i32 @ps_test_aio_read(%struct.aiocb* %24)
store i32 %25, i32* %9
%26 = load i32, i32* %9
ret i32 %26
}

LLVM IR (-O2):
%struct.aiocb = type { i32, i32, i64, i8* }
define i32 @ps_test_aio_read_start(i32 %0, %struct.aiocb* %1, i8* %2, i32 %3) {
%5 = bitcast %struct.aiocb* %1 to i8*
%6 = tail call i32 @memset(i8* %5, i32 0, i32 24)
%7 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %1, i64 0, i32 0
store i32 %0, i32* %7
%8 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %1, i64 0, i32 3
store i8* %2, i8** %8
%9 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %1, i64 0, i32 1
store i32 %3, i32* %9
%10 = getelementptr inbounds %struct.aiocb, %struct.aiocb* %1, i64 0, i32 2
store i64 0, i64* %10
%11 = tail call i32 @ps_test_aio_read(%struct.aiocb* %1)
ret i32 %11
}