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


x86 assembly (clang, -O0):
<file_modified_at>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%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     11a5 <file_modified_at+0x65>
lea    -0x90(%rbp),%rdi
call   1050 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ab <file_modified_at+0x6b>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_modified_at>:
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <strcat@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <stat@plt>
test   %rax,%rax
jne    1183 <file_modified_at+0x43>
mov    0x8(%rsp),%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret
lea    0x10(%rsp),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%eax
jmp    117b <file_modified_at+0x3b>

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

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