#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*/ time_t;
typedef double clock_t;

/* Variables and functions */
float CLOCKS_PER_SEC;
int atoi(char *);
double clock();
int /*<<< orphan*/ mergeSort(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int *strcmp(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  clock_t t;
  time_t timer;
  srand(time(NULL));
  if (argc < 3) {
    printf("Entre com o tamanho do vetor\n");
    return 1;
  }
  int tmp, i, j, r, n = atoi(argv[1]);
  int *v = NULL;
  v = strcmp(argv[2], "entrada100.txt");
  t = clock();
  mergeSort(v, n);
  printf("%f time \n", t, ((float)t) / CLOCKS_PER_SEC);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
cmpl   $0x3,-0x8(%rbp)
jge    11ba <main+0x4a>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1234 <main+0xc4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <atoi@plt>
mov    %eax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe3d(%rip),%rsi
call   1060 <strcmp@plt>
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%esi
call   1070 <mergeSort@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
cvtsd2ss %xmm1,%xmm1
mov    0x2dd1(%rip),%rax
divss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe07(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %r14d,%r14d
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1060 <srand@plt>
cmp    $0x2,%ebp
jg     11b7 <main+0x37>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
jmp    1213 <main+0x93>
mov    0x8(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
lea    0xe33(%rip),%rsi
call   1070 <strcmp@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <clock@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1080 <mergeSort@plt>
movsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm1
mov    0x2deb(%rip),%rax
divss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe03(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Entre com o tamanho do vetor\0A\00"
@.str.1 = [15 x i8] c"entrada100.txt\00"
@.str.2 = [10 x i8] c"%f time \0A\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call i32 @time(i32* null)
%15 = call i32 @srand(i32 %14)
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %40
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %12
store i32* null, i32** %13
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32* @strcmp(i8* %27, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32* %28, i32** %13
%29 = call double (...) @clock()
store double %29, double* %6
%30 = load i32*, i32** %13
%31 = load i32, i32* %12
%32 = call i32 @mergeSort(i32* %30, i32 %31)
%33 = load double, double* %6
%34 = load double, double* %6
%35 = fptrunc double %34 to float
%36 = load float, float* @CLOCKS_PER_SEC
%37 = fdiv float %35, %36
%38 = fpext float %37 to double
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %33, double %38)
store i32 0, i32* %3
br label %40
40: ; preds = %20, %18
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"entrada100.txt\00"
@.str.2 = [10 x i8] c"%f time \0A\00"
@CLOCKS_PER_SEC = global float 0.000000e+00
@str = [29 x i8] c"Entre com o tamanho do vetor\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %22
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32* @strcmp(i8* %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%15 = tail call double (...) @clock()
%16 = tail call i32 @mergeSort(i32* %14, i32 %11)
%17 = fptrunc double %15 to float
%18 = load float, float* @CLOCKS_PER_SEC
%19 = fdiv float %17, %18
%20 = fpext float %19 to double
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %15, double %20)
br label %22
22: ; preds = %8, %6
%23 = phi i32 [ 1, %6 ], [ 0, %8 ]
ret i32 %23
}