user: Please show me the C implementation that matches the assembly code listed below:

```asm
<evaluateGTRGAMMAPROT>:
  endbr64
  push   %r15
  movapd %xmm0,%xmm1
  mov    %rsi,%r15
  push   %r14
  push   %r13
  push   %r12
  mov    %r9,%r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  movsd  D60(%rip),%xmm0
  mov    %rdi,0x30(%rsp)
  maxsd  %xmm1,%xmm0
  mov    %rdx,0x18(%rsp)
  mov    %rcx,0x38(%rsp)
  mov    %r8,0x28(%rsp)
  call   <log@plt>
  mov    $0x260,%edi
  movsd  %xmm0,0x8(%rsp)
  call   <malloc@plt>
  mov    0x90(%rsp),%r13
  mov    %rax,0x10(%rsp)
  mov    %rax,%rbx
  lea    0x260(%rax),%rbp
L11:
  movsd  0x0(%r13),%xmm6
  xor    %r14d,%r14d
  movsd  %xmm6,(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L101:
  movsd  (%rsp),%xmm0
  mulsd  (%r12,%r14,1),%xmm0
  mulsd  0x8(%rsp),%xmm0
  call   <exp@plt>
  movsd  %xmm0,(%rbx,%r14,1)
  add    $0x8,%r14
  cmp    $0x98,%r14
  jne    L101
  add    $0x98,%rbx
  add    $0x8,%r13
  cmp    %rbx,%rbp
  jne    L11
  cmpq   $0x0,0xa0(%rsp)
  mov    0xb0(%rsp),%eax
  je     L30
  cmp    %eax,0xa8(%rsp)
  jge    L15
  mov    D65(%rip),%r14
  movslq 0xa8(%rsp),%rbx
  sub    $0x1,%eax
  movsd  D54(%rip),%xmm3
  movsd  D30(%rip),%xmm4
  mov    %r14,(%rsp)
  sub    0xa8(%rsp),%eax
  lea    0x1(%rbx),%r12
  mov    %r14,0x30(%rsp)
  mov    0xa0(%rsp),%r14
  lea    (%rax,%r12,1),%r13
  movsd  %xmm3,0x8(%rsp)
  movsd  %xmm4,0x20(%rsp)
  nopw   0x0(%rax,%rax,1)
L44:
  movsbl (%r14,%rbx,1),%eax
  mov    0x98(%rsp),%rsi
  pxor   %xmm0,%xmm0
  mov    0x10(%rsp),%rdx
  lea    (%rax,%rax,4),%eax
  shl    $0x2,%eax
  cltq
  lea    (%rsi,%rax,8),%rax
  mov    (%rax),%r9
  mov    0x8(%rax),%r8
  mov    0x10(%rax),%rdi
  mov    0x18(%rax),%rsi
  mov    0x20(%rax),%rcx
  movsd  0x28(%rax),%xmm15
  movsd  0x30(%rax),%xmm14
  movsd  0x38(%rax),%xmm13
  movsd  0x40(%rax),%xmm12
  movsd  0x48(%rax),%xmm11
  movsd  0x50(%rax),%xmm10
  movsd  0x58(%rax),%xmm9
  movsd  0x60(%rax),%xmm8
  movsd  0x68(%rax),%xmm7
  movsd  0x70(%rax),%xmm6
  movsd  0x78(%rax),%xmm5
  movsd  0x80(%rax),%xmm4
  movsd  0x88(%rax),%xmm3
  movsd  0x90(%rax),%xmm2
  mov    0x98(%rax),%r10
  lea    (%rbx,%rbx,4),%rax
  shl    $0x7,%rax
  add    0x28(%rsp),%rax
L6:
  movq   %r9,%xmm1
  add    $0x98,%rdx
  add    $0xa0,%rax
  mulsd  -0xa0(%rax),%xmm1
  addsd  %xmm1,%xmm0
  movq   %r8,%xmm1
  mulsd  -0x98(%rax),%xmm1
  mulsd  -0x98(%rdx),%xmm1
  addsd  %xmm1,%xmm0
  movq   %rdi,%xmm1
  mulsd  -0x90(%rax),%xmm1
  mulsd  -0x90(%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movq   %rsi,%xmm0
  mulsd  -0x88(%rax),%xmm0
  mulsd  -0x88(%rdx),%xmm0
  addsd  %xmm1,%xmm0
  movq   %rcx,%xmm1
  mulsd  -0x80(%rax),%xmm1
  mulsd  -0x80(%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x78(%rax),%xmm0
  mulsd  %xmm15,%xmm0
  mulsd  -0x78(%rdx),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x70(%rax),%xmm1
  mulsd  %xmm14,%xmm1
  mulsd  -0x70(%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x68(%rax),%xmm0
  mulsd  %xmm13,%xmm0
  mulsd  -0x68(%rdx),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x60(%rax),%xmm1
  mulsd  %xmm12,%xmm1
  mulsd  -0x60(%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x58(%rax),%xmm0
  mulsd  %xmm11,%xmm0
  mulsd  -0x58(%rdx),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x50(%rax),%xmm1
  mulsd  %xmm10,%xmm1
  mulsd  -0x50(%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x48(%rax),%xmm0
  mulsd  %xmm9,%xmm0
  mulsd  -0x48(%rdx),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x40(%rax),%xmm1
  mulsd  %xmm8,%xmm1
  mulsd  -0x40(%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x38(%rax),%xmm0
  mulsd  %xmm7,%xmm0
  mulsd  -0x38(%rdx),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x30(%rax),%xmm1
  mulsd  %xmm6,%xmm1
  mulsd  -0x30(%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x28(%rax),%xmm0
  mulsd  %xmm5,%xmm0
  mulsd  -0x28(%rdx),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x20(%rax),%xmm1
  mulsd  %xmm4,%xmm1
  mulsd  -0x20(%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x18(%rax),%xmm0
  mulsd  %xmm3,%xmm0
  mulsd  -0x18(%rdx),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x10(%rax),%xmm1
  mulsd  %xmm2,%xmm1
  mulsd  -0x10(%rdx),%xmm1
  addsd  %xmm0,%xmm1
  movq   %r10,%xmm0
  mulsd  -0x8(%rax),%xmm0
  mulsd  -0x8(%rdx),%xmm0
  addsd  %xmm1,%xmm0
  cmp    %rdx,%rbp
  jne    L6
  mulsd  0x8(%rsp),%xmm0
  call   <log@plt>
  mov    0x18(%rsp),%rax
  movapd %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sdl (%r15,%rbx,4),%xmm0
  mulsd  0x20(%rsp),%xmm0
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl (%rax,%rbx,4),%xmm1
  mov    %r12,%rbx
  mulsd  %xmm1,%xmm0
  addsd  (%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  cmp    %r12,%r13
  je     L112
  add    $0x1,%r12
  jmp    L44
L15:
  pxor   %xmm4,%xmm4
  movsd  %xmm4,(%rsp)
L112:
  mov    0x10(%rsp),%rdi
  call   <free@plt>
  movsd  (%rsp),%xmm0
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L30:
  cmp    %eax,0xa8(%rsp)
  jge    L65
  mov    0xa8(%rsp),%eax
  movslq 0xa8(%rsp),%r13
  movsd  D54(%rip),%xmm5
  mov    D65(%rip),%r14
  lea    (%rax,%rax,4),%r12d
  mov    0xb0(%rsp),%eax
  shl    $0x4,%r12d
  movsd  %xmm5,0x8(%rsp)
  movsd  D30(%rip),%xmm5
  lea    -0x1(%rax),%ebx
  movslq %r12d,%r12
  mov    %r14,(%rsp)
  mov    %ebx,%eax
  lea    0x1(%r13),%rbx
  shl    $0x3,%r12
  sub    0xa8(%rsp),%eax
  add    %rbx,%rax
  mov    %r14,0x48(%rsp)
  mov    %rbp,%r14
  mov    %r13,%rbp
  mov    %rax,0x40(%rsp)
  mov    %rbx,%r13
  mov    %r12,%rbx
  mov    %r15,%r12
  mov    0x28(%rsp),%r15
  movsd  %xmm5,0x20(%rsp)
  nopl   (%rax)
L58:
  mov    0x38(%rsp),%rax
  lea    (%r15,%rbx,1),%rdx
  pxor   %xmm0,%xmm0
  lea    (%rax,%rbx,1),%rcx
  mov    0x10(%rsp),%rax
L5:
  movsd  (%rcx),%xmm1
  mulsd  (%rdx),%xmm1
  add    $0x98,%rax
  add    $0xa0,%rcx
  add    $0xa0,%rdx
  addsd  %xmm1,%xmm0
  movsd  -0x98(%rcx),%xmm1
  mulsd  -0x98(%rdx),%xmm1
  mulsd  -0x98(%rax),%xmm1
  addsd  %xmm1,%xmm0
  movsd  -0x90(%rcx),%xmm1
  mulsd  -0x90(%rdx),%xmm1
  mulsd  -0x90(%rax),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x88(%rcx),%xmm0
  mulsd  -0x88(%rdx),%xmm0
  mulsd  -0x88(%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x80(%rcx),%xmm1
  mulsd  -0x80(%rdx),%xmm1
  mulsd  -0x80(%rax),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x78(%rcx),%xmm0
  mulsd  -0x78(%rdx),%xmm0
  mulsd  -0x78(%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x70(%rcx),%xmm1
  mulsd  -0x70(%rdx),%xmm1
  mulsd  -0x70(%rax),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x68(%rcx),%xmm0
  mulsd  -0x68(%rdx),%xmm0
  mulsd  -0x68(%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x60(%rcx),%xmm1
  mulsd  -0x60(%rdx),%xmm1
  mulsd  -0x60(%rax),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x58(%rcx),%xmm0
  mulsd  -0x58(%rdx),%xmm0
  mulsd  -0x58(%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x50(%rcx),%xmm1
  mulsd  -0x50(%rdx),%xmm1
  mulsd  -0x50(%rax),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x48(%rcx),%xmm0
  mulsd  -0x48(%rdx),%xmm0
  mulsd  -0x48(%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x40(%rcx),%xmm1
  mulsd  -0x40(%rdx),%xmm1
  mulsd  -0x40(%rax),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x38(%rcx),%xmm0
  mulsd  -0x38(%rdx),%xmm0
  mulsd  -0x38(%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x30(%rcx),%xmm1
  mulsd  -0x30(%rdx),%xmm1
  mulsd  -0x30(%rax),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x28(%rcx),%xmm0
  mulsd  -0x28(%rdx),%xmm0
  mulsd  -0x28(%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x20(%rcx),%xmm1
  mulsd  -0x20(%rdx),%xmm1
  mulsd  -0x20(%rax),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x18(%rcx),%xmm0
  mulsd  -0x18(%rdx),%xmm0
  mulsd  -0x18(%rax),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x10(%rcx),%xmm1
  mulsd  -0x10(%rdx),%xmm1
  mulsd  -0x10(%rax),%xmm1
  addsd  %xmm0,%xmm1
  movsd  -0x8(%rcx),%xmm0
  mulsd  -0x8(%rdx),%xmm0
  mulsd  -0x8(%rax),%xmm0
  addsd  %xmm1,%xmm0
  cmp    %rax,%r14
  jne    L5
  mulsd  0x8(%rsp),%xmm0
  add    $0x280,%rbx
  call   <log@plt>
  mov    0x30(%rsp),%rdi
  mov    (%r12,%rbp,4),%eax
  movapd %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  add    (%rdi,%rbp,4),%eax
  cvtsi2sd %eax,%xmm0
  mulsd  0x20(%rsp),%xmm0
  mov    0x18(%rsp),%rax
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl (%rax,%rbp,4),%xmm1
  mov    %r13,%rbp
  mulsd  %xmm1,%xmm0
  addsd  (%rsp),%xmm0
  movsd  %xmm0,(%rsp)
  cmp    %r13,0x40(%rsp)
  je     L112
  add    $0x1,%r13
  jmp    L58
L65:
  pxor   %xmm3,%xmm3
  movsd  %xmm3,(%rsp)
  jmp    L112
```

