int test_fexists(void) {
  int res;
  res = fexists("README.md");
  do {
    if (!(res == 1)) {
      printf("%sERROR!%s [%s:%d] %s %sFAILED!%s\n", "\x1B[1;31m", "\x1B[1;0m",
             __func__, 271, "res == 1", "\x1B[1;31m", "\x1B[1;0m");
      return -1;
    }
  } while (0);
  res = fexists("./README.md");
  do {
    if (!(res == 1)) {
      printf("%sERROR!%s [%s:%d] %s %sFAILED!%s\n", "\x1B[1;31m", "\x1B[1;0m",
             __func__, 274, "res == 1", "\x1B[1;31m", "\x1B[1;0m");
      return -1;
    }
  } while (0);
  res = fexists("./README.m");
  do {
    if (!(res == 0)) {
      printf("%sERROR!%s [%s:%d] %s %sFAILED!%s\n", "\x1B[1;31m", "\x1B[1;0m",
             __func__, 277, "res == 0", "\x1B[1;31m", "\x1B[1;0m");
      return -1;
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_fexists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xf1b(%rip),%rdi
mov    $0x0,%al
call   1030 <fexists@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     118e <test_fexists+0x6e>
lea    0xeb6(%rip),%rdi
lea    0xed2(%rip),%r10
lea    0xed3(%rip),%rax
lea    0xed3(%rip),%rcx
mov    $0x10f,%r8d
lea    0xed3(%rip),%r9
mov    %r10,%rsi
mov    %rax,%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1270 <test_fexists+0x150>
jmp    1193 <test_fexists+0x73>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <fexists@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     11f9 <test_fexists+0xd9>
lea    0xe4b(%rip),%rdi
lea    0xe67(%rip),%r10
lea    0xe68(%rip),%rax
lea    0xe68(%rip),%rcx
mov    $0x112,%r8d
lea    0xe68(%rip),%r9
mov    %r10,%rsi
mov    %rax,%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1270 <test_fexists+0x150>
jmp    11fe <test_fexists+0xde>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <fexists@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1264 <test_fexists+0x144>
lea    0xde0(%rip),%rdi
lea    0xdfc(%rip),%r10
lea    0xdfd(%rip),%rax
lea    0xdfd(%rip),%rcx
mov    $0x115,%r8d
lea    0xe1d(%rip),%r9
mov    %r10,%rsi
mov    %rax,%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1270 <test_fexists+0x150>
jmp    1269 <test_fexists+0x149>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fexists>:
push   %rbx
lea    0xf22(%rip),%rdi
xor    %eax,%eax
call   1030 <fexists@plt>
cmp    $0x1,%eax
jne    118a <test_fexists+0x6a>
lea    0xf0d(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <fexists@plt>
cmp    $0x1,%eax
jne    11b5 <test_fexists+0x95>
lea    0xf04(%rip),%rdi
xor    %eax,%eax
call   1030 <fexists@plt>
test   %eax,%eax
je     11f0 <test_fexists+0xd0>
lea    0xec5(%rip),%rdx
lea    0xeb6(%rip),%rsi
lea    0xe8c(%rip),%rdi
lea    0xeb7(%rip),%rcx
lea    0xedd(%rip),%r9
mov    $0x115,%r8d
jmp    11de <test_fexists+0xbe>
lea    0xe9a(%rip),%rdx
lea    0xe8b(%rip),%rsi
lea    0xe61(%rip),%rdi
lea    0xe8c(%rip),%rcx
lea    0xe92(%rip),%r9
mov    $0x10f,%r8d
jmp    11de <test_fexists+0xbe>
lea    0xe6f(%rip),%rdx
lea    0xe60(%rip),%rsi
lea    0xe36(%rip),%rdi
lea    0xe61(%rip),%rcx
lea    0xe67(%rip),%r9
mov    $0x112,%r8d
xor    %eax,%eax
push   %rdx
push   %rsi
call   1040 <printf@plt>
add    $0x10,%rsp
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"README.md\00"
@.str.1 = [35 x i8] c"%sERROR!%s [%s:%d] %s %sFAILED!%s\0A\00"
@.str.2 = [8 x i8] c"\1B[1;31m\00"
@.str.3 = [7 x i8] c"\1B[1;0m\00"
@__func__.test_fexists = [13 x i8] c"test_fexists\00"
@.str.4 = [9 x i8] c"res == 1\00"
@.str.5 = [12 x i8] c"./README.md\00"
@.str.6 = [11 x i8] c"./README.m\00"
@.str.7 = [9 x i8] c"res == 0\00"
define i32 @test_fexists() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @fexists to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %2
br label %4
4: ; preds = %0
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 1
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_fexists, i64 0, i64 0), i32 271, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %27
9: ; preds = %4
br label %10
10: ; preds = %9
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @fexists to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
store i32 %11, i32* %2
br label %12
12: ; preds = %10
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 1
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_fexists, i64 0, i64 0), i32 274, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %27
17: ; preds = %12
br label %18
18: ; preds = %17
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @fexists to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
store i32 %19, i32* %2
br label %20
20: ; preds = %18
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_fexists, i64 0, i64 0), i32 277, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %1
br label %27
25: ; preds = %20
br label %26
26: ; preds = %25
store i32 0, i32* %1
br label %27
27: ; preds = %26, %23, %15, %7
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [10 x i8] c"README.md\00"
@.str.1 = [35 x i8] c"%sERROR!%s [%s:%d] %s %sFAILED!%s\0A\00"
@.str.2 = [8 x i8] c"\1B[1;31m\00"
@.str.3 = [7 x i8] c"\1B[1;0m\00"
@__func__.test_fexists = [13 x i8] c"test_fexists\00"
@.str.4 = [9 x i8] c"res == 1\00"
@.str.5 = [12 x i8] c"./README.md\00"
@.str.6 = [11 x i8] c"./README.m\00"
@.str.7 = [9 x i8] c"res == 0\00"
define i32 @test_fexists() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fexists to i32 (i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_fexists, i64 0, i64 0), i32 271, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %15
5: ; preds = %0
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fexists to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%7 = icmp eq i32 %6, 1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_fexists, i64 0, i64 0), i32 274, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %15
10: ; preds = %5
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fexists to i32 (i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.test_fexists, i64 0, i64 0), i32 277, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %10, %13, %8, %3
%16 = phi i32 [ -1, %13 ], [ -1, %8 ], [ -1, %3 ], [ 0, %10 ]
ret i32 %16
}