#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 /*<<< orphan*/ F_OK;
int O_CREAT;
int O_TRUNC;
int /*<<< orphan*/ S_IRWXU;
int /*<<< orphan*/ access_test(char *, int /*<<< orphan*/);
int /*<<< orphan*/ close_test(int);
int creat_test(char *, int /*<<< orphan*/);
int expect_gez(int /*<<< orphan*/, int);
int expect_zng(int, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int open_test(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ testbreak();
int /*<<< orphan*/ unlink_test(char *);
int /*<<< orphan*/ xtmpnam(char *);
int BasicFile(void) {
  char tf[8192] = {0};
  int fd;
  int passed;
  int block = 0;
  xtmpnam(tf);
  testbreak();
  passed = expect_gez(0, fd = creat_test(tf, S_IRWXU));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  if (passed == -1) {
    printf("\tFail Phase 2: Aborting test because of catastrophic failure\n");
    fflush(NULL);
    return passed;
  };
  passed = expect_zng(0, access_test(tf, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, close_test(fd));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, unlink_test(tf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, access_test(tf, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  passed = expect_zng(-1, access_test("", F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  if (passed == -1) {
    printf("\tFail Phase 2: Aborting test because of catastrophic failure\n");
    fflush(NULL);
    return passed;
  };
  passed = expect_zng(-1, access_test(NULL, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  if (passed == -1) {
    printf("\tFail Phase 2: Aborting test because of catastrophic failure\n");
    fflush(NULL);
    return passed;
  };
  testbreak();
  passed = expect_gez(0, fd = open_test(tf, O_CREAT | O_TRUNC, S_IRWXU));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  if (passed == -1) {
    printf("\tFail Phase 2: Aborting test because of catastrophic failure\n");
    fflush(NULL);
    return passed;
  };
  passed = expect_zng(0, access_test(tf, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, close_test(fd));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, unlink_test(tf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, access_test(tf, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  return block;
}


x86 assembly (clang, -O0):
<BasicFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
lea    -0x2010(%rbp),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1070 <memset@plt>
movl   $0x0,-0x201c(%rbp)
lea    -0x2010(%rbp),%rdi
call   1040 <xtmpnam@plt>
mov    $0x0,%al
call   10b0 <testbreak@plt>
lea    -0x2010(%rbp),%rdi
mov    0x2dcf(%rip),%rax
mov    (%rax),%esi
call   1030 <creat_test@plt>
mov    %eax,%esi
mov    %esi,-0x2014(%rbp)
xor    %edi,%edi
call   10e0 <expect_gez@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     1251 <BasicFile+0x91>
lea    0xdc7(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2018(%rbp)
jne    1281 <BasicFile+0xc1>
lea    0xdd1(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
mov    -0x2018(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    169a <BasicFile+0x4da>
lea    -0x2010(%rbp),%rdi
mov    0x2d31(%rip),%rax
mov    (%rax),%esi
call   10d0 <access_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     12d1 <BasicFile+0x111>
lea    0xd47(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
mov    -0x2014(%rbp),%edi
call   1050 <close_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     1317 <BasicFile+0x157>
lea    0xd01(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
call   10c0 <unlink_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     135e <BasicFile+0x19e>
lea    0xcba(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
mov    0x2c54(%rip),%rax
mov    (%rax),%esi
call   10d0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     13b1 <BasicFile+0x1f1>
lea    0xc67(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
mov    $0x0,%al
call   10b0 <testbreak@plt>
mov    0x2c01(%rip),%rax
mov    (%rax),%esi
lea    0xc6d(%rip),%rdi
call   10d0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     140b <BasicFile+0x24b>
lea    0xc0d(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2018(%rbp)
jne    143b <BasicFile+0x27b>
lea    0xc17(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
mov    -0x2018(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    169a <BasicFile+0x4da>
mov    0x2b7e(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     148b <BasicFile+0x2cb>
lea    0xb8d(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2018(%rbp)
jne    14bb <BasicFile+0x2fb>
lea    0xb97(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
mov    -0x2018(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    169a <BasicFile+0x4da>
mov    $0x0,%al
call   10b0 <testbreak@plt>
lea    -0x2010(%rbp),%rdi
mov    0x2b28(%rip),%rax
mov    (%rax),%esi
mov    0x2b17(%rip),%rax
or     (%rax),%esi
mov    0x2af6(%rip),%rax
mov    (%rax),%edx
call   1080 <open_test@plt>
mov    %eax,%esi
mov    %esi,-0x2014(%rbp)
xor    %edi,%edi
call   10e0 <expect_gez@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     152a <BasicFile+0x36a>
lea    0xaee(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2018(%rbp)
jne    155a <BasicFile+0x39a>
lea    0xaf8(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
mov    -0x2018(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    169a <BasicFile+0x4da>
lea    -0x2010(%rbp),%rdi
mov    0x2a58(%rip),%rax
mov    (%rax),%esi
call   10d0 <access_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     15aa <BasicFile+0x3ea>
lea    0xa6e(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
mov    -0x2014(%rbp),%edi
call   1050 <close_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     15f0 <BasicFile+0x430>
lea    0xa28(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
call   10c0 <unlink_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     1637 <BasicFile+0x477>
lea    0x9e1(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
mov    0x297b(%rip),%rax
mov    (%rax),%esi
call   10d0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1090 <expect_zng@plt>
mov    %eax,-0x2018(%rbp)
cmpl   $0x0,-0x2018(%rbp)
je     168a <BasicFile+0x4ca>
lea    0x98e(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
movl   $0xffffffff,-0x201c(%rbp)
ff ff ff
mov    $0x0,%al
call   10b0 <testbreak@plt>
mov    -0x201c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BasicFile>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x2000,%rsp
mov    %rsp,%rbx
xor    %r14d,%r14d
mov    $0x2000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
mov    %rbx,%rdi
call   1050 <xtmpnam@plt>
xor    %eax,%eax
call   10b0 <testbreak@plt>
mov    0x2dde(%rip),%r12
mov    (%r12),%esi
mov    %rbx,%rdi
call   1030 <creat_test@plt>
mov    %eax,%ebp
xor    %edi,%edi
mov    %eax,%esi
call   10e0 <expect_gez@plt>
test   %eax,%eax
je     1239 <BasicFile+0x79>
mov    %eax,%ebx
lea    0xe1f(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%ebx
je     14a9 <BasicFile+0x2e9>
mov    0x2d80(%rip),%r15
mov    (%r15),%esi
mov    %rsp,%rdi
call   10d0 <access_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     1271 <BasicFile+0xb1>
lea    0xdde(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    %ebp,%edi
call   1060 <close_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     129e <BasicFile+0xde>
lea    0xdb1(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    %rsp,%rdi
call   10c0 <unlink_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     12cc <BasicFile+0x10c>
lea    0xd83(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    (%r15),%esi
mov    %rsp,%rdi
call   10d0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     1300 <BasicFile+0x140>
lea    0xd4f(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
xor    %eax,%eax
call   10b0 <testbreak@plt>
mov    (%r15),%esi
lea    0xd60(%rip),%rdi
call   10d0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     134a <BasicFile+0x18a>
mov    %eax,%ebp
lea    0xd0e(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%ebp
je     14a9 <BasicFile+0x2e9>
mov    (%r15),%esi
xor    %edi,%edi
call   10d0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     1388 <BasicFile+0x1c8>
mov    %eax,%ebp
lea    0xcd0(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%ebp
je     14a9 <BasicFile+0x2e9>
xor    %eax,%eax
call   10b0 <testbreak@plt>
mov    0x2c62(%rip),%rax
mov    0x2c53(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    (%r12),%edx
mov    %rsp,%rdi
call   1080 <open_test@plt>
mov    %eax,%ebp
xor    %edi,%edi
mov    %eax,%esi
call   10e0 <expect_gez@plt>
test   %eax,%eax
je     13e0 <BasicFile+0x220>
mov    %eax,%ebx
lea    0xc78(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%ebx
je     14a9 <BasicFile+0x2e9>
mov    (%r15),%esi
mov    %rsp,%rdi
call   10d0 <access_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     1411 <BasicFile+0x251>
lea    0xc3e(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    %ebp,%edi
call   1060 <close_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     143e <BasicFile+0x27e>
lea    0xc11(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    %rsp,%rdi
call   10c0 <unlink_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     146c <BasicFile+0x2ac>
lea    0xbe3(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    (%r15),%esi
mov    %rsp,%rdi
call   10d0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1090 <expect_zng@plt>
test   %eax,%eax
je     14a0 <BasicFile+0x2e0>
lea    0xbaf(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
xor    %eax,%eax
call   10b0 <testbreak@plt>
jmp    14c2 <BasicFile+0x302>
lea    0xb50(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x2000,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@S_IRWXU = global i32 0
@.str = [54 x i8] c"\09Failed Phase 2: This call did something unexpected.\0A\00"
@.str.1 = [62 x i8] c"\09Fail Phase 2: Aborting test because of catastrophic failure\0A\00"
@F_OK = global i32 0
@.str.2 = [1 x i8] zeroinitializer
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
define i32 @BasicFile() {
%1 = alloca i32
%2 = alloca [8192 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [8192 x i8]* %2 to i8*
store i32 0, i32* %5
%7 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%8 = call i32 @xtmpnam(i8* %7)
%9 = call i32 (...) @testbreak()
%10 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%11 = load i32, i32* @S_IRWXU
%12 = call i32 @creat_test(i8* %10, i32 %11)
store i32 %12, i32* %3
%13 = call i32 @expect_gez(i32 0, i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %19
19: ; preds = %16, %0
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @fflush(i32* null)
%25 = load i32, i32* %4
store i32 %25, i32* %1
br label %159
26: ; preds = %19
%27 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%28 = load i32, i32* @F_OK
%29 = call i32 @access_test(i8* %27, i32 %28)
%30 = call i32 @expect_zng(i32 0, i32 %29)
store i32 %30, i32* %4
%31 = load i32, i32* %4
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%35 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %36
36: ; preds = %33, %26
%37 = load i32, i32* %3
%38 = call i32 @close_test(i32 %37)
%39 = call i32 @expect_zng(i32 0, i32 %38)
store i32 %39, i32* %4
%40 = load i32, i32* %4
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %36
%43 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%44 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %45
45: ; preds = %42, %36
%46 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%47 = call i32 @unlink_test(i8* %46)
%48 = call i32 @expect_zng(i32 0, i32 %47)
store i32 %48, i32* %4
%49 = load i32, i32* %4
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %45
%52 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%53 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %54
54: ; preds = %51, %45
%55 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%56 = load i32, i32* @F_OK
%57 = call i32 @access_test(i8* %55, i32 %56)
%58 = call i32 @expect_zng(i32 -1, i32 %57)
store i32 %58, i32* %4
%59 = load i32, i32* %4
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %54
%62 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%63 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %64
64: ; preds = %61, %54
%65 = call i32 (...) @testbreak()
%66 = load i32, i32* @F_OK
%67 = call i32 @access_test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 %66)
%68 = call i32 @expect_zng(i32 -1, i32 %67)
store i32 %68, i32* %4
%69 = load i32, i32* %4
%70 = icmp ne i32 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %64
%72 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%73 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %74
74: ; preds = %71, %64
%75 = load i32, i32* %4
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %81
77: ; preds = %74
%78 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%79 = call i32 @fflush(i32* null)
%80 = load i32, i32* %4
store i32 %80, i32* %1
br label %159
81: ; preds = %74
%82 = load i32, i32* @F_OK
%83 = call i32 @access_test(i8* null, i32 %82)
%84 = call i32 @expect_zng(i32 -1, i32 %83)
store i32 %84, i32* %4
%85 = load i32, i32* %4
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %81
%88 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%89 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %90
90: ; preds = %87, %81
%91 = load i32, i32* %4
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %97
93: ; preds = %90
%94 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%95 = call i32 @fflush(i32* null)
%96 = load i32, i32* %4
store i32 %96, i32* %1
br label %159
97: ; preds = %90
%98 = call i32 (...) @testbreak()
%99 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%100 = load i32, i32* @O_CREAT
%101 = load i32, i32* @O_TRUNC
%102 = or i32 %100, %101
%103 = load i32, i32* @S_IRWXU
%104 = call i32 @open_test(i8* %99, i32 %102, i32 %103)
store i32 %104, i32* %3
%105 = call i32 @expect_gez(i32 0, i32 %104)
store i32 %105, i32* %4
%106 = load i32, i32* %4
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %111
108: ; preds = %97
%109 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%110 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %111
111: ; preds = %108, %97
%112 = load i32, i32* %4
%113 = icmp eq i32 %112, -1
br i1 %113, label %114, label %118
114: ; preds = %111
%115 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%116 = call i32 @fflush(i32* null)
%117 = load i32, i32* %4
store i32 %117, i32* %1
br label %159
118: ; preds = %111
%119 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%120 = load i32, i32* @F_OK
%121 = call i32 @access_test(i8* %119, i32 %120)
%122 = call i32 @expect_zng(i32 0, i32 %121)
store i32 %122, i32* %4
%123 = load i32, i32* %4
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %128
125: ; preds = %118
%126 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%127 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %128
128: ; preds = %125, %118
%129 = load i32, i32* %3
%130 = call i32 @close_test(i32 %129)
%131 = call i32 @expect_zng(i32 0, i32 %130)
store i32 %131, i32* %4
%132 = load i32, i32* %4
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %137
134: ; preds = %128
%135 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%136 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %137
137: ; preds = %134, %128
%138 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%139 = call i32 @unlink_test(i8* %138)
%140 = call i32 @expect_zng(i32 0, i32 %139)
store i32 %140, i32* %4
%141 = load i32, i32* %4
%142 = icmp ne i32 %141, 0
br i1 %142, label %143, label %146
143: ; preds = %137
%144 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%145 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %146
146: ; preds = %143, %137
%147 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%148 = load i32, i32* @F_OK
%149 = call i32 @access_test(i8* %147, i32 %148)
%150 = call i32 @expect_zng(i32 -1, i32 %149)
store i32 %150, i32* %4
%151 = load i32, i32* %4
%152 = icmp ne i32 %151, 0
br i1 %152, label %153, label %156
153: ; preds = %146
%154 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%155 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %156
156: ; preds = %153, %146
%157 = call i32 (...) @testbreak()
%158 = load i32, i32* %5
store i32 %158, i32* %1
br label %159
159: ; preds = %156, %114, %93, %77, %22
%160 = load i32, i32* %1
ret i32 %160
}

LLVM IR (-O2):
@S_IRWXU = global i32 0
@F_OK = global i32 0
@.str.2 = [1 x i8] zeroinitializer
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@str.16 = [61 x i8] c"\09Fail Phase 2: Aborting test because of catastrophic failure\00"
@str.17 = [53 x i8] c"\09Failed Phase 2: This call did something unexpected.\00"
define i32 @BasicFile() {
%1 = alloca [8192 x i8]
%2 = getelementptr inbounds [8192 x i8], [8192 x i8]* %1, i64 0, i64 0
%3 = call i32 @xtmpnam(i8* %2)
%4 = call i32 (...) @testbreak()
%5 = load i32, i32* @S_IRWXU
%6 = call i32 @creat_test(i8* %2, i32 %5)
%7 = call i32 @expect_gez(i32 0, i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%11 = call i32 @fflush(i32* null)
%12 = icmp eq i32 %7, -1
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.16, i64 0, i64 0))
%15 = call i32 @fflush(i32* null)
br label %131
16: ; preds = %0, %9
%17 = phi i32 [ -1, %9 ], [ 0, %0 ]
%18 = load i32, i32* @F_OK
%19 = call i32 @access_test(i8* %2, i32 %18)
%20 = call i32 @expect_zng(i32 0, i32 %19)
%21 = icmp eq i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %16
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%24 = call i32 @fflush(i32* null)
br label %25
25: ; preds = %22, %16
%26 = phi i32 [ -1, %22 ], [ %17, %16 ]
%27 = call i32 @close_test(i32 %6)
%28 = call i32 @expect_zng(i32 0, i32 %27)
%29 = icmp eq i32 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %25
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%32 = call i32 @fflush(i32* null)
br label %33
33: ; preds = %30, %25
%34 = phi i32 [ -1, %30 ], [ %26, %25 ]
%35 = call i32 @unlink_test(i8* %2)
%36 = call i32 @expect_zng(i32 0, i32 %35)
%37 = icmp eq i32 %36, 0
br i1 %37, label %41, label %38
38: ; preds = %33
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%40 = call i32 @fflush(i32* null)
br label %41
41: ; preds = %38, %33
%42 = phi i32 [ -1, %38 ], [ %34, %33 ]
%43 = load i32, i32* @F_OK
%44 = call i32 @access_test(i8* %2, i32 %43)
%45 = call i32 @expect_zng(i32 -1, i32 %44)
%46 = icmp eq i32 %45, 0
br i1 %46, label %50, label %47
47: ; preds = %41
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%49 = call i32 @fflush(i32* null)
br label %50
50: ; preds = %47, %41
%51 = phi i32 [ -1, %47 ], [ %42, %41 ]
%52 = call i32 (...) @testbreak()
%53 = load i32, i32* @F_OK
%54 = call i32 @access_test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = call i32 @expect_zng(i32 -1, i32 %54)
%56 = icmp eq i32 %55, 0
br i1 %56, label %64, label %57
57: ; preds = %50
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%59 = call i32 @fflush(i32* null)
%60 = icmp eq i32 %55, -1
br i1 %60, label %61, label %64
61: ; preds = %57
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.16, i64 0, i64 0))
%63 = call i32 @fflush(i32* null)
br label %131
64: ; preds = %50, %57
%65 = phi i32 [ -1, %57 ], [ %51, %50 ]
%66 = load i32, i32* @F_OK
%67 = call i32 @access_test(i8* null, i32 %66)
%68 = call i32 @expect_zng(i32 -1, i32 %67)
%69 = icmp eq i32 %68, 0
br i1 %69, label %77, label %70
70: ; preds = %64
%71 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%72 = call i32 @fflush(i32* null)
%73 = icmp eq i32 %68, -1
br i1 %73, label %74, label %77
74: ; preds = %70
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.16, i64 0, i64 0))
%76 = call i32 @fflush(i32* null)
br label %131
77: ; preds = %64, %70
%78 = phi i32 [ -1, %70 ], [ %65, %64 ]
%79 = call i32 (...) @testbreak()
%80 = load i32, i32* @O_CREAT
%81 = load i32, i32* @O_TRUNC
%82 = or i32 %81, %80
%83 = load i32, i32* @S_IRWXU
%84 = call i32 @open_test(i8* %2, i32 %82, i32 %83)
%85 = call i32 @expect_gez(i32 0, i32 %84)
%86 = icmp eq i32 %85, 0
br i1 %86, label %94, label %87
87: ; preds = %77
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%89 = call i32 @fflush(i32* null)
%90 = icmp eq i32 %85, -1
br i1 %90, label %91, label %94
91: ; preds = %87
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.16, i64 0, i64 0))
%93 = call i32 @fflush(i32* null)
br label %131
94: ; preds = %77, %87
%95 = phi i32 [ -1, %87 ], [ %78, %77 ]
%96 = load i32, i32* @F_OK
%97 = call i32 @access_test(i8* %2, i32 %96)
%98 = call i32 @expect_zng(i32 0, i32 %97)
%99 = icmp eq i32 %98, 0
br i1 %99, label %103, label %100
100: ; preds = %94
%101 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%102 = call i32 @fflush(i32* null)
br label %103
103: ; preds = %100, %94
%104 = phi i32 [ -1, %100 ], [ %95, %94 ]
%105 = call i32 @close_test(i32 %84)
%106 = call i32 @expect_zng(i32 0, i32 %105)
%107 = icmp eq i32 %106, 0
br i1 %107, label %111, label %108
108: ; preds = %103
%109 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%110 = call i32 @fflush(i32* null)
br label %111
111: ; preds = %108, %103
%112 = phi i32 [ -1, %108 ], [ %104, %103 ]
%113 = call i32 @unlink_test(i8* %2)
%114 = call i32 @expect_zng(i32 0, i32 %113)
%115 = icmp eq i32 %114, 0
br i1 %115, label %119, label %116
116: ; preds = %111
%117 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%118 = call i32 @fflush(i32* null)
br label %119
119: ; preds = %116, %111
%120 = phi i32 [ -1, %116 ], [ %112, %111 ]
%121 = load i32, i32* @F_OK
%122 = call i32 @access_test(i8* %2, i32 %121)
%123 = call i32 @expect_zng(i32 -1, i32 %122)
%124 = icmp eq i32 %123, 0
br i1 %124, label %128, label %125
125: ; preds = %119
%126 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.17, i64 0, i64 0))
%127 = call i32 @fflush(i32* null)
br label %128
128: ; preds = %125, %119
%129 = phi i32 [ -1, %125 ], [ %120, %119 ]
%130 = call i32 (...) @testbreak()
br label %131
131: ; preds = %128, %91, %74, %61, %13
%132 = phi i32 [ -1, %13 ], [ -1, %61 ], [ -1, %74 ], [ -1, %91 ], [ %129, %128 ]
ret i32 %132
}