void coreGTRCAT(int lower, int upper, int numberOfCategories, double *sum,
                double *d1, double *d2, double *wrptr, double *wr2ptr,
                double *rptr, double *EIGN, int *cptr, double lz) {
  int i;
  double *d, *d_start, tmp_0, tmp_1, tmp_2, inv_Li, dlnLidlz, d2lnLidlz2,
      dlnLdlz = 0.0, d2lnLdlz2 = 0.0;
  double e[6];
  double dd1, dd2, dd3;
  e[0] = EIGN[0];
  e[1] = EIGN[0] * EIGN[0];
  e[2] = EIGN[1];
  e[3] = EIGN[1] * EIGN[1];
  e[4] = EIGN[2];
  e[5] = EIGN[2] * EIGN[2];
  d = d_start = (double *)malloc(numberOfCategories * 3 * sizeof(double));
  dd1 = e[0] * lz;
  dd2 = e[2] * lz;
  dd3 = e[4] * lz;
  for (i = 0; i < numberOfCategories; i++) {
    *d++ = exp(dd1 * rptr[i]);
    *d++ = exp(dd2 * rptr[i]);
    *d++ = exp(dd3 * rptr[i]);
  }
  for (i = lower; i < upper; i++) {
    d = &d_start[3 * cptr[i]];
    inv_Li = sum[4 * i];
    inv_Li += (tmp_0 = d[0] * sum[4 * i + 1]);
    inv_Li += (tmp_1 = d[1] * sum[4 * i + 2]);
    inv_Li += (tmp_2 = d[2] * sum[4 * i + 3]);
    inv_Li = 1.0 / inv_Li;
    dlnLidlz = tmp_0 * e[0];
    d2lnLidlz2 = tmp_0 * e[1];
    dlnLidlz += tmp_1 * e[2];
    d2lnLidlz2 += tmp_1 * e[3];
    dlnLidlz += tmp_2 * e[4];
    d2lnLidlz2 += tmp_2 * e[5];
    dlnLidlz *= inv_Li;
    d2lnLidlz2 *= inv_Li;
    dlnLdlz += wrptr[i] * dlnLidlz;
    d2lnLdlz2 += wr2ptr[i] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
  }
  *d1 = dlnLdlz;
  *d2 = d2lnLdlz2;
  free(d_start);
}


