#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 */

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ prepare();
int /*<<< orphan*/ stderr;
scalar_t__ test(int, char **);
int main(int argc, char **argv) {
  int result = 0;
  prepare();
  result += test(argc, argv);
  if (result) {
    fprintf(stderr, "pread/pwrite test failed.\n");
    return (EXIT_FAILURE);
  }
  fprintf(stderr, "pread/pwrite test successful.\n");
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <prepare@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <test@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     119d <main+0x6d>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11be <main+0x8e>
mov    0x2e3c(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <prepare@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <test@plt>
mov    0x2e90(%rip),%rcx
mov    (%rcx),%edi
test   %eax,%eax
lea    0xec0(%rip),%rax
lea    0xe9e(%rip),%rsi
cmove  %rax,%rsi
mov    0x2e6b(%rip),%rbx
cmove  0x2e5b(%rip),%rbx
call   1030 <fprintf@plt>
mov    (%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"pread/pwrite test failed.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"pread/pwrite test successful.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = call i32 (...) @prepare()
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i64 @test(i32 %8, i8** %9)
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = add nsw i64 %12, %10
%14 = trunc i64 %13 to i32
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
store i32 %20, i32* %3
br label %25
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* @EXIT_SUCCESS
store i32 %24, i32* %3
br label %25
25: ; preds = %21, %17
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"pread/pwrite test failed.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [31 x i8] c"pread/pwrite test successful.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @prepare()
%4 = tail call i64 @test(i32 %0, i8** %1)
%5 = trunc i64 %4 to i32
%6 = icmp eq i32 %5, 0
%7 = load i32, i32* @stderr
%8 = select i1 %6, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0)
%9 = tail call i32 @fprintf(i32 %7, i8* %8)
%10 = load i32, i32* @EXIT_SUCCESS
%11 = load i32, i32* @EXIT_FAILURE
%12 = select i1 %6, i32 %10, i32 %11
ret i32 %12
}