#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 dir_based_fops(int /*<<< orphan*/);
int dup_fd_based_fops(int /*<<< orphan*/);
int fd_based_fops_1(int /*<<< orphan*/);
int fd_based_fops_2(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int link_based_fops(int /*<<< orphan*/);
int path_based_fops(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int test_open_modes(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int ret = -1;
  int result = 0;
  char filename[255] = {
      0,
  };
  if (argc > 1)
    strcpy(filename, argv[1]);
  else
    strcpy(filename, "temp-xattr-test-file");
  ret = fd_based_fops_1(strcat(filename, "_1"));
  if (ret < 0) {
    fprintf(stderr, "fd based file operation 1 failed\n");
    result |= ret;
  } else {
    fprintf(stdout, "fd based file operation 1 passed\n");
  }
  ret = fd_based_fops_2(strcat(filename, "_2"));
  if (ret < 0) {
    result |= ret;
    fprintf(stderr, "fd based file operation 2 failed\n");
  } else {
    fprintf(stdout, "fd based file operation 2 passed\n");
  }
  ret = dup_fd_based_fops(strcat(filename, "_3"));
  if (ret < 0) {
    result |= ret;
    fprintf(stderr, "dup fd based file operation failed\n");
  } else {
    fprintf(stdout, "dup fd based file operation passed\n");
  }
  ret = path_based_fops(strcat(filename, "_4"));
  if (ret < 0) {
    result |= ret;
    fprintf(stderr, "path based file operation failed\n");
  } else {
    fprintf(stdout, "path based file operation passed\n");
  }
  ret = dir_based_fops(strcat(filename, "_5"));
  if (ret < 0) {
    result |= ret;
    fprintf(stderr, "directory based file operation failed\n");
  } else {
    fprintf(stdout, "directory based file operation passed\n");
  }
  ret = link_based_fops(strcat(filename, "_5"));
  if (ret < 0) {
    result |= ret;
    fprintf(stderr, "link based file operation failed\n");
  } else {
    fprintf(stdout, "link based file operation passed\n");
  }
  ret = test_open_modes(strcat(filename, "_5"));
  if (ret < 0) {
    result |= ret;
    fprintf(stderr, "testing modes of `open' call failed\n");
  } else {
    fprintf(stdout, "testing modes of `open' call passed\n");
  }
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1070 <memset@plt>
cmpl   $0x1,-0x8(%rbp)
jle    120d <main+0x5d>
lea    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
jmp    1220 <main+0x70>
lea    -0x120(%rbp),%rdi
lea    0xde5(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x120(%rbp),%rdi
lea    0xde7(%rip),%rsi
call   10b0 <strcat@plt>
mov    %eax,%edi
call   10a0 <fd_based_fops_1@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    126a <main+0xba>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
lea    0xdc1(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    127f <main+0xcf>
mov    0x2d67(%rip),%rax
mov    (%rax),%edi
lea    0xdc0(%rip),%rsi
call   1090 <fprintf@plt>
lea    -0x120(%rbp),%rdi
lea    0xdcf(%rip),%rsi
call   10b0 <strcat@plt>
mov    %eax,%edi
call   1040 <fd_based_fops_2@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12c9 <main+0x119>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
lea    0xda0(%rip),%rsi
call   1090 <fprintf@plt>
jmp    12de <main+0x12e>
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
lea    0xda8(%rip),%rsi
call   1090 <fprintf@plt>
lea    -0x120(%rbp),%rdi
lea    0xdb7(%rip),%rsi
call   10b0 <strcat@plt>
mov    %eax,%edi
call   1080 <dup_fd_based_fops@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1328 <main+0x178>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2ccb(%rip),%rax
mov    (%rax),%edi
lea    0xd88(%rip),%rsi
call   1090 <fprintf@plt>
jmp    133d <main+0x18d>
mov    0x2ca9(%rip),%rax
mov    (%rax),%edi
lea    0xd92(%rip),%rsi
call   1090 <fprintf@plt>
lea    -0x120(%rbp),%rdi
lea    0xda3(%rip),%rsi
call   10b0 <strcat@plt>
mov    %eax,%edi
call   10c0 <path_based_fops@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1387 <main+0x1d7>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2c6c(%rip),%rax
mov    (%rax),%edi
lea    0xd74(%rip),%rsi
call   1090 <fprintf@plt>
jmp    139c <main+0x1ec>
mov    0x2c4a(%rip),%rax
mov    (%rax),%edi
lea    0xd7c(%rip),%rsi
call   1090 <fprintf@plt>
lea    -0x120(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   10b0 <strcat@plt>
mov    %eax,%edi
call   1060 <dir_based_fops@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    13e6 <main+0x236>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2c0d(%rip),%rax
mov    (%rax),%edi
lea    0xd5c(%rip),%rsi
call   1090 <fprintf@plt>
jmp    13fb <main+0x24b>
mov    0x2beb(%rip),%rax
mov    (%rax),%edi
lea    0xd69(%rip),%rsi
call   1090 <fprintf@plt>
lea    -0x120(%rbp),%rdi
lea    0xd2c(%rip),%rsi
call   10b0 <strcat@plt>
mov    %eax,%edi
call   1050 <link_based_fops@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1445 <main+0x295>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2bae(%rip),%rax
mov    (%rax),%edi
lea    0xd4b(%rip),%rsi
call   1090 <fprintf@plt>
jmp    145a <main+0x2aa>
mov    0x2b8c(%rip),%rax
mov    (%rax),%edi
lea    0xd53(%rip),%rsi
call   1090 <fprintf@plt>
lea    -0x120(%rbp),%rdi
lea    0xccd(%rip),%rsi
call   10b0 <strcat@plt>
mov    %eax,%edi
call   10d0 <test_open_modes@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    14a4 <main+0x2f4>
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2b4f(%rip),%rax
mov    (%rax),%edi
lea    0xd30(%rip),%rsi
call   1090 <fprintf@plt>
jmp    14b9 <main+0x309>
mov    0x2b2d(%rip),%rax
mov    (%rax),%edi
lea    0xd3b(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x18(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0xef(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
cmp    $0x2,%edi
jl     1226 <main+0x86>
mov    0x8(%rsi),%rsi
jmp    122d <main+0x8d>
lea    0xdd3(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xdd6(%rip),%rsi
mov    %r14,%rdi
call   10a0 <strcat@plt>
mov    %eax,%edi
call   1090 <fd_based_fops_1@plt>
mov    %eax,%ebp
sar    $0x1f,%ebp
and    %eax,%ebp
test   %eax,%eax
lea    0xdba(%rip),%rax
lea    0xdd5(%rip),%rsi
cmovs  %rax,%rsi
mov    0x2d70(%rip),%rcx
mov    0x2d61(%rip),%r12
mov    %r12,%rax
cmovs  %rcx,%rax
mov    %rcx,%r15
mov    (%rax),%edi
call   1080 <fprintf@plt>
lea    0xdcd(%rip),%rsi
mov    %r14,%rdi
call   10a0 <strcat@plt>
mov    %eax,%edi
call   1040 <fd_based_fops_2@plt>
mov    %eax,%ebx
sar    $0x1f,%ebx
and    %eax,%ebx
or     %ebp,%ebx
test   %eax,%eax
lea    0xdaf(%rip),%rax
lea    0xdca(%rip),%rsi
cmovs  %rax,%rsi
mov    %r12,%rax
cmovs  %r15,%rax
mov    (%rax),%edi
call   1080 <fprintf@plt>
lea    0xdd3(%rip),%rsi
mov    %r14,%rdi
call   10a0 <strcat@plt>
mov    %eax,%edi
call   1070 <dup_fd_based_fops@plt>
mov    %eax,%ebp
sar    $0x1f,%ebp
and    %eax,%ebp
test   %eax,%eax
lea    0xdb7(%rip),%rax
lea    0xdd4(%rip),%rsi
cmovs  %rax,%rsi
mov    %r12,%rax
cmovs  %r15,%rax
mov    (%rax),%edi
call   1080 <fprintf@plt>
lea    0xddf(%rip),%rsi
mov    %r14,%rdi
call   10a0 <strcat@plt>
mov    %eax,%edi
call   10b0 <path_based_fops@plt>
mov    %eax,%r13d
sar    $0x1f,%r13d
and    %eax,%r13d
or     %ebp,%r13d
or     %ebx,%r13d
test   %eax,%eax
lea    0xdba(%rip),%rax
lea    0xdd5(%rip),%rsi
cmovs  %rax,%rsi
mov    %r12,%rax
mov    %r15,%rbp
cmovs  %r15,%rax
mov    (%rax),%edi
call   1080 <fprintf@plt>
lea    0xddb(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <strcat@plt>
mov    %eax,%edi
call   1060 <dir_based_fops@plt>
mov    %eax,%r15d
sar    $0x1f,%r15d
and    %eax,%r15d
test   %eax,%eax
lea    0xdb9(%rip),%rax
lea    0xdd9(%rip),%rsi
cmovs  %rax,%rsi
mov    %r12,%rax
cmovs  %rbp,%rax
mov    (%rax),%edi
call   1080 <fprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <strcat@plt>
mov    %eax,%edi
call   1050 <link_based_fops@plt>
mov    %eax,%ebp
sar    $0x1f,%ebp
and    %eax,%ebp
or     %r15d,%ebp
test   %eax,%eax
lea    0xdc9(%rip),%rax
lea    0xde4(%rip),%rsi
cmovs  %rax,%rsi
mov    %r12,%rax
mov    0x2c0e(%rip),%r15
cmovs  %r15,%rax
mov    (%rax),%edi
call   1080 <fprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <strcat@plt>
mov    %eax,%edi
call   10c0 <test_open_modes@plt>
mov    %eax,%ebx
sar    $0x1f,%ebx
and    %eax,%ebx
or     %ebp,%ebx
or     %r13d,%ebx
test   %eax,%eax
lea    0xdc6(%rip),%rax
lea    0xde4(%rip),%rsi
cmovs  %rax,%rsi
cmovs  %r15,%r12
mov    (%r12),%edi
call   1080 <fprintf@plt>
mov    %ebx,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"temp-xattr-test-file\00"
@.str.1 = [3 x i8] c"_1\00"
@stderr = global i32 0
@.str.2 = [34 x i8] c"fd based file operation 1 failed\0A\00"
@stdout = global i32 0
@.str.3 = [34 x i8] c"fd based file operation 1 passed\0A\00"
@.str.4 = [3 x i8] c"_2\00"
@.str.5 = [34 x i8] c"fd based file operation 2 failed\0A\00"
@.str.6 = [34 x i8] c"fd based file operation 2 passed\0A\00"
@.str.7 = [3 x i8] c"_3\00"
@.str.8 = [36 x i8] c"dup fd based file operation failed\0A\00"
@.str.9 = [36 x i8] c"dup fd based file operation passed\0A\00"
@.str.10 = [3 x i8] c"_4\00"
@.str.11 = [34 x i8] c"path based file operation failed\0A\00"
@.str.12 = [34 x i8] c"path based file operation passed\0A\00"
@.str.13 = [3 x i8] c"_5\00"
@.str.14 = [39 x i8] c"directory based file operation failed\0A\00"
@.str.15 = [39 x i8] c"directory based file operation passed\0A\00"
@.str.16 = [34 x i8] c"link based file operation failed\0A\00"
@.str.17 = [34 x i8] c"link based file operation passed\0A\00"
@.str.18 = [37 x i8] c"testing modes of `open' call failed\0A\00"
@.str.19 = [37 x i8] c"testing modes of `open' call passed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [255 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
store i32 0, i32* %7
%9 = bitcast [255 x i8]* %8 to i8*
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcpy(i8* %13, i8* %16)
br label %21
18: ; preds = %2
%19 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %18, %12
%22 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%23 = call i32 @strcat(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @fd_based_fops_1(i32 %23)
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %21
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = or i32 %31, %30
store i32 %32, i32* %7
br label %36
33: ; preds = %21
%34 = load i32, i32* @stdout
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
br label %36
36: ; preds = %33, %27
%37 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%38 = call i32 @strcat(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%39 = call i32 @fd_based_fops_2(i32 %38)
store i32 %39, i32* %6
%40 = load i32, i32* %6
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %36
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = or i32 %44, %43
store i32 %45, i32* %7
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
br label %51
48: ; preds = %36
%49 = load i32, i32* @stdout
%50 = call i32 @fprintf(i32 %49, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %51
51: ; preds = %48, %42
%52 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%53 = call i32 @strcat(i8* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%54 = call i32 @dup_fd_based_fops(i32 %53)
store i32 %54, i32* %6
%55 = load i32, i32* %6
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %63
57: ; preds = %51
%58 = load i32, i32* %6
%59 = load i32, i32* %7
%60 = or i32 %59, %58
store i32 %60, i32* %7
%61 = load i32, i32* @stderr
%62 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0))
br label %66
63: ; preds = %51
%64 = load i32, i32* @stdout
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0))
br label %66
66: ; preds = %63, %57
%67 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%68 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%69 = call i32 @path_based_fops(i32 %68)
store i32 %69, i32* %6
%70 = load i32, i32* %6
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %78
72: ; preds = %66
%73 = load i32, i32* %6
%74 = load i32, i32* %7
%75 = or i32 %74, %73
store i32 %75, i32* %7
%76 = load i32, i32* @stderr
%77 = call i32 @fprintf(i32 %76, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0))
br label %81
78: ; preds = %66
%79 = load i32, i32* @stdout
%80 = call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0))
br label %81
81: ; preds = %78, %72
%82 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%83 = call i32 @strcat(i8* %82, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%84 = call i32 @dir_based_fops(i32 %83)
store i32 %84, i32* %6
%85 = load i32, i32* %6
%86 = icmp slt i32 %85, 0
br i1 %86, label %87, label %93
87: ; preds = %81
%88 = load i32, i32* %6
%89 = load i32, i32* %7
%90 = or i32 %89, %88
store i32 %90, i32* %7
%91 = load i32, i32* @stderr
%92 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.14, i64 0, i64 0))
br label %96
93: ; preds = %81
%94 = load i32, i32* @stdout
%95 = call i32 @fprintf(i32 %94, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %96
96: ; preds = %93, %87
%97 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%98 = call i32 @strcat(i8* %97, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%99 = call i32 @link_based_fops(i32 %98)
store i32 %99, i32* %6
%100 = load i32, i32* %6
%101 = icmp slt i32 %100, 0
br i1 %101, label %102, label %108
102: ; preds = %96
%103 = load i32, i32* %6
%104 = load i32, i32* %7
%105 = or i32 %104, %103
store i32 %105, i32* %7
%106 = load i32, i32* @stderr
%107 = call i32 @fprintf(i32 %106, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0))
br label %111
108: ; preds = %96
%109 = load i32, i32* @stdout
%110 = call i32 @fprintf(i32 %109, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.17, i64 0, i64 0))
br label %111
111: ; preds = %108, %102
%112 = getelementptr inbounds [255 x i8], [255 x i8]* %8, i64 0, i64 0
%113 = call i32 @strcat(i8* %112, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%114 = call i32 @test_open_modes(i32 %113)
store i32 %114, i32* %6
%115 = load i32, i32* %6
%116 = icmp slt i32 %115, 0
br i1 %116, label %117, label %123
117: ; preds = %111
%118 = load i32, i32* %6
%119 = load i32, i32* %7
%120 = or i32 %119, %118
store i32 %120, i32* %7
%121 = load i32, i32* @stderr
%122 = call i32 @fprintf(i32 %121, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.18, i64 0, i64 0))
br label %126
123: ; preds = %111
%124 = load i32, i32* @stdout
%125 = call i32 @fprintf(i32 %124, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.19, i64 0, i64 0))
br label %126
126: ; preds = %123, %117
%127 = load i32, i32* %7
ret i32 %127
}

LLVM IR (-O2):
@.str = [21 x i8] c"temp-xattr-test-file\00"
@.str.1 = [3 x i8] c"_1\00"
@stderr = global i32 0
@.str.2 = [34 x i8] c"fd based file operation 1 failed\0A\00"
@stdout = global i32 0
@.str.3 = [34 x i8] c"fd based file operation 1 passed\0A\00"
@.str.4 = [3 x i8] c"_2\00"
@.str.5 = [34 x i8] c"fd based file operation 2 failed\0A\00"
@.str.6 = [34 x i8] c"fd based file operation 2 passed\0A\00"
@.str.7 = [3 x i8] c"_3\00"
@.str.8 = [36 x i8] c"dup fd based file operation failed\0A\00"
@.str.9 = [36 x i8] c"dup fd based file operation passed\0A\00"
@.str.10 = [3 x i8] c"_4\00"
@.str.11 = [34 x i8] c"path based file operation failed\0A\00"
@.str.12 = [34 x i8] c"path based file operation passed\0A\00"
@.str.13 = [3 x i8] c"_5\00"
@.str.14 = [39 x i8] c"directory based file operation failed\0A\00"
@.str.15 = [39 x i8] c"directory based file operation passed\0A\00"
@.str.16 = [34 x i8] c"link based file operation failed\0A\00"
@.str.17 = [34 x i8] c"link based file operation passed\0A\00"
@.str.18 = [37 x i8] c"testing modes of `open' call failed\0A\00"
@.str.19 = [37 x i8] c"testing modes of `open' call passed\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
br label %9
9: ; preds = %2, %6
%10 = phi i8* [ %8, %6 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %2 ]
%11 = call i32 @strcpy(i8* %4, i8* %10)
%12 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @fd_based_fops_1(i32 %12)
%14 = icmp slt i32 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0)
%16 = select i1 %14, i32 %13, i32 0
%17 = load i32, i32* @stderr
%18 = load i32, i32* @stdout
%19 = select i1 %14, i32 %17, i32 %18
%20 = call i32 @fprintf(i32 %19, i8* %15)
%21 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @fd_based_fops_2(i32 %21)
%23 = icmp slt i32 %22, 0
%24 = select i1 %23, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0)
%25 = select i1 %23, i32 %22, i32 0
%26 = or i32 %16, %25
%27 = load i32, i32* @stderr
%28 = load i32, i32* @stdout
%29 = select i1 %23, i32 %27, i32 %28
%30 = call i32 @fprintf(i32 %29, i8* %24)
%31 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%32 = call i32 @dup_fd_based_fops(i32 %31)
%33 = icmp slt i32 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.9, i64 0, i64 0)
%35 = select i1 %33, i32 %32, i32 0
%36 = or i32 %26, %35
%37 = load i32, i32* @stderr
%38 = load i32, i32* @stdout
%39 = select i1 %33, i32 %37, i32 %38
%40 = call i32 @fprintf(i32 %39, i8* %34)
%41 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%42 = call i32 @path_based_fops(i32 %41)
%43 = icmp slt i32 %42, 0
%44 = select i1 %43, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0)
%45 = select i1 %43, i32 %42, i32 0
%46 = or i32 %36, %45
%47 = load i32, i32* @stderr
%48 = load i32, i32* @stdout
%49 = select i1 %43, i32 %47, i32 %48
%50 = call i32 @fprintf(i32 %49, i8* %44)
%51 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%52 = call i32 @dir_based_fops(i32 %51)
%53 = icmp slt i32 %52, 0
%54 = select i1 %53, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0)
%55 = select i1 %53, i32 %52, i32 0
%56 = or i32 %46, %55
%57 = load i32, i32* @stderr
%58 = load i32, i32* @stdout
%59 = select i1 %53, i32 %57, i32 %58
%60 = call i32 @fprintf(i32 %59, i8* %54)
%61 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%62 = call i32 @link_based_fops(i32 %61)
%63 = icmp slt i32 %62, 0
%64 = select i1 %63, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.17, i64 0, i64 0)
%65 = select i1 %63, i32 %62, i32 0
%66 = or i32 %56, %65
%67 = load i32, i32* @stderr
%68 = load i32, i32* @stdout
%69 = select i1 %63, i32 %67, i32 %68
%70 = call i32 @fprintf(i32 %69, i8* %64)
%71 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0))
%72 = call i32 @test_open_modes(i32 %71)
%73 = icmp slt i32 %72, 0
%74 = select i1 %73, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.19, i64 0, i64 0)
%75 = select i1 %73, i32 %72, i32 0
%76 = or i32 %66, %75
%77 = load i32, i32* @stderr
%78 = load i32, i32* @stdout
%79 = select i1 %73, i32 %77, i32 %78
%80 = call i32 @fprintf(i32 %79, i8* %74)
ret i32 %76
}