x86 assembly (clang, -O0):
<coreGTRCAT>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x28(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    0x28(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
mov    0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    0x28(%rbp),%rax
mulsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
imul   $0x3,-0xc(%rbp),%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    %rax,-0x40(%rbp)
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12f9 <coreGTRCAT+0x1c9>
movsd  -0xc8(%rbp),%xmm0
ff
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   1050 <exp@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x40(%rbp)
movsd  %xmm0,(%rax)
movsd  -0xd0(%rbp),%xmm0
ff
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   1050 <exp@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x40(%rbp)
movsd  %xmm0,(%rax)
movsd  -0xd8(%rbp),%xmm0
ff
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
call   1050 <exp@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x40(%rbp)
movsd  %xmm0,(%rax)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1258 <coreGTRCAT+0x128>
mov    -0x4(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    151b <coreGTRCAT+0x3eb>
mov    -0x48(%rbp),%rax
mov    0x30(%rbp),%rcx
movslq -0x34(%rbp),%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x40(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x40(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
addsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xc32(%rip),%xmm0
divsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x70(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x78(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0xb0(%rbp),%xmm2
ff
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0xa0(%rbp),%xmm2
ff
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x98(%rbp),%xmm2
ff
movsd  -0x78(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x68(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x70(%rbp),%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12ff <coreGTRCAT+0x1cf>
movsd  -0x80(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coreGTRCAT>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
movsd  %xmm0,(%rsp)
mov    %r9,0x50(%rsp)
mov    %r8,0x48(%rsp)
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %esi,0xc(%rsp)
mov    %rdi,0x40(%rsp)
mov    0xc0(%rsp),%rax
mov    %rax,0x30(%rsp)
mov    0xb0(%rsp),%r15
mov    0xa8(%rsp),%rax
mov    %rax,0x38(%rsp)
mov    0xa0(%rsp),%rax
mov    %rax,0x28(%rsp)
mov    0xb8(%rsp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rax),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x10(%rax),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    (%r14,%r14,2),%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,%r12
test   %r14d,%r14d
jle    1261 <coreGTRCAT+0x131>
movsd  0x20(%rsp),%xmm1
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x60(%rsp)
movsd  0x18(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x58(%rsp)
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %r14d,%r14d
xor    %ebp,%ebp
mov    %r12,%r13
nopw   0x0(%rax,%rax,1)
movsd  (%r15,%rbp,8),%xmm0
mulsd  0x60(%rsp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x0(%r13)
movsd  (%r15,%rbp,8),%xmm0
mulsd  0x58(%rsp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x8(%r13)
movsd  (%r15,%rbp,8),%xmm0
mulsd  (%rsp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x10(%r13)
add    $0x1,%rbp
add    $0x18,%r13
cmp    %rbp,%r14
jne    1210 <coreGTRCAT+0xe0>
xorpd  %xmm5,%xmm5
mov    0x40(%rsp),%r11
mov    0xc(%rsp),%eax
cmp    %eax,%r11d
jge    13c3 <coreGTRCAT+0x293>
movsd  0x20(%rsp),%xmm11
movapd %xmm11,%xmm9
mulsd  %xmm11,%xmm9
movsd  0x18(%rsp),%xmm12
movapd %xmm12,%xmm10
mulsd  %xmm12,%xmm10
movsd  0x10(%rsp),%xmm13
movapd %xmm13,%xmm2
mulsd  %xmm13,%xmm2
movslq %r11d,%rdi
cltq
shl    $0x2,%r11d
mov    0x30(%rsp),%rcx
lea    (%rcx,%rdi,4),%r8
mov    0x28(%rsp),%rcx
lea    (%rcx,%rdi,8),%r9
mov    0x38(%rsp),%rcx
lea    (%rcx,%rdi,8),%r10
sub    %rdi,%rax
xorpd  %xmm3,%xmm3
xor    %edi,%edi
movsd  0xd20(%rip),%xmm8
movslq (%r8,%rdi,1),%rbp
lea    0x0(%rbp,%rbp,2),%rbp
lea    (%r11,%rdi,1),%rcx
movslq %ecx,%rcx
lea    0x1(%rcx),%edx
movsd  (%r12,%rbp,8),%xmm6
movslq %edx,%rdx
lea    0x2(%rcx),%esi
mulsd  (%rbx,%rdx,8),%xmm6
movslq %esi,%rdx
lea    0x3(%rcx),%esi
movslq %esi,%rsi
movsd  (%rbx,%rcx,8),%xmm7
movsd  (%rbx,%rdx,8),%xmm4
movhpd (%rbx,%rsi,8),%xmm4
addsd  %xmm6,%xmm7
movupd 0x8(%r12,%rbp,8),%xmm5
mulpd  %xmm5,%xmm4
addsd  %xmm4,%xmm7
movapd %xmm4,%xmm5
unpckhpd %xmm4,%xmm5
addsd  %xmm5,%xmm7
movapd %xmm8,%xmm0
divsd  %xmm7,%xmm0
movapd %xmm11,%xmm7
mulsd  %xmm6,%xmm7
movapd %xmm4,%xmm1
mulsd  %xmm9,%xmm6
mulsd  %xmm12,%xmm1
addsd  %xmm7,%xmm1
mulsd  %xmm10,%xmm4
movapd %xmm5,%xmm7
addsd  %xmm6,%xmm4
mulsd  %xmm13,%xmm7
addsd  %xmm1,%xmm7
mulsd  %xmm2,%xmm5
addsd  %xmm4,%xmm5
mulsd  %xmm0,%xmm7
mulsd  %xmm0,%xmm5
movapd %xmm7,%xmm0
mulsd  %xmm7,%xmm0
subsd  %xmm0,%xmm5
movsd  (%r10,%rdi,2),%xmm0
movhpd (%r9,%rdi,2),%xmm0
unpcklpd %xmm7,%xmm5
movapd %xmm3,%xmm6
mulpd  %xmm0,%xmm5
movapd %xmm5,%xmm3
addpd  %xmm6,%xmm3
add    $0x4,%rdi
add    $0xffffffffffffffff,%rax
jne    12e0 <coreGTRCAT+0x1b0>
addpd  %xmm6,%xmm5
mov    0x48(%rsp),%rax
movhpd %xmm5,(%rax)
mov    0x50(%rsp),%rax
movlpd %xmm5,(%rax)
mov    %r12,%rdi
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @coreGTRCAT(i32 %0, i32 %1, i32 %2, double* nocapture %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture %6, double* nocapture %7, double* nocapture %8, double* nocapture %9, i32* nocapture %10, double %11) {
%13 = load double, double* %9
%14 = fmul double %13, %13
%15 = getelementptr inbounds double, double* %9, i64 1
%16 = load double, double* %15
%17 = fmul double %16, %16
%18 = getelementptr inbounds double, double* %9, i64 2
%19 = load double, double* %18
%20 = fmul double %19, %19
%21 = mul nsw i32 %2, 3
%22 = sext i32 %21 to i64
%23 = shl nsw i64 %22, 3
%24 = tail call i8* @malloc(i64 %23)
%25 = bitcast i8* %24 to double*
%26 = fmul double %13, %11
%27 = fmul double %16, %11
%28 = fmul double %19, %11
%29 = icmp sgt i32 %2, 0
br i1 %29, label %30, label %32
30: ; preds = %12
%31 = zext i32 %2 to i64
br label %37
32: ; preds = %37, %12
%33 = icmp slt i32 %0, %1
br i1 %33, label %34, label %117
34: ; preds = %32
%35 = sext i32 %0 to i64
%36 = sext i32 %1 to i64
br label %55
37: ; preds = %30, %37
%38 = phi i64 [ 0, %30 ], [ %53, %37 ]
%39 = phi double* [ %25, %30 ], [ %52, %37 ]
%40 = getelementptr inbounds double, double* %8, i64 %38
%41 = load double, double* %40
%42 = fmul double %26, %41
%43 = tail call double @exp(double %42)
%44 = getelementptr inbounds double, double* %39, i64 1
store double %43, double* %39
%45 = load double, double* %40
%46 = fmul double %27, %45
%47 = tail call double @exp(double %46)
%48 = getelementptr inbounds double, double* %39, i64 2
store double %47, double* %44
%49 = load double, double* %40
%50 = fmul double %28, %49
%51 = tail call double @exp(double %50)
%52 = getelementptr inbounds double, double* %39, i64 3
store double %51, double* %48
%53 = add nuw nsw i64 %38, 1
%54 = icmp eq i64 %53, %31
br i1 %54, label %32, label %37
55: ; preds = %34, %55
%56 = phi i64 [ %35, %34 ], [ %113, %55 ]
%57 = phi <2 x double> [ zeroinitializer, %34 ], [ %112, %55 ]
%58 = trunc i64 %56 to i32
%59 = getelementptr inbounds i32, i32* %10, i64 %56
%60 = load i32, i32* %59
%61 = mul nsw i32 %60, 3
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %25, i64 %62
%64 = shl nsw i32 %58, 2
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %3, i64 %65
%67 = load double, double* %66
%68 = load double, double* %63
%69 = or i32 %64, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %3, i64 %70
%72 = load double, double* %71
%73 = fmul double %68, %72
%74 = fadd double %67, %73
%75 = getelementptr inbounds double, double* %63, i64 1
%76 = or i32 %64, 2
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds double, double* %3, i64 %77
%79 = load double, double* %78
%80 = bitcast double* %75 to <2 x double>*
%81 = load <2 x double>, <2 x double>* %80
%82 = or i32 %64, 3
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %3, i64 %83
%85 = load double, double* %84
%86 = insertelement <2 x double> poison, double %79, i64 0
%87 = insertelement <2 x double> %86, double %85, i64 1
%88 = fmul <2 x double> %81, %87
%89 = extractelement <2 x double> %88, i64 0
%90 = fadd double %74, %89
%91 = extractelement <2 x double> %88, i64 1
%92 = fadd double %90, %91
%93 = fdiv double 1.000000e+00, %92
%94 = fmul double %13, %73
%95 = fmul double %14, %73
%96 = tail call double @llvm.fmuladd.f64(double %89, double %16, double %94)
%97 = tail call double @llvm.fmuladd.f64(double %89, double %17, double %95)
%98 = tail call double @llvm.fmuladd.f64(double %91, double %19, double %96)
%99 = tail call double @llvm.fmuladd.f64(double %91, double %20, double %97)
%100 = fmul double %98, %93
%101 = fmul double %99, %93
%102 = getelementptr inbounds double, double* %6, i64 %56
%103 = load double, double* %102
%104 = getelementptr inbounds double, double* %7, i64 %56
%105 = load double, double* %104
%106 = fneg double %100
%107 = tail call double @llvm.fmuladd.f64(double %106, double %100, double %101)
%108 = insertelement <2 x double> poison, double %105, i64 0
%109 = insertelement <2 x double> %108, double %103, i64 1
%110 = insertelement <2 x double> poison, double %107, i64 0
%111 = insertelement <2 x double> %110, double %100, i64 1
%112 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %109, <2 x double> %111, <2 x double> %57)
%113 = add nsw i64 %56, 1
%114 = icmp eq i64 %113, %36
br i1 %114, label %115, label %55
115: ; preds = %55
%116 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %109, <2 x double> %111, <2 x double> %57)
br label %117
117: ; preds = %115, %32
%118 = phi <2 x double> [ zeroinitializer, %32 ], [ %116, %115 ]
%119 = extractelement <2 x double> %118, i64 1
store double %119, double* %4
%120 = extractelement <2 x double> %118, i64 0
store double %120, double* %5
tail call void @free(i8* %24)
ret void
}