#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*/ EFAULT;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __utime(char const *, struct utimbuf *);
int __utimes(const char *filename, struct timeval tvp[2]) {
  struct utimbuf utimbuf;
  if (filename == NULL) {
    __set_errno(EFAULT);
    return -1;
  }
  if (tvp == NULL)
    return __utime(filename, NULL);
  utimbuf.actime = tvp[0].tv_sec;
  utimbuf.modtime = tvp[1].tv_sec;
  return __utime(filename, &utimbuf);
}


x86 assembly (clang, -O0):
<__utimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1155 <__utimes+0x35>
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1198 <__utimes+0x78>
cmpq   $0x0,-0x18(%rbp)
jne    1175 <__utimes+0x55>
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <__utime@plt>
mov    %eax,-0x4(%rbp)
jmp    1198 <__utimes+0x78>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <__utime@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__utimes>:
push   %rax
test   %rdi,%rdi
je     1141 <__utimes+0x21>
test   %rsi,%rsi
je     1156 <__utimes+0x36>
mov    (%rsi),%eax
mov    %eax,0x4(%rsp)
mov    0x4(%rsi),%eax
mov    %eax,(%rsp)
mov    %rsp,%rsi
call   1040 <__utime@plt>
pop    %rcx
ret
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
xor    %esi,%esi
pop    %rax
jmp    1040 <__utime@plt>

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

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.utimbuf = type { i32, i32 }
@EFAULT = global i32 0
define i32 @__utimes(i8* %0, %struct.timeval* %1) {
%3 = alloca %struct.utimbuf
%4 = bitcast %struct.utimbuf* %3 to i8*
%5 = icmp eq i8* %0, null
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* @EFAULT
%8 = tail call i32 @__set_errno(i32 %7)
br label %21
9: ; preds = %2
%10 = icmp eq %struct.timeval* %1, null
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 @__utime(i8* %0, %struct.utimbuf* null)
br label %21
13: ; preds = %9
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i64 0, i32 1
store i32 %15, i32* %16
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 1, i32 0
%18 = load i32, i32* %17
%19 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %3, i64 0, i32 0
store i32 %18, i32* %19
%20 = call i32 @__utime(i8* %0, %struct.utimbuf* %3)
br label %21
21: ; preds = %13, %11, %6
%22 = phi i32 [ -1, %6 ], [ %12, %11 ], [ %20, %13 ]
ret i32 %22
}