void get_amr_index_xyz(int nq, int i, int j, int k, int pBasis, int nX, int nY,
                       int nZ, int nf, double *xlo, double *dx, double qnodes[],
                       int *index, double *xyz) {
  int base;
  int starting_entry;
  int ind = 0;
  int two_nf = 2 * nf;
  int qp_1d = pBasis + 1;
  int grid_stride = nq * (nX + two_nf) * (nY + two_nf) * (nZ + two_nf);
  int z_stride = grid_stride * (qp_1d * qp_1d);
  int y_stride = grid_stride * (qp_1d);
  double cell_xlo = xlo[0] + i * dx[0];
  double cell_ylo = xlo[1] + j * dx[1];
  double cell_zlo = xlo[2] + k * dx[2];
  double half_dx = 0.5 * dx[0];
  double half_dy = 0.5 * dx[1];
  double half_dz = 0.5 * dx[2];
  double yco = 0.0;
  double zco = 0.0;
  int x, y, z;
  starting_entry = (nY + two_nf) * (nX + two_nf) * (k + nf) +
                   (nX + two_nf) * (j + nf) + (i + nf);
  for (z = 0; z < qp_1d; z++) {
    zco = cell_zlo + half_dz * (1.0 + qnodes[z]);
    for (y = 0; y < qp_1d; y++) {
      yco = cell_ylo + half_dy * (1.0 + qnodes[y]);
      for (x = 0; x < qp_1d; x++) {
        index[ind] = starting_entry + z_stride * (z) + y_stride * (y) +
                     grid_stride * (x);
        base = 3 * ind;
        xyz[base] = cell_xlo + half_dx * (1.0 + qnodes[x]);
        xyz[base + 1] = yco;
        xyz[base + 2] = zco;
        ind++;
      }
    }
  }
}


