#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 scalar_t__ clock_t;

/* Variables and functions */
float CLOCKS_PER_SEC;
int EXIT_FAILURE;
scalar_t__ clock();
double diff(char *, char *);
int /*<<< orphan*/ free(char *);
char *get_string_file(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int ac, char **av) {
  (void)ac;
  (void)av;
  int ret = EXIT_FAILURE;
  double per_ret;
  char *buf1, *buf2;
  if (ac == 3) {
    if (!(buf1 = get_string_file(av[1])) || !(buf2 = get_string_file(av[2]))) {
      printf("Error to get file to string\n");
      return ret;
    }
    clock_t begin, end;
    float time_spent;
    begin = clock();
    if ((per_ret = diff(buf1, buf2)) < 0) {
      printf("ERROR\n");
    }
    end = clock();
    time_spent = (float)(end - begin) / CLOCKS_PER_SEC;
    printf("Diff result: %0.2f%% Time %0.2f\n", per_ret, time_spent);
    free(buf1);
    free(buf2);
  } else
    printf("I need arguments ./my_rsync /path/file/1 /path/file/2\n");
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    1261 <main+0x111>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <get_string_file@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     11b2 <main+0x62>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <get_string_file@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    11cb <main+0x7b>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1275 <main+0x125>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1070 <diff@plt>
movaps %xmm0,%xmm1
movsd  %xmm1,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1206 <main+0xb6>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <clock@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
sub    -0x38(%rbp),%rax
cvtsi2ss %rax,%xmm0
mov    0x2dc3(%rip),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x44(%rbp)
movsd  -0x20(%rbp),%xmm0
movss  -0x44(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xde1(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
jmp    126f <main+0x11f>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2e65(%rip),%rax
mov    (%rax),%ebp
cmp    $0x3,%edi
jne    1226 <main+0xc6>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1070 <get_string_file@plt>
test   %rax,%rax
je     122f <main+0xcf>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
call   1070 <get_string_file@plt>
test   %rax,%rax
je     122f <main+0xcf>
mov    %rax,%r15
xor    %eax,%eax
call   1050 <clock@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <diff@plt>
xorpd  %xmm1,%xmm1
movsd  %xmm0,0x8(%rsp)
ucomisd %xmm0,%xmm1
jbe    11dc <main+0x7c>
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <clock@plt>
sub    %r12,%rax
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mov    0x2df3(%rip),%rax
divss  (%rax),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
lea    0xdf9(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x2,%al
call   1060 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
jmp    123b <main+0xdb>
lea    0xdf4(%rip),%rdi
jmp    1236 <main+0xd6>
lea    0xe21(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [29 x i8] c"Error to get file to string\0A\00"
@.str.1 = [7 x i8] c"ERROR\0A\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.2 = [33 x i8] c"Diff result: %0.2f%% Time %0.2f\0A\00"
@.str.3 = [55 x i8] c"I need arguments ./my_rsync /path/file/1 /path/file/2\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = load i32, i32* @EXIT_FAILURE
store i32 %15, i32* %6
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 3
br i1 %17, label %18, label %57
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i8* @get_string_file(i8* %21)
store i8* %22, i8** %8
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %30
24: ; preds = %18
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i8* @get_string_file(i8* %27)
store i8* %28, i8** %9
%29 = icmp ne i8* %28, null
br i1 %29, label %33, label %30
30: ; preds = %24, %18
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* %6
store i32 %32, i32* %3
br label %61
33: ; preds = %24
%34 = call i64 (...) @clock()
store i64 %34, i64* %10
%35 = load i8*, i8** %8
%36 = load i8*, i8** %9
%37 = call double @diff(i8* %35, i8* %36)
store double %37, double* %7
%38 = fcmp olt double %37, 0.000000e+00
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %39, %33
%42 = call i64 (...) @clock()
store i64 %42, i64* %11
%43 = load i64, i64* %11
%44 = load i64, i64* %10
%45 = sub nsw i64 %43, %44
%46 = sitofp i64 %45 to float
%47 = load float, float* @CLOCKS_PER_SEC
%48 = fdiv float %46, %47
store float %48, float* %12
%49 = load double, double* %7
%50 = load float, float* %12
%51 = fpext float %50 to double
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), double %49, double %51)
%53 = load i8*, i8** %8
%54 = call i32 @free(i8* %53)
%55 = load i8*, i8** %9
%56 = call i32 @free(i8* %55)
br label %59
57: ; preds = %2
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0))
br label %59
59: ; preds = %57, %41
%60 = load i32, i32* %6
store i32 %60, i32* %3
br label %61
61: ; preds = %59, %30
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@CLOCKS_PER_SEC = global float 0.000000e+00
@.str.2 = [33 x i8] c"Diff result: %0.2f%% Time %0.2f\0A\00"
@str = [54 x i8] c"I need arguments ./my_rsync /path/file/1 /path/file/2\00"
@str.4 = [28 x i8] c"Error to get file to string\00"
@str.5 = [6 x i8] c"ERROR\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @EXIT_FAILURE
%4 = icmp eq i32 %0, 3
br i1 %4, label %5, label %33
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i8* @get_string_file(i8* %7)
%9 = icmp eq i8* %8, null
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i8* @get_string_file(i8* %12)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %17
15: ; preds = %10, %5
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.4, i64 0, i64 0))
br label %35
17: ; preds = %10
%18 = tail call i64 (...) @clock()
%19 = tail call double @diff(i8* %8, i8* %13)
%20 = fcmp olt double %19, 0.000000e+00
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0))
br label %23
23: ; preds = %21, %17
%24 = tail call i64 (...) @clock()
%25 = sub nsw i64 %24, %18
%26 = sitofp i64 %25 to float
%27 = load float, float* @CLOCKS_PER_SEC
%28 = fdiv float %26, %27
%29 = fpext float %28 to double
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), double %19, double %29)
%31 = tail call i32 @free(i8* %8)
%32 = tail call i32 @free(i8* %13)
br label %35
33: ; preds = %2
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
br label %35
35: ; preds = %23, %33, %15
ret i32 %3
}