#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 */
int /*<<< orphan*/ perror(char *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int file_compare1(char *path, char *filename1, char *filename2) {
  struct stat st1;
  struct stat st2;
  char file1[100];
  strcpy(file1, path);
  strcat(file1, filename1);
  char file2[100];
  strcpy(file2, path);
  strcat(file2, filename2);
  if (stat(file1, &st1) != 0)
    perror(file1);
  if (stat(file2, &st2) != 0)
    perror(file2);
  return st1.st_ctime >= st2.st_ctime ? 1 : -1;
}


x86 assembly (clang, -O0):
<file_compare1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x100(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x100(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <strcat@plt>
lea    -0x90(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     11bd <file_compare1+0x7d>
lea    -0x90(%rbp),%rdi
call   1050 <perror@plt>
lea    -0x100(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     11e3 <file_compare1+0xa3>
lea    -0x100(%rbp),%rdi
call   1050 <perror@plt>
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    %rsi,%rdx
cmovge %ecx,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_compare1>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x80(%rsp),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1060 <strcat@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
lea    0x8(%rsp),%rsi
mov    %r12,%rdi
call   1040 <stat@plt>
test   %rax,%rax
jne    11d7 <file_compare1+0x97>
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %rax,%rax
jne    11e6 <file_compare1+0xa6>
mov    0x8(%rsp),%rax
xor    %ecx,%ecx
cmp    (%rsp),%rax
setge  %cl
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0x80(%rsp),%rdi
call   1050 <perror@plt>
jmp    11a2 <file_compare1+0x62>
lea    0x10(%rsp),%rdi
call   1050 <perror@plt>
jmp    11b4 <file_compare1+0x74>

LLVM IR (-O0):
%struct.stat = type { i64 }
define i32 @file_compare1(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.stat
%8 = alloca %struct.stat
%9 = alloca [100 x i8]
%10 = alloca [100 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %5
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%18 = load i8*, i8** %4
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%21 = load i8*, i8** %6
%22 = call i32 @strcat(i8* %20, i8* %21)
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%24 = call i64 @stat(i8* %23, %struct.stat* %7)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %3
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%28 = call i32 @perror(i8* %27)
br label %29
29: ; preds = %26, %3
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%31 = call i64 @stat(i8* %30, %struct.stat* %8)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%35 = call i32 @perror(i8* %34)
br label %36
36: ; preds = %33, %29
%37 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%38 = load i64, i64* %37
%39 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%40 = load i64, i64* %39
%41 = icmp sge i64 %38, %40
%42 = zext i1 %41 to i64
%43 = select i1 %41, i32 1, i32 -1
ret i32 %43
}

LLVM IR (-O2):
%struct.stat = type { i64 }
define i32 @file_compare1(i8* %0, i8* %1, i8* %2) {
%4 = alloca %struct.stat
%5 = alloca %struct.stat
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = bitcast %struct.stat* %4 to i8*
%9 = bitcast %struct.stat* %5 to i8*
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* %0)
%12 = call i32 @strcat(i8* %10, i8* %1)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%14 = call i32 @strcpy(i8* %13, i8* %0)
%15 = call i32 @strcat(i8* %13, i8* %2)
%16 = call i64 @stat(i8* %10, %struct.stat* %4)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %3
%19 = call i32 @perror(i8* %10)
br label %20
20: ; preds = %18, %3
%21 = call i64 @stat(i8* %13, %struct.stat* %5)
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 @perror(i8* %13)
br label %25
25: ; preds = %23, %20
%26 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%27 = load i64, i64* %26
%28 = getelementptr inbounds %struct.stat, %struct.stat* %5, i64 0, i32 0
%29 = load i64, i64* %28
%30 = icmp slt i64 %27, %29
%31 = select i1 %30, i32 -1, i32 1
ret i32 %31
}