#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 is_file_exist(char *);
int /*<<< orphan*/ printf(char *);
int main() {
  int ret = -2;
  if ((ret = is_file_exist("file_exist.c")) == -1)
    printf("file is not exist or file_path is wrong\n");
  else
    printf("file is exist!\n");
  if ((ret = is_file_exist("ssfile_exist.c")) == -1)
    printf("ssfile_exist.c is not exist or file_path is wrong\n");
  else
    printf("ssfile_exist.c is exist!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffffe,-0x8(%rbp)
lea    0xefe(%rip),%rdi
call   1040 <is_file_exist@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    115f <main+0x3f>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    116b <main+0x4b>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
call   1040 <is_file_exist@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    1194 <main+0x74>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    11a0 <main+0x80>
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeda(%rip),%rdi
call   1040 <is_file_exist@plt>
cmp    $0xffffffff,%eax
lea    0xf32(%rip),%rax
lea    0xed1(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xeb2(%rip),%rdi
call   1040 <is_file_exist@plt>
cmp    $0xffffffff,%eax
lea    0xeda(%rip),%rax
lea    0xeba(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"file_exist.c\00"
@.str.1 = [41 x i8] c"file is not exist or file_path is wrong\0A\00"
@.str.2 = [16 x i8] c"file is exist!\0A\00"
@.str.3 = [15 x i8] c"ssfile_exist.c\00"
@.str.4 = [51 x i8] c"ssfile_exist.c is not exist or file_path is wrong\0A\00"
@.str.5 = [26 x i8] c"ssfile_exist.c is exist!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -2, i32* %2
%3 = call i32 @is_file_exist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %2
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = call i32 @is_file_exist(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
store i32 %10, i32* %2
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.4, i64 0, i64 0))
br label %16
14: ; preds = %9
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"file_exist.c\00"
@.str.3 = [15 x i8] c"ssfile_exist.c\00"
@str = [15 x i8] c"file is exist!\00"
@str.6 = [25 x i8] c"ssfile_exist.c is exist!\00"
@str.7 = [50 x i8] c"ssfile_exist.c is not exist or file_path is wrong\00"
@str.8 = [40 x i8] c"file is not exist or file_path is wrong\00"
define i32 @main() {
%1 = tail call i32 @is_file_exist(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
%3 = select i1 %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @str.8, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
%5 = tail call i32 @is_file_exist(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%6 = icmp eq i32 %5, -1
%7 = select i1 %6, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @str.6, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}