#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 */
struct stat {
  int st_mode;
};
typedef int mode_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int S_IRWXG;
int S_IRWXO;
int S_IRWXU;
int expect_bol(int, int);
int expect_msk(int /*<<< orphan*/, int);
int expect_ptr(int /*<<< orphan*/, int /*<<< orphan*/ *);
int expect_zng(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fclose_test(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ fstat_test(int /*<<< orphan*/, struct stat *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ testbreak();
int /*<<< orphan*/ *tmpfile_test();
int umask_test(int);
int BasicUmask(void) {
  FILE *fp;
  int passed;
  int block = 0;
  struct stat buf;
  mode_t oldmask;
  testbreak();
  passed = expect_msk(0, oldmask = umask_test(S_IRWXG | S_IRWXO));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_ptr(0, fp = tmpfile_test());
  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, fstat_test(fileno(fp), &buf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_bol(0, buf.st_mode & S_IRWXU);
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_msk(0, umask_test(oldmask));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, fclose_test(fp));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  passed = expect_msk(0, oldmask = umask_test(S_IRWXU));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_ptr(0, fp = tmpfile_test());
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, fstat_test(fileno(fp), &buf));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_bol(-1, buf.st_mode & S_IRWXU);
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_msk(0, umask_test(oldmask));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  passed = expect_zng(0, fclose_test(fp));
  if (passed != 0) {
    printf("\tFailed Phase 2: This call did something unexpected.\n");
    fflush(NULL);
    block = -1;
  };
  testbreak();
  return block;
}


x86 assembly (clang, -O0):
<BasicUmask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   10a0 <testbreak@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
mov    0x2e0a(%rip),%rax
or     (%rax),%edi
call   10e0 <umask_test@plt>
mov    %eax,%esi
mov    %esi,-0x24(%rbp)
xor    %edi,%edi
call   10b0 <expect_msk@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1222 <BasicUmask+0x62>
lea    0xdf3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    $0x0,%al
call   10d0 <tmpfile_test@plt>
mov    %rax,%rsi
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <expect_ptr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1260 <BasicUmask+0xa0>
lea    0xdb5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    128a <BasicUmask+0xca>
lea    0xdc5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1510 <BasicUmask+0x350>
mov    -0x10(%rbp),%rdi
call   1070 <fileno@plt>
mov    %eax,%edi
lea    -0x20(%rbp),%rsi
call   1080 <fstat_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1060 <expect_zng@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     12d0 <BasicUmask+0x110>
lea    0xd45(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    -0x20(%rbp),%esi
mov    0x2d06(%rip),%rax
and    (%rax),%esi
xor    %edi,%edi
call   10c0 <expect_bol@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     130c <BasicUmask+0x14c>
lea    0xd09(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    -0x24(%rbp),%edi
call   10e0 <umask_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10b0 <expect_msk@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1346 <BasicUmask+0x186>
lea    0xccf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fclose_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1060 <expect_zng@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1381 <BasicUmask+0x1c1>
lea    0xc94(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    $0x0,%al
call   10a0 <testbreak@plt>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
call   10e0 <umask_test@plt>
mov    %eax,%esi
mov    %esi,-0x24(%rbp)
xor    %edi,%edi
call   10b0 <expect_msk@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     13cb <BasicUmask+0x20b>
lea    0xc4a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    $0x0,%al
call   10d0 <tmpfile_test@plt>
mov    %rax,%rsi
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <expect_ptr@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1409 <BasicUmask+0x249>
lea    0xc0c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <fileno@plt>
mov    %eax,%edi
lea    -0x20(%rbp),%rsi
call   1080 <fstat_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1060 <expect_zng@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     144f <BasicUmask+0x28f>
lea    0xbc6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    -0x20(%rbp),%esi
mov    0x2b87(%rip),%rax
and    (%rax),%esi
mov    $0xffffffff,%edi
call   10c0 <expect_bol@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     148e <BasicUmask+0x2ce>
lea    0xb87(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    -0x24(%rbp),%edi
call   10e0 <umask_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   10b0 <expect_msk@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     14c8 <BasicUmask+0x308>
lea    0xb4d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <fclose_test@plt>
mov    %eax,%esi
xor    %edi,%edi
call   1060 <expect_zng@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1503 <BasicUmask+0x343>
lea    0xb12(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <fflush@plt>
movl   $0xffffffff,-0x18(%rbp)
mov    $0x0,%al
call   10a0 <testbreak@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BasicUmask>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   10a0 <testbreak@plt>
mov    0x2dfc(%rip),%rax
mov    0x2e0d(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   10e0 <umask_test@plt>
mov    %eax,%r14d
xor    %edi,%edi
mov    %eax,%esi
call   10b0 <expect_msk@plt>
test   %eax,%eax
je     1214 <BasicUmask+0x54>
lea    0xe3a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   10d0 <tmpfile_test@plt>
mov    %rax,%r15
xor    %edi,%edi
mov    %rax,%rsi
call   1040 <expect_ptr@plt>
test   %eax,%eax
je     124f <BasicUmask+0x8f>
mov    %eax,%ebp
lea    0xe08(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
cmp    $0xffffffff,%ebp
je     1446 <BasicUmask+0x286>
mov    %r15,%rdi
call   1070 <fileno@plt>
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   1080 <fstat_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1060 <expect_zng@plt>
test   %eax,%eax
je     1288 <BasicUmask+0xc8>
lea    0xdc6(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
mov    0x2d51(%rip),%r12
mov    (%r12),%esi
and    0x8(%rsp),%esi
xor    %edi,%edi
call   10c0 <expect_bol@plt>
test   %eax,%eax
je     12ba <BasicUmask+0xfa>
lea    0xd94(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %r14d,%edi
call   10e0 <umask_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10b0 <expect_msk@plt>
test   %eax,%eax
je     12e7 <BasicUmask+0x127>
lea    0xd67(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %r15,%rdi
call   1050 <fclose_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1060 <expect_zng@plt>
test   %eax,%eax
je     1314 <BasicUmask+0x154>
lea    0xd3a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   10a0 <testbreak@plt>
mov    (%r12),%edi
call   10e0 <umask_test@plt>
mov    %eax,%r14d
xor    %edi,%edi
mov    %eax,%esi
call   10b0 <expect_msk@plt>
test   %eax,%eax
je     134c <BasicUmask+0x18c>
lea    0xd02(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   10d0 <tmpfile_test@plt>
mov    %rax,%rbp
xor    %edi,%edi
mov    %rax,%rsi
call   1040 <expect_ptr@plt>
test   %eax,%eax
je     137c <BasicUmask+0x1bc>
lea    0xcd2(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %rbp,%rdi
call   1070 <fileno@plt>
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   1080 <fstat_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1060 <expect_zng@plt>
test   %eax,%eax
je     13b5 <BasicUmask+0x1f5>
lea    0xc99(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
mov    (%r12),%esi
and    0x8(%rsp),%esi
mov    $0xffffffff,%edi
call   10c0 <expect_bol@plt>
test   %eax,%eax
je     13e3 <BasicUmask+0x223>
lea    0xc6b(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %r14d,%edi
call   10e0 <umask_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   10b0 <expect_msk@plt>
test   %eax,%eax
je     1410 <BasicUmask+0x250>
lea    0xc3e(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %rbp,%rdi
call   1050 <fclose_test@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1060 <expect_zng@plt>
test   %eax,%eax
je     143d <BasicUmask+0x27d>
lea    0xc11(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
xor    %eax,%eax
call   10a0 <testbreak@plt>
jmp    145e <BasicUmask+0x29e>
lea    0xbb3(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1090 <fflush@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_IRWXG = global i32 0
@S_IRWXO = 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"
@S_IRWXU = global i32 0
define i32 @BasicUmask() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.stat
%6 = alloca i32
store i32 0, i32* %4
%7 = call i32 (...) @testbreak()
%8 = load i32, i32* @S_IRWXG
%9 = load i32, i32* @S_IRWXO
%10 = or i32 %8, %9
%11 = call i32 @umask_test(i32 %10)
store i32 %11, i32* %6
%12 = call i32 @expect_msk(i32 0, i32 %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %18
18: ; preds = %15, %0
%19 = call i32* (...) @tmpfile_test()
store i32* %19, i32** %2
%20 = call i32 @expect_ptr(i32 0, i32* %19)
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %26
26: ; preds = %23, %18
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @fflush(i32* null)
%32 = load i32, i32* %3
store i32 %32, i32* %1
br label %132
33: ; preds = %26
%34 = load i32*, i32** %2
%35 = call i32 @fileno(i32* %34)
%36 = call i32 @fstat_test(i32 %35, %struct.stat* %5)
%37 = call i32 @expect_zng(i32 0, i32 %36)
store i32 %37, i32* %3
%38 = load i32, i32* %3
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %33
%41 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%42 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %43
43: ; preds = %40, %33
%44 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%45 = load i32, i32* %44
%46 = load i32, i32* @S_IRWXU
%47 = and i32 %45, %46
%48 = call i32 @expect_bol(i32 0, i32 %47)
store i32 %48, i32* %3
%49 = load i32, i32* %3
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %43
%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* %4
br label %54
54: ; preds = %51, %43
%55 = load i32, i32* %6
%56 = call i32 @umask_test(i32 %55)
%57 = call i32 @expect_msk(i32 0, i32 %56)
store i32 %57, i32* %3
%58 = load i32, i32* %3
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %54
%61 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%62 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %63
63: ; preds = %60, %54
%64 = load i32*, i32** %2
%65 = call i32 @fclose_test(i32* %64)
%66 = call i32 @expect_zng(i32 0, i32 %65)
store i32 %66, i32* %3
%67 = load i32, i32* %3
%68 = icmp ne i32 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %63
%70 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%71 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %72
72: ; preds = %69, %63
%73 = call i32 (...) @testbreak()
%74 = load i32, i32* @S_IRWXU
%75 = call i32 @umask_test(i32 %74)
store i32 %75, i32* %6
%76 = call i32 @expect_msk(i32 0, i32 %75)
store i32 %76, i32* %3
%77 = load i32, i32* %3
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %72
%80 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%81 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %82
82: ; preds = %79, %72
%83 = call i32* (...) @tmpfile_test()
store i32* %83, i32** %2
%84 = call i32 @expect_ptr(i32 0, i32* %83)
store i32 %84, i32* %3
%85 = load i32, i32* %3
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %82
%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* %4
br label %90
90: ; preds = %87, %82
%91 = load i32*, i32** %2
%92 = call i32 @fileno(i32* %91)
%93 = call i32 @fstat_test(i32 %92, %struct.stat* %5)
%94 = call i32 @expect_zng(i32 0, i32 %93)
store i32 %94, i32* %3
%95 = load i32, i32* %3
%96 = icmp ne i32 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %90
%98 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%99 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %100
100: ; preds = %97, %90
%101 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%102 = load i32, i32* %101
%103 = load i32, i32* @S_IRWXU
%104 = and i32 %102, %103
%105 = call i32 @expect_bol(i32 -1, i32 %104)
store i32 %105, i32* %3
%106 = load i32, i32* %3
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %111
108: ; preds = %100
%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* %4
br label %111
111: ; preds = %108, %100
%112 = load i32, i32* %6
%113 = call i32 @umask_test(i32 %112)
%114 = call i32 @expect_msk(i32 0, i32 %113)
store i32 %114, i32* %3
%115 = load i32, i32* %3
%116 = icmp ne i32 %115, 0
br i1 %116, label %117, label %120
117: ; preds = %111
%118 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%119 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %120
120: ; preds = %117, %111
%121 = load i32*, i32** %2
%122 = call i32 @fclose_test(i32* %121)
%123 = call i32 @expect_zng(i32 0, i32 %122)
store i32 %123, i32* %3
%124 = load i32, i32* %3
%125 = icmp ne i32 %124, 0
br i1 %125, label %126, label %129
126: ; preds = %120
%127 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%128 = call i32 @fflush(i32* null)
store i32 -1, i32* %4
br label %129
129: ; preds = %126, %120
%130 = call i32 (...) @testbreak()
%131 = load i32, i32* %4
store i32 %131, i32* %1
br label %132
132: ; preds = %129, %29
%133 = load i32, i32* %1
ret i32 %133
}

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