#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 timespec {
  int dummy;
};
struct stat {
  struct timespec st_mtim;
  struct timespec st_atim;
};

/* Variables and functions */
int /*<<< orphan*/ err(int, char *, char const *);
scalar_t__ stat(char const *, struct stat *);
void stime_file(const char *fname, struct timespec *tsp) {
  struct stat sb;
  if (stat(fname, &sb))
    err(1, "%s", fname);
  tsp[0] = sb.st_atim;
  tsp[1] = sb.st_mtim;
}


x86 assembly (clang, -O0):
<stime_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     115c <stime_file+0x3c>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xea9(%rip),%rsi
call   1040 <err@plt>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,0x4(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stime_file>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rsi
call   1030 <stat@plt>
test   %rax,%rax
je     114b <stime_file+0x2b>
lea    0xec2(%rip),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
call   1040 <err@plt>
mov    0x4(%rsp),%eax
mov    %eax,(%r14)
mov    (%rsp),%eax
mov    %eax,0x4(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
%struct.stat = type { %struct.timespec, %struct.timespec }
@.str = [3 x i8] c"%s\00"
define void @stime_file(i8* %0, %struct.timespec* %1) {
%3 = alloca i8*
%4 = alloca %struct.timespec*
%5 = alloca %struct.stat
store i8* %0, i8** %3
store %struct.timespec* %1, %struct.timespec** %4
%6 = load i8*, i8** %3
%7 = call i64 @stat(i8* %6, %struct.stat* %5)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %2
%13 = load %struct.timespec*, %struct.timespec** %4
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i64 0
%15 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 1
%16 = bitcast %struct.timespec* %14 to i8*
%17 = bitcast %struct.timespec* %15 to i8*
%18 = load %struct.timespec*, %struct.timespec** %4
%19 = getelementptr inbounds %struct.timespec, %struct.timespec* %18, i64 1
%20 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%21 = bitcast %struct.timespec* %19 to i8*
%22 = bitcast %struct.timespec* %20 to i8*
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
%struct.stat = type { %struct.timespec, %struct.timespec }
@.str = [3 x i8] c"%s\00"
define void @stime_file(i8* %0, %struct.timespec* nocapture writeonly %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = call i64 @stat(i8* %0, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %9
9: ; preds = %7, %2
%10 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1, i32 0
%11 = getelementptr %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%12 = load i32, i32* %10
store i32 %12, i32* %11
%13 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0, i32 0
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 1, i32 0
%15 = load i32, i32* %13
store i32 %15, i32* %14
ret void
}