x86 assembly (clang, -O0):
<get_amr_index_xyz>:
push   %rbp
mov    %rsp,%rbp
push   %rax
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    0x20(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    -0x28(%rbp),%ecx
imul   %ecx,%eax
mov    0x10(%rbp),%ecx
add    -0x28(%rbp),%ecx
imul   %ecx,%eax
mov    0x18(%rbp),%ecx
add    -0x28(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x2c(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
imul   -0x2c(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm1
cvtsi2sdl -0x8(%rbp),%xmm0
mov    0x30(%rbp),%rax
movsd  (%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    0x28(%rbp),%rax
movsd  0x8(%rax),%xmm1
cvtsi2sdl -0xc(%rbp),%xmm0
mov    0x30(%rbp),%rax
movsd  0x8(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0x28(%rbp),%rax
movsd  0x10(%rax),%xmm1
cvtsi2sdl -0x10(%rbp),%xmm0
mov    0x30(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    0x30(%rbp),%rax
movsd  0xe00(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    0x30(%rbp),%rax
movsd  0xdeb(%rip),%xmm0
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    0x30(%rbp),%rax
movsd  0xdd5(%rip),%xmm0
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    0x10(%rbp),%eax
add    -0x28(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    -0x28(%rbp),%ecx
imul   %ecx,%eax
mov    -0x10(%rbp),%ecx
add    0x20(%rbp),%ecx
imul   %ecx,%eax
mov    -0x18(%rbp),%ecx
add    -0x28(%rbp),%ecx
mov    -0xc(%rbp),%edx
add    0x20(%rbp),%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
add    0x20(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13eb <get_amr_index_xyz+0x2eb>
movsd  -0x50(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm0
mov    0x38(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  0xd59(%rip),%xmm2
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13d2 <get_amr_index_xyz+0x2d2>
movsd  -0x48(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
mov    0x38(%rbp),%rax
movslq -0x80(%rbp),%rcx
movsd  0xd1a(%rip),%xmm2
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    13bf <get_amr_index_xyz+0x2bf>
mov    -0x20(%rbp),%edx
mov    -0x34(%rbp),%eax
imul   -0x84(%rbp),%eax
add    %eax,%edx
mov    -0x38(%rbp),%eax
imul   -0x80(%rbp),%eax
add    %eax,%edx
mov    -0x30(%rbp),%eax
imul   -0x7c(%rbp),%eax
add    %eax,%edx
mov    0x40(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
imul   $0x3,-0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
mov    0x38(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  0xca8(%rip),%xmm2
addsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x48(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x70(%rbp),%xmm0
mov    0x48(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x78(%rbp),%xmm0
mov    0x48(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1307 <get_amr_index_xyz+0x207>
jmp    13c4 <get_amr_index_xyz+0x2c4>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    12c8 <get_amr_index_xyz+0x1c8>
jmp    13d7 <get_amr_index_xyz+0x2d7>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1283 <get_amr_index_xyz+0x183>
add    $0x8,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_amr_index_xyz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
test   %r8d,%r8d
js     155b <get_amr_index_xyz+0x45b>
mov    0xa8(%rsp),%r11
mov    0x98(%rsp),%r10
mov    0x80(%rsp),%ebx
mov    0x88(%rsp),%r14
mov    0x90(%rsp),%rax
lea    (%rbx,%rbx,1),%r13d
add    $0x1,%r8d
lea    (%r9,%rbx,2),%r15d
mov    0x70(%rsp),%ebp
add    %r13d,%ebp
cvtsi2sd %esi,%xmm14
movsd  (%rax),%xmm10
mulsd  %xmm10,%xmm14
addsd  (%r14),%xmm14
movsd  0x8(%rax),%xmm6
cvtsi2sd %edx,%xmm7
mulsd  %xmm6,%xmm7
addsd  0x8(%r14),%xmm7
cvtsi2sd %ecx,%xmm2
movsd  0x10(%rax),%xmm3
mulsd  %xmm3,%xmm2
addsd  0x10(%r14),%xmm2
movsd  %xmm2,-0x60(%rsp)
movsd  0xe67(%rip),%xmm2
mulsd  %xmm2,%xmm10
mulsd  %xmm2,%xmm6
mulsd  %xmm2,%xmm3
movsd  %xmm3,-0x68(%rsp)
add    %ebx,%ecx
add    0x78(%rsp),%r13d
imul   %edi,%r13d
add    %ebx,%edx
add    %esi,%ebx
mov    %r8d,%r9d
lea    (%r9,%r9,2),%rax
lea    (%r11,%rax,8),%rax
mov    %rax,-0x30(%rsp)
lea    (%r10,%r9,8),%rax
mov    %rax,-0x28(%rsp)
mov    %r9,-0x80(%rsp)
and    $0xfffffffe,%r9d
movd   %r13d,%xmm2
pshufd $0x50,%xmm2,%xmm0
movd   %ecx,%xmm2
pshufd $0x50,%xmm2,%xmm5
movd   %ebp,%xmm2
pshufd $0x50,%xmm2,%xmm1
movd   %edx,%xmm2
pshufd $0x50,%xmm2,%xmm13
movd   %r15d,%xmm2
pshufd $0x50,%xmm2,%xmm2
mov    %rbx,-0x18(%rsp)
movd   %ebx,%xmm3
pshufd $0x50,%xmm3,%xmm8
movapd %xmm10,%xmm12
unpcklpd %xmm10,%xmm12
movapd %xmm14,%xmm9
unpcklpd %xmm14,%xmm9
lea    0x10(%r11),%rax
mov    %rax,-0x20(%rsp)
mov    %r8d,%eax
imul   %r8d,%eax
mov    %eax,-0x78(%rsp)
mov    %r13d,-0x6c(%rsp)
mov    %ebp,-0x74(%rsp)
imul   %ebp,%r13d
mov    %r15d,-0x70(%rsp)
imul   %r15d,%r13d
xor    %r11d,%r11d
movsd  0xda3(%rip),%xmm3
xor    %eax,%eax
xor    %r15d,%r15d
movsd  %xmm6,-0x40(%rsp)
movsd  %xmm7,-0x48(%rsp)
movapd %xmm12,0x20(%rsp)
movapd %xmm9,0x10(%rsp)
movdqa %xmm8,(%rsp)
jmp    12ae <get_amr_index_xyz+0x1ae>
nopl   0x0(%rax)
mov    -0x58(%rsp),%rax
add    $0x1,%rax
mov    -0x50(%rsp),%r11
add    -0x78(%rsp),%r11d
cmp    -0x80(%rsp),%rax
je     155b <get_amr_index_xyz+0x45b>
movsd  (%r10,%rax,8),%xmm15
addsd  %xmm3,%xmm15
mulsd  -0x68(%rsp),%xmm15
addsd  -0x60(%rsp),%xmm15
mov    %r8d,%esi
mov    %rax,-0x58(%rsp)
imul   %eax,%esi
mov    %rsi,-0x38(%rsp)
movapd %xmm15,%xmm4
unpcklpd %xmm15,%xmm4
movapd %xmm4,-0x10(%rsp)
mov    %r11,-0x50(%rsp)
xor    %r12d,%r12d
jmp    130e <get_amr_index_xyz+0x20e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12
add    %r8d,%r11d
cmp    -0x80(%rsp),%r12
je     1290 <get_amr_index_xyz+0x190>
movsd  (%r10,%r12,8),%xmm11
addsd  %xmm3,%xmm11
mulsd  %xmm6,%xmm11
addsd  %xmm7,%xmm11
movslq %r15d,%rdi
cmp    $0x2,%r8d
jb     135c <get_amr_index_xyz+0x25c>
lea    0x0(,%rdi,8),%rax
lea    (%rax,%rax,2),%rax
mov    0xa8(%rsp),%rsi
add    %rax,%rsi
cmp    -0x28(%rsp),%rsi
jae    13f0 <get_amr_index_xyz+0x2f0>
add    -0x30(%rsp),%rax
cmp    %r10,%rax
jbe    13f0 <get_amr_index_xyz+0x2f0>
mov    %rdi,%r15
xor    %esi,%esi
mov    0xa0(%rsp),%rax
lea    (%rax,%r15,4),%r14
lea    (%r15,%r15,2),%rax
mov    -0x20(%rsp),%rdi
lea    (%rdi,%rax,8),%rax
lea    (%r10,%rsi,8),%rbx
lea    (%r11,%rsi,1),%ebp
imul   -0x6c(%rsp),%ebp
add    %ecx,%ebp
imul   -0x74(%rsp),%ebp
add    %edx,%ebp
imul   -0x70(%rsp),%ebp
add    -0x18(%rsp),%ebp
mov    -0x80(%rsp),%rdi
sub    %rsi,%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebp,(%r14,%rsi,4)
movsd  (%rbx,%rsi,8),%xmm4
addsd  %xmm3,%xmm4
mulsd  %xmm10,%xmm4
addsd  %xmm14,%xmm4
movsd  %xmm4,-0x10(%rax)
movsd  %xmm11,-0x8(%rax)
movsd  %xmm15,(%rax)
add    $0x1,%rsi
add    $0x18,%rax
add    %r13d,%ebp
cmp    %rsi,%rdi
jne    13b0 <get_amr_index_xyz+0x2b0>
add    %rsi,%r15
jmp    1300 <get_amr_index_xyz+0x200>
nop
mov    %edx,%ebp
mov    %ecx,%ebx
mov    -0x38(%rsp),%rax
lea    (%rax,%r12,1),%edx
mov    %r8d,%eax
imul   %r8d,%edx
lea    (%rdi,%r9,1),%r15
movd   %edx,%xmm7
pshufd $0x50,%xmm7,%xmm8
movapd %xmm11,%xmm9
unpcklpd %xmm11,%xmm9
mov    0xa0(%rsp),%rcx
lea    (%rcx,%rdi,4),%r14
lea    (%rdi,%rdi,2),%rcx
mov    0xa8(%rsp),%rdx
lea    (%rdx,%rcx,8),%rcx
xor    %edx,%edx
movdqa 0xbcd(%rip),%xmm12
movapd -0x10(%rsp),%xmm3
nopl   0x0(%rax)
movdqa %xmm8,%xmm7
paddd  %xmm12,%xmm7
movdqa %xmm0,%xmm6
pmuludq %xmm7,%xmm6
pshufd $0xf5,%xmm7,%xmm7
movdqa %xmm13,%xmm4
pshufd $0xf5,%xmm0,%xmm13
pmuludq %xmm7,%xmm13
pshufd $0xe8,%xmm6,%xmm6
pshufd $0xe8,%xmm13,%xmm7
movdqa %xmm4,%xmm13
punpckldq %xmm7,%xmm6
paddd  %xmm5,%xmm6
pshufd $0xf5,%xmm6,%xmm7
pmuludq %xmm1,%xmm6
pshufd $0xf5,%xmm1,%xmm4
pmuludq %xmm7,%xmm4
pshufd $0xe8,%xmm6,%xmm6
pshufd $0xe8,%xmm4,%xmm4
punpckldq %xmm4,%xmm6
paddd  %xmm13,%xmm6
pshufd $0xf5,%xmm6,%xmm4
pshufd $0xf5,%xmm2,%xmm7
pmuludq %xmm4,%xmm7
pmuludq %xmm2,%xmm6
punpckldq %xmm7,%xmm6
paddd  (%rsp),%xmm6
movq   %xmm6,(%r14,%rdx,4)
movupd (%r10,%rdx,8),%xmm4
addpd  0xb3d(%rip),%xmm4
mulpd  0x20(%rsp),%xmm4
addpd  0x10(%rsp),%xmm4
movapd %xmm9,%xmm6
unpckhpd %xmm3,%xmm6
movupd %xmm6,0x20(%rcx)
movapd %xmm4,%xmm6
movsd  %xmm3,%xmm4
movupd %xmm4,0x10(%rcx)
unpcklpd %xmm9,%xmm6
movupd %xmm6,(%rcx)
add    $0x2,%rdx
paddd  0xb10(%rip),%xmm12
add    $0x30,%rcx
cmp    %rdx,%r9
jne    1450 <get_amr_index_xyz+0x350>
mov    %r9,%rsi
cmp    -0x80(%rsp),%r9
mov    %ebx,%ecx
mov    %eax,%r8d
mov    %ebp,%edx
movsd  -0x40(%rsp),%xmm6
movsd  -0x48(%rsp),%xmm7
movsd  0xab8(%rip),%xmm3
je     1300 <get_amr_index_xyz+0x200>
jmp    1361 <get_amr_index_xyz+0x261>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @get_amr_index_xyz(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, double* nocapture %9, double* nocapture %10, double* nocapture %11, i32* nocapture writeonly %12, double* nocapture writeonly %13) {
%15 = shl nsw i32 %8, 1
%16 = add i32 %4, 1
%17 = add nsw i32 %15, %5
%18 = add nsw i32 %15, %6
%19 = load double, double* %9
%20 = sitofp i32 %1 to double
%21 = load double, double* %10
%22 = tail call double @llvm.fmuladd.f64(double %20, double %21, double %19)
%23 = getelementptr inbounds double, double* %9, i64 1
%24 = load double, double* %23
%25 = sitofp i32 %2 to double
%26 = getelementptr inbounds double, double* %10, i64 1
%27 = load double, double* %26
%28 = tail call double @llvm.fmuladd.f64(double %25, double %27, double %24)
%29 = getelementptr inbounds double, double* %9, i64 2
%30 = load double, double* %29
%31 = sitofp i32 %3 to double
%32 = getelementptr inbounds double, double* %10, i64 2
%33 = load double, double* %32
%34 = tail call double @llvm.fmuladd.f64(double %31, double %33, double %30)
%35 = fmul double %21, 5.000000e-01
%36 = fmul double %27, 5.000000e-01
%37 = fmul double %33, 5.000000e-01
%38 = add nsw i32 %8, %3
%39 = icmp slt i32 %4, 0
br i1 %39, label %166, label %40
40: ; preds = %14
%41 = add nsw i32 %15, %7
%42 = mul i32 %41, %0
%43 = add i32 %8, %2
%44 = add i32 %8, %1
%45 = zext i32 %16 to i64
%46 = mul nuw nsw i64 %45, 3
%47 = getelementptr double, double* %13, i64 %46
%48 = getelementptr double, double* %11, i64 %45
%49 = icmp ult i32 %16, 2
%50 = and i64 %45, 4294967294
%51 = insertelement <2 x i32> poison, i32 %42, i64 0
%52 = shufflevector <2 x i32> %51, <2 x i32> poison, <2 x i32> zeroinitializer
%53 = insertelement <2 x i32> poison, i32 %38, i64 0
%54 = shufflevector <2 x i32> %53, <2 x i32> poison, <2 x i32> zeroinitializer
%55 = insertelement <2 x i32> poison, i32 %18, i64 0
%56 = shufflevector <2 x i32> %55, <2 x i32> poison, <2 x i32> zeroinitializer
%57 = insertelement <2 x i32> poison, i32 %43, i64 0
%58 = shufflevector <2 x i32> %57, <2 x i32> poison, <2 x i32> zeroinitializer
%59 = insertelement <2 x i32> poison, i32 %17, i64 0
%60 = shufflevector <2 x i32> %59, <2 x i32> poison, <2 x i32> zeroinitializer
%61 = insertelement <2 x i32> poison, i32 %44, i64 0
%62 = shufflevector <2 x i32> %61, <2 x i32> poison, <2 x i32> zeroinitializer
%63 = insertelement <2 x double> poison, double %35, i64 0
%64 = shufflevector <2 x double> %63, <2 x double> poison, <2 x i32> zeroinitializer
%65 = insertelement <2 x double> poison, double %22, i64 0
%66 = shufflevector <2 x double> %65, <2 x double> poison, <2 x i32> zeroinitializer
%67 = icmp eq i64 %50, %45
br label %68
68: ; preds = %163, %40
%69 = phi i64 [ 0, %40 ], [ %164, %163 ]
%70 = phi i64 [ 0, %40 ], [ %160, %163 ]
%71 = getelementptr inbounds double, double* %11, i64 %69
%72 = load double, double* %71
%73 = fadd double %72, 1.000000e+00
%74 = tail call double @llvm.fmuladd.f64(double %37, double %73, double %34)
%75 = trunc i64 %69 to i32
%76 = mul i32 %16, %75
%77 = insertelement <2 x double> poison, double %74, i64 0
%78 = shufflevector <2 x double> %77, <2 x double> poison, <4 x i32> <i32 0, i32 0, i32 undef, i32 undef>
br label %79
79: ; preds = %159, %68
%80 = phi i64 [ 0, %68 ], [ %161, %159 ]
%81 = phi i64 [ %70, %68 ], [ %160, %159 ]
%82 = getelementptr inbounds double, double* %11, i64 %80
%83 = load double, double* %82
%84 = fadd double %83, 1.000000e+00
%85 = tail call double @llvm.fmuladd.f64(double %36, double %84, double %28)
%86 = trunc i64 %80 to i32
%87 = add i32 %76, %86
%88 = mul i32 %87, %16
%89 = shl i64 %81, 32
%90 = ashr exact i64 %89, 32
br i1 %49, label %131, label %91
91: ; preds = %79
%92 = mul nsw i64 %90, 3
%93 = getelementptr double, double* %13, i64 %92
%94 = getelementptr double, double* %47, i64 %92
%95 = icmp ult double* %93, %48
%96 = icmp ugt double* %94, %11
%97 = and i1 %95, %96
br i1 %97, label %131, label %98
98: ; preds = %91
%99 = add nsw i64 %90, %50
%100 = insertelement <2 x i32> poison, i32 %88, i64 0
%101 = shufflevector <2 x i32> %100, <2 x i32> poison, <2 x i32> zeroinitializer
%102 = insertelement <2 x double> poison, double %85, i64 0
%103 = shufflevector <2 x double> %102, <2 x double> poison, <2 x i32> zeroinitializer
br label %104
104: ; preds = %104, %98
%105 = phi i64 [ 0, %98 ], [ %127, %104 ]
%106 = phi <2 x i32> [ <i32 0, i32 1>, %98 ], [ %128, %104 ]
%107 = add i64 %90, %105
%108 = add <2 x i32> %101, %106
%109 = mul <2 x i32> %52, %108
%110 = add <2 x i32> %54, %109
%111 = mul <2 x i32> %110, %56
%112 = add <2 x i32> %58, %111
%113 = mul <2 x i32> %112, %60
%114 = add <2 x i32> %62, %113
%115 = getelementptr inbounds i32, i32* %12, i64 %107
%116 = bitcast i32* %115 to <2 x i32>*
store <2 x i32> %114, <2 x i32>* %116
%117 = mul nsw i64 %107, 3
%118 = getelementptr inbounds double, double* %11, i64 %105
%119 = bitcast double* %118 to <2 x double>*
%120 = load <2 x double>, <2 x double>* %119
%121 = fadd <2 x double> %120, <double 1.000000e+00, double 1.000000e+00>
%122 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %64, <2 x double> %121, <2 x double> %66)
%123 = getelementptr inbounds double, double* %13, i64 %117
%124 = bitcast double* %123 to <6 x double>*
%125 = shufflevector <2 x double> %122, <2 x double> %103, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
%126 = shufflevector <4 x double> %125, <4 x double> %78, <6 x i32> <i32 0, i32 2, i32 4, i32 1, i32 3, i32 5>
store <6 x double> %126, <6 x double>* %124
%127 = add nuw i64 %105, 2
%128 = add <2 x i32> %106, <i32 2, i32 2>
%129 = icmp eq i64 %127, %50
br i1 %129, label %130, label %104
130: ; preds = %104
br i1 %67, label %159, label %131
131: ; preds = %91, %79, %130
%132 = phi i64 [ %90, %91 ], [ %90, %79 ], [ %99, %130 ]
%133 = phi i64 [ 0, %91 ], [ 0, %79 ], [ %50, %130 ]
br label %134
134: ; preds = %131, %134
%135 = phi i64 [ %156, %134 ], [ %132, %131 ]
%136 = phi i64 [ %157, %134 ], [ %133, %131 ]
%137 = trunc i64 %136 to i32
%138 = add i32 %88, %137
%139 = mul i32 %42, %138
%140 = add i32 %38, %139
%141 = mul i32 %140, %18
%142 = add i32 %43, %141
%143 = mul i32 %142, %17
%144 = add i32 %44, %143
%145 = getelementptr inbounds i32, i32* %12, i64 %135
store i32 %144, i32* %145
%146 = mul nsw i64 %135, 3
%147 = getelementptr inbounds double, double* %11, i64 %136
%148 = load double, double* %147
%149 = fadd double %148, 1.000000e+00
%150 = tail call double @llvm.fmuladd.f64(double %35, double %149, double %22)
%151 = getelementptr inbounds double, double* %13, i64 %146
store double %150, double* %151
%152 = add nsw i64 %146, 1
%153 = getelementptr inbounds double, double* %13, i64 %152
store double %85, double* %153
%154 = add nsw i64 %146, 2
%155 = getelementptr inbounds double, double* %13, i64 %154
store double %74, double* %155
%156 = add nsw i64 %135, 1
%157 = add nuw nsw i64 %136, 1
%158 = icmp eq i64 %157, %45
br i1 %158, label %159, label %134
159: ; preds = %134, %130
%160 = phi i64 [ %99, %130 ], [ %156, %134 ]
%161 = add nuw nsw i64 %80, 1
%162 = icmp eq i64 %161, %45
br i1 %162, label %163, label %79
163: ; preds = %159
%164 = add nuw nsw i64 %69, 1
%165 = icmp eq i64 %164, %45
br i1 %165, label %166, label %68
166: ; preds = %163, %14
ret void
}