#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 dummy;
};

/* Variables and functions */
scalar_t__ ENOENT;
scalar_t__ errno;
int /*<<< orphan*/ perror(char *);
scalar_t__ stat(char const *, struct stat *);
int statit(const char *path, struct stat *buf) {
  if (stat(path, buf) != 0) {
    if (errno == ENOENT) {
    } else {
      perror("statit()->stat()");
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<statit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     1183 <statit+0x63>
mov    0x2e92(%rip),%rax
mov    (%rax),%rax
mov    0x2e78(%rip),%rcx
cmp    (%rcx),%rax
jne    1166 <statit+0x46>
jmp    117e <statit+0x5e>
lea    0xe93(%rip),%rdi
call   1040 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    118a <statit+0x6a>
jmp    1183 <statit+0x63>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<statit>:
push   %rax
call   1030 <stat@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1149 <statit+0x29>
mov    0x2ea6(%rip),%rcx
mov    (%rcx),%rcx
mov    0x2e8c(%rip),%rdx
cmp    (%rdx),%rcx
jne    114b <statit+0x2b>
pop    %rcx
ret
lea    0xeae(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@errno = global i64 0
@ENOENT = global i64 0
@.str = [17 x i8] c"statit()->stat()\00"
define i32 @statit(i8* %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.stat*
store i8* %0, i8** %4
store %struct.stat* %1, %struct.stat** %5
%6 = load i8*, i8** %4
%7 = load %struct.stat*, %struct.stat** %5
%8 = call i64 @stat(i8* %6, %struct.stat* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %2
%11 = load i64, i64* @errno
%12 = load i64, i64* @ENOENT
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %10
br label %17
15: ; preds = %10
%16 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %19
17: ; preds = %14
br label %18
18: ; preds = %17, %2
store i32 1, i32* %3
br label %19
19: ; preds = %18, %15
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@errno = global i64 0
@ENOENT = global i64 0
@.str = [17 x i8] c"statit()->stat()\00"
define i32 @statit(i8* %0, %struct.stat* %1) {
%3 = tail call i64 @stat(i8* %0, %struct.stat* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = load i64, i64* @errno
%7 = load i64, i64* @ENOENT
%8 = icmp eq i64 %6, %7
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %2, %5, %9
%12 = phi i32 [ 0, %9 ], [ 1, %5 ], [ 1, %2 ]
ret i32 %12
}