#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 {
  scalar_t__ modtime;
  scalar_t__ actime;
};
struct timeval {
  int tv_usec;
  scalar_t__ 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;
    buf.actime = tvp[0].tv_sec + tvp[0].tv_usec / 1000000;
    buf.modtime = tvp[1].tv_sec + tvp[1].tv_usec / 1000000;
  } else
    times = NULL;
  return utime(file, times);
}


x86 assembly (clang, -O0):
<__utimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118d <__utimes+0x7d>
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    1195 <__utimes+0x85>
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <utime@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__utimes>:
sub    $0x18,%rsp
test   %rsi,%rsi
je     1165 <__utimes+0x55>
movslq (%rsi),%rax
imul   $0x431bde83,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rax
add    %ecx,%eax
cltq
add    0x8(%rsi),%rax
mov    %rax,0x10(%rsp)
movslq 0x10(%rsi),%rax
imul   $0x431bde83,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rax
add    %ecx,%eax
cltq
add    0x18(%rsi),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
jmp    1167 <__utimes+0x57>
xor    %esi,%esi
call   1030 <utime@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
%struct.utimbuf = type { i64, i64 }
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 %34
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 1
%13 = load i64, i64* %12
%14 = load %struct.timeval*, %struct.timeval** %4
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i64 0
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %15, i32 0, i32 0
%17 = load i32, i32* %16
%18 = sdiv i32 %17, 1000000
%19 = sext i32 %18 to i64
%20 = add nsw i64 %13, %19
%21 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 1
store i64 %20, i64* %21
%22 = load %struct.timeval*, %struct.timeval** %4
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %22, i64 1
%24 = getelementptr inbounds %struct.timeval, %struct.timeval* %23, i32 0, i32 1
%25 = load i64, i64* %24
%26 = load %struct.timeval*, %struct.timeval** %4
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %26, i64 1
%28 = getelementptr inbounds %struct.timeval, %struct.timeval* %27, i32 0, i32 0
%29 = load i32, i32* %28
%30 = sdiv i32 %29, 1000000
%31 = sext i32 %30 to i64
%32 = add nsw i64 %25, %31
%33 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %5, i32 0, i32 0
store i64 %32, i64* %33
br label %35
34: ; preds = %2
store %struct.utimbuf* null, %struct.utimbuf** %6
br label %35
35: ; preds = %34, %9
%36 = load i8*, i8** %3
%37 = load %struct.utimbuf*, %struct.utimbuf** %6
%38 = call i32 @utime(i8* %36, %struct.utimbuf* %37)
ret i32 %38
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
%struct.utimbuf = type { i64, i64 }
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 %23, label %6
6: ; preds = %2
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i64, i64* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000000
%12 = sext i32 %11 to i64
%13 = add nsw i64 %8, %12
%14 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i64 0, i32 1
store i64 %13, i64* %14
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 1, i32 1
%16 = load i64, i64* %15
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 1, i32 0
%18 = load i32, i32* %17
%19 = sdiv i32 %18, 1000000
%20 = sext i32 %19 to i64
%21 = add nsw i64 %16, %20
%22 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i64 0, i32 0
store i64 %21, i64* %22
br label %23
23: ; preds = %2, %6
%24 = phi %struct.utimbuf* [ %3, %6 ], [ null, %2 ]
%25 = call i32 @utime(i8* %0, %struct.utimbuf* %24)
ret i32 %25
}