#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 doErrorTest();
int doFunctionalTest();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fillPatternBuffer();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ unlink(char *);
int main(int argc, char **argv) {
  puts("*** POSIX TEST READV/WRITEV ***");
  if (fillPatternBuffer() != 1) {
    puts("Error filling pattern buffer");
    exit(0);
  }
  if (doErrorTest() != 1) {
    puts("Error during error test!!!!");
    exit(0);
  }
  if (doFunctionalTest() != 1) {
    puts("Error during functional test!!!!");
    exit(0);
  }
  unlink("testfile1.tst");
  puts("*** END OF TEST PSXRDWRV ***");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1080 <fillPatternBuffer@plt>
cmp    $0x1,%eax
je     11a5 <main+0x45>
lea    0xe87(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    $0x0,%al
call   1050 <doErrorTest@plt>
cmp    $0x1,%eax
je     11c8 <main+0x68>
lea    0xe81(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    $0x0,%al
call   1060 <doFunctionalTest@plt>
cmp    $0x1,%eax
je     11eb <main+0x8b>
lea    0xe7a(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe88(%rip),%rdi
call   1030 <unlink@plt>
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe98(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1080 <fillPatternBuffer@plt>
cmp    $0x1,%eax
jne    11a6 <main+0x46>
xor    %eax,%eax
call   1050 <doErrorTest@plt>
cmp    $0x1,%eax
jne    11af <main+0x4f>
xor    %eax,%eax
call   1060 <doFunctionalTest@plt>
cmp    $0x1,%eax
jne    11b8 <main+0x58>
lea    0xee2(%rip),%rdi
call   1030 <unlink@plt>
lea    0xee4(%rip),%rdi
jmp    11bf <main+0x5f>
lea    0xe73(%rip),%rdi
jmp    11bf <main+0x5f>
lea    0xe87(%rip),%rdi
jmp    11bf <main+0x5f>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"*** POSIX TEST READV/WRITEV ***\00"
@.str.1 = [29 x i8] c"Error filling pattern buffer\00"
@.str.2 = [28 x i8] c"Error during error test!!!!\00"
@.str.3 = [33 x i8] c"Error during functional test!!!!\00"
@.str.4 = [14 x i8] c"testfile1.tst\00"
@.str.5 = [29 x i8] c"*** END OF TEST PSXRDWRV ***\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @puts(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @fillPatternBuffer()
%8 = icmp ne i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 0)
unreachable
12: ; preds = %2
%13 = call i32 (...) @doErrorTest()
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @exit(i32 0)
unreachable
18: ; preds = %12
%19 = call i32 (...) @doFunctionalTest()
%20 = icmp ne i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i32 @puts(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %18
%25 = call i32 @unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%26 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [32 x i8] c"*** POSIX TEST READV/WRITEV ***\00"
@.str.1 = [29 x i8] c"Error filling pattern buffer\00"
@.str.2 = [28 x i8] c"Error during error test!!!!\00"
@.str.3 = [33 x i8] c"Error during functional test!!!!\00"
@.str.4 = [14 x i8] c"testfile1.tst\00"
@.str.5 = [29 x i8] c"*** END OF TEST PSXRDWRV ***\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @fillPatternBuffer()
%5 = icmp eq i32 %4, 1
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = tail call i32 (...) @doErrorTest()
%11 = icmp eq i32 %10, 1
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call i32 @exit(i32 0)
unreachable
15: ; preds = %9
%16 = tail call i32 (...) @doFunctionalTest()
%17 = icmp eq i32 %16, 1
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%20 = tail call i32 @exit(i32 0)
unreachable
21: ; preds = %15
%22 = tail call i32 @unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%24 = tail call i32 @exit(i32 0)
unreachable
}