#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 cos(double);
double sin(double);
double sqrt(double);
void rho_j_k(const double x_vec[][3], const double v_vec[][3], int N_x,
             const double k_vec[][3], int N_k, double (*restrict rho_k)[2],
             double (*restrict j_k)[6]) {
  int x_i, k_i;
  double rho_ki_0, rho_ki_1;
  double j_ki_0, j_ki_1, j_ki_2, j_ki_3, j_ki_4, j_ki_5;
  double factor = (1.0 / sqrt((double)N_x));
  register double alpha, ca, sa;
#pragma omp parallel for shared(                                               \
    rho_k, j_k, x_vec, v_vec, k_vec,                                           \
    factor) private(k_i, x_i, alpha, ca, sa, rho_ki_0, rho_ki_1, j_ki_0,       \
                    j_ki_1, j_ki_2, j_ki_3, j_ki_4, j_ki_5)
  for (k_i = 0; k_i < N_k; k_i++) {
    rho_ki_0 = 0.0;
    rho_ki_1 = 0.0;
    j_ki_0 = 0.0;
    j_ki_1 = 0.0;
    j_ki_2 = 0.0;
    j_ki_3 = 0.0;
    j_ki_4 = 0.0;
    j_ki_5 = 0.0;
    for (x_i = 0; x_i < N_x; x_i++) {
      alpha = x_vec[x_i][0] * k_vec[k_i][0] + x_vec[x_i][1] * k_vec[k_i][1] +
              x_vec[x_i][2] * k_vec[k_i][2];
      ca = cos(alpha);
      sa = sin(alpha);
      rho_ki_0 += ca;
      rho_ki_1 += sa;
      j_ki_0 += ca * v_vec[x_i][0];
      j_ki_1 += sa * v_vec[x_i][0];
      j_ki_2 += ca * v_vec[x_i][1];
      j_ki_3 += sa * v_vec[x_i][1];
      j_ki_4 += ca * v_vec[x_i][2];
      j_ki_5 += sa * v_vec[x_i][2];
    }
    rho_k[k_i][0] = factor * rho_ki_0;
    rho_k[k_i][1] = factor * rho_ki_1;
    j_k[k_i][0] = factor * j_ki_0;
    j_k[k_i][1] = factor * j_ki_1;
    j_k[k_i][2] = factor * j_ki_2;
    j_k[k_i][3] = factor * j_ki_3;
    j_k[k_i][4] = factor * j_ki_4;
    j_k[k_i][5] = factor * j_ki_5;
  }
}