tool_calls: name: read_data
arguments: label: D60
type: byte[8]
name: read_data
arguments: label: D65
type: f64
name: read_data
arguments: label: D54
type: f64
name: read_data
arguments: label: D30
type: byte[8]

tool: {"D60": [0x16,0x56,0xe7,0x9e,0xaf,0x03,0xd2,0x3c]}

tool: D65: 0

tool: D54: 0.25

tool: {"D30": [0xef,0x39,0xfa,0xfe,0x42,0x2e,0x66,0xc0]}

assistant: ```c
double evaluateGTRGAMMAPROT(int *ex1, int *ex2, int *wptr, double *x1, double *x2, double *EIGN, double *gammaRates, double *tipVector, double pz, char *tipX1, int lower, int n) {
  double sum, z, lz, term, ki;
  int i, j;
  double *diagptable, *diagptable_start, *left, *right;
  z = pz;
  if (z < 1.0E-15)
    z = 1.0E-15;
  lz = log(z);
  diagptable = diagptable_start = (double *)malloc(sizeof(double) * 4 * 19);
  for (i = 0; i < 4; i++) {
    ki = gammaRates[i];
    for (j = 0; j < 19; j++)
      *diagptable++ = exp(EIGN[j] * ki * lz);
  }
  sum = 0.0;
  if (tipX1) {
    for (i = lower; i < n; i++) {
      left = &(tipVector[20 * tipX1[i]]);
      diagptable = diagptable_start;
      term = 0;
      for (j = 0; j < 4; j++) {
        right = &(x2[80 * i + 20 * j]);
        term += left[0] * right[0];
        term += left[1] * right[1] * *diagptable++;
        term += left[2] * right[2] * *diagptable++;
        term += left[3] * right[3] * *diagptable++;
        term += left[4] * right[4] * *diagptable++;
        term += left[5] * right[5] * *diagptable++;
        term += left[6] * right[6] * *diagptable++;
        term += left[7] * right[7] * *diagptable++;
        term += left[8] * right[8] * *diagptable++;
        term += left[9] * right[9] * *diagptable++;
        term += left[10] * right[10] * *diagptable++;
        term += left[11] * right[11] * *diagptable++;
        term += left[12] * right[12] * *diagptable++;
        term += left[13] * right[13] * *diagptable++;
        term += left[14] * right[14] * *diagptable++;
        term += left[15] * right[15] * *diagptable++;
        term += left[16] * right[16] * *diagptable++;
        term += left[17] * right[17] * *diagptable++;
        term += left[18] * right[18] * *diagptable++;
        term += left[19] * right[19] * *diagptable++;
      }
      term = log(0.25 * term) + (ex2[i] * log((1.0 / 115792089237316195423570985008687907853269984665640564039457584007913129639936.0)));
      sum += wptr[i] * term;
    }
    free(diagptable_start);
    return sum;
  }
  for (i = lower; i < n; i++) {
    diagptable = diagptable_start;
    term = 0;
    for (j = 0; j < 4; j++) {
      left = &(x1[80 * i + 20 * j]);
      right = &(x2[80 * i + 20 * j]);
      term += left[0] * right[0];
      term += left[1] * right[1] * *diagptable++;
      term += left[2] * right[2] * *diagptable++;
      term += left[3] * right[3] * *diagptable++;
      term += left[4] * right[4] * *diagptable++;
      term += left[5] * right[5] * *diagptable++;
      term += left[6] * right[6] * *diagptable++;
      term += left[7] * right[7] * *diagptable++;
      term += left[8] * right[8] * *diagptable++;
      term += left[9] * right[9] * *diagptable++;
      term += left[10] * right[10] * *diagptable++;
      term += left[11] * right[11] * *diagptable++;
      term += left[12] * right[12] * *diagptable++;
      term += left[13] * right[13] * *diagptable++;
      term += left[14] * right[14] * *diagptable++;
      term += left[15] * right[15] * *diagptable++;
      term += left[16] * right[16] * *diagptable++;
      term += left[17] * right[17] * *diagptable++;
      term += left[18] * right[18] * *diagptable++;
      term += left[19] * right[19] * *diagptable++;
    }
    term = log(0.25 * term) + ((ex1[i] + ex2[i]) * log((1.0 / 115792089237316195423570985008687907853269984665640564039457584007913129639936.0)));
    sum += wptr[i] * term;
  }
  free(diagptable_start);
  return sum;
}
```