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

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
int newer(char *f1, char *f2) {
  struct stat x, y;
  if (stat(f1, (struct stat *)&x) < 0)
    return 0;
  if (stat(f2, (struct stat *)&y) < 0)
    return 1;
  if (x.st_mtime < y.st_mtime)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<newer>:
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 <stat@plt>
cmp    $0x0,%rax
jge    1143 <newer+0x33>
movl   $0x0,-0x4(%rbp)
jmp    1187 <newer+0x77>
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jge    1166 <newer+0x56>
movl   $0x1,-0x4(%rbp)
jmp    1187 <newer+0x77>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    1180 <newer+0x70>
movl   $0x0,-0x4(%rbp)
jmp    1187 <newer+0x77>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newer>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
call   1030 <stat@plt>
test   %rax,%rax
js     1147 <newer+0x37>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <stat@plt>
test   %rax,%rax
js     114b <newer+0x3b>
mov    0x8(%rsp),%rcx
xor    %eax,%eax
cmp    (%rsp),%rcx
setge  %al
jmp    1150 <newer+0x40>
xor    %eax,%eax
jmp    1150 <newer+0x40>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
define i32 @newer(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 slt i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 0, i32* %3
br label %25
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = call i64 @stat(i8* %13, %struct.stat* %7)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 1, i32* %3
br label %25
17: ; preds = %12
%18 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%19 = load i64, i64* %18
%20 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%21 = load i64, i64* %20
%22 = icmp slt i64 %19, %21
br i1 %22, label %23, label %24
23: ; preds = %17
store i32 0, i32* %3
br label %25
24: ; preds = %17
store i32 1, i32* %3
br label %25
25: ; preds = %24, %23, %16, %11
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i32 @newer(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 slt i64 %7, 0
br i1 %8, label %19, label %9
9: ; preds = %2
%10 = call i64 @stat(i8* %1, %struct.stat* %4)
%11 = icmp slt i64 %10, 0
br i1 %11, label %19, label %12
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 sge i64 %14, %16
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %12, %9, %2
%20 = phi i32 [ 0, %2 ], [ 1, %9 ], [ %18, %12 ]
ret i32 %20
}