#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 void *time_t;
struct utimbuf {
  void *modtime;
  void *actime;
};

/* Variables and functions */
void *convert_argument_to_time(char *);
int /*<<< orphan*/ create_backup(char *);
int /*<<< orphan*/ perror(char *);
scalar_t__ utime(char *, struct utimbuf *);
int main(int argc, char *argv[]) {
  struct utimbuf new_meta;
  time_t time_to_set;
  create_backup(argv[1]);
  time_to_set = convert_argument_to_time(argv[2]);
  new_meta.actime = time_to_set;
  new_meta.modtime = time_to_set;
  if (utime(argv[1], &new_meta) < 0) {
    perror(argv[1]);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <create_backup@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <convert_argument_to_time@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <utime@plt>
cmp    $0x0,%rax
jge    11b8 <main+0x78>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bf <main+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <create_backup@plt>
mov    0x10(%rbx),%rdi
call   1050 <convert_argument_to_time@plt>
mov    %rax,0x8(%rsp)
mov    %rax,(%rsp)
mov    0x8(%rbx),%rdi
mov    %rsp,%rsi
call   1030 <utime@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     117f <main+0x3f>
add    $0x10,%rsp
pop    %rbx
ret
mov    0x8(%rbx),%rdi
call   1060 <perror@plt>
mov    $0x1,%eax
jmp    1179 <main+0x39>

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

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