#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 S_IFBLK;
int S_IFCHR;
int S_IFDIR;
int S_IFIFO;
int S_IRWXU;
int /*<<< orphan*/ access_test(char *, int /*<<< orphan*/);
int expect_zng(int, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ mknod_test(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ testbreak();
int /*<<< orphan*/ unlink_test(char *);
int /*<<< orphan*/ xtmpnam(char *);
int BasicMknod(void) {
  char tf[8192] = {0};
  int passed;
  int block = 0;
  xtmpnam(tf);
  testbreak();
  passed = expect_zng(0, mknod_test(tf, S_IFIFO | S_IRWXU, 0));
  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, unlink_test(tf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  passed = expect_zng(-1, mknod_test(tf, S_IFCHR | S_IRWXU, 0));
  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(tf, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, unlink_test(tf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  passed = expect_zng(-1, mknod_test(tf, S_IFDIR | S_IRWXU, 0));
  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(tf, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, unlink_test(tf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  passed = expect_zng(-1, mknod_test(tf, S_IFBLK | S_IRWXU, 0));
  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(tf, F_OK));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(-1, unlink_test(tf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  return block;
}


x86 assembly (clang, -O0):
<BasicMknod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
lea    -0x2010(%rbp),%rdi
xor    %esi,%esi
mov    $0x2000,%edx
call   1060 <memset@plt>
movl   $0x0,-0x2018(%rbp)
lea    -0x2010(%rbp),%rdi
call   1040 <xtmpnam@plt>
mov    $0x0,%al
call   1090 <testbreak@plt>
lea    -0x2010(%rbp),%rdi
mov    0x2def(%rip),%rax
mov    (%rax),%esi
mov    0x2e06(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   1030 <mknod_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     1226 <BasicMknod+0x96>
lea    0xdf2(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2014(%rbp)
jne    1256 <BasicMknod+0xc6>
lea    0xdfc(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
mov    -0x2014(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1693 <BasicMknod+0x503>
lea    -0x2010(%rbp),%rdi
mov    0x2d54(%rip),%rax
mov    (%rax),%esi
call   10b0 <access_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     12a6 <BasicMknod+0x116>
lea    0xd72(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
call   10a0 <unlink_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     12ed <BasicMknod+0x15d>
lea    0xd2b(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
mov    $0x0,%al
call   1090 <testbreak@plt>
lea    -0x2010(%rbp),%rdi
mov    0x2cce(%rip),%rax
mov    (%rax),%esi
mov    0x2cdd(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   1030 <mknod_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     1352 <BasicMknod+0x1c2>
lea    0xcc6(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2014(%rbp)
jne    1382 <BasicMknod+0x1f2>
lea    0xcd0(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
mov    -0x2014(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1693 <BasicMknod+0x503>
lea    -0x2010(%rbp),%rdi
mov    0x2c28(%rip),%rax
mov    (%rax),%esi
call   10b0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     13d5 <BasicMknod+0x245>
lea    0xc43(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
call   10a0 <unlink_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     141f <BasicMknod+0x28f>
lea    0xbf9(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
mov    $0x0,%al
call   1090 <testbreak@plt>
lea    -0x2010(%rbp),%rdi
mov    0x2b7c(%rip),%rax
mov    (%rax),%esi
mov    0x2bab(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   1030 <mknod_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     1484 <BasicMknod+0x2f4>
lea    0xb94(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2014(%rbp)
jne    14b4 <BasicMknod+0x324>
lea    0xb9e(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
mov    -0x2014(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1693 <BasicMknod+0x503>
lea    -0x2010(%rbp),%rdi
mov    0x2af6(%rip),%rax
mov    (%rax),%esi
call   10b0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     1507 <BasicMknod+0x377>
lea    0xb11(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
call   10a0 <unlink_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     1551 <BasicMknod+0x3c1>
lea    0xac7(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
mov    $0x0,%al
call   1090 <testbreak@plt>
lea    -0x2010(%rbp),%rdi
mov    0x2a72(%rip),%rax
mov    (%rax),%esi
mov    0x2a79(%rip),%rax
or     (%rax),%esi
xor    %edx,%edx
call   1030 <mknod_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     15b6 <BasicMknod+0x426>
lea    0xa62(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
cmpl   $0xffffffff,-0x2014(%rbp)
jne    15e6 <BasicMknod+0x456>
lea    0xa6c(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
mov    -0x2014(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1693 <BasicMknod+0x503>
lea    -0x2010(%rbp),%rdi
mov    0x29c4(%rip),%rax
mov    (%rax),%esi
call   10b0 <access_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     1639 <BasicMknod+0x4a9>
lea    0x9df(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
lea    -0x2010(%rbp),%rdi
call   10a0 <unlink_test@plt>
mov    %eax,%esi
mov    $0xffffffff,%edi
call   1070 <expect_zng@plt>
mov    %eax,-0x2014(%rbp)
cmpl   $0x0,-0x2014(%rbp)
je     1683 <BasicMknod+0x4f3>
lea    0x995(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <fflush@plt>
movl   $0xffffffff,-0x2018(%rbp)
ff ff ff
mov    $0x0,%al
call   1090 <testbreak@plt>
mov    -0x2018(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BasicMknod>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x2008,%rsp
mov    %rsp,%rbp
xor    %ebx,%ebx
mov    $0x2000,%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    %rbp,%rdi
call   1050 <xtmpnam@plt>
xor    %eax,%eax
call   1090 <testbreak@plt>
mov    0x2e01(%rip),%rax
mov    0x2e1a(%rip),%r14
mov    (%r14),%esi
or     (%rax),%esi
mov    %rbp,%rdi
xor    %edx,%edx
call   1030 <mknod_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     120d <BasicMknod+0x7d>
mov    %eax,%ebp
lea    0xe4a(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
cmp    $0xffffffff,%ebp
je     148f <BasicMknod+0x2ff>
mov    0x2da4(%rip),%r15
mov    (%r15),%esi
mov    %rsp,%rdi
call   10b0 <access_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     1244 <BasicMknod+0xb4>
lea    0xe0a(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %rsp,%rdi
call   10a0 <unlink_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     1271 <BasicMknod+0xe1>
lea    0xddd(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   1090 <testbreak@plt>
mov    0x2d51(%rip),%rax
mov    (%r14),%esi
or     (%rax),%esi
mov    %rsp,%rdi
xor    %edx,%edx
call   1030 <mknod_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     12c1 <BasicMknod+0x131>
mov    %eax,%ebp
lea    0xd96(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
cmp    $0xffffffff,%ebp
je     148f <BasicMknod+0x2ff>
mov    (%r15),%esi
mov    %rsp,%rdi
call   10b0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     12f4 <BasicMknod+0x164>
lea    0xd5a(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %rsp,%rdi
call   10a0 <unlink_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     1324 <BasicMknod+0x194>
lea    0xd2a(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   1090 <testbreak@plt>
mov    0x2c7e(%rip),%rax
mov    (%r14),%esi
or     (%rax),%esi
mov    %rsp,%rdi
xor    %edx,%edx
call   1030 <mknod_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     1374 <BasicMknod+0x1e4>
mov    %eax,%ebp
lea    0xce3(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
cmp    $0xffffffff,%ebp
je     148f <BasicMknod+0x2ff>
mov    (%r15),%esi
mov    %rsp,%rdi
call   10b0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     13a7 <BasicMknod+0x217>
lea    0xca7(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %rsp,%rdi
call   10a0 <unlink_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     13d7 <BasicMknod+0x247>
lea    0xc77(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   1090 <testbreak@plt>
mov    0x2bf3(%rip),%rax
mov    (%r14),%esi
or     (%rax),%esi
mov    %rsp,%rdi
xor    %edx,%edx
call   1030 <mknod_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     1423 <BasicMknod+0x293>
mov    %eax,%ebp
lea    0xc30(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
cmp    $0xffffffff,%ebp
je     148f <BasicMknod+0x2ff>
mov    (%r15),%esi
mov    %rsp,%rdi
call   10b0 <access_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     1456 <BasicMknod+0x2c6>
lea    0xbf8(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %rsp,%rdi
call   10a0 <unlink_test@plt>
mov    $0xffffffff,%edi
mov    %eax,%esi
call   1070 <expect_zng@plt>
test   %eax,%eax
je     1486 <BasicMknod+0x2f6>
lea    0xbc8(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   1090 <testbreak@plt>
jmp    14a7 <BasicMknod+0x317>
lea    0xb6a(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1080 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x2008,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@S_IFIFO = global i32 0
@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
@S_IFCHR = global i32 0
@S_IFDIR = global i32 0
@S_IFBLK = global i32 0
define i32 @BasicMknod() {
%1 = alloca i32
%2 = alloca [8192 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = bitcast [8192 x i8]* %2 to i8*
store i32 0, i32* %4
%6 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%7 = call i32 @xtmpnam(i8* %6)
%8 = call i32 (...) @testbreak()
%9 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%10 = load i32, i32* @S_IFIFO
%11 = load i32, i32* @S_IRWXU
%12 = or i32 %10, %11
%13 = call i32 @mknod_test(i8* %9, i32 %12, i32 0)
%14 = call i32 @expect_zng(i32 0, i32 %13)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%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* %4
br label %20
20: ; preds = %17, %0
%21 = load i32, i32* %3
%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* %3
store i32 %26, i32* %1
br label %166
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* %3
%32 = load i32, i32* %3
%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* %4
br label %37
37: ; preds = %34, %27
%38 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%39 = call i32 @unlink_test(i8* %38)
%40 = call i32 @expect_zng(i32 0, i32 %39)
store i32 %40, i32* %3
%41 = load i32, i32* %3
%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* %4
br label %46
46: ; preds = %43, %37
%47 = call i32 (...) @testbreak()
%48 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%49 = load i32, i32* @S_IFCHR
%50 = load i32, i32* @S_IRWXU
%51 = or i32 %49, %50
%52 = call i32 @mknod_test(i8* %48, i32 %51, i32 0)
%53 = call i32 @expect_zng(i32 -1, i32 %52)
store i32 %53, i32* %3
%54 = load i32, i32* %3
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %46
%57 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%58 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %59
59: ; preds = %56, %46
%60 = load i32, i32* %3
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %66
62: ; preds = %59
%63 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%64 = call i32 @fflush(i32* null)
%65 = load i32, i32* %3
store i32 %65, i32* %1
br label %166
66: ; preds = %59
%67 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%68 = load i32, i32* @F_OK
%69 = call i32 @access_test(i8* %67, i32 %68)
%70 = call i32 @expect_zng(i32 -1, i32 %69)
store i32 %70, i32* %3
%71 = load i32, i32* %3
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %66
%74 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%75 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %76
76: ; preds = %73, %66
%77 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%78 = call i32 @unlink_test(i8* %77)
%79 = call i32 @expect_zng(i32 -1, i32 %78)
store i32 %79, i32* %3
%80 = load i32, i32* %3
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %76
%83 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%84 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %85
85: ; preds = %82, %76
%86 = call i32 (...) @testbreak()
%87 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%88 = load i32, i32* @S_IFDIR
%89 = load i32, i32* @S_IRWXU
%90 = or i32 %88, %89
%91 = call i32 @mknod_test(i8* %87, i32 %90, i32 0)
%92 = call i32 @expect_zng(i32 -1, i32 %91)
store i32 %92, i32* %3
%93 = load i32, i32* %3
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %85
%96 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%97 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %98
98: ; preds = %95, %85
%99 = load i32, i32* %3
%100 = icmp eq i32 %99, -1
br i1 %100, label %101, label %105
101: ; preds = %98
%102 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%103 = call i32 @fflush(i32* null)
%104 = load i32, i32* %3
store i32 %104, i32* %1
br label %166
105: ; preds = %98
%106 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%107 = load i32, i32* @F_OK
%108 = call i32 @access_test(i8* %106, i32 %107)
%109 = call i32 @expect_zng(i32 -1, i32 %108)
store i32 %109, i32* %3
%110 = load i32, i32* %3
%111 = icmp ne i32 %110, 0
br i1 %111, label %112, label %115
112: ; preds = %105
%113 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%114 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %115
115: ; preds = %112, %105
%116 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%117 = call i32 @unlink_test(i8* %116)
%118 = call i32 @expect_zng(i32 -1, i32 %117)
store i32 %118, i32* %3
%119 = load i32, i32* %3
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %124
121: ; preds = %115
%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* %4
br label %124
124: ; preds = %121, %115
%125 = call i32 (...) @testbreak()
%126 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%127 = load i32, i32* @S_IFBLK
%128 = load i32, i32* @S_IRWXU
%129 = or i32 %127, %128
%130 = call i32 @mknod_test(i8* %126, i32 %129, i32 0)
%131 = call i32 @expect_zng(i32 -1, i32 %130)
store i32 %131, i32* %3
%132 = load i32, i32* %3
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %137
134: ; preds = %124
%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* %4
br label %137
137: ; preds = %134, %124
%138 = load i32, i32* %3
%139 = icmp eq i32 %138, -1
br i1 %139, label %140, label %144
140: ; preds = %137
%141 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%142 = call i32 @fflush(i32* null)
%143 = load i32, i32* %3
store i32 %143, i32* %1
br label %166
144: ; preds = %137
%145 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%146 = load i32, i32* @F_OK
%147 = call i32 @access_test(i8* %145, i32 %146)
%148 = call i32 @expect_zng(i32 -1, i32 %147)
store i32 %148, i32* %3
%149 = load i32, i32* %3
%150 = icmp ne i32 %149, 0
br i1 %150, label %151, label %154
151: ; preds = %144
%152 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%153 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %154
154: ; preds = %151, %144
%155 = getelementptr inbounds [8192 x i8], [8192 x i8]* %2, i64 0, i64 0
%156 = call i32 @unlink_test(i8* %155)
%157 = call i32 @expect_zng(i32 -1, i32 %156)
store i32 %157, i32* %3
%158 = load i32, i32* %3
%159 = icmp ne i32 %158, 0
br i1 %159, label %160, label %163
160: ; preds = %154
%161 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%162 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %163
163: ; preds = %160, %154
%164 = call i32 (...) @testbreak()
%165 = load i32, i32* %4
store i32 %165, i32* %1
br label %166
166: ; preds = %163, %140, %101, %62, %23
%167 = load i32, i32* %1
ret i32 %167
}

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