x86 assembly (clang, -O0):
<rho_j_k>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xe95(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    14d2 <rho_j_k+0x3a2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13d6 <rho_j_k+0x2a6>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1040 <cos@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
call   1030 <sin@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  (%rax),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x90(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x98(%rbp),%xmm0
ff
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movsd  0x10(%rax),%xmm2
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11ce <rho_j_k+0x9e>
movsd  -0x80(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x80(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x80(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x80(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,0x18(%rax)
movsd  -0x80(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,0x20(%rax)
movsd  -0x80(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
imul   $0x30,%rcx,%rcx
add    %rcx,%rax
movsd  %xmm0,0x28(%rax)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    117b <rho_j_k+0x4b>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rho_j_k>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %edx,0xc(%rsp)
cvtsi2sd %edx,%xmm0
mov    %r9,0x20(%rsp)
mov    %r8d,%r14d
mov    %rcx,0x10(%rsp)
mov    %rsi,%rbx
mov    %rdi,%rbp
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1174 <rho_j_k+0x44>
sqrtsd %xmm0,%xmm0
test   %r14d,%r14d
jg     1182 <rho_j_k+0x52>
jmp    1346 <rho_j_k+0x216>
call   1050 <sqrt@plt>
test   %r14d,%r14d
jle    1346 <rho_j_k+0x216>
movsd  0xe76(%rip),%xmm1
divsd  %xmm0,%xmm1
mov    %r14d,%eax
mov    %rax,0x18(%rsp)
mov    0xc(%rsp),%eax
unpcklpd %xmm1,%xmm1
movapd %xmm1,0x30(%rsp)
shl    $0x3,%rax
lea    (%rax,%rax,2),%r14
xor    %r12d,%r12d
jmp    1227 <rho_j_k+0xf7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorpd  %xmm6,%xmm6
xorpd  %xmm2,%xmm2
xorpd  %xmm1,%xmm1
xorpd  %xmm0,%xmm0
mov    %r12,%rax
shl    $0x4,%rax
movapd 0x30(%rsp),%xmm3
mulpd  %xmm3,%xmm6
mov    0x20(%rsp),%rcx
movupd %xmm6,(%rcx,%rax,1)
lea    (%r12,%r12,2),%rax
shl    $0x4,%rax
mulpd  %xmm3,%xmm2
mov    0xd0(%rsp),%rcx
movupd %xmm2,(%rcx,%rax,1)
mulpd  %xmm3,%xmm1
movupd %xmm1,0x10(%rcx,%rax,1)
mulpd  %xmm3,%xmm0
movupd %xmm0,0x20(%rcx,%rax,1)
add    $0x1,%r12
cmp    0x18(%rsp),%r12
je     1346 <rho_j_k+0x216>
cmpl   $0x0,0xc(%rsp)
jle    11c0 <rho_j_k+0x90>
lea    (%r12,%r12,2),%rax
mov    0x10(%rsp),%rcx
lea    (%rcx,%rax,8),%r15
xorps  %xmm6,%xmm6
xor    %r13d,%r13d
xorps  %xmm3,%xmm3
xorps  %xmm4,%xmm4
xorps  %xmm5,%xmm5
nopw   0x0(%rax,%rax,1)
movaps %xmm6,0x80(%rsp)
movaps %xmm5,0x70(%rsp)
movaps %xmm4,0x60(%rsp)
movaps %xmm3,0x50(%rsp)
movsd  0x8(%rbp,%r13,1),%xmm0
mulsd  0x8(%r15),%xmm0
movsd  0x0(%rbp,%r13,1),%xmm1
mulsd  (%r15),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rbp,%r13,1),%xmm0
mulsd  0x10(%r15),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
call   1040 <cos@plt>
movapd %xmm0,0x40(%rsp)
movsd  0x28(%rsp),%xmm0
call   1030 <sin@plt>
movapd 0x70(%rsp),%xmm7
movapd 0x60(%rsp),%xmm9
movapd 0x50(%rsp),%xmm8
movapd 0x80(%rsp),%xmm6
movapd 0x40(%rsp),%xmm4
unpcklpd %xmm0,%xmm4
addpd  %xmm4,%xmm6
movsd  (%rbx,%r13,1),%xmm2
movsd  0x8(%rbx,%r13,1),%xmm1
movsd  0x10(%rbx,%r13,1),%xmm0
unpcklpd %xmm2,%xmm2
mulpd  %xmm4,%xmm2
movapd %xmm2,%xmm3
addpd  %xmm8,%xmm3
unpcklpd %xmm1,%xmm1
mulpd  %xmm4,%xmm1
movapd %xmm4,%xmm5
movapd %xmm1,%xmm4
addpd  %xmm9,%xmm4
unpcklpd %xmm0,%xmm0
mulpd  %xmm5,%xmm0
movapd %xmm0,%xmm5
addpd  %xmm7,%xmm5
add    $0x18,%r13
cmp    %r13,%r14
jne    1250 <rho_j_k+0x120>
addpd  %xmm7,%xmm0
addpd  %xmm9,%xmm1
addpd  %xmm8,%xmm2
jmp    11d0 <rho_j_k+0xa0>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @rho_j_k([3 x double]* %0, [3 x double]* %1, i32 %2, [3 x double]* %3, i32 %4, [2 x double]* noalias %5, [6 x double]* noalias %6) {
%8 = alloca [3 x double]*
%9 = alloca [3 x double]*
%10 = alloca i32
%11 = alloca [3 x double]*
%12 = alloca i32
%13 = alloca [2 x double]*
%14 = alloca [6 x double]*
%15 = alloca i32
%16 = alloca i32
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
store [3 x double]* %0, [3 x double]** %8
store [3 x double]* %1, [3 x double]** %9
store i32 %2, i32* %10
store [3 x double]* %3, [3 x double]** %11
store i32 %4, i32* %12
store [2 x double]* %5, [2 x double]** %13
store [6 x double]* %6, [6 x double]** %14
%29 = load i32, i32* %10
%30 = sitofp i32 %29 to double
%31 = call double @sqrt(double %30)
%32 = fdiv double 1.000000e+00, %31
store double %32, double* %25
store i32 0, i32* %16
br label %33
33: ; preds = %214, %7
%34 = load i32, i32* %16
%35 = load i32, i32* %12
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %217
37: ; preds = %33
store double 0.000000e+00, double* %17
store double 0.000000e+00, double* %18
store double 0.000000e+00, double* %19
store double 0.000000e+00, double* %20
store double 0.000000e+00, double* %21
store double 0.000000e+00, double* %22
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %24
store i32 0, i32* %15
br label %38
38: ; preds = %146, %37
%39 = load i32, i32* %15
%40 = load i32, i32* %10
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %149
42: ; preds = %38
%43 = load [3 x double]*, [3 x double]** %8
%44 = load i32, i32* %15
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [3 x double], [3 x double]* %43, i64 %45
%47 = getelementptr inbounds [3 x double], [3 x double]* %46, i64 0, i64 0
%48 = load double, double* %47
%49 = load [3 x double]*, [3 x double]** %11
%50 = load i32, i32* %16
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [3 x double], [3 x double]* %49, i64 %51
%53 = getelementptr inbounds [3 x double], [3 x double]* %52, i64 0, i64 0
%54 = load double, double* %53
%55 = load [3 x double]*, [3 x double]** %8
%56 = load i32, i32* %15
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [3 x double], [3 x double]* %55, i64 %57
%59 = getelementptr inbounds [3 x double], [3 x double]* %58, i64 0, i64 1
%60 = load double, double* %59
%61 = load [3 x double]*, [3 x double]** %11
%62 = load i32, i32* %16
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [3 x double], [3 x double]* %61, i64 %63
%65 = getelementptr inbounds [3 x double], [3 x double]* %64, i64 0, i64 1
%66 = load double, double* %65
%67 = fmul double %60, %66
%68 = call double @llvm.fmuladd.f64(double %48, double %54, double %67)
%69 = load [3 x double]*, [3 x double]** %8
%70 = load i32, i32* %15
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [3 x double], [3 x double]* %69, i64 %71
%73 = getelementptr inbounds [3 x double], [3 x double]* %72, i64 0, i64 2
%74 = load double, double* %73
%75 = load [3 x double]*, [3 x double]** %11
%76 = load i32, i32* %16
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [3 x double], [3 x double]* %75, i64 %77
%79 = getelementptr inbounds [3 x double], [3 x double]* %78, i64 0, i64 2
%80 = load double, double* %79
%81 = call double @llvm.fmuladd.f64(double %74, double %80, double %68)
store double %81, double* %26
%82 = load double, double* %26
%83 = call double @cos(double %82)
store double %83, double* %27
%84 = load double, double* %26
%85 = call double @sin(double %84)
store double %85, double* %28
%86 = load double, double* %27
%87 = load double, double* %17
%88 = fadd double %87, %86
store double %88, double* %17
%89 = load double, double* %28
%90 = load double, double* %18
%91 = fadd double %90, %89
store double %91, double* %18
%92 = load double, double* %27
%93 = load [3 x double]*, [3 x double]** %9
%94 = load i32, i32* %15
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [3 x double], [3 x double]* %93, i64 %95
%97 = getelementptr inbounds [3 x double], [3 x double]* %96, i64 0, i64 0
%98 = load double, double* %97
%99 = load double, double* %19
%100 = call double @llvm.fmuladd.f64(double %92, double %98, double %99)
store double %100, double* %19
%101 = load double, double* %28
%102 = load [3 x double]*, [3 x double]** %9
%103 = load i32, i32* %15
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [3 x double], [3 x double]* %102, i64 %104
%106 = getelementptr inbounds [3 x double], [3 x double]* %105, i64 0, i64 0
%107 = load double, double* %106
%108 = load double, double* %20
%109 = call double @llvm.fmuladd.f64(double %101, double %107, double %108)
store double %109, double* %20
%110 = load double, double* %27
%111 = load [3 x double]*, [3 x double]** %9
%112 = load i32, i32* %15
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [3 x double], [3 x double]* %111, i64 %113
%115 = getelementptr inbounds [3 x double], [3 x double]* %114, i64 0, i64 1
%116 = load double, double* %115
%117 = load double, double* %21
%118 = call double @llvm.fmuladd.f64(double %110, double %116, double %117)
store double %118, double* %21
%119 = load double, double* %28
%120 = load [3 x double]*, [3 x double]** %9
%121 = load i32, i32* %15
%122 = sext i32 %121 to i64
%123 = getelementptr inbounds [3 x double], [3 x double]* %120, i64 %122
%124 = getelementptr inbounds [3 x double], [3 x double]* %123, i64 0, i64 1
%125 = load double, double* %124
%126 = load double, double* %22
%127 = call double @llvm.fmuladd.f64(double %119, double %125, double %126)
store double %127, double* %22
%128 = load double, double* %27
%129 = load [3 x double]*, [3 x double]** %9
%130 = load i32, i32* %15
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [3 x double], [3 x double]* %129, i64 %131
%133 = getelementptr inbounds [3 x double], [3 x double]* %132, i64 0, i64 2
%134 = load double, double* %133
%135 = load double, double* %23
%136 = call double @llvm.fmuladd.f64(double %128, double %134, double %135)
store double %136, double* %23
%137 = load double, double* %28
%138 = load [3 x double]*, [3 x double]** %9
%139 = load i32, i32* %15
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds [3 x double], [3 x double]* %138, i64 %140
%142 = getelementptr inbounds [3 x double], [3 x double]* %141, i64 0, i64 2
%143 = load double, double* %142
%144 = load double, double* %24
%145 = call double @llvm.fmuladd.f64(double %137, double %143, double %144)
store double %145, double* %24
br label %146
146: ; preds = %42
%147 = load i32, i32* %15
%148 = add nsw i32 %147, 1
store i32 %148, i32* %15
br label %38
149: ; preds = %38
%150 = load double, double* %25
%151 = load double, double* %17
%152 = fmul double %150, %151
%153 = load [2 x double]*, [2 x double]** %13
%154 = load i32, i32* %16
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds [2 x double], [2 x double]* %153, i64 %155
%157 = getelementptr inbounds [2 x double], [2 x double]* %156, i64 0, i64 0
store double %152, double* %157
%158 = load double, double* %25
%159 = load double, double* %18
%160 = fmul double %158, %159
%161 = load [2 x double]*, [2 x double]** %13
%162 = load i32, i32* %16
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds [2 x double], [2 x double]* %161, i64 %163
%165 = getelementptr inbounds [2 x double], [2 x double]* %164, i64 0, i64 1
store double %160, double* %165
%166 = load double, double* %25
%167 = load double, double* %19
%168 = fmul double %166, %167
%169 = load [6 x double]*, [6 x double]** %14
%170 = load i32, i32* %16
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds [6 x double], [6 x double]* %169, i64 %171
%173 = getelementptr inbounds [6 x double], [6 x double]* %172, i64 0, i64 0
store double %168, double* %173
%174 = load double, double* %25
%175 = load double, double* %20
%176 = fmul double %174, %175
%177 = load [6 x double]*, [6 x double]** %14
%178 = load i32, i32* %16
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds [6 x double], [6 x double]* %177, i64 %179
%181 = getelementptr inbounds [6 x double], [6 x double]* %180, i64 0, i64 1
store double %176, double* %181
%182 = load double, double* %25
%183 = load double, double* %21
%184 = fmul double %182, %183
%185 = load [6 x double]*, [6 x double]** %14
%186 = load i32, i32* %16
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds [6 x double], [6 x double]* %185, i64 %187
%189 = getelementptr inbounds [6 x double], [6 x double]* %188, i64 0, i64 2
store double %184, double* %189
%190 = load double, double* %25
%191 = load double, double* %22
%192 = fmul double %190, %191
%193 = load [6 x double]*, [6 x double]** %14
%194 = load i32, i32* %16
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds [6 x double], [6 x double]* %193, i64 %195
%197 = getelementptr inbounds [6 x double], [6 x double]* %196, i64 0, i64 3
store double %192, double* %197
%198 = load double, double* %25
%199 = load double, double* %23
%200 = fmul double %198, %199
%201 = load [6 x double]*, [6 x double]** %14
%202 = load i32, i32* %16
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds [6 x double], [6 x double]* %201, i64 %203
%205 = getelementptr inbounds [6 x double], [6 x double]* %204, i64 0, i64 4
store double %200, double* %205
%206 = load double, double* %25
%207 = load double, double* %24
%208 = fmul double %206, %207
%209 = load [6 x double]*, [6 x double]** %14
%210 = load i32, i32* %16
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds [6 x double], [6 x double]* %209, i64 %211
%213 = getelementptr inbounds [6 x double], [6 x double]* %212, i64 0, i64 5
store double %208, double* %213
br label %214
214: ; preds = %149
%215 = load i32, i32* %16
%216 = add nsw i32 %215, 1
store i32 %216, i32* %16
br label %33
217: ; preds = %33
ret void
}

LLVM IR (-O2):
define void @rho_j_k([3 x double]* nocapture %0, [3 x double]* nocapture %1, i32 %2, [3 x double]* nocapture %3, i32 %4, [2 x double]* noalias nocapture writeonly %5, [6 x double]* noalias nocapture writeonly %6) {
%8 = sitofp i32 %2 to double
%9 = tail call double @sqrt(double %8)
%10 = fdiv double 1.000000e+00, %9
%11 = icmp sgt i32 %4, 0
br i1 %11, label %12, label %93
12: ; preds = %7
%13 = icmp sgt i32 %2, 0
%14 = zext i32 %4 to i64
%15 = zext i32 %2 to i64
%16 = insertelement <2 x double> poison, double %10, i64 0
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> zeroinitializer
%18 = insertelement <2 x double> poison, double %10, i64 0
%19 = shufflevector <2 x double> %18, <2 x double> poison, <2 x i32> zeroinitializer
%20 = insertelement <2 x double> poison, double %10, i64 0
%21 = shufflevector <2 x double> %20, <2 x double> poison, <2 x i32> zeroinitializer
%22 = insertelement <2 x double> poison, double %10, i64 0
%23 = shufflevector <2 x double> %22, <2 x double> poison, <2 x i32> zeroinitializer
br label %24
24: ; preds = %12, %74
%25 = phi i64 [ 0, %12 ], [ %91, %74 ]
br i1 %13, label %26, label %74
26: ; preds = %24
%27 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 %25, i64 0
%28 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 %25, i64 1
%29 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 %25, i64 2
br label %30
30: ; preds = %26, %30
%31 = phi i64 [ 0, %26 ], [ %68, %30 ]
%32 = phi <2 x double> [ zeroinitializer, %26 ], [ %52, %30 ]
%33 = phi <2 x double> [ zeroinitializer, %26 ], [ %57, %30 ]
%34 = phi <2 x double> [ zeroinitializer, %26 ], [ %62, %30 ]
%35 = phi <2 x double> [ zeroinitializer, %26 ], [ %67, %30 ]
%36 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %31, i64 0
%37 = load double, double* %36
%38 = load double, double* %27
%39 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %31, i64 1
%40 = load double, double* %39
%41 = load double, double* %28
%42 = fmul double %40, %41
%43 = tail call double @llvm.fmuladd.f64(double %37, double %38, double %42)
%44 = getelementptr inbounds [3 x double], [3 x double]* %0, i64 %31, i64 2
%45 = load double, double* %44
%46 = load double, double* %29
%47 = tail call double @llvm.fmuladd.f64(double %45, double %46, double %43)
%48 = tail call double @cos(double %47)
%49 = tail call double @sin(double %47)
%50 = insertelement <2 x double> poison, double %48, i64 0
%51 = insertelement <2 x double> %50, double %49, i64 1
%52 = fadd <2 x double> %32, %51
%53 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %31, i64 0
%54 = load double, double* %53
%55 = insertelement <2 x double> poison, double %54, i64 0
%56 = shufflevector <2 x double> %55, <2 x double> poison, <2 x i32> zeroinitializer
%57 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %51, <2 x double> %56, <2 x double> %33)
%58 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %31, i64 1
%59 = load double, double* %58
%60 = insertelement <2 x double> poison, double %59, i64 0
%61 = shufflevector <2 x double> %60, <2 x double> poison, <2 x i32> zeroinitializer
%62 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %51, <2 x double> %61, <2 x double> %34)
%63 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 %31, i64 2
%64 = load double, double* %63
%65 = insertelement <2 x double> poison, double %64, i64 0
%66 = shufflevector <2 x double> %65, <2 x double> poison, <2 x i32> zeroinitializer
%67 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %51, <2 x double> %66, <2 x double> %35)
%68 = add nuw nsw i64 %31, 1
%69 = icmp eq i64 %68, %15
br i1 %69, label %70, label %30
70: ; preds = %30
%71 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %51, <2 x double> %66, <2 x double> %35)
%72 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %51, <2 x double> %61, <2 x double> %34)
%73 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %51, <2 x double> %56, <2 x double> %33)
br label %74
74: ; preds = %70, %24
%75 = phi <2 x double> [ zeroinitializer, %24 ], [ %52, %70 ]
%76 = phi <2 x double> [ zeroinitializer, %24 ], [ %73, %70 ]
%77 = phi <2 x double> [ zeroinitializer, %24 ], [ %72, %70 ]
%78 = phi <2 x double> [ zeroinitializer, %24 ], [ %71, %70 ]
%79 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 %25, i64 0
%80 = fmul <2 x double> %17, %75
%81 = bitcast double* %79 to <2 x double>*
store <2 x double> %80, <2 x double>* %81
%82 = getelementptr inbounds [6 x double], [6 x double]* %6, i64 %25, i64 0
%83 = fmul <2 x double> %19, %76
%84 = bitcast double* %82 to <2 x double>*
store <2 x double> %83, <2 x double>* %84
%85 = getelementptr inbounds [6 x double], [6 x double]* %6, i64 %25, i64 2
%86 = fmul <2 x double> %21, %77
%87 = bitcast double* %85 to <2 x double>*
store <2 x double> %86, <2 x double>* %87
%88 = getelementptr inbounds [6 x double], [6 x double]* %6, i64 %25, i64 4
%89 = fmul <2 x double> %23, %78
%90 = bitcast double* %88 to <2 x double>*
store <2 x double> %89, <2 x double>* %90
%91 = add nuw nsw i64 %25, 1
%92 = icmp eq i64 %91, %14
br i1 %92, label %93, label %24
93: ; preds = %74, %7
ret void
}