#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 timeval {
  int tv_usec;
  int /*<<< orphan*/ tv_sec;
};
struct timespec {
  int tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int /*<<< orphan*/ AT_SYMLINK_NOFOLLOW;
int utimensat(int /*<<< orphan*/, char const *, struct timespec *,
              int /*<<< orphan*/);
int lutimes(const char *filename, const struct timeval tv[2]) {
  struct timespec times[2];
  times[0].tv_sec = tv[0].tv_sec;
  times[0].tv_nsec = tv[0].tv_usec * 1000;
  times[1].tv_sec = tv[1].tv_sec;
  times[1].tv_nsec = tv[1].tv_usec * 1000;
  return utimensat(AT_FDCWD, filename, times, AT_SYMLINK_NOFOLLOW);
}


x86 assembly (clang, -O0):
<lutimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
imul   $0x3e8,(%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
imul   $0x3e8,0x8(%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
lea    -0x20(%rbp),%rdx
mov    0x2e79(%rip),%rax
mov    (%rax),%ecx
call   1030 <utimensat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lutimes>:
sub    $0x18,%rsp
mov    %rdi,%rax
mov    0x4(%rsi),%ecx
mov    %ecx,0x4(%rsp)
imul   $0x3e8,(%rsi),%ecx
mov    %ecx,(%rsp)
mov    0xc(%rsi),%ecx
mov    %ecx,0xc(%rsp)
imul   $0x3e8,0x8(%rsi),%ecx
mov    %ecx,0x8(%rsp)
mov    0x2e90(%rip),%rcx
mov    (%rcx),%edi
mov    0x2e97(%rip),%rcx
mov    (%rcx),%ecx
mov    %rsp,%rdx
mov    %rax,%rsi
call   1030 <utimensat@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.timespec = type { i32, i32 }
@AT_FDCWD = global i32 0
@AT_SYMLINK_NOFOLLOW = global i32 0
define i32 @lutimes(i8* %0, %struct.timeval* %1) {
%3 = alloca i8*
%4 = alloca %struct.timeval*
%5 = alloca [2 x %struct.timespec]
store i8* %0, i8** %3
store %struct.timeval* %1, %struct.timeval** %4
%6 = load %struct.timeval*, %struct.timeval** %4
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %5, i64 0, i64 0
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 1
store i32 %9, i32* %11
%12 = load %struct.timeval*, %struct.timeval** %4
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i64 0
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = mul nsw i32 %15, 1000
%17 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %5, i64 0, i64 0
%18 = getelementptr inbounds %struct.timespec, %struct.timespec* %17, i32 0, i32 0
store i32 %16, i32* %18
%19 = load %struct.timeval*, %struct.timeval** %4
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %19, i64 1
%21 = getelementptr inbounds %struct.timeval, %struct.timeval* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %5, i64 0, i64 1
%24 = getelementptr inbounds %struct.timespec, %struct.timespec* %23, i32 0, i32 1
store i32 %22, i32* %24
%25 = load %struct.timeval*, %struct.timeval** %4
%26 = getelementptr inbounds %struct.timeval, %struct.timeval* %25, i64 1
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = mul nsw i32 %28, 1000
%30 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %5, i64 0, i64 1
%31 = getelementptr inbounds %struct.timespec, %struct.timespec* %30, i32 0, i32 0
store i32 %29, i32* %31
%32 = load i32, i32* @AT_FDCWD
%33 = load i8*, i8** %3
%34 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %5, i64 0, i64 0
%35 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%36 = call i32 @utimensat(i32 %32, i8* %33, %struct.timespec* %34, i32 %35)
ret i32 %36
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.timespec = type { i32, i32 }
@AT_FDCWD = global i32 0
@AT_SYMLINK_NOFOLLOW = global i32 0
define i32 @lutimes(i8* %0, %struct.timeval* nocapture %1) {
%3 = alloca [2 x %struct.timespec]
%4 = bitcast [2 x %struct.timespec]* %3 to i8*
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%6 = load i32, i32* %5
%7 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %3, i64 0, i64 0
%8 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %3, i64 0, i64 0, i32 1
store i32 %6, i32* %8
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 1000
%12 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %3, i64 0, i64 0, i32 0
store i32 %11, i32* %12
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 1, i32 1
%14 = load i32, i32* %13
%15 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %3, i64 0, i64 1, i32 1
store i32 %14, i32* %15
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 1, i32 0
%17 = load i32, i32* %16
%18 = mul nsw i32 %17, 1000
%19 = getelementptr inbounds [2 x %struct.timespec], [2 x %struct.timespec]* %3, i64 0, i64 1, i32 0
store i32 %18, i32* %19
%20 = load i32, i32* @AT_FDCWD
%21 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%22 = call i32 @utimensat(i32 %20, i8* %0, %struct.timespec* %7, i32 %21)
ret i32 %22
}