#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 */
double dist(double, double, double, double, double, double);
double disti(double *vertex, int v1, int v2) {
  return dist(vertex[3 * v1 + 0], vertex[3 * v1 + 1], vertex[3 * v1 + 2],
              vertex[3 * v2 + 0], vertex[3 * v2 + 1], vertex[3 * v2 + 2]);
}


x86 assembly (clang, -O0):
<disti>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
imul   $0x3,-0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
imul   $0x3,-0x10(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    -0x8(%rbp),%rax
imul   $0x3,-0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm4
mov    -0x8(%rbp),%rax
imul   $0x3,-0x10(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm5
call   1030 <dist@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disti>:
lea    (%rsi,%rsi,2),%eax
cltq
movsd  (%rdi,%rax,8),%xmm0
movsd  0x8(%rdi,%rax,8),%xmm1
movsd  0x10(%rdi,%rax,8),%xmm2
lea    (%rdx,%rdx,2),%eax
cltq
movsd  (%rdi,%rax,8),%xmm3
movsd  0x8(%rdi,%rax,8),%xmm4
movsd  0x10(%rdi,%rax,8),%xmm5
jmp    1030 <dist@plt>

LLVM IR (-O0):
define double @disti(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load i32, i32* %5
%9 = mul nsw i32 3, %8
%10 = add nsw i32 %9, 0
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds double, double* %7, i64 %11
%13 = load double, double* %12
%14 = load double*, double** %4
%15 = load i32, i32* %5
%16 = mul nsw i32 3, %15
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %14, i64 %18
%20 = load double, double* %19
%21 = load double*, double** %4
%22 = load i32, i32* %5
%23 = mul nsw i32 3, %22
%24 = add nsw i32 %23, 2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %21, i64 %25
%27 = load double, double* %26
%28 = load double*, double** %4
%29 = load i32, i32* %6
%30 = mul nsw i32 3, %29
%31 = add nsw i32 %30, 0
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %28, i64 %32
%34 = load double, double* %33
%35 = load double*, double** %4
%36 = load i32, i32* %6
%37 = mul nsw i32 3, %36
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %35, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %4
%43 = load i32, i32* %6
%44 = mul nsw i32 3, %43
%45 = add nsw i32 %44, 2
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %42, i64 %46
%48 = load double, double* %47
%49 = call double @dist(double %13, double %20, double %27, double %34, double %41, double %48)
ret double %49
}

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