#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 */
unsigned long atol(char *);
double dwalltime();
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ inicializar(double *, unsigned long);
scalar_t__ malloc(unsigned long);
double max(double *, unsigned long);
double min(double *, unsigned long);
int /*<<< orphan*/ printf(char *, double);
double promedio(double *, unsigned long);
main(int argc, char *argv[]) {
  unsigned long N = atol(argv[1]);
  printf("Calculando para %lu \n", N);
  double *v;
  double resultado;
  double timetick;
  v = (double *)malloc(N * sizeof(double));
  inicializar(v, N);
  timetick = dwalltime();
  resultado = (max(v, N) - min(v, N)) / promedio(v, N);
  printf("Tiempo en segundos %f\n", dwalltime() - timetick);
  printf("%f\n", resultado);
  free(v);
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <atol@plt>
mov    %rax,-0x18(%rbp)
movaps 0xe42(%rip),%xmm1
movq   -0x18(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xe41(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
lea    0xe3b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
shl    $0x3,%rdi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <inicializar@plt>
mov    $0x0,%al
call   1080 <dwalltime@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <max@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <min@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10b0 <promedio@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1080 <dwalltime@plt>
subsd  -0x30(%rbp),%xmm0
lea    0xdc1(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xdc3(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x8(%rsi),%rdi
call   10a0 <atol@plt>
mov    %rax,%rbx
movq   %rax,%xmm1
punpckldq 0xe50(%rip),%xmm1
subpd  0xe58(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
lea    0x0(,%rbx,8),%rdi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1070 <inicializar@plt>
xor    %eax,%eax
call   1080 <dwalltime@plt>
movsd  %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <max@plt>
movsd  %xmm0,0x8(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <min@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %r14,%rdi
mov    %rbx,%rsi
call   10b0 <promedio@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xor    %eax,%eax
call   1080 <dwalltime@plt>
subsd  0x10(%rsp),%xmm0
lea    0xde3(%rip),%rdi
call   1040 <printf@plt>
lea    0xdea(%rip),%rdi
movsd  0x8(%rsp),%xmm0
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Calculando para %lu \0A\00"
@.str.1 = [23 x i8] c"Tiempo en segundos %f\0A\00"
@.str.2 = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca double*
%8 = alloca double
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @atol(i8* %12)
store i64 %13, i64* %6
%14 = load i64, i64* %6
%15 = uitofp i64 %14 to double
%16 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %15)
%17 = load i64, i64* %6
%18 = mul i64 %17, 8
%19 = call i64 @malloc(i64 %18)
%20 = inttoptr i64 %19 to double*
store double* %20, double** %7
%21 = load double*, double** %7
%22 = load i64, i64* %6
%23 = call i32 @inicializar(double* %21, i64 %22)
%24 = call double (...) @dwalltime()
store double %24, double* %9
%25 = load double*, double** %7
%26 = load i64, i64* %6
%27 = call double @max(double* %25, i64 %26)
%28 = load double*, double** %7
%29 = load i64, i64* %6
%30 = call double @min(double* %28, i64 %29)
%31 = fsub double %27, %30
%32 = load double*, double** %7
%33 = load i64, i64* %6
%34 = call double @promedio(double* %32, i64 %33)
%35 = fdiv double %31, %34
store double %35, double* %8
%36 = call double (...) @dwalltime()
%37 = load double, double* %9
%38 = fsub double %36, %37
%39 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %38)
%40 = load double, double* %8
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %40)
%42 = load double*, double** %7
%43 = call i32 @free(double* %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Calculando para %lu \0A\00"
@.str.1 = [23 x i8] c"Tiempo en segundos %f\0A\00"
@.str.2 = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atol(i8* %4)
%6 = uitofp i64 %5 to double
%7 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %6)
%8 = shl i64 %5, 3
%9 = tail call i64 @malloc(i64 %8)
%10 = inttoptr i64 %9 to double*
%11 = tail call i32 @inicializar(double* %10, i64 %5)
%12 = tail call double (...) @dwalltime()
%13 = tail call double @max(double* %10, i64 %5)
%14 = tail call double @min(double* %10, i64 %5)
%15 = fsub double %13, %14
%16 = tail call double @promedio(double* %10, i64 %5)
%17 = fdiv double %15, %16
%18 = tail call double (...) @dwalltime()
%19 = fsub double %18, %12
%20 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), double %19)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %17)
%22 = tail call i32 @free(double* %10)
ret i32 0
}