#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 int atoi(char *);
int /*<<< orphan*/ daxpy(double *, double *, unsigned int, int);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(unsigned int);
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, double, double);
int main(int argc, char **argv) {
  unsigned int N = 500, i;
  double start, end, elapsed;
  if (argc >= 2)
    N = atoi(argv[1]);
  double *x, *y;
  x = (double *)malloc(N * sizeof(double));
  y = (double *)malloc(N * sizeof(double));
  for (i = 0; i < N; i++) {
    x[i] = i;
    y[i] = i;
  }
  start = omp_get_wtime();
  daxpy(x, y, N, 20);
  end = omp_get_wtime();
  elapsed = end - start;
  printf("Tiempo(seg.):%11.9f\t / Tam:%u\n", elapsed, N);
  printf("Primer componente del resultado [%f]\nultimo componente del "
         "resultado [%f]\n",
         y[i], y[N - 1]);
  free(x);
  free(y);
}


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)
movl   $0x1f4,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1197 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1203 <main+0xa3>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
cvtsi2sd %rcx,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
cvtsi2sd %rax,%xmm0
mov    -0x40(%rbp),%rax
mov    -0x18(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11c2 <main+0x62>
xor    %eax,%eax
mov    %al,-0x41(%rbp)
call   1040 <omp_get_wtime@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x14,%ecx
call   1060 <daxpy@plt>
mov    -0x41(%rbp),%al
call   1040 <omp_get_wtime@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x14(%rbp),%eax
cvtsi2sd %rax,%xmm1
lea    0xda5(%rip),%rdi
call   1050 <printf@plt>
mov    -0x40(%rbp),%rax
mov    -0x18(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm1
lea    0xd9b(%rip),%rdi
call   1050 <printf@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x1f4,%r14d
cmp    $0x2,%edi
jl     117f <main+0x1f>
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
lea    0x0(,%r14,8),%ebx
mov    %ebx,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
mov    %ebx,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %r14d,%r12d
test   %r14d,%r14d
je     13c7 <main+0x267>
cmp    $0x4,%r14d
jb     11c7 <main+0x67>
lea    (%rbx,%r12,8),%rax
cmp    %rax,%r15
jae    127b <main+0x11b>
lea    (%r15,%r12,8),%rax
cmp    %rax,%rbx
jae    127b <main+0x11b>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
add    %r12,%rcx
mov    %r12,%rdx
and    $0x3,%rdx
je     11ff <main+0x9f>
nopl   0x0(%rax,%rax,1)
mov    %eax,%esi
xorps  %xmm0,%xmm0
cvtsi2sd %rsi,%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  %xmm0,(%rbx,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    11e0 <main+0x80>
cmp    $0x3,%rcx
jb     13c7 <main+0x267>
nopl   0x0(%rax)
mov    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  %xmm0,(%rbx,%rax,8)
lea    0x1(%rax),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
movsd  %xmm0,0x8(%r15,%rax,8)
movsd  %xmm0,0x8(%rbx,%rax,8)
lea    0x2(%rax),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
movsd  %xmm0,0x10(%r15,%rax,8)
movsd  %xmm0,0x10(%rbx,%rax,8)
lea    0x3(%rax),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %rcx,%xmm0
movsd  %xmm0,0x18(%r15,%rax,8)
movsd  %xmm0,0x18(%rbx,%rax,8)
add    $0x4,%rax
cmp    %r12,%rax
jne    1210 <main+0xb0>
jmp    13c7 <main+0x267>
mov    %r12d,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     1440 <main+0x2e0>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
movdqa 0xd58(%rip),%xmm1
xor    %ecx,%ecx
movdqa 0xd5d(%rip),%xmm8
pxor   %xmm2,%xmm2
movdqa 0xd61(%rip),%xmm3
movdqa 0xd69(%rip),%xmm4
movdqa 0xd71(%rip),%xmm5
movdqa 0xd79(%rip),%xmm6
nopw   0x0(%rax,%rax,1)
movdqa %xmm1,%xmm7
paddd  %xmm8,%xmm7
movdqa %xmm1,%xmm0
punpckldq %xmm2,%xmm0
por    %xmm3,%xmm0
subpd  %xmm3,%xmm0
punpckldq %xmm2,%xmm7
por    %xmm3,%xmm7
subpd  %xmm3,%xmm7
movupd %xmm0,(%r15,%rcx,8)
movupd %xmm7,0x10(%r15,%rcx,8)
movupd %xmm0,(%rbx,%rcx,8)
movupd %xmm7,0x10(%rbx,%rcx,8)
movdqa %xmm1,%xmm0
paddd  %xmm4,%xmm0
movdqa %xmm1,%xmm7
paddd  %xmm5,%xmm7
punpckldq %xmm2,%xmm0
por    %xmm3,%xmm0
subpd  %xmm3,%xmm0
punpckldq %xmm2,%xmm7
por    %xmm3,%xmm7
subpd  %xmm3,%xmm7
movupd %xmm0,0x20(%r15,%rcx,8)
movupd %xmm7,0x30(%r15,%rcx,8)
movupd %xmm0,0x20(%rbx,%rcx,8)
movupd %xmm7,0x30(%rbx,%rcx,8)
add    $0x8,%rcx
paddd  %xmm6,%xmm1
add    $0xfffffffffffffffe,%rsi
jne    12e0 <main+0x180>
test   $0x1,%dl
je     13be <main+0x25e>
movdqa 0xc92(%rip),%xmm0
paddd  %xmm1,%xmm0
pxor   %xmm2,%xmm2
punpckldq %xmm2,%xmm1
movdqa 0xc8e(%rip),%xmm3
por    %xmm3,%xmm1
subpd  %xmm3,%xmm1
punpckldq %xmm2,%xmm0
por    %xmm3,%xmm0
subpd  %xmm3,%xmm0
movupd %xmm1,(%r15,%rcx,8)
movupd %xmm0,0x10(%r15,%rcx,8)
movupd %xmm1,(%rbx,%rcx,8)
movupd %xmm0,0x10(%rbx,%rcx,8)
cmp    %r12,%rax
jne    11c9 <main+0x69>
xor    %eax,%eax
call   1040 <omp_get_wtime@plt>
movsd  %xmm0,(%rsp)
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
mov    $0x14,%ecx
call   1060 <daxpy@plt>
xor    %eax,%eax
call   1040 <omp_get_wtime@plt>
subsd  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %r12,%xmm1
lea    0xc5f(%rip),%rdi
call   1050 <printf@plt>
movsd  (%rbx,%r12,8),%xmm0
add    $0xffffffff,%r14d
movsd  (%rbx,%r14,8),%xmm1
lea    0xc62(%rip),%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
movdqa 0xbb8(%rip),%xmm1
xor    %ecx,%ecx
test   $0x1,%dl
jne    1376 <main+0x216>
jmp    13be <main+0x25e>

LLVM IR (-O0):
@.str = [31 x i8] c"Tiempo(seg.):%11.9f\09 / Tam:%u\0A\00"
@.str.1 = [75 x i8] c"Primer componente del resultado [%f]\0Aultimo componente del resultado [%f]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 500, i32* %6
%13 = load i32, i32* %4
%14 = icmp sge i32 %13, 2
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %6
br label %20
20: ; preds = %15, %2
%21 = load i32, i32* %6
%22 = zext i32 %21 to i64
%23 = mul i64 %22, 8
%24 = trunc i64 %23 to i32
%25 = call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to double*
store double* %26, double** %11
%27 = load i32, i32* %6
%28 = zext i32 %27 to i64
%29 = mul i64 %28, 8
%30 = trunc i64 %29 to i32
%31 = call i64 @malloc(i32 %30)
%32 = inttoptr i64 %31 to double*
store double* %32, double** %12
store i32 0, i32* %7
br label %33
33: ; preds = %50, %20
%34 = load i32, i32* %7
%35 = load i32, i32* %6
%36 = icmp ult i32 %34, %35
br i1 %36, label %37, label %53
37: ; preds = %33
%38 = load i32, i32* %7
%39 = uitofp i32 %38 to double
%40 = load double*, double** %11
%41 = load i32, i32* %7
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
store double %39, double* %43
%44 = load i32, i32* %7
%45 = uitofp i32 %44 to double
%46 = load double*, double** %12
%47 = load i32, i32* %7
%48 = zext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
store double %45, double* %49
br label %50
50: ; preds = %37
%51 = load i32, i32* %7
%52 = add i32 %51, 1
store i32 %52, i32* %7
br label %33
53: ; preds = %33
%54 = call double (...) @omp_get_wtime()
store double %54, double* %8
%55 = load double*, double** %11
%56 = load double*, double** %12
%57 = load i32, i32* %6
%58 = call i32 @daxpy(double* %55, double* %56, i32 %57, i32 20)
%59 = call double (...) @omp_get_wtime()
store double %59, double* %9
%60 = load double, double* %9
%61 = load double, double* %8
%62 = fsub double %60, %61
store double %62, double* %10
%63 = load double, double* %10
%64 = load i32, i32* %6
%65 = uitofp i32 %64 to double
%66 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), double %63, double %65)
%67 = load double*, double** %12
%68 = load i32, i32* %7
%69 = zext i32 %68 to i64
%70 = getelementptr inbounds double, double* %67, i64 %69
%71 = load double, double* %70
%72 = load double*, double** %12
%73 = load i32, i32* %6
%74 = sub i32 %73, 1
%75 = zext i32 %74 to i64
%76 = getelementptr inbounds double, double* %72, i64 %75
%77 = load double, double* %76
%78 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), double %71, double %77)
%79 = load double*, double** %11
%80 = call i32 @free(double* %79)
%81 = load double*, double** %12
%82 = call i32 @free(double* %81)
%83 = load i32, i32* %3
ret i32 %83
}

LLVM IR (-O2):
@.str = [31 x i8] c"Tiempo(seg.):%11.9f\09 / Tam:%u\0A\00"
@.str.1 = [75 x i8] c"Primer componente del resultado [%f]\0Aultimo componente del resultado [%f]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 500, %2 ]
%10 = shl i32 %9, 3
%11 = tail call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to double*
%13 = inttoptr i64 %11 to i8*
%14 = tail call i64 @malloc(i32 %10)
%15 = inttoptr i64 %14 to double*
%16 = inttoptr i64 %14 to i8*
%17 = icmp eq i32 %9, 0
br i1 %17, label %130, label %18
18: ; preds = %8
%19 = zext i32 %9 to i64
%20 = icmp ult i32 %9, 4
br i1 %20, label %88, label %21
21: ; preds = %18
%22 = getelementptr double, double* %12, i64 %19
%23 = bitcast double* %22 to i8*
%24 = getelementptr double, double* %15, i64 %19
%25 = bitcast double* %24 to i8*
%26 = icmp ult i8* %13, %25
%27 = icmp ult i8* %16, %23
%28 = and i1 %26, %27
br i1 %28, label %88, label %29
29: ; preds = %21
%30 = and i64 %19, 4294967292
%31 = add nsw i64 %30, -4
%32 = lshr exact i64 %31, 2
%33 = add nuw nsw i64 %32, 1
%34 = and i64 %33, 1
%35 = icmp eq i64 %31, 0
br i1 %35, label %70, label %36
36: ; preds = %29
%37 = and i64 %33, 9223372036854775806
br label %38
38: ; preds = %38, %36
%39 = phi i64 [ 0, %36 ], [ %66, %38 ]
%40 = phi <2 x i32> [ <i32 0, i32 1>, %36 ], [ %67, %38 ]
%41 = phi i64 [ 0, %36 ], [ %68, %38 ]
%42 = add <2 x i32> %40, <i32 2, i32 2>
%43 = uitofp <2 x i32> %40 to <2 x double>
%44 = uitofp <2 x i32> %42 to <2 x double>
%45 = getelementptr inbounds double, double* %12, i64 %39
%46 = bitcast double* %45 to <2 x double>*
store <2 x double> %43, <2 x double>* %46
%47 = getelementptr inbounds double, double* %45, i64 2
%48 = bitcast double* %47 to <2 x double>*
store <2 x double> %44, <2 x double>* %48
%49 = getelementptr inbounds double, double* %15, i64 %39
%50 = bitcast double* %49 to <2 x double>*
store <2 x double> %43, <2 x double>* %50
%51 = getelementptr inbounds double, double* %49, i64 2
%52 = bitcast double* %51 to <2 x double>*
store <2 x double> %44, <2 x double>* %52
%53 = or i64 %39, 4
%54 = add <2 x i32> %40, <i32 4, i32 4>
%55 = add <2 x i32> %40, <i32 6, i32 6>
%56 = uitofp <2 x i32> %54 to <2 x double>
%57 = uitofp <2 x i32> %55 to <2 x double>
%58 = getelementptr inbounds double, double* %12, i64 %53
%59 = bitcast double* %58 to <2 x double>*
store <2 x double> %56, <2 x double>* %59
%60 = getelementptr inbounds double, double* %58, i64 2
%61 = bitcast double* %60 to <2 x double>*
store <2 x double> %57, <2 x double>* %61
%62 = getelementptr inbounds double, double* %15, i64 %53
%63 = bitcast double* %62 to <2 x double>*
store <2 x double> %56, <2 x double>* %63
%64 = getelementptr inbounds double, double* %62, i64 2
%65 = bitcast double* %64 to <2 x double>*
store <2 x double> %57, <2 x double>* %65
%66 = add nuw i64 %39, 8
%67 = add <2 x i32> %40, <i32 8, i32 8>
%68 = add i64 %41, 2
%69 = icmp eq i64 %68, %37
br i1 %69, label %70, label %38
70: ; preds = %38, %29
%71 = phi i64 [ 0, %29 ], [ %66, %38 ]
%72 = phi <2 x i32> [ <i32 0, i32 1>, %29 ], [ %67, %38 ]
%73 = icmp eq i64 %34, 0
br i1 %73, label %86, label %74
74: ; preds = %70
%75 = add <2 x i32> %72, <i32 2, i32 2>
%76 = uitofp <2 x i32> %72 to <2 x double>
%77 = uitofp <2 x i32> %75 to <2 x double>
%78 = getelementptr inbounds double, double* %12, i64 %71
%79 = bitcast double* %78 to <2 x double>*
store <2 x double> %76, <2 x double>* %79
%80 = getelementptr inbounds double, double* %78, i64 2
%81 = bitcast double* %80 to <2 x double>*
store <2 x double> %77, <2 x double>* %81
%82 = getelementptr inbounds double, double* %15, i64 %71
%83 = bitcast double* %82 to <2 x double>*
store <2 x double> %76, <2 x double>* %83
%84 = getelementptr inbounds double, double* %82, i64 2
%85 = bitcast double* %84 to <2 x double>*
store <2 x double> %77, <2 x double>* %85
br label %86
86: ; preds = %70, %74
%87 = icmp eq i64 %30, %19
br i1 %87, label %130, label %88
88: ; preds = %21, %18, %86
%89 = phi i64 [ 0, %21 ], [ 0, %18 ], [ %30, %86 ]
%90 = xor i64 %89, -1
%91 = add nsw i64 %90, %19
%92 = and i64 %19, 3
%93 = icmp eq i64 %92, 0
br i1 %93, label %104, label %94
94: ; preds = %88, %94
%95 = phi i64 [ %101, %94 ], [ %89, %88 ]
%96 = phi i64 [ %102, %94 ], [ 0, %88 ]
%97 = trunc i64 %95 to i32
%98 = uitofp i32 %97 to double
%99 = getelementptr inbounds double, double* %12, i64 %95
store double %98, double* %99
%100 = getelementptr inbounds double, double* %15, i64 %95
store double %98, double* %100
%101 = add nuw nsw i64 %95, 1
%102 = add i64 %96, 1
%103 = icmp eq i64 %102, %92
br i1 %103, label %104, label %94
104: ; preds = %94, %88
%105 = phi i64 [ %89, %88 ], [ %101, %94 ]
%106 = icmp ult i64 %91, 3
br i1 %106, label %130, label %107
107: ; preds = %104, %107
%108 = phi i64 [ %128, %107 ], [ %105, %104 ]
%109 = trunc i64 %108 to i32
%110 = uitofp i32 %109 to double
%111 = getelementptr inbounds double, double* %12, i64 %108
store double %110, double* %111
%112 = getelementptr inbounds double, double* %15, i64 %108
store double %110, double* %112
%113 = add nuw nsw i64 %108, 1
%114 = trunc i64 %113 to i32
%115 = uitofp i32 %114 to double
%116 = getelementptr inbounds double, double* %12, i64 %113
store double %115, double* %116
%117 = getelementptr inbounds double, double* %15, i64 %113
store double %115, double* %117
%118 = add nuw nsw i64 %108, 2
%119 = trunc i64 %118 to i32
%120 = uitofp i32 %119 to double
%121 = getelementptr inbounds double, double* %12, i64 %118
store double %120, double* %121
%122 = getelementptr inbounds double, double* %15, i64 %118
store double %120, double* %122
%123 = add nuw nsw i64 %108, 3
%124 = trunc i64 %123 to i32
%125 = uitofp i32 %124 to double
%126 = getelementptr inbounds double, double* %12, i64 %123
store double %125, double* %126
%127 = getelementptr inbounds double, double* %15, i64 %123
store double %125, double* %127
%128 = add nuw nsw i64 %108, 4
%129 = icmp eq i64 %128, %19
br i1 %129, label %130, label %107
130: ; preds = %104, %107, %86, %8
%131 = tail call double (...) @omp_get_wtime()
%132 = tail call i32 @daxpy(double* %12, double* %15, i32 %9, i32 20)
%133 = tail call double (...) @omp_get_wtime()
%134 = fsub double %133, %131
%135 = uitofp i32 %9 to double
%136 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), double %134, double %135)
%137 = zext i32 %9 to i64
%138 = getelementptr inbounds double, double* %15, i64 %137
%139 = load double, double* %138
%140 = add i32 %9, -1
%141 = zext i32 %140 to i64
%142 = getelementptr inbounds double, double* %15, i64 %141
%143 = load double, double* %142
%144 = tail call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), double %139, double %143)
%145 = tail call i32 @free(double* %12)
%146 = tail call i32 @free(double* %15)
ret i32 0
}