#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 int /*<<< orphan*/ time_t;
struct utimbuf {
  int /*<<< orphan*/ modtime;
  int /*<<< orphan*/ actime;
};
struct stat {
  int /*<<< orphan*/ st_atime;
};

/* Variables and functions */
int stat(char *, struct stat *);
int /*<<< orphan*/ utime(char *, struct utimbuf *);
void reset_mod_time(char *filename, time_t mtime) {
  struct stat stb;
  struct utimbuf utb;
  if (stat(filename, &stb) == -1)
    return;
  utb.actime = stb.st_atime;
  utb.modtime = mtime;
  (void)utime(filename, &utb);
}


x86 assembly (clang, -O0):
<reset_mod_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
jne    114a <reset_mod_time+0x2a>
jmp    1163 <reset_mod_time+0x43>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <utime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_mod_time>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
je     1153 <reset_mod_time+0x33>
mov    0x8(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    %ebp,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <utime@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.utimbuf = type { i32, i32 }
define void @reset_mod_time(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.stat
%6 = alloca %struct.utimbuf
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @stat(i8* %7, %struct.stat* %5)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %2
br label %19
11: ; preds = %2
%12 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %6, i32 0, i32 1
store i32 %13, i32* %14
%15 = load i32, i32* %4
%16 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %6, i32 0, i32 0
store i32 %15, i32* %16
%17 = load i8*, i8** %3
%18 = call i32 @utime(i8* %17, %struct.utimbuf* %6)
br label %19
19: ; preds = %11, %10
ret void
}

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