#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_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    1590 <BasicFile+0x3d0>
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>
lea    -0x2010(%rbp),%rdi
mov    0x2c32(%rip),%rax
mov    (%rax),%esi
mov    0x2c21(%rip),%rax
or     (%rax),%esi
mov    0x2c00(%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     1420 <BasicFile+0x260>
lea    0xbf8(%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    1450 <BasicFile+0x290>
lea    0xc02(%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    1590 <BasicFile+0x3d0>
lea    -0x2010(%rbp),%rdi
mov    0x2b62(%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     14a0 <BasicFile+0x2e0>
lea    0xb78(%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     14e6 <BasicFile+0x326>
lea    0xb32(%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     152d <BasicFile+0x36d>
lea    0xaeb(%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    0x2a85(%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     1580 <BasicFile+0x3c0>
lea    0xa98(%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     1421 <BasicFile+0x261>
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    0x2cea(%rip),%rax
mov    0x2cdb(%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     1358 <BasicFile+0x198>
mov    %eax,%ebx
lea    0xd00(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
cmp    $0xffffffff,%ebx
je     1421 <BasicFile+0x261>
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     1389 <BasicFile+0x1c9>
lea    0xcc6(%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     13b6 <BasicFile+0x1f6>
lea    0xc99(%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     13e4 <BasicFile+0x224>
lea    0xc6b(%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     1418 <BasicFile+0x258>
lea    0xc37(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10a0 <fflush@plt>
mov    $0xffffffff,%r14d
xor    %eax,%eax
call   10b0 <testbreak@plt>
jmp    143a <BasicFile+0x27a>
lea    0xbd8(%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
@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 %126
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 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%67 = load i32, i32* @O_CREAT
%68 = load i32, i32* @O_TRUNC
%69 = or i32 %67, %68
%70 = load i32, i32* @S_IRWXU
%71 = call i32 @open_test(i8* %66, i32 %69, i32 %70)
store i32 %71, i32* %3
%72 = call i32 @expect_gez(i32 0, i32 %71)
store i32 %72, i32* %4
%73 = load i32, i32* %4
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %64
%76 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%77 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %78
78: ; preds = %75, %64
%79 = load i32, i32* %4
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %85
81: ; preds = %78
%82 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%83 = call i32 @fflush(i32* null)
%84 = load i32, i32* %4
store i32 %84, i32* %1
br label %126
85: ; preds = %78
%86 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%87 = load i32, i32* @F_OK
%88 = call i32 @access_test(i8* %86, i32 %87)
%89 = call i32 @expect_zng(i32 0, i32 %88)
store i32 %89, i32* %4
%90 = load i32, i32* %4
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %95
92: ; preds = %85
%93 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%94 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %95
95: ; preds = %92, %85
%96 = load i32, i32* %3
%97 = call i32 @close_test(i32 %96)
%98 = call i32 @expect_zng(i32 0, i32 %97)
store i32 %98, i32* %4
%99 = load i32, i32* %4
%100 = icmp ne i32 %99, 0
br i1 %100, label %101, label %104
101: ; preds = %95
%102 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%103 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %104
104: ; preds = %101, %95
%105 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%106 = call i32 @unlink_test(i8* %105)
%107 = call i32 @expect_zng(i32 0, i32 %106)
store i32 %107, i32* %4
%108 = load i32, i32* %4
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %104
%111 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%112 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %113
113: ; preds = %110, %104
%114 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%115 = load i32, i32* @F_OK
%116 = call i32 @access_test(i8* %114, i32 %115)
%117 = call i32 @expect_zng(i32 -1, i32 %116)
store i32 %117, i32* %4
%118 = load i32, i32* %4
%119 = icmp ne i32 %118, 0
br i1 %119, label %120, label %123
120: ; preds = %113
%121 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%122 = call i32 @fflush(i32* null)
store i32 -1, i32* %5
br label %123
123: ; preds = %120, %113
%124 = call i32 (...) @testbreak()
%125 = load i32, i32* %5
store i32 %125, i32* %1
br label %126
126: ; preds = %123, %81, %22
%127 = load i32, i32* %1
ret i32 %127
}

LLVM IR (-O2):
@S_IRWXU = global i32 0
@F_OK = global i32 0
@O_CREAT = global i32 0
@O_TRUNC = global i32 0
@str.11 = [61 x i8] c"\09Fail Phase 2: Aborting test because of catastrophic failure\00"
@str.12 = [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.12, 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.11, i64 0, i64 0))
%15 = call i32 @fflush(i32* null)
br label %104
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.12, 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.12, 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.12, 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.12, 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* @O_CREAT
%54 = load i32, i32* @O_TRUNC
%55 = or i32 %54, %53
%56 = load i32, i32* @S_IRWXU
%57 = call i32 @open_test(i8* %2, i32 %55, i32 %56)
%58 = call i32 @expect_gez(i32 0, i32 %57)
%59 = icmp eq i32 %58, 0
br i1 %59, label %67, label %60
60: ; preds = %50
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.12, i64 0, i64 0))
%62 = call i32 @fflush(i32* null)
%63 = icmp eq i32 %58, -1
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str.11, i64 0, i64 0))
%66 = call i32 @fflush(i32* null)
br label %104
67: ; preds = %50, %60
%68 = phi i32 [ -1, %60 ], [ %51, %50 ]
%69 = load i32, i32* @F_OK
%70 = call i32 @access_test(i8* %2, i32 %69)
%71 = call i32 @expect_zng(i32 0, i32 %70)
%72 = icmp eq i32 %71, 0
br i1 %72, label %76, label %73
73: ; preds = %67
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.12, i64 0, i64 0))
%75 = call i32 @fflush(i32* null)
br label %76
76: ; preds = %73, %67
%77 = phi i32 [ -1, %73 ], [ %68, %67 ]
%78 = call i32 @close_test(i32 %57)
%79 = call i32 @expect_zng(i32 0, i32 %78)
%80 = icmp eq i32 %79, 0
br i1 %80, label %84, label %81
81: ; preds = %76
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.12, i64 0, i64 0))
%83 = call i32 @fflush(i32* null)
br label %84
84: ; preds = %81, %76
%85 = phi i32 [ -1, %81 ], [ %77, %76 ]
%86 = call i32 @unlink_test(i8* %2)
%87 = call i32 @expect_zng(i32 0, i32 %86)
%88 = icmp eq i32 %87, 0
br i1 %88, label %92, label %89
89: ; preds = %84
%90 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.12, i64 0, i64 0))
%91 = call i32 @fflush(i32* null)
br label %92
92: ; preds = %89, %84
%93 = phi i32 [ -1, %89 ], [ %85, %84 ]
%94 = load i32, i32* @F_OK
%95 = call i32 @access_test(i8* %2, i32 %94)
%96 = call i32 @expect_zng(i32 -1, i32 %95)
%97 = icmp eq i32 %96, 0
br i1 %97, label %101, label %98
98: ; preds = %92
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.12, i64 0, i64 0))
%100 = call i32 @fflush(i32* null)
br label %101
101: ; preds = %98, %92
%102 = phi i32 [ -1, %98 ], [ %93, %92 ]
%103 = call i32 (...) @testbreak()
br label %104
104: ; preds = %101, %64, %13
%105 = phi i32 [ -1, %13 ], [ -1, %64 ], [ %102, %101 ]
ret i32 %105
}