#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 */
scalar_t__ pow(double, int);
double sqrt(scalar_t__);
double Distancia(double *posX, double *posY, double *posZ, int t, int p1,
                 int p2) {
  double d = 0;
  d = sqrt(pow(posX[p1 * 10000 + t] - posX[p2 * 10000 + t], 2) +
           pow(posY[p1 * 10000 + t] - posY[p2 * 10000 + t], 2) +
           pow(posZ[p1 * 10000 + t] - posZ[p2 * 10000 + t], 2));
  return d;
}


x86 assembly (clang, -O0):
<Distancia>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x2710,-0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
imul   $0x2710,-0x24(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
imul   $0x2710,-0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
imul   $0x2710,-0x24(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
imul   $0x2710,-0x20(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
imul   $0x2710,-0x24(%rbp),%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    -0x38(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Distancia>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
imul   $0x2710,%r8d,%eax
add    %ecx,%eax
movslq %eax,%r12
movsd  (%rdi,%r12,8),%xmm0
imul   $0x2710,%r9d,%eax
add    %ecx,%eax
movslq %eax,%r13
subsd  (%rdi,%r13,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %rax,%rbx
movsd  (%r15,%r12,8),%xmm0
subsd  (%r15,%r13,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
add    %rax,%rbx
movsd  (%r14,%r12,8),%xmm0
subsd  (%r14,%r13,8),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @Distancia(double* %0, double* %1, double* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
store double* %0, double** %7
store double* %1, double** %8
store double* %2, double** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store double 0.000000e+00, double* %13
%14 = load double*, double** %7
%15 = load i32, i32* %11
%16 = mul nsw i32 %15, 10000
%17 = load i32, i32* %10
%18 = add nsw i32 %16, %17
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %14, i64 %19
%21 = load double, double* %20
%22 = load double*, double** %7
%23 = load i32, i32* %12
%24 = mul nsw i32 %23, 10000
%25 = load i32, i32* %10
%26 = add nsw i32 %24, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %22, i64 %27
%29 = load double, double* %28
%30 = fsub double %21, %29
%31 = call i64 @pow(double %30, i32 2)
%32 = load double*, double** %8
%33 = load i32, i32* %11
%34 = mul nsw i32 %33, 10000
%35 = load i32, i32* %10
%36 = add nsw i32 %34, %35
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %32, i64 %37
%39 = load double, double* %38
%40 = load double*, double** %8
%41 = load i32, i32* %12
%42 = mul nsw i32 %41, 10000
%43 = load i32, i32* %10
%44 = add nsw i32 %42, %43
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %40, i64 %45
%47 = load double, double* %46
%48 = fsub double %39, %47
%49 = call i64 @pow(double %48, i32 2)
%50 = add nsw i64 %31, %49
%51 = load double*, double** %9
%52 = load i32, i32* %11
%53 = mul nsw i32 %52, 10000
%54 = load i32, i32* %10
%55 = add nsw i32 %53, %54
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %51, i64 %56
%58 = load double, double* %57
%59 = load double*, double** %9
%60 = load i32, i32* %12
%61 = mul nsw i32 %60, 10000
%62 = load i32, i32* %10
%63 = add nsw i32 %61, %62
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %59, i64 %64
%66 = load double, double* %65
%67 = fsub double %58, %66
%68 = call i64 @pow(double %67, i32 2)
%69 = add nsw i64 %50, %68
%70 = call double @sqrt(i64 %69)
store double %70, double* %13
%71 = load double, double* %13
ret double %71
}

LLVM IR (-O2):
define double @Distancia(double* nocapture %0, double* nocapture %1, double* nocapture %2, i32 %3, i32 %4, i32 %5) {
%7 = mul nsw i32 %4, 10000
%8 = add nsw i32 %7, %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds double, double* %0, i64 %9
%11 = load double, double* %10
%12 = mul nsw i32 %5, 10000
%13 = add nsw i32 %12, %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %0, i64 %14
%16 = load double, double* %15
%17 = fsub double %11, %16
%18 = tail call i64 @pow(double %17, i32 2)
%19 = getelementptr inbounds double, double* %1, i64 %9
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %1, i64 %14
%22 = load double, double* %21
%23 = fsub double %20, %22
%24 = tail call i64 @pow(double %23, i32 2)
%25 = add nsw i64 %24, %18
%26 = getelementptr inbounds double, double* %2, i64 %9
%27 = load double, double* %26
%28 = getelementptr inbounds double, double* %2, i64 %14
%29 = load double, double* %28
%30 = fsub double %27, %29
%31 = tail call i64 @pow(double %30, i32 2)
%32 = add nsw i64 %25, %31
%33 = tail call double @sqrt(i64 %32)
ret double %33
}