#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 utimbuf {
  int /*<<< orphan*/ modtime;
  int /*<<< orphan*/ actime;
};
struct timeval {
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
scalar_t__ utime(char const *, struct utimbuf *);
void set_utimes(const char *filename, int fd, const struct timeval times[2]) {
  struct utimbuf ut;
  ut.actime = times[0].tv_sec;
  ut.modtime = times[1].tv_sec;
  if (utime(filename, &ut) < 0)
    perror("utime");
}


x86 assembly (clang, -O0):
<set_utimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <utime@plt>
cmp    $0x0,%rax
jge    1169 <set_utimes+0x49>
lea    0xe9c(%rip),%rdi
call   1040 <perror@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_utimes>:
push   %rax
mov    (%rdx),%eax
mov    %eax,0x4(%rsp)
mov    0x4(%rdx),%eax
mov    %eax,(%rsp)
mov    %rsp,%rsi
call   1030 <utime@plt>
test   %rax,%rax
js     113c <set_utimes+0x1c>
pop    %rax
ret
lea    0xebd(%rip),%rdi
pop    %rax
jmp    1040 <perror@plt>

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

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