#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int fileCheck(char *fileName) {
  char location[1024];
  strcat(location, ".storage/");
  strcat(location, fileName);
  FILE *fd;
  if ((fd = fopen(location, "r")) != NULL) {
    fclose(fd);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<fileCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x410(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x418(%rbp)
cmp    $0x0,%rax
je     119e <fileCheck+0x6e>
mov    -0x418(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a5 <fileCheck+0x75>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileCheck>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
lea    0xebc(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1050 <strcat@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
lea    0xea9(%rip),%rsi
mov    %r14,%rdi
call   1040 <fopen@plt>
test   %rax,%rax
je     117a <fileCheck+0x4a>
mov    %rax,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    117f <fileCheck+0x4f>
mov    $0x1,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c".storage/\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @fileCheck(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1024 x i8]
%5 = alloca i32*
store i8* %0, i8** %3
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = load i8*, i8** %3
%10 = call i32 @strcat(i8* %8, i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %5
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = load i32*, i32** %5
%16 = call i32 @fclose(i32* %15)
store i32 0, i32* %2
br label %18
17: ; preds = %1
store i32 1, i32* %2
br label %18
18: ; preds = %17, %14
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [10 x i8] c".storage/\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @fileCheck(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcat(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @strcat(i8* %3, i8* %0)
%6 = call i32* @fopen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @fclose(i32* %6)
br label %10
10: ; preds = %1, %8
%11 = phi i32 [ 0, %8 ], [ 1, %1 ]
ret i32 %11
}