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

/* Variables and functions */
int lchmod(char const *, int /*<<< orphan*/);
int lstat(char const *, struct stat *);
int utime(char const *, struct utimbuf *);
int copydate(const char *pszToFile, const char *pszFromFile) {
  struct stat stFrom = {0};
  struct utimbuf utbTo = {0};
  int err;
  do {
  } while (0);
  err = lstat(pszFromFile, &stFrom);
  err = lchmod(pszToFile, stFrom.st_mode);
  utbTo.actime = stFrom.st_atime;
  utbTo.modtime = stFrom.st_mtime;
  err = utime(pszToFile, &utbTo);

  ;
  return err;
}


x86 assembly (clang, -O0):
<copydate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
jmp    1175 <copydate+0x35>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <lstat@plt>
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1040 <lchmod@plt>
mov    %eax,-0x34(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <utime@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copydate>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x18(%rsp)
mov    %rsp,%rsi
mov    %rax,%rdi
call   1050 <lstat@plt>
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1040 <lchmod@plt>
mov    (%rsp),%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <utime@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32, i32 }
%struct.utimbuf = type { i32, i32, i32 }
define i32 @copydate(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.stat
%6 = alloca %struct.utimbuf
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = bitcast %struct.stat* %5 to i8*
%9 = bitcast %struct.utimbuf* %6 to i8*
br label %10
10: ; preds = %2
br label %11
11: ; preds = %10
%12 = load i8*, i8** %4
%13 = call i32 @lstat(i8* %12, %struct.stat* %5)
store i32 %13, i32* %7
%14 = load i8*, i8** %3
%15 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 2
%16 = load i32, i32* %15
%17 = call i32 @lchmod(i8* %14, i32 %16)
store i32 %17, i32* %7
%18 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 1
%19 = load i32, i32* %18
%20 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %6, i32 0, i32 1
store i32 %19, i32* %20
%21 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %6, i32 0, i32 0
store i32 %22, i32* %23
%24 = load i8*, i8** %3
%25 = call i32 @utime(i8* %24, %struct.utimbuf* %6)
store i32 %25, i32* %7
%26 = load i32, i32* %7
ret i32 %26
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32 }
%struct.utimbuf = type { i32, i32, i32 }
define i32 @copydate(i8* %0, i8* nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.utimbuf
%5 = bitcast %struct.stat* %3 to i8*
%6 = bitcast %struct.utimbuf* %4 to i8*
%7 = getelementptr inbounds %struct.utimbuf, %struct.utimbuf* %4, i64 0, i32 2
store i32 0, i32* %7
%8 = call i32 @lstat(i8* %1, %struct.stat* %3)
%9 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 2
%10 = load i32, i32* %9
%11 = tail call i32 @lchmod(i8* %0, i32 %10)
%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 i32 @utime(i8* %0, %struct.utimbuf* %4)
ret i32 %18
}