#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ tv_sec;
  scalar_t__ tv_nsec;
};
struct stat {
  TYPE_1__ st_mtim;
};

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
int newerf(const char *f1, const char *f2) {
  struct stat b1, b2;
  if (stat(f1, &b1) != 0 || stat(f2, &b2) != 0)
    return 0;
  if (b1.st_mtim.tv_sec > b2.st_mtim.tv_sec)
    return 1;
  if (b1.st_mtim.tv_sec < b2.st_mtim.tv_sec)
    return 0;
  return (b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec);
}


x86 assembly (clang, -O0):
<newerf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    114e <newerf+0x3e>
mov    -0x18(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     115a <newerf+0x4a>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <newerf+0x91>
mov    -0x28(%rbp),%rax
cmp    -0x38(%rbp),%rax
jle    1174 <newerf+0x64>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <newerf+0x91>
mov    -0x28(%rbp),%rax
cmp    -0x38(%rbp),%rax
jge    118e <newerf+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <newerf+0x91>
mov    -0x20(%rbp),%rax
cmp    -0x30(%rbp),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newerf>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
lea    0x18(%rsp),%rsi
call   1030 <stat@plt>
xor    %ebx,%ebx
test   %rax,%rax
jne    1164 <newerf+0x54>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <stat@plt>
test   %rax,%rax
jne    1164 <newerf+0x54>
mov    0x8(%rsp),%rax
mov    $0x1,%ebx
cmp    %rax,0x18(%rsp)
jg     1164 <newerf+0x54>
mov    $0x0,%ebx
jl     1164 <newerf+0x54>
mov    0x20(%rsp),%rax
xor    %ebx,%ebx
cmp    0x10(%rsp),%rax
setg   %bl
mov    %ebx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
define i32 @newerf(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 @stat(i8* %8, %struct.stat* %6)
%10 = icmp ne i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = call i64 @stat(i8* %12, %struct.stat* %7)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11, %2
store i32 0, i32* %3
br label %43
16: ; preds = %11
%17 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%18 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %17, i32 0, i32 0
%19 = load i64, i64* %18
%20 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%21 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %20, i32 0, i32 0
%22 = load i64, i64* %21
%23 = icmp sgt i64 %19, %22
br i1 %23, label %24, label %25
24: ; preds = %16
store i32 1, i32* %3
br label %43
25: ; preds = %16
%26 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%27 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %26, i32 0, i32 0
%28 = load i64, i64* %27
%29 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%30 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %29, i32 0, i32 0
%31 = load i64, i64* %30
%32 = icmp slt i64 %28, %31
br i1 %32, label %33, label %34
33: ; preds = %25
store i32 0, i32* %3
br label %43
34: ; preds = %25
%35 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%36 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %35, i32 0, i32 1
%37 = load i64, i64* %36
%38 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%39 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %38, i32 0, i32 1
%40 = load i64, i64* %39
%41 = icmp sgt i64 %37, %40
%42 = zext i1 %41 to i32
store i32 %42, i32* %3
br label %43
43: ; preds = %34, %33, %24, %15
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
%struct.stat = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i64 }
define i32 @newerf(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 @stat(i8* %0, %struct.stat* %3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %27
9: ; preds = %2
%10 = call i64 @stat(i8* %1, %struct.stat* %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0, i32 0
%14 = load i64, i64* %13
%15 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0, i32 0
%16 = load i64, i64* %15
%17 = icmp sgt i64 %14, %16
br i1 %17, label %27, label %18
18: ; preds = %12
%19 = icmp slt i64 %14, %16
br i1 %19, label %27, label %20
20: ; preds = %18
%21 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0, i32 1
%22 = load i64, i64* %21
%23 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0, i32 1
%24 = load i64, i64* %23
%25 = icmp sgt i64 %22, %24
%26 = zext i1 %25 to i32
br label %27
27: ; preds = %18, %12, %2, %9, %20
%28 = phi i32 [ %26, %20 ], [ 0, %9 ], [ 0, %2 ], [ 1, %12 ], [ 0, %18 ]
ret i32 %28
}