#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 utime(char const *, struct utimbuf *);
int utimes(const char *file, const struct timeval tvp[2]) {
  struct utimbuf buf, *times;
  if (tvp) {
    times = &buf;
    times->actime = tvp[0].tv_sec;
    times->modtime = tvp[1].tv_sec;
  } else {
    times = NULL;
  }
  return utime(file, times);
}


x86 assembly (clang, -O0):
<utimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1152 <utimes+0x42>
lea    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    115a <utimes+0x4a>
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <utime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utimes>:
push   %rax
test   %rsi,%rsi
je     1127 <utimes+0x17>
mov    (%rsi),%eax
mov    %eax,0x4(%rsp)
mov    0x4(%rsi),%eax
mov    %eax,(%rsp)
mov    %rsp,%rsi
jmp    1129 <utimes+0x19>
xor    %esi,%esi
call   1030 <utime@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.utimbuf = type { i32, i32 }
define i32 @utimes(i8* %0, %struct.timeval* %1) {
%3 = alloca i8*
%4 = alloca %struct.timeval*
%5 = alloca %struct.utimbuf
%6 = alloca %struct.utimbuf*
store i8* %0, i8** %3
store %struct.timeval* %1, %struct.timeval** %4
%7 = load %struct.timeval*, %struct.timeval** %4
%8 = icmp ne %struct.timeval* %7, null
br i1 %8, label %9, label %22
9: ; preds = %2
store %struct.utimbuf* %5, %struct.utimbuf** %6
%10 = load %struct.timeval*, %struct.timeval** %4
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i64 0
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = load %struct.utimbuf*, %struct.utimbuf** %6
%15 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %14, i32 0, i32 1
store i32 %13, i32* %15
%16 = load %struct.timeval*, %struct.timeval** %4
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i64 1
%18 = getelementptr inbounds %struct.timeval, %struct.timeval* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = load %struct.utimbuf*, %struct.utimbuf** %6
%21 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %20, i32 0, i32 0
store i32 %19, i32* %21
br label %23
22: ; preds = %2
store %struct.utimbuf* null, %struct.utimbuf** %6
br label %23
23: ; preds = %22, %9
%24 = load i8*, i8** %3
%25 = load %struct.utimbuf*, %struct.utimbuf** %6
%26 = call i32 @utime(i8* %24, %struct.utimbuf* %25)
ret i32 %26
}

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