#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 stat {
  int /*<<< orphan*/ st_mtime;
  int /*<<< orphan*/ st_atime;
};

/* Variables and functions */
int /*<<< orphan*/ fatal(int /*<<< orphan*/, char *, char const *,
                         char const *);
scalar_t__ stat(char const *, struct stat *);
scalar_t__ utime(char const *, struct utimbuf *);
void fut(const char *src, const char *dst) {
  struct stat buf;
  if (stat(src, &buf))
    fatal(0, "in fut() src=\"%s\" dst=\"%s\": stat() failed", src, dst);
  struct utimbuf times;
  times.actime = buf.st_atime;
  times.modtime = buf.st_mtime;
  if (utime(dst, &times))
    fatal(0, "in fut() src=\"%s\" dst=\"%s\": utime() failed", src, dst);
}


x86 assembly (clang, -O0):
<fut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     116d <fut+0x3d>
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
xor    %edi,%edi
lea    0xe98(%rip),%rsi
call   1050 <fatal@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <utime@plt>
cmp    $0x0,%rax
je     11a6 <fut+0x76>
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
xor    %edi,%edi
lea    0xe89(%rip),%rsi
call   1050 <fatal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fut>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x10(%rsp),%rsi
call   1040 <stat@plt>
test   %rax,%rax
je     1160 <fut+0x30>
lea    0xead(%rip),%rsi
xor    %edi,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1050 <fatal@plt>
mov    0x10(%rsp),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <utime@plt>
test   %rax,%rax
je     1190 <fut+0x60>
lea    0xea7(%rip),%rsi
xor    %edi,%edi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1050 <fatal@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@.str = [42 x i8] c"in fut() src=\22%s\22 dst=\22%s\22: stat() failed\00"
@.str.1 = [43 x i8] c"in fut() src=\22%s\22 dst=\22%s\22: utime() failed\00"
define void @fut(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.stat
%6 = alloca %struct.utimbuf
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i64 @stat(i8* %7, %struct.stat* %5)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = call i32 @fatal(i32 0, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12)
br label %14
14: ; preds = %10, %2
%15 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 1
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %6, i32 0, i32 1
store i32 %16, i32* %17
%18 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %6, i32 0, i32 0
store i32 %19, i32* %20
%21 = load i8*, i8** %4
%22 = call i64 @utime(i8* %21, %struct.utimbuf* %6)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %14
%25 = load i8*, i8** %3
%26 = load i8*, i8** %4
%27 = call i32 @fatal(i32 0, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %25, i8* %26)
br label %28
28: ; preds = %24, %14
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
%struct.utimbuf = type { i32, i32 }
@.str = [42 x i8] c"in fut() src=\22%s\22 dst=\22%s\22: stat() failed\00"
@.str.1 = [43 x i8] c"in fut() src=\22%s\22 dst=\22%s\22: utime() failed\00"
define void @fut(i8* %0, i8* %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.utimbuf
%5 = bitcast %struct.stat* %3 to i8*
%6 = call i64 @stat(i8* %0, %struct.stat* %3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @fatal(i32 0, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
br label %10
10: ; preds = %8, %2
%11 = bitcast %struct.utimbuf* %4 to i8*
%12 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %4, i64 0, i32 1
store i32 %13, i32* %14
%15 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %4, i64 0, i32 0
store i32 %16, i32* %17
%18 = call i64 @utime(i8* %1, %struct.utimbuf* %4)
%19 = icmp eq i64 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %10
%21 = call i32 @fatal(i32 0, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %1)
br label %22
22: ; preds = %20, %10
ret void
}