#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 */
typedef struct utimbuf {
  int /*<<< orphan*/ modtime;
  int /*<<< orphan*/ actime;
} const utimbuf;
struct timeval {
  scalar_t__ tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ _DIAGASSERT(int /*<<< orphan*/);
int utimes(char const *, struct timeval *);
int utime(const char *path, const struct utimbuf *times) {
  struct timeval tv[2], *tvp;
  _DIAGASSERT(path != NULL);
  if (times == (struct utimbuf *)NULL)
    tvp = NULL;
  else {
    tv[0].tv_sec = times->actime;
    tv[1].tv_sec = times->modtime;
    tv[0].tv_usec = tv[1].tv_usec = 0;
    tvp = tv;
  }
  return (utimes(path, tvp));
}


x86 assembly (clang, -O0):
<utime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <_DIAGASSERT@plt>
cmpq   $0x0,-0x10(%rbp)
jne    115a <utime+0x3a>
movq   $0x0,-0x38(%rbp)
jmp    1185 <utime+0x65>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x30(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1030 <utimes@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utime>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <_DIAGASSERT@plt>
test   %rbx,%rbx
je     1163 <utime+0x43>
mov    0x4(%rbx),%eax
mov    %rsp,%rsi
mov    %eax,0x8(%rsp)
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,(%rsp)
jmp    1165 <utime+0x45>
xor    %esi,%esi
mov    %r14,%rdi
call   1030 <utimes@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
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]
%6 = alloca %struct.timeval*
store i8* %0, i8** %3
store %struct.utimbuf* %1, %struct.utimbuf** %4
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @_DIAGASSERT(i32 %9)
%11 = load %struct.utimbuf*, %struct.utimbuf** %4
%12 = icmp eq %struct.utimbuf* %11, null
br i1 %12, label %13, label %14
13: ; preds = %2
store %struct.timeval* null, %struct.timeval** %6
br label %30
14: ; preds = %2
%15 = load %struct.utimbuf*, %struct.utimbuf** %4
%16 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 0
%19 = getelementptr inbounds %struct.timeval, %struct.timeval* %18, i32 0, i32 1
store i32 %17, i32* %19
%20 = load %struct.utimbuf*, %struct.utimbuf** %4
%21 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %20, i32 0, i32 0
%22 = load i32, i32* %21
%23 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 1
%24 = getelementptr inbounds %struct.timeval, %struct.timeval* %23, i32 0, i32 1
store i32 %22, i32* %24
%25 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 1
%26 = getelementptr inbounds %struct.timeval, %struct.timeval* %25, i32 0, i32 0
store i64 0, i64* %26
%27 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 0
%28 = getelementptr inbounds %struct.timeval, %struct.timeval* %27, i32 0, i32 0
store i64 0, i64* %28
%29 = getelementptr inbounds [2 x %struct.timeval], [2 x %struct.timeval]* %5, i64 0, i64 0
store %struct.timeval* %29, %struct.timeval** %6
br label %30
30: ; preds = %14, %13
%31 = load i8*, i8** %3
%32 = load %struct.timeval*, %struct.timeval** %6
%33 = call i32 @utimes(i8* %31, %struct.timeval* %32)
ret i32 %33
}

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