#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 {
  scalar_t__ st_ctime;
};

/* Variables and functions */
scalar_t__ fhandle_stat(char const *, struct stat *);
int fhandle_cnewer(const char *path1, const char *path2) {
  struct stat st1_buf, st2_buf;
  if (fhandle_stat(path1, &st1_buf)) {
    return -1;
  } else if (fhandle_stat(path2, &st2_buf)) {
    return -1;
  }
  if (st1_buf.st_ctime > st2_buf.st_ctime) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fhandle_cnewer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <fhandle_stat@plt>
cmp    $0x0,%rax
je     1143 <fhandle_cnewer+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    118c <fhandle_cnewer+0x7c>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <fhandle_stat@plt>
cmp    $0x0,%rax
je     1166 <fhandle_cnewer+0x56>
movl   $0xffffffff,-0x4(%rbp)
jmp    118c <fhandle_cnewer+0x7c>
jmp    116b <fhandle_cnewer+0x5b>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    1185 <fhandle_cnewer+0x75>
movl   $0x1,-0x4(%rbp)
jmp    118c <fhandle_cnewer+0x7c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fhandle_cnewer>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
lea    0x10(%rsp),%rsi
call   1030 <fhandle_stat@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
jne    114f <fhandle_cnewer+0x3f>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <fhandle_stat@plt>
test   %rax,%rax
jne    114f <fhandle_cnewer+0x3f>
mov    0x10(%rsp),%rax
xor    %ebx,%ebx
cmp    0x8(%rsp),%rax
setg   %bl
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i32 @fhandle_cnewer(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.stat
%7 = alloca %struct.stat
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i64 @fhandle_stat(i8* %8, %struct.stat* %6)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %26
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i64 @fhandle_stat(i8* %13, %struct.stat* %7)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 -1, i32* %3
br label %26
17: ; preds = %12
br label %18
18: ; preds = %17
%19 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%20 = load i64, i64* %19
%21 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%22 = load i64, i64* %21
%23 = icmp sgt i64 %20, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 1, i32* %3
br label %26
25: ; preds = %18
store i32 0, i32* %3
br label %26
26: ; preds = %25, %24, %16, %11
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i32 @fhandle_cnewer(i8* %0, i8* %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %3 to i8*
%6 = bitcast %struct.stat* %4 to i8*
%7 = call i64 @fhandle_stat(i8* %0, %struct.stat* %3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = call i64 @fhandle_stat(i8* %1, %struct.stat* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%14 = load i64, i64* %13
%15 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%16 = load i64, i64* %15
%17 = icmp sgt i64 %14, %16
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %12, %9, %2
%20 = phi i32 [ -1, %2 ], [ -1, %9 ], [ %18, %12 ]
ret i32 %20
}