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

/* Variables and functions */
int /*<<< orphan*/ execv(char *, char **);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ logErrorMessages(char *, char *);
int /*<<< orphan*/ logInfoMessages(char *, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ read_from_log(char *, char *, char *);
char *str_date_log(char *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strstr(char *, char *);
void push_modified_files(char *destintation, char *log_path) {
  FILE *fp;
  char buf[100];
  char log_file_name[50] = "/root/logs/";
  char log_date[50];
  char *log_date_buff = str_date_log(log_date);
  strcat(log_file_name, log_path);
  strcat(log_file_name, "/");
  strcat(log_file_name, log_date_buff);
  strcat(log_file_name, ".log");
  if ((fp = fopen(log_file_name, "r")) == NULL) {
    logErrorMessages("Failed to open config file", log_file_name);
  }
  while (!feof(fp)) {
    fgets(buf, 100, fp);
    if (strstr(buf, "MODIFIED")) {
      char file_name[50];
      char directory_path[50];
      char file_directory[100];
      memset(file_name, 0, 50);
      memset(directory_path, 0, 50);
      memset(file_directory, 0, 100);
      read_from_log(buf, file_name, directory_path);
      strcat(file_directory, directory_path);
      strcat(file_directory, file_name);
      logInfoMessages(file_directory, destintation);
      char *args[] = {"cp", "--parents", file_directory, destintation, NULL};
      execv("/bin/cp", args);
    }
  }
  fclose(fp);
}


x86 assembly (clang, -O0):
<push_modified_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0xc0(%rbp),%rdi
lea    0xe0f(%rip),%rsi
mov    $0x32,%edx
call   1080 <memcpy@plt>
lea    -0x100(%rbp),%rdi
call   1090 <str_date_log@plt>
mov    %rax,-0x108(%rbp)
lea    -0xc0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10c0 <strcat@plt>
lea    -0xc0(%rbp),%rdi
lea    0xe06(%rip),%rsi
call   10c0 <strcat@plt>
lea    -0xc0(%rbp),%rdi
mov    -0x108(%rbp),%rsi
call   10c0 <strcat@plt>
lea    -0xc0(%rbp),%rdi
lea    0xde2(%rip),%rsi
call   10c0 <strcat@plt>
lea    -0xc0(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    128b <push_modified_files+0xbb>
lea    -0xc0(%rbp),%rsi
lea    0xdb5(%rip),%rdi
call   10a0 <logErrorMessages@plt>
jmp    1290 <push_modified_files+0xc0>
mov    -0x18(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12ae <push_modified_files+0xde>
jmp    13b8 <push_modified_files+0x1e8>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x64,%esi
call   1060 <fgets@plt>
lea    -0x80(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     13b3 <push_modified_files+0x1e3>
lea    -0x140(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1050 <memset@plt>
lea    -0x180(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1050 <memset@plt>
lea    -0x1f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
lea    -0x80(%rbp),%rdi
lea    -0x140(%rbp),%rsi
lea    -0x180(%rbp),%rdx
call   10d0 <read_from_log@plt>
lea    -0x1f0(%rbp),%rdi
lea    -0x180(%rbp),%rsi
call   10c0 <strcat@plt>
lea    -0x1f0(%rbp),%rdi
lea    -0x140(%rbp),%rsi
call   10c0 <strcat@plt>
lea    -0x1f0(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <logInfoMessages@plt>
lea    0xd07(%rip),%rax
mov    %rax,-0x220(%rbp)
lea    0xcea(%rip),%rax
mov    %rax,-0x218(%rbp)
lea    -0x1f0(%rbp),%rax
mov    %rax,-0x210(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x208(%rbp)
movq   $0x0,-0x200(%rbp)
lea    -0x220(%rbp),%rsi
lea    0xcbb(%rip),%rdi
call   10e0 <execv@plt>
jmp    1290 <push_modified_files+0xc0>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<push_modified_files>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x208,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
movaps 0xe42(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xe26(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe0a(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movw   $0x0,0x60(%rsp)
lea    0xf0(%rsp),%rdi
call   1080 <str_date_log@plt>
mov    %rax,%rbp
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   10b0 <strcat@plt>
lea    0xe09(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcat@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10b0 <strcat@plt>
lea    0xdf1(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcat@plt>
lea    0xde7(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1273 <push_modified_files+0xb3>
lea    0xdd2(%rip),%rdi
lea    0x30(%rsp),%rsi
call   1090 <logErrorMessages@plt>
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     1299 <push_modified_files+0xd9>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x1a0(%rsp),%r15
lea    0xb0(%rsp),%r13
lea    0x70(%rsp),%rbp
lea    0x130(%rsp),%r12
jmp    12cc <push_modified_files+0x10c>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    127f <push_modified_files+0xbf>
mov    %r15,%rdi
mov    $0x64,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
mov    %r15,%rdi
lea    0xd70(%rip),%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     12c0 <push_modified_files+0x100>
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1050 <memset@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1050 <memset@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
call   10c0 <read_from_log@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   10b0 <strcat@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   10b0 <strcat@plt>
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <logInfoMessages@plt>
lea    0xd1b(%rip),%rax
mov    %rax,(%rsp)
lea    0xd01(%rip),%rax
mov    %rax,0x8(%rsp)
mov    %r12,0x10(%rsp)
mov    %r14,0x18(%rsp)
movq   $0x0,0x20(%rsp)
lea    0xcec(%rip),%rdi
mov    %rsp,%rsi
call   10d0 <execv@plt>
jmp    12c0 <push_modified_files+0x100>

LLVM IR (-O0):
@__const.push_modified_files.log_file_name = [50 x i8] c"/root/logs/\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"/\00"
@.str.1 = [5 x i8] c".log\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [27 x i8] c"Failed to open config file\00"
@.str.4 = [9 x i8] c"MODIFIED\00"
@.str.5 = [3 x i8] c"cp\00"
@.str.6 = [10 x i8] c"--parents\00"
@.str.7 = [8 x i8] c"/bin/cp\00"
define void @push_modified_files(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca [100 x i8]
%7 = alloca [50 x i8]
%8 = alloca [50 x i8]
%9 = alloca i8*
%10 = alloca [50 x i8]
%11 = alloca [50 x i8]
%12 = alloca [100 x i8]
%13 = alloca [5 x i8*]
store i8* %0, i8** %3
store i8* %1, i8** %4
%14 = bitcast [50 x i8]* %7 to i8*
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %8, i64 0, i64 0
%16 = call i8* @str_date_log(i8* %15)
store i8* %16, i8** %9
%17 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%18 = load i8*, i8** %4
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%21 = call i32 @strcat(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%22 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%23 = load i8*, i8** %9
%24 = call i32 @strcat(i8* %22, i8* %23)
%25 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%26 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%28 = call i32* @fopen(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %28, i32** %5
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %33
30: ; preds = %2
%31 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%32 = call i32 @logErrorMessages(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %30, %2
br label %34
34: ; preds = %75, %33
%35 = load i32*, i32** %5
%36 = call i32 @feof(i32* %35)
%37 = icmp ne i32 %36, 0
%38 = xor i1 %37, true
br i1 %38, label %39, label %76
39: ; preds = %34
%40 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%41 = load i32*, i32** %5
%42 = call i32 @fgets(i8* %40, i32 100, i32* %41)
%43 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%44 = call i64 @strstr(i8* %43, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %75
46: ; preds = %39
%47 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%48 = call i32 @memset(i8* %47, i32 0, i32 50)
%49 = getelementptr inbounds [50 x i8], [50 x i8]* %11, i64 0, i64 0
%50 = call i32 @memset(i8* %49, i32 0, i32 50)
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%52 = call i32 @memset(i8* %51, i32 0, i32 100)
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%54 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%55 = getelementptr inbounds [50 x i8], [50 x i8]* %11, i64 0, i64 0
%56 = call i32 @read_from_log(i8* %53, i8* %54, i8* %55)
%57 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%58 = getelementptr inbounds [50 x i8], [50 x i8]* %11, i64 0, i64 0
%59 = call i32 @strcat(i8* %57, i8* %58)
%60 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%61 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%62 = call i32 @strcat(i8* %60, i8* %61)
%63 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%64 = load i8*, i8** %3
%65 = call i32 @logInfoMessages(i8* %63, i8* %64)
%66 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i64 0, i64 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %66
%67 = getelementptr inbounds i8*, i8** %66, i64 1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8** %67
%68 = getelementptr inbounds i8*, i8** %67, i64 1
%69 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
store i8* %69, i8** %68
%70 = getelementptr inbounds i8*, i8** %68, i64 1
%71 = load i8*, i8** %3
store i8* %71, i8** %70
%72 = getelementptr inbounds i8*, i8** %70, i64 1
store i8* null, i8** %72
%73 = getelementptr inbounds [5 x i8*], [5 x i8*]* %13, i64 0, i64 0
%74 = call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8** %73)
br label %75
75: ; preds = %46, %39
br label %34
76: ; preds = %34
%77 = load i32*, i32** %5
%78 = call i32 @fclose(i32* %77)
ret void
}

LLVM IR (-O2):
@__const.push_modified_files.log_file_name = [50 x i8] c"/root/logs/\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [2 x i8] c"/\00"
@.str.1 = [5 x i8] c".log\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [27 x i8] c"Failed to open config file\00"
@.str.4 = [9 x i8] c"MODIFIED\00"
@.str.5 = [3 x i8] c"cp\00"
@.str.6 = [10 x i8] c"--parents\00"
@.str.7 = [8 x i8] c"/bin/cp\00"
define void @push_modified_files(i8* %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = alloca [50 x i8]
%5 = alloca [50 x i8]
%6 = alloca [50 x i8]
%7 = alloca [50 x i8]
%8 = alloca [100 x i8]
%9 = alloca [5 x i8*]
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%13 = call i8* @str_date_log(i8* %12)
%14 = call i32 @strcat(i8* %11, i8* %1)
%15 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @strcat(i8* %11, i8* %13)
%17 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 @logErrorMessages(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %11)
br label %22
22: ; preds = %20, %2
%23 = call i32 @feof(i32* %18)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %51
25: ; preds = %22
%26 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%29 = bitcast [5 x i8*]* %9 to i8*
%30 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 0
%31 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 1
%32 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 2
%33 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 3
%34 = getelementptr inbounds [5 x i8*], [5 x i8*]* %9, i64 0, i64 4
br label %35
35: ; preds = %25, %48
%36 = call i32 @fgets(i8* %10, i32 100, i32* %18)
%37 = call i64 @strstr(i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %48, label %39
39: ; preds = %35
%40 = call i32 @memset(i8* %26, i32 0, i32 50)
%41 = call i32 @memset(i8* %27, i32 0, i32 50)
%42 = call i32 @memset(i8* %28, i32 0, i32 100)
%43 = call i32 @read_from_log(i8* %10, i8* %26, i8* %27)
%44 = call i32 @strcat(i8* %28, i8* %27)
%45 = call i32 @strcat(i8* %28, i8* %26)
%46 = call i32 @logInfoMessages(i8* %28, i8* %0)
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %30
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8** %31
store i8* %28, i8** %32
store i8* %0, i8** %33
store i8* null, i8** %34
%47 = call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i8** %30)
br label %48
48: ; preds = %39, %35
%49 = call i32 @feof(i32* %18)
%50 = icmp eq i32 %49, 0
br i1 %50, label %35, label %51
51: ; preds = %48, %22
%52 = call i32 @fclose(i32* %18)
ret void
}