#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 sqrt(double);
double vecint_P1_3d(double *un, int *iv, double *cb, double *v) {
  double *u0, *u1, *u2, *u3, dd;
  u0 = &un[3 * (iv[0] - 1) + 1];
  u1 = &un[3 * (iv[1] - 1) + 1];
  u2 = &un[3 * (iv[2] - 1) + 1];
  u3 = &un[3 * (iv[3] - 1) + 1];
  v[0] = cb[0] * u0[0] + cb[1] * u1[0] + cb[2] * u2[0] + cb[3] * u3[0];
  v[1] = cb[0] * u0[1] + cb[1] * u1[1] + cb[2] * u2[1] + cb[3] * u3[1];
  v[2] = cb[0] * u0[2] + cb[1] * u1[2] + cb[2] * u2[2] + cb[3] * u3[2];
  dd = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
  return (dd);
}


x86 assembly (clang, -O0):
<vecint_P1_3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    0x4(%rcx),%ecx
sub    $0x1,%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%ecx
sub    $0x1,%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    0xc(%rcx),%ecx
sub    $0x1,%ecx
imul   $0x3,%ecx,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x30(%rbp),%rax
mulsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x30(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x40(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x30(%rbp),%rax
mulsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x40(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vecint_P1_3d>:
mov    (%rsi),%eax
mov    0x4(%rsi),%r9d
lea    (%rax,%rax,2),%eax
add    $0xfffffffe,%eax
movslq %eax,%r8
lea    -0x2(%r9,%r9,2),%eax
movslq %eax,%r10
mov    0x8(%rsi),%eax
lea    -0x2(%rax,%rax,2),%eax
movslq %eax,%r9
mov    0xc(%rsi),%eax
lea    -0x2(%rax,%rax,2),%eax
movslq %eax,%rsi
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm1
mulsd  (%rdi,%r10,8),%xmm1
mulsd  (%rdi,%r8,8),%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%rdx),%xmm2
mulsd  (%rdi,%r9,8),%xmm2
addsd  %xmm0,%xmm2
movsd  0x18(%rdx),%xmm1
mulsd  (%rdi,%rsi,8),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rcx)
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm2
mulsd  0x8(%rdi,%r10,8),%xmm2
mulsd  0x8(%rdi,%r8,8),%xmm0
addsd  %xmm2,%xmm0
movsd  0x10(%rdx),%xmm2
mulsd  0x8(%rdi,%r9,8),%xmm2
addsd  %xmm0,%xmm2
movsd  0x18(%rdx),%xmm3
mulsd  0x8(%rdi,%rsi,8),%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rcx)
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm2
mulsd  0x10(%rdi,%r10,8),%xmm2
mulsd  0x10(%rdi,%r8,8),%xmm0
addsd  %xmm2,%xmm0
movsd  0x10(%rdx),%xmm2
mulsd  0x10(%rdi,%r9,8),%xmm2
addsd  %xmm0,%xmm2
movsd  0x18(%rdx),%xmm0
mulsd  0x10(%rdi,%rsi,8),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rcx)
mulsd  %xmm3,%xmm3
mulsd  %xmm1,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1216 <vecint_P1_3d+0x106>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @vecint_P1_3d(double* %0, i32* %1, double* %2, double* %3) {
%5 = alloca double*
%6 = alloca i32*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
store double* %0, double** %5
store i32* %1, i32** %6
store double* %2, double** %7
store double* %3, double** %8
%14 = load double*, double** %5
%15 = load i32*, i32** %6
%16 = getelementptr inbounds i32, i32* %15, i64 0
%17 = load i32, i32* %16
%18 = sub nsw i32 %17, 1
%19 = mul nsw i32 3, %18
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds double, double* %14, i64 %21
store double* %22, double** %9
%23 = load double*, double** %5
%24 = load i32*, i32** %6
%25 = getelementptr inbounds i32, i32* %24, i64 1
%26 = load i32, i32* %25
%27 = sub nsw i32 %26, 1
%28 = mul nsw i32 3, %27
%29 = add nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %23, i64 %30
store double* %31, double** %10
%32 = load double*, double** %5
%33 = load i32*, i32** %6
%34 = getelementptr inbounds i32, i32* %33, i64 2
%35 = load i32, i32* %34
%36 = sub nsw i32 %35, 1
%37 = mul nsw i32 3, %36
%38 = add nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %32, i64 %39
store double* %40, double** %11
%41 = load double*, double** %5
%42 = load i32*, i32** %6
%43 = getelementptr inbounds i32, i32* %42, i64 3
%44 = load i32, i32* %43
%45 = sub nsw i32 %44, 1
%46 = mul nsw i32 3, %45
%47 = add nsw i32 %46, 1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %41, i64 %48
store double* %49, double** %12
%50 = load double*, double** %7
%51 = getelementptr inbounds double, double* %50, i64 0
%52 = load double, double* %51
%53 = load double*, double** %9
%54 = getelementptr inbounds double, double* %53, i64 0
%55 = load double, double* %54
%56 = load double*, double** %7
%57 = getelementptr inbounds double, double* %56, i64 1
%58 = load double, double* %57
%59 = load double*, double** %10
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = fmul double %58, %61
%63 = call double @llvm.fmuladd.f64(double %52, double %55, double %62)
%64 = load double*, double** %7
%65 = getelementptr inbounds double, double* %64, i64 2
%66 = load double, double* %65
%67 = load double*, double** %11
%68 = getelementptr inbounds double, double* %67, i64 0
%69 = load double, double* %68
%70 = call double @llvm.fmuladd.f64(double %66, double %69, double %63)
%71 = load double*, double** %7
%72 = getelementptr inbounds double, double* %71, i64 3
%73 = load double, double* %72
%74 = load double*, double** %12
%75 = getelementptr inbounds double, double* %74, i64 0
%76 = load double, double* %75
%77 = call double @llvm.fmuladd.f64(double %73, double %76, double %70)
%78 = load double*, double** %8
%79 = getelementptr inbounds double, double* %78, i64 0
store double %77, double* %79
%80 = load double*, double** %7
%81 = getelementptr inbounds double, double* %80, i64 0
%82 = load double, double* %81
%83 = load double*, double** %9
%84 = getelementptr inbounds double, double* %83, i64 1
%85 = load double, double* %84
%86 = load double*, double** %7
%87 = getelementptr inbounds double, double* %86, i64 1
%88 = load double, double* %87
%89 = load double*, double** %10
%90 = getelementptr inbounds double, double* %89, i64 1
%91 = load double, double* %90
%92 = fmul double %88, %91
%93 = call double @llvm.fmuladd.f64(double %82, double %85, double %92)
%94 = load double*, double** %7
%95 = getelementptr inbounds double, double* %94, i64 2
%96 = load double, double* %95
%97 = load double*, double** %11
%98 = getelementptr inbounds double, double* %97, i64 1
%99 = load double, double* %98
%100 = call double @llvm.fmuladd.f64(double %96, double %99, double %93)
%101 = load double*, double** %7
%102 = getelementptr inbounds double, double* %101, i64 3
%103 = load double, double* %102
%104 = load double*, double** %12
%105 = getelementptr inbounds double, double* %104, i64 1
%106 = load double, double* %105
%107 = call double @llvm.fmuladd.f64(double %103, double %106, double %100)
%108 = load double*, double** %8
%109 = getelementptr inbounds double, double* %108, i64 1
store double %107, double* %109
%110 = load double*, double** %7
%111 = getelementptr inbounds double, double* %110, i64 0
%112 = load double, double* %111
%113 = load double*, double** %9
%114 = getelementptr inbounds double, double* %113, i64 2
%115 = load double, double* %114
%116 = load double*, double** %7
%117 = getelementptr inbounds double, double* %116, i64 1
%118 = load double, double* %117
%119 = load double*, double** %10
%120 = getelementptr inbounds double, double* %119, i64 2
%121 = load double, double* %120
%122 = fmul double %118, %121
%123 = call double @llvm.fmuladd.f64(double %112, double %115, double %122)
%124 = load double*, double** %7
%125 = getelementptr inbounds double, double* %124, i64 2
%126 = load double, double* %125
%127 = load double*, double** %11
%128 = getelementptr inbounds double, double* %127, i64 2
%129 = load double, double* %128
%130 = call double @llvm.fmuladd.f64(double %126, double %129, double %123)
%131 = load double*, double** %7
%132 = getelementptr inbounds double, double* %131, i64 3
%133 = load double, double* %132
%134 = load double*, double** %12
%135 = getelementptr inbounds double, double* %134, i64 2
%136 = load double, double* %135
%137 = call double @llvm.fmuladd.f64(double %133, double %136, double %130)
%138 = load double*, double** %8
%139 = getelementptr inbounds double, double* %138, i64 2
store double %137, double* %139
%140 = load double*, double** %8
%141 = getelementptr inbounds double, double* %140, i64 0
%142 = load double, double* %141
%143 = load double*, double** %8
%144 = getelementptr inbounds double, double* %143, i64 0
%145 = load double, double* %144
%146 = load double*, double** %8
%147 = getelementptr inbounds double, double* %146, i64 1
%148 = load double, double* %147
%149 = load double*, double** %8
%150 = getelementptr inbounds double, double* %149, i64 1
%151 = load double, double* %150
%152 = fmul double %148, %151
%153 = call double @llvm.fmuladd.f64(double %142, double %145, double %152)
%154 = load double*, double** %8
%155 = getelementptr inbounds double, double* %154, i64 2
%156 = load double, double* %155
%157 = load double*, double** %8
%158 = getelementptr inbounds double, double* %157, i64 2
%159 = load double, double* %158
%160 = call double @llvm.fmuladd.f64(double %156, double %159, double %153)
%161 = call double @sqrt(double %160)
store double %161, double* %13
%162 = load double, double* %13
ret double %162
}

