#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 */

/* Variables and functions */
int /*<<< orphan*/ execv(char *, char **);
int /*<<< orphan*/ lockAllFiles(char *);
int /*<<< orphan*/ logInfoMessage(char *);
int /*<<< orphan*/ strcat(char *, char *);
char *string_date(char *);
int /*<<< orphan*/ unlockAllFiles(char *);
void backup_folder(char *sourceFile, char *targetFile) {
  lockAllFiles(sourceFile);
  char date[50];
  char *time_buff = string_date(date);
  strcat(targetFile, time_buff);
  char *args[] = {"cp", "-R", sourceFile, targetFile, NULL};
  execv("/bin/cp", args);
  logInfoMessage("backup completed");
  unlockAllFiles(sourceFile);
}


x86 assembly (clang, -O0):
<backup_folder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <lockAllFiles@plt>
lea    -0x50(%rbp),%rdi
call   1050 <string_date@plt>
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1060 <strcat@plt>
lea    0xe6b(%rip),%rax
mov    %rax,-0x80(%rbp)
lea    0xe58(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
movq   $0x0,-0x60(%rbp)
lea    -0x80(%rbp),%rsi
lea    0xe34(%rip),%rdi
call   1080 <execv@plt>
lea    0xe30(%rip),%rdi
call   1040 <logInfoMessage@plt>
mov    -0x8(%rbp),%rdi
call   1070 <unlockAllFiles@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backup_folder>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <lockAllFiles@plt>
lea    0x30(%rsp),%rdi
call   1050 <string_date@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1060 <strcat@plt>
lea    0xe7a(%rip),%rax
mov    %rax,(%rsp)
lea    0xe67(%rip),%rax
mov    %rax,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r14,0x18(%rsp)
movq   $0x0,0x20(%rsp)
lea    0xe4b(%rip),%rdi
mov    %rsp,%rsi
call   1080 <execv@plt>
lea    0xe44(%rip),%rdi
call   1040 <logInfoMessage@plt>
mov    %rbx,%rdi
call   1070 <unlockAllFiles@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"cp\00"
@.str.1 = [3 x i8] c"-R\00"
@.str.2 = [8 x i8] c"/bin/cp\00"
@.str.3 = [17 x i8] c"backup completed\00"
define void @backup_folder(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [50 x i8]
%6 = alloca i8*
%7 = alloca [5 x i8*]
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = call i32 @lockAllFiles(i8* %8)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%11 = call i8* @string_date(i8* %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %4
%13 = load i8*, i8** %6
%14 = call i32 @strcat(i8* %12, i8* %13)
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i64 0, i64 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %15
%16 = getelementptr inbounds i8*, i8** %15, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %16
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %3
store i8* %18, i8** %17
%19 = getelementptr inbounds i8*, i8** %17, i64 1
%20 = load i8*, i8** %4
store i8* %20, i8** %19
%21 = getelementptr inbounds i8*, i8** %19, i64 1
store i8* null, i8** %21
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %7, i64 0, i64 0
%23 = call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %22)
%24 = call i32 @logInfoMessage(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%25 = load i8*, i8** %3
%26 = call i32 @unlockAllFiles(i8* %25)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"cp\00"
@.str.1 = [3 x i8] c"-R\00"
@.str.2 = [8 x i8] c"/bin/cp\00"
@.str.3 = [17 x i8] c"backup completed\00"
define void @backup_folder(i8* %0, i8* %1) {
%3 = alloca [50 x i8]
%4 = alloca [5 x i8*]
%5 = tail call i32 @lockAllFiles(i8* %0)
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = call i8* @string_date(i8* %6)
%8 = call i32 @strcat(i8* %1, i8* %7)
%9 = bitcast [5 x i8*]* %4 to i8*
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 2
store i8* %0, i8** %12
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 3
store i8* %1, i8** %13
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 4
store i8* null, i8** %14
%15 = call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %10)
%16 = call i32 @logInfoMessage(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @unlockAllFiles(i8* %0)
ret void
}