#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 {
  scalar_t__ tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int utimes(char const *, struct timeval *);
int utime(const char *filename, const struct utimbuf *buf) {
  struct timeval tvp[2];
  tvp[0].tv_sec = buf->actime;
  tvp[0].tv_usec = 0;
  tvp[1].tv_sec = buf->modtime;
  tvp[1].tv_usec = 0;
  return utimes(filename, tvp);
}


x86 assembly (clang, -O0):
<utime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <utimes@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utime>:
sub    $0x28,%rsp
mov    0x4(%rsi),%eax
mov    %eax,0x8(%rsp)
movq   $0x0,(%rsp)
mov    (%rsi),%eax
mov    %eax,0x18(%rsp)
movq   $0x0,0x10(%rsp)
mov    %rsp,%rsi
call   1030 <utimes@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.utimbuf = type { i32, i32 }
%struct.timeval = type { i64, i32 }
define i32 @utime(i8* %0, %struct.utimbuf* %1) {
%3 = alloca i8*
%4 = alloca %struct.utimbuf*
%5 = alloca [2 x %struct.timeval]
store i8* %0, i8** %3
store %struct.utimbuf* %1, %struct.utimbuf** %4
%6 = load %struct.utimbuf*, %struct.utimbuf** %4
%7 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %6, i32 0, i32 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 0
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 1
store i32 %8, i32* %10
%11 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 0
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
store i64 0, i64* %12
%13 = load %struct.utimbuf*, %struct.utimbuf** %4
%14 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 1
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 1
store i32 %15, i32* %17
%18 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 1
%19 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 0
store i64 0, i64* %19
%20 = load i8*, i8** %3
%21 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 0
%22 = call i32 @utimes(i8* %20, %struct.timeval* %21)
ret i32 %22
}

LLVM IR (-O2):
%struct.utimbuf = type { i32, i32 }
%struct.timeval = type { i64, i32 }
define i32 @utime(i8* nocapture %0, %struct.utimbuf* nocapture %1) {
%3 = alloca [2 x %struct.timeval]
%4 = bitcast [2 x %struct.timeval]* %3 to i8*
%5 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %1, i64 0, i32 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %3, i64 0, i64 0
%8 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %3, i64 0, i64 0, i32 1
store i32 %6, i32* %8
%9 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %3, i64 0, i64 0, i32 0
store i64 0, i64* %9
%10 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %1, i64 0, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %3, i64 0, i64 1, i32 1
store i32 %11, i32* %12
%13 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %3, i64 0, i64 1, i32 0
store i64 0, i64* %13
%14 = call i32 @utimes(i8* %0, %struct.timeval* %7)
ret i32 %14
}