LLVM IR (-O2):
define double @vecint_P1_3d(double* nocapture %0, i32* nocapture %1, double* nocapture %2, double* nocapture %3) {
%5 = load i32, i32* %1
%6 = mul i32 %5, 3
%7 = add i32 %6, -2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds double, double* %0, i64 %8
%10 = getelementptr inbounds i32, i32* %1, i64 1
%11 = load i32, i32* %10
%12 = mul i32 %11, 3
%13 = add i32 %12, -2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %0, i64 %14
%16 = getelementptr inbounds i32, i32* %1, i64 2
%17 = load i32, i32* %16
%18 = mul i32 %17, 3
%19 = add i32 %18, -2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %0, i64 %20
%22 = getelementptr inbounds i32, i32* %1, i64 3
%23 = load i32, i32* %22
%24 = mul i32 %23, 3
%25 = add i32 %24, -2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %0, i64 %26
%28 = load double, double* %2
%29 = load double, double* %9
%30 = getelementptr inbounds double, double* %2, i64 1
%31 = load double, double* %30
%32 = load double, double* %15
%33 = fmul double %31, %32
%34 = tail call double @llvm.fmuladd.f64(double %28, double %29, double %33)
%35 = getelementptr inbounds double, double* %2, i64 2
%36 = load double, double* %35
%37 = load double, double* %21
%38 = tail call double @llvm.fmuladd.f64(double %36, double %37, double %34)
%39 = getelementptr inbounds double, double* %2, i64 3
%40 = load double, double* %39
%41 = load double, double* %27
%42 = tail call double @llvm.fmuladd.f64(double %40, double %41, double %38)
store double %42, double* %3
%43 = load double, double* %2
%44 = getelementptr inbounds double, double* %9, i64 1
%45 = load double, double* %44
%46 = load double, double* %30
%47 = getelementptr inbounds double, double* %15, i64 1
%48 = load double, double* %47
%49 = fmul double %46, %48
%50 = tail call double @llvm.fmuladd.f64(double %43, double %45, double %49)
%51 = load double, double* %35
%52 = getelementptr inbounds double, double* %21, i64 1
%53 = load double, double* %52
%54 = tail call double @llvm.fmuladd.f64(double %51, double %53, double %50)
%55 = load double, double* %39
%56 = getelementptr inbounds double, double* %27, i64 1
%57 = load double, double* %56
%58 = tail call double @llvm.fmuladd.f64(double %55, double %57, double %54)
%59 = getelementptr inbounds double, double* %3, i64 1
store double %58, double* %59
%60 = load double, double* %2
%61 = getelementptr inbounds double, double* %9, i64 2
%62 = load double, double* %61
%63 = load double, double* %30
%64 = getelementptr inbounds double, double* %15, i64 2
%65 = load double, double* %64
%66 = fmul double %63, %65
%67 = tail call double @llvm.fmuladd.f64(double %60, double %62, double %66)
%68 = load double, double* %35
%69 = getelementptr inbounds double, double* %21, i64 2
%70 = load double, double* %69
%71 = tail call double @llvm.fmuladd.f64(double %68, double %70, double %67)
%72 = load double, double* %39
%73 = getelementptr inbounds double, double* %27, i64 2
%74 = load double, double* %73
%75 = tail call double @llvm.fmuladd.f64(double %72, double %74, double %71)
%76 = getelementptr inbounds double, double* %3, i64 2
store double %75, double* %76
%77 = fmul double %58, %58
%78 = tail call double @llvm.fmuladd.f64(double %42, double %42, double %77)
%79 = tail call double @llvm.fmuladd.f64(double %75, double %75, double %78)
%80 = tail call double @sqrt(double %79)
ret double %80
}