double evaluateGTRCAT(int *ex1, int *ex2, int *cptr, int *wptr,
                      double *x1_start, double *x2_start, double *EIGN,
                      double *rptr, double *tipVector, double pz, char *tipX1,
                      int lower, int n, int numberOfCategories) {
  double sum, z, lz, ki, lz1, lz2, lz3, term;
  int i;
  double *diagptable, *diagptable_start, *x1, *x2;
  z = pz;
  if (z < 1.0E-15)
    z = 1.0E-15;
  lz = log(z);
  lz1 = EIGN[0] * lz;
  lz2 = EIGN[1] * lz;
  lz3 = EIGN[2] * lz;
  diagptable = diagptable_start =
      (double *)malloc(sizeof(double) * numberOfCategories * 3);
  for (i = 0; i < numberOfCategories; i++) {
    ki = rptr[i];
    *diagptable++ = exp(ki * lz1);
    *diagptable++ = exp(ki * lz2);
    *diagptable++ = exp(ki * lz3);
  }
  sum = 0.0;
  if (tipX1) {
    for (i = lower; i < n; i++) {
      x1 = &(tipVector[4 * tipX1[i]]);
      x2 = &x2_start[4 * i];
      diagptable = &diagptable_start[3 * cptr[i]];
      term = x1[0] * x2[0];
      term += x1[1] * x2[1] * *diagptable++;
      term += x1[2] * x2[2] * *diagptable++;
      term += x1[3] * x2[3] * *diagptable++;
      term =
          log(term) +
          (ex2[i] *
           log((
               1.0 /
               115792089237316195423570985008687907853269984665640564039457584007913129639936.0)));
      sum += wptr[i] * term;
    }
    free(diagptable_start);
    return sum;
  }
  for (i = lower; i < n; i++) {
    x1 = &x1_start[4 * i];
    x2 = &x2_start[4 * i];
    diagptable = &diagptable_start[3 * cptr[i]];
    term = x1[0] * x2[0];
    term += x1[1] * x2[1] * *diagptable++;
    term += x1[2] * x2[2] * *diagptable++;
    term += x1[3] * x2[3] * *diagptable++;
    term =
        log(term) +
        ((ex1[i] + ex2[i]) *
         log((
             1.0 /
             115792089237316195423570985008687907853269984665640564039457584007913129639936.0)));
    sum += wptr[i] * term;
  }
  free(diagptable_start);
  return sum;
}


x86 assembly (clang, -O0):
<evaluateGTRCAT>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe6d(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    11ab <evaluateGTRCAT+0x6b>
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0x58(%rbp)
mov    0x10(%rbp),%rax
movsd  (%rax),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movslq 0x40(%rbp),%rax
shl    $0x3,%rax
imul   $0x3,%rax,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x98(%rbp)
mov    %rax,-0x90(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    0x40(%rbp),%eax
jge    12cb <evaluateGTRCAT+0x18b>
mov    0x18(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
call   1050 <exp@plt>
mov    -0x90(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x90(%rbp)
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x70(%rbp),%xmm0
call   1050 <exp@plt>
mov    -0x90(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x90(%rbp)
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
call   1050 <exp@plt>
mov    -0x90(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x90(%rbp)
movsd  %xmm0,(%rax)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    121b <evaluateGTRCAT+0xdb>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
cmpq   $0x0,0x28(%rbp)
je     14f3 <evaluateGTRCAT+0x3b3>
mov    0x30(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    0x38(%rbp),%eax
jge    14d8 <evaluateGTRCAT+0x398>
mov    0x20(%rbp),%rax
mov    0x28(%rbp),%rcx
movslq -0x84(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x84(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x98(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x84(%rbp),%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x90(%rbp)
mov    -0xa0(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0xa8(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0xa0(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0xa8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mov    -0x90(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x90(%rbp)
movsd  (%rax),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0xa0(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0xa8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
mov    -0x90(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x90(%rbp)
movsd  (%rax),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0xa0(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0xa8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
mov    -0x90(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x90(%rbp)
movsd  (%rax),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x18(%rbp),%rax
movslq -0x84(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  0xb90(%rip),%xmm0
call   1060 <log@plt>
movsd  -0xb8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x84(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  -0x80(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    12e7 <evaluateGTRCAT+0x1a7>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    170a <evaluateGTRCAT+0x5ca>
mov    0x30(%rbp),%eax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    0x38(%rbp),%eax
jge    16f4 <evaluateGTRCAT+0x5b4>
mov    -0x30(%rbp),%rax
mov    -0x84(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xa0(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x84(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0xa8(%rbp)
mov    -0x98(%rbp),%rax
mov    -0x20(%rbp),%rcx
movslq -0x84(%rbp),%rdx
imul   $0x3,(%rcx,%rdx,4),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x90(%rbp)
mov    -0xa0(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0xa8(%rbp),%rax
mulsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0xa0(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0xa8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mov    -0x90(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x90(%rbp)
movsd  (%rax),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0xa0(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0xa8(%rbp),%rax
mulsd  0x10(%rax),%xmm0
mov    -0x90(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x90(%rbp)
movsd  (%rax),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0xa0(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0xa8(%rbp),%rax
mulsd  0x18(%rax),%xmm0
mov    -0x90(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x90(%rbp)
movsd  (%rax),%xmm2
movsd  -0x80(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm0
call   1060 <log@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x84(%rbp),%rdx
add    (%rcx,%rdx,4),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0x974(%rip),%xmm0
call   1060 <log@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x84(%rbp),%rcx
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  -0x80(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    14fc <evaluateGTRCAT+0x3bc>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluateGTRCAT>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,%r12
mov    %r8,%r15
mov    %rcx,0x28(%rsp)
mov    %rdx,0x20(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,0x30(%rsp)
movslq 0xc0(%rsp),%rbx
mov    0x90(%rsp),%rbp
movsd  0xe80(%rip),%xmm1
maxsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1060 <log@plt>
movsd  0x0(%rbp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x50(%rsp)
movsd  0x8(%rbp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x48(%rsp)
mulsd  0x10(%rbp),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0x0(,%rbx,8),%rax
lea    (%rax,%rax,2),%rdi
call   1040 <malloc@plt>
mov    %rax,0x8(%rsp)
test   %rbx,%rbx
jle    1249 <evaluateGTRCAT+0x109>
mov    0x98(%rsp),%r14
mov    %ebx,%ebp
xor    %ebx,%ebx
mov    0x8(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r14,%rbx,8),%xmm1
movsd  %xmm1,(%rsp)
movsd  0x50(%rsp),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x0(%r13)
movsd  0x48(%rsp),%xmm0
mulsd  (%rsp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x8(%r13)
movsd  (%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1050 <exp@plt>
movsd  %xmm0,0x10(%r13)
add    $0x1,%rbx
add    $0x18,%r13
cmp    %rbx,%rbp
jne    11f0 <evaluateGTRCAT+0xb0>
mov    0xb8(%rsp),%eax
mov    0xb0(%rsp),%r14d
mov    0xa8(%rsp),%rcx
xorpd  %xmm0,%xmm0
test   %rcx,%rcx
je     1377 <evaluateGTRCAT+0x237>
cmp    %eax,%r14d
mov    0x28(%rsp),%r13
mov    0x20(%rsp),%rsi
mov    0x18(%rsp),%rbp
mov    0x8(%rsp),%rdi
jge    148f <evaluateGTRCAT+0x34f>
movslq %r14d,%r15
cltq
mov    %rax,0x10(%rsp)
shl    $0x2,%r14d
xorpd  %xmm0,%xmm0
nopl   0x0(%rax)
movsd  %xmm0,(%rsp)
movsbq (%rcx,%r15,1),%rax
shl    $0x5,%rax
movslq %r14d,%r14
movslq (%rsi,%r15,4),%rcx
mov    0xa0(%rsp),%rbx
movsd  (%rbx,%rax,1),%xmm0
movsd  0x8(%rbx,%rax,1),%xmm1
mulsd  (%r12,%r14,8),%xmm0
mulsd  0x8(%r12,%r14,8),%xmm1
lea    (%rcx,%rcx,2),%rcx
mulsd  (%rdi,%rcx,8),%xmm1
movsd  0x10(%rbx,%rax,1),%xmm2
mulsd  0x10(%r12,%r14,8),%xmm2
mulsd  0x8(%rdi,%rcx,8),%xmm2
addsd  %xmm0,%xmm1
movsd  0x18(%rbx,%rax,1),%xmm0
mulsd  0x18(%r12,%r14,8),%xmm0
addsd  %xmm1,%xmm2
mulsd  0x10(%rdi,%rcx,8),%xmm0
addsd  %xmm2,%xmm0
mov    %rsi,%rbx
call   1060 <log@plt>
mov    %rbx,%rsi
mov    0xa8(%rsp),%rcx
mov    0x8(%rsp),%rdi
xorps  %xmm1,%xmm1
cvtsi2sdl 0x0(%rbp,%r15,4),%xmm1
mulsd  0xcce(%rip),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl 0x0(%r13,%r15,4),%xmm0
mulsd  %xmm1,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x1,%r15
add    $0x4,%r14d
cmp    %r15,0x10(%rsp)
jne    12a0 <evaluateGTRCAT+0x160>
jmp    148f <evaluateGTRCAT+0x34f>
cmp    %eax,%r14d
mov    0x28(%rsp),%rbx
mov    0x20(%rsp),%r13
mov    0x18(%rsp),%rsi
mov    0x8(%rsp),%rdi
mov    0x30(%rsp),%rcx
jge    148f <evaluateGTRCAT+0x34f>
movslq %r14d,%rbp
cltq
mov    %rax,0x10(%rsp)
shl    $0x2,%r14d
xorpd  %xmm0,%xmm0
mov    %r12,0x40(%rsp)
mov    %r15,0x38(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,(%rsp)
movslq %r14d,%r14
movslq 0x0(%r13,%rbp,4),%rax
movsd  (%r15,%r14,8),%xmm0
movsd  0x8(%r15,%r14,8),%xmm1
mulsd  (%r12,%r14,8),%xmm0
mulsd  0x8(%r12,%r14,8),%xmm1
lea    (%rax,%rax,2),%rax
mulsd  (%rdi,%rax,8),%xmm1
movsd  0x10(%r15,%r14,8),%xmm2
mulsd  0x10(%r12,%r14,8),%xmm2
mulsd  0x8(%rdi,%rax,8),%xmm2
addsd  %xmm0,%xmm1
movsd  0x18(%r15,%r14,8),%xmm0
mulsd  0x18(%r12,%r14,8),%xmm0
addsd  %xmm1,%xmm2
mulsd  0x10(%rdi,%rax,8),%xmm0
addsd  %xmm2,%xmm0
mov    %rsi,%r15
mov    %rcx,%r12
call   1060 <log@plt>
mov    %r12,%rcx
mov    %r15,%rsi
mov    0x38(%rsp),%r15
mov    0x40(%rsp),%r12
mov    0x8(%rsp),%rdi
mov    (%rsi,%rbp,4),%eax
add    (%rcx,%rbp,4),%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xbaf(%rip),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdl (%rbx,%rbp,4),%xmm0
mulsd  %xmm1,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x1,%rbp
add    $0x4,%r14d
cmp    %rbp,0x10(%rsp)
jne    13c0 <evaluateGTRCAT+0x280>
movsd  %xmm0,(%rsp)
call   1030 <free@plt>
movsd  (%rsp),%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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