#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 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_compare2(char *path, char *filename, int cmpTime) {
  struct stat st;
  char file[100];
  strcpy(file, path);
  strcat(file, filename);
  if (stat(file, &st) != 0) {
    perror(file);
    return -1;
  }
  int changeTime = st.st_ctime;
  return changeTime >= cmpTime ? changeTime : -1;
}


x86 assembly (clang, -O0):
<file_compare2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%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     11a8 <file_compare2+0x68>
lea    -0x90(%rbp),%rdi
call   1050 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ea <file_compare2+0xaa>
mov    -0x20(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11d1 <file_compare2+0x91>
mov    -0x94(%rbp),%eax
mov    %eax,-0x98(%rbp)
jmp    11e1 <file_compare2+0xa1>
mov    $0xffffffff,%eax
mov    %eax,-0x98(%rbp)
jmp    11e1 <file_compare2+0xa1>
mov    -0x98(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_compare2>:
push   %rbp
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
lea    0x8(%rsp),%rsi
mov    %rbp,%rdi
call   1040 <stat@plt>
test   %rax,%rax
jne    1199 <file_compare2+0x59>
mov    0x8(%rsp),%ecx
cmp    %r14d,%ecx
mov    $0xffffffff,%eax
cmovge %ecx,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0x10(%rsp),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%eax
jmp    118d <file_compare2+0x4d>

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @file_compare2(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.stat
%9 = alloca [100 x i8]
%10 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%12 = load i8*, i8** %5
%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** %6
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%18 = call i64 @stat(i8* %17, %struct.stat* %8)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %3
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%22 = call i32 @perror(i8* %21)
store i32 -1, i32* %4
br label %34
23: ; preds = %3
%24 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%25 = load i32, i32* %24
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = load i32, i32* %7
%28 = icmp sge i32 %26, %27
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = load i32, i32* %10
br label %32
31: ; preds = %23
br label %32
32: ; preds = %31, %29
%33 = phi i32 [ %30, %29 ], [ -1, %31 ]
store i32 %33, i32* %4
br label %34
34: ; preds = %32, %20
%35 = load i32, i32* %4
ret i32 %35
}

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