#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 */
int /*<<< orphan*/ assert(int *);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, float);
float sqrt(int /*<<< orphan*/);
int /*<<< orphan*/ sum(int *, int *, int);
void main(int argc, char **argv) {
  int *vector1;
  int *vector2;
  int size = 1000;
  float dist;
  int i;
  vector1 = (int *)malloc(size * sizeof(int));
  assert(vector1);
  vector2 = (int *)malloc(size * sizeof(int));
  assert(vector1);
  for (i = 0; i < size; i++) {
    vector1[i] = i + 1;
    vector2[i] = size - i;
  }
  dist = sqrt(sum(vector1, vector2, size));
  printf("La suma de la distancia euclídea de vector1 y vector2 es : %f\n",
         dist);
  dist = sqrt(sum(vector1, vector1, size));
  printf("La suma de la distancia euclídea de vector1 y vector1 es : %f\n",
         dist);
  free(vector1);
  free(vector2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3e8,-0x24(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <assert@plt>
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <assert@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11f1 <main+0x91>
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%edx
sub    -0x2c(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b5 <main+0x55>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1060 <sum@plt>
mov    %eax,%edi
call   1080 <sqrt@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
lea    0xde7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1060 <sum@plt>
mov    %eax,%edi
call   1080 <sqrt@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
lea    0xdfa(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xfa0,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <assert@plt>
mov    $0xfa0,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <assert@plt>
lea    0xfa0(%rbx),%rax
cmp    %rax,%r14
jae    1264 <main+0x104>
mov    %r14,%rax
add    $0xfa0,%rax
cmp    %rax,%rbx
jae    1264 <main+0x104>
mov    $0x3e8,%eax
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%edx
mov    %edx,(%r14,%rcx,4)
mov    %eax,(%rbx,%rcx,4)
lea    0x2(%rcx),%edx
mov    %edx,0x4(%r14,%rcx,4)
lea    -0x1(%rax),%edx
mov    %edx,0x4(%rbx,%rcx,4)
lea    0x3(%rcx),%edx
mov    %edx,0x8(%r14,%rcx,4)
lea    -0x2(%rax),%edx
mov    %edx,0x8(%rbx,%rcx,4)
lea    0x4(%rcx),%rdx
mov    %edx,0xc(%r14,%rcx,4)
lea    -0x3(%rax),%esi
mov    %esi,0xc(%rbx,%rcx,4)
add    $0xfffffffc,%eax
mov    %rdx,%rcx
cmp    $0x3e8,%rdx
jne    11c0 <main+0x60>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x3e8,%edx
call   1060 <sum@plt>
mov    %eax,%edi
call   1080 <sqrt@plt>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %r14,%rsi
mov    $0x3e8,%edx
call   1060 <sum@plt>
mov    %eax,%edi
call   1080 <sqrt@plt>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
movaps 0xd95(%rip),%xmm0
movaps 0xd9e(%rip),%xmm5
movdqa 0xda6(%rip),%xmm2
mov    $0xc,%eax
pcmpeqd %xmm13,%xmm13
movdqa 0xda4(%rip),%xmm4
movdqa 0xdab(%rip),%xmm8
movdqa 0xdb2(%rip),%xmm10
movdqa 0xdba(%rip),%xmm7
movdqa 0xdc1(%rip),%xmm9
movdqa 0xdc8(%rip),%xmm11
movdqa 0xdd0(%rip),%xmm6
movdqa 0xdd7(%rip),%xmm12
nopl   0x0(%rax)
movaps %xmm5,%xmm1
shufps $0x88,%xmm0,%xmm1
movaps %xmm1,%xmm3
psubd  %xmm13,%xmm3
paddd  %xmm4,%xmm1
movdqu %xmm3,-0x30(%r14,%rax,4)
movdqu %xmm1,-0x20(%r14,%rax,4)
movdqa %xmm8,%xmm1
psubd  %xmm2,%xmm1
movdqa %xmm10,%xmm3
psubd  %xmm2,%xmm3
movdqu %xmm1,-0x30(%rbx,%rax,4)
movdqu %xmm3,-0x20(%rbx,%rax,4)
cmp    $0x3ec,%rax
je     1207 <main+0xa7>
movaps %xmm5,%xmm1
paddq  %xmm7,%xmm1
movaps %xmm0,%xmm3
paddq  %xmm7,%xmm3
shufps $0x88,%xmm3,%xmm1
movaps %xmm1,%xmm3
psubd  %xmm13,%xmm3
paddd  %xmm4,%xmm1
movdqu %xmm3,-0x10(%r14,%rax,4)
movdqu %xmm1,(%r14,%rax,4)
movdqa %xmm9,%xmm1
psubd  %xmm2,%xmm1
movdqa %xmm11,%xmm3
psubd  %xmm2,%xmm3
movdqu %xmm1,-0x10(%rbx,%rax,4)
movdqu %xmm3,(%rbx,%rax,4)
paddq  %xmm6,%xmm5
paddq  %xmm6,%xmm0
paddd  %xmm12,%xmm2
add    $0x10,%rax
jmp    12d0 <main+0x170>

LLVM IR (-O0):
@.str = [64 x i8] c"La suma de la distancia eucl\C3\ADdea de vector1 y vector2 es : %f\0A\00"
@.str.1 = [64 x i8] c"La suma de la distancia eucl\C3\ADdea de vector1 y vector1 es : %f\0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca float
%9 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 1000, i32* %7
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = mul i64 %11, 4
%13 = trunc i64 %12 to i32
%14 = call i64 @malloc(i32 %13)
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %5
%16 = load i32*, i32** %5
%17 = call i32 @assert(i32* %16)
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = mul i64 %19, 4
%21 = trunc i64 %20 to i32
%22 = call i64 @malloc(i32 %21)
%23 = inttoptr i64 %22 to i32*
store i32* %23, i32** %6
%24 = load i32*, i32** %5
%25 = call i32 @assert(i32* %24)
store i32 0, i32* %9
br label %26
26: ; preds = %44, %2
%27 = load i32, i32* %9
%28 = load i32, i32* %7
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %47
30: ; preds = %26
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
%33 = load i32*, i32** %5
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
store i32 %32, i32* %36
%37 = load i32, i32* %7
%38 = load i32, i32* %9
%39 = sub nsw i32 %37, %38
%40 = load i32*, i32** %6
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
store i32 %39, i32* %43
br label %44
44: ; preds = %30
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %26
47: ; preds = %26
%48 = load i32*, i32** %5
%49 = load i32*, i32** %6
%50 = load i32, i32* %7
%51 = call i32 @sum(i32* %48, i32* %49, i32 %50)
%52 = call float @sqrt(i32 %51)
store float %52, float* %8
%53 = load float, float* %8
%54 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), float %53)
%55 = load i32*, i32** %5
%56 = load i32*, i32** %5
%57 = load i32, i32* %7
%58 = call i32 @sum(i32* %55, i32* %56, i32 %57)
%59 = call float @sqrt(i32 %58)
store float %59, float* %8
%60 = load float, float* %8
%61 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), float %60)
%62 = load i32*, i32** %5
%63 = call i32 @free(i32* %62)
%64 = load i32*, i32** %6
%65 = call i32 @free(i32* %64)
ret void
}

LLVM IR (-O2):
@.str = [64 x i8] c"La suma de la distancia eucl\C3\ADdea de vector1 y vector2 es : %f\0A\00"
@.str.1 = [64 x i8] c"La suma de la distancia eucl\C3\ADdea de vector1 y vector1 es : %f\0A\00"
define void @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 4000)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i32 @assert(i32* %4)
%6 = tail call i64 @malloc(i32 4000)
%7 = inttoptr i64 %6 to i32*
%8 = tail call i32 @assert(i32* %4)
%9 = inttoptr i64 %6 to i8*
%10 = inttoptr i64 %3 to i8*
%11 = getelementptr i32, i32* %4, i64 1000
%12 = bitcast i32* %11 to i8*
%13 = getelementptr i32, i32* %7, i64 1000
%14 = bitcast i32* %13 to i8*
%15 = icmp ult i8* %10, %14
%16 = icmp ult i8* %9, %12
%17 = and i1 %15, %16
br i1 %17, label %57, label %18
18: ; preds = %2, %39
%19 = phi i64 [ %54, %39 ], [ 0, %2 ]
%20 = phi <4 x i64> [ %55, %39 ], [ <i64 0, i64 1, i64 2, i64 3>, %2 ]
%21 = phi <4 x i32> [ %56, %39 ], [ <i32 0, i32 1, i32 2, i32 3>, %2 ]
%22 = getelementptr inbounds i32, i32* %4, i64 %19
%23 = trunc <4 x i64> %20 to <4 x i32>
%24 = add <4 x i32> %23, <i32 1, i32 1, i32 1, i32 1>
%25 = trunc <4 x i64> %20 to <4 x i32>
%26 = add <4 x i32> %25, <i32 5, i32 5, i32 5, i32 5>
%27 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> %24, <4 x i32>* %27
%28 = getelementptr inbounds i32, i32* %22, i64 4
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> %26, <4 x i32>* %29
%30 = getelementptr inbounds i32, i32* %7, i64 %19
%31 = sub <4 x i32> <i32 1000, i32 1000, i32 1000, i32 1000>, %21
%32 = sub <4 x i32> <i32 996, i32 996, i32 996, i32 996>, %21
%33 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> %31, <4 x i32>* %33
%34 = getelementptr inbounds i32, i32* %30, i64 4
%35 = bitcast i32* %34 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %35
%36 = or i64 %19, 8
%37 = add <4 x i64> %20, <i64 8, i64 8, i64 8, i64 8>
%38 = icmp eq i64 %36, 1000
br i1 %38, label %84, label %39
39: ; preds = %18
%40 = getelementptr inbounds i32, i32* %4, i64 %36
%41 = trunc <4 x i64> %37 to <4 x i32>
%42 = add <4 x i32> %41, <i32 1, i32 1, i32 1, i32 1>
%43 = trunc <4 x i64> %37 to <4 x i32>
%44 = add <4 x i32> %43, <i32 5, i32 5, i32 5, i32 5>
%45 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> %42, <4 x i32>* %45
%46 = getelementptr inbounds i32, i32* %40, i64 4
%47 = bitcast i32* %46 to <4 x i32>*
store <4 x i32> %44, <4 x i32>* %47
%48 = getelementptr inbounds i32, i32* %7, i64 %36
%49 = sub <4 x i32> <i32 992, i32 992, i32 992, i32 992>, %21
%50 = sub <4 x i32> <i32 988, i32 988, i32 988, i32 988>, %21
%51 = bitcast i32* %48 to <4 x i32>*
store <4 x i32> %49, <4 x i32>* %51
%52 = getelementptr inbounds i32, i32* %48, i64 4
%53 = bitcast i32* %52 to <4 x i32>*
store <4 x i32> %50, <4 x i32>* %53
%54 = add nuw nsw i64 %19, 16
%55 = add <4 x i64> %20, <i64 16, i64 16, i64 16, i64 16>
%56 = add <4 x i32> %21, <i32 16, i32 16, i32 16, i32 16>
br label %18
57: ; preds = %2, %57
%58 = phi i64 [ %77, %57 ], [ 0, %2 ]
%59 = or i64 %58, 1
%60 = getelementptr inbounds i32, i32* %4, i64 %58
%61 = trunc i64 %59 to i32
store i32 %61, i32* %60
%62 = getelementptr inbounds i32, i32* %7, i64 %58
%63 = trunc i64 %58 to i32
%64 = sub nuw nsw i32 1000, %63
store i32 %64, i32* %62
%65 = or i64 %58, 2
%66 = getelementptr inbounds i32, i32* %4, i64 %59
%67 = trunc i64 %65 to i32
store i32 %67, i32* %66
%68 = getelementptr inbounds i32, i32* %7, i64 %59
%69 = trunc i64 %59 to i32
%70 = sub nuw nsw i32 1000, %69
store i32 %70, i32* %68
%71 = or i64 %58, 3
%72 = getelementptr inbounds i32, i32* %4, i64 %65
%73 = trunc i64 %71 to i32
store i32 %73, i32* %72
%74 = getelementptr inbounds i32, i32* %7, i64 %65
%75 = trunc i64 %65 to i32
%76 = sub nuw nsw i32 1000, %75
store i32 %76, i32* %74
%77 = add nuw nsw i64 %58, 4
%78 = getelementptr inbounds i32, i32* %4, i64 %71
%79 = trunc i64 %77 to i32
store i32 %79, i32* %78
%80 = getelementptr inbounds i32, i32* %7, i64 %71
%81 = trunc i64 %71 to i32
%82 = sub nuw nsw i32 1000, %81
store i32 %82, i32* %80
%83 = icmp eq i64 %77, 1000
br i1 %83, label %84, label %57
84: ; preds = %18, %57
%85 = tail call i32 @sum(i32* %4, i32* %7, i32 1000)
%86 = tail call float @sqrt(i32 %85)
%87 = tail call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), float %86)
%88 = tail call i32 @sum(i32* %4, i32* %4, i32 1000)
%89 = tail call float @sqrt(i32 %88)
%90 = tail call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), float %89)
%91 = tail call i32 @free(i32* %4)
%92 = tail call i32 @free(i32* %7)
ret void
}