#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 */
typedef int /*<<< orphan*/ FILE;

/* 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;
  FILE *fp;
  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    $0x2030,%rsp
lea    -0x2010(%rbp),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1070 <memset@plt>
movl   $0x0,-0x2028(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2024(%rbp)
jne    1281 <BasicFile+0xc1>
lea    0xdd1(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
mov    -0x2024(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2024(%rbp)
jne    1450 <BasicFile+0x290>
lea    0xc02(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <fflush@plt>
mov    -0x2024(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%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,-0x2024(%rbp)
cmpl   $0x0,-0x2024(%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,-0x2028(%rbp)
ff ff ff
mov    $0x0,%al
call   10b0 <testbreak@plt>
mov    -0x2028(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2030,%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 = alloca i32
%7 = bitcast [8192 x i8]* %2 to i8*
store i32 0, i32* %6
%8 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%9 = call i32 @xtmpnam(i8* %8)
%10 = call i32 (...) @testbreak()
%11 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%12 = load i32, i32* @S_IRWXU
%13 = call i32 @creat_test(i8* %11, i32 %12)
store i32 %13, i32* %3
%14 = call i32 @expect_gez(i32 0, i32 %13)
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %0
%18 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %20
20: ; preds = %17, %0
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @fflush(i32* null)
%26 = load i32, i32* %5
store i32 %26, i32* %1
br label %127
27: ; preds = %20
%28 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%29 = load i32, i32* @F_OK
%30 = call i32 @access_test(i8* %28, i32 %29)
%31 = call i32 @expect_zng(i32 0, i32 %30)
store i32 %31, i32* %5
%32 = load i32, i32* %5
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %27
%35 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%36 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %37
37: ; preds = %34, %27
%38 = load i32, i32* %3
%39 = call i32 @close_test(i32 %38)
%40 = call i32 @expect_zng(i32 0, i32 %39)
store i32 %40, i32* %5
%41 = load i32, i32* %5
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %37
%44 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%45 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %46
46: ; preds = %43, %37
%47 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%48 = call i32 @unlink_test(i8* %47)
%49 = call i32 @expect_zng(i32 0, i32 %48)
store i32 %49, i32* %5
%50 = load i32, i32* %5
%51 = icmp ne i32 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %46
%53 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%54 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %55
55: ; preds = %52, %46
%56 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%57 = load i32, i32* @F_OK
%58 = call i32 @access_test(i8* %56, i32 %57)
%59 = call i32 @expect_zng(i32 -1, i32 %58)
store i32 %59, i32* %5
%60 = load i32, i32* %5
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %55
%63 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%64 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %65
65: ; preds = %62, %55
%66 = call i32 (...) @testbreak()
%67 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%68 = load i32, i32* @O_CREAT
%69 = load i32, i32* @O_TRUNC
%70 = or i32 %68, %69
%71 = load i32, i32* @S_IRWXU
%72 = call i32 @open_test(i8* %67, i32 %70, i32 %71)
store i32 %72, i32* %3
%73 = call i32 @expect_gez(i32 0, i32 %72)
store i32 %73, i32* %5
%74 = load i32, i32* %5
%75 = icmp ne i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %65
%77 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%78 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %79
79: ; preds = %76, %65
%80 = load i32, i32* %5
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %86
82: ; preds = %79
%83 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%84 = call i32 @fflush(i32* null)
%85 = load i32, i32* %5
store i32 %85, i32* %1
br label %127
86: ; preds = %79
%87 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%88 = load i32, i32* @F_OK
%89 = call i32 @access_test(i8* %87, i32 %88)
%90 = call i32 @expect_zng(i32 0, i32 %89)
store i32 %90, i32* %5
%91 = load i32, i32* %5
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %96
93: ; preds = %86
%94 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%95 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %96
96: ; preds = %93, %86
%97 = load i32, i32* %3
%98 = call i32 @close_test(i32 %97)
%99 = call i32 @expect_zng(i32 0, i32 %98)
store i32 %99, i32* %5
%100 = load i32, i32* %5
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %96
%103 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%104 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %105
105: ; preds = %102, %96
%106 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%107 = call i32 @unlink_test(i8* %106)
%108 = call i32 @expect_zng(i32 0, i32 %107)
store i32 %108, i32* %5
%109 = load i32, i32* %5
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %114
111: ; preds = %105
%112 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%113 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %114
114: ; preds = %111, %105
%115 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%116 = load i32, i32* @F_OK
%117 = call i32 @access_test(i8* %115, i32 %116)
%118 = call i32 @expect_zng(i32 -1, i32 %117)
store i32 %118, i32* %5
%119 = load i32, i32* %5
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %124
121: ; preds = %114
%122 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%123 = call i32 @fflush(i32* null)
store i32 -1, i32* %6
br label %124
124: ; preds = %121, %114
%125 = call i32 (...) @testbreak()
%126 = load i32, i32* %6
store i32 %126, i32* %1
br label %127
127: ; preds = %124, %82, %23
%128 = load i32, i32* %1
ret i32 %128
}

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
}