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

```asm
<coreGTRGAMMAPROTINVAR>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x128,%rsp
  xor    %ebp,%ebp
  mov    0x1160(%rsp),%rax
  mov    0x1170(%rsp),%r15
  mov    %rax,0x68(%rsp)
  mov    0x1168(%rsp),%rax
  mov    %r8,%r13
  lea    0x390(%rsp),%rbx
  movsd  %xmm0,0x28(%rsp)
  movsd  D7(%rip),%xmm0
  mov    %rdi,0x48(%rsp)
  subsd  %xmm1,%xmm0
  mulsd  D18(%rip),%xmm0
  mov    %rsi,0x50(%rsp)
  mov    %rdx,0x40(%rsp)
  mov    %ecx,0x5c(%rsp)
  mov    %r9,0x60(%rsp)
  mov    %fs:0x28,%rdx
  mov    %rdx,0x1118(%rsp)
  xor    %edx,%edx
  movsd  %xmm0,0x30(%rsp)
  movapd %xmm1,%xmm0
  movupd (%rax),%xmm1
  unpcklpd %xmm0,%xmm0
  mulpd  %xmm0,%xmm1
  movaps %xmm1,0x70(%rsp)
  movupd 0x10(%rax),%xmm1
  mulpd  %xmm0,%xmm1
  movaps %xmm1,0x80(%rsp)
  movupd 0x20(%rax),%xmm1
  mulpd  %xmm0,%xmm1
  movaps %xmm1,0x90(%rsp)
  movupd 0x30(%rax),%xmm1
  mulpd  %xmm0,%xmm1
  movaps %xmm1,0xa0(%rsp)
  movupd 0x40(%rax),%xmm1
  mulpd  %xmm0,%xmm1
  movaps %xmm1,0xb0(%rsp)
  movupd 0x50(%rax),%xmm1
  mulpd  %xmm0,%xmm1
  movaps %xmm1,0xc0(%rsp)
  movupd 0x60(%rax),%xmm1
  mulpd  %xmm0,%xmm1
  movaps %xmm1,0xd0(%rsp)
  movupd 0x70(%rax),%xmm1
  mulpd  %xmm0,%xmm1
  movaps %xmm1,0xe0(%rsp)
  movupd 0x80(%rax),%xmm1
  mulpd  %xmm0,%xmm1
  movaps %xmm1,0xf0(%rsp)
  movupd 0x90(%rax),%xmm1
  lea    0x110(%rsp),%rax
  mov    %rax,0x38(%rsp)
  mulpd  %xmm1,%xmm0
  movaps %xmm0,0x100(%rsp)
L74:
  mov    0x48(%rsp),%rax
  mov    0x50(%rsp),%r12
  lea    -0x260(%rbx),%r14
  movsd  (%rax,%rbp,8),%xmm4
  movsd  %xmm4,0x18(%rsp)
  mulsd  %xmm4,%xmm4
  movsd  %xmm4,0x20(%rsp)
  nopl   (%rax)
L18:
  movsd  (%r12),%xmm1
  movsd  0x18(%rsp),%xmm2
  add    $0x20,%r14
  add    $0x8,%r12
  movsd  0x28(%rsp),%xmm0
  mulsd  %xmm1,%xmm2
  movsd  %xmm1,0x10(%rsp)
  mulsd  %xmm2,%xmm0
  movsd  %xmm2,0x8(%rsp)
  call   <exp@plt>
  movsd  0x10(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm2
  mulsd  %xmm1,%xmm1
  unpcklpd %xmm2,%xmm0
  mulsd  0x20(%rsp),%xmm1
  movaps %xmm0,-0x20(%r14)
  movsd  %xmm1,-0x10(%r14)
  cmp    %rbx,%r14
  jne    L18
  add    $0x1,%rbp
  lea    0x400(%r14),%rbx
  cmp    $0x4,%rbp
  jne    L74
  mov    0x5c(%rsp),%eax
  test   %eax,%eax
  jle    L78
  movslq %eax,%r12
  mov    0x38(%rsp),%rax
  pxor   %xmm3,%xmm3
  xor    %r14d,%r14d
  xor    %ebx,%ebx
  movapd %xmm3,%xmm4
  movapd %xmm3,%xmm5
  lea    0x1000(%rax),%rbp
  xchg   %ax,%ax
L47:
  mov    0x40(%rsp),%rax
  movapd %xmm3,%xmm6
  movapd %xmm3,%xmm8
  movapd %xmm3,%xmm0
  lea    (%rax,%r14,1),%rcx
  mov    0x38(%rsp),%rax
  mov    %rcx,%rdx
  xchg   %ax,%ax
L23:
  movapd 0x20(%rax),%xmm2
  movapd 0x40(%rax),%xmm9
  add    $0x400,%rax
  add    $0xa0,%rcx
  movupd 0x8(%rdx),%xmm1
  addsd  -0xa0(%rcx),%xmm0
  add    $0xa0,%rdx
  movhpd -0x3d0(%rax),%xmm2
  movhpd -0x3b0(%rax),%xmm9
  movapd -0x3b0(%rax),%xmm10
  movlpd -0x3b8(%rax),%xmm10
  movapd %xmm2,%xmm7
  unpckhpd %xmm9,%xmm2
  unpcklpd %xmm9,%xmm7
  movapd -0x380(%rax),%xmm9
  mulpd  %xmm1,%xmm7
  movhpd -0x370(%rax),%xmm9
  addsd  %xmm7,%xmm0
  mulpd  %xmm7,%xmm2
  movapd %xmm7,%xmm1
  unpckhpd %xmm1,%xmm1
  addsd  %xmm1,%xmm0
  movapd -0x3d0(%rax),%xmm1
  movlpd -0x3d8(%rax),%xmm1
  unpcklpd %xmm10,%xmm1
  addsd  %xmm2,%xmm6
  unpckhpd %xmm2,%xmm2
  movapd -0x370(%rax),%xmm10
  movlpd -0x378(%rax),%xmm10
  mulpd  %xmm7,%xmm1
  addsd  %xmm2,%xmm6
  movapd -0x3a0(%rax),%xmm2
  movhpd -0x390(%rax),%xmm2
  addsd  %xmm1,%xmm8
  unpckhpd %xmm1,%xmm1
  movapd %xmm2,%xmm7
  unpcklpd %xmm9,%xmm7
  unpckhpd %xmm9,%xmm2
  movapd -0x340(%rax),%xmm9
  movhpd -0x330(%rax),%xmm9
  addsd  %xmm8,%xmm1
  movupd -0x88(%rdx),%xmm8
  mulpd  %xmm7,%xmm8
  addsd  %xmm8,%xmm0
  movapd %xmm8,%xmm7
  unpckhpd %xmm7,%xmm7
  addsd  %xmm0,%xmm7
  movapd -0x390(%rax),%xmm0
  movlpd -0x398(%rax),%xmm0
  unpcklpd %xmm10,%xmm0
  movapd -0x330(%rax),%xmm10
  movlpd -0x338(%rax),%xmm10
  mulpd  %xmm8,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  movapd %xmm2,%xmm0
  mulpd  %xmm8,%xmm0
  movapd %xmm0,%xmm2
  unpckhpd %xmm0,%xmm0
  addsd  %xmm6,%xmm2
  movapd %xmm0,%xmm6
  movupd -0x78(%rdx),%xmm0
  addsd  %xmm2,%xmm6
  movapd -0x360(%rax),%xmm2
  movhpd -0x350(%rax),%xmm2
  movapd %xmm2,%xmm8
  unpckhpd %xmm9,%xmm2
  unpcklpd %xmm9,%xmm8
  movapd -0x300(%rax),%xmm9
  mulpd  %xmm0,%xmm8
  movhpd -0x2f0(%rax),%xmm9
  addsd  %xmm8,%xmm7
  movapd %xmm8,%xmm0
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm7
  movapd -0x350(%rax),%xmm0
  movlpd -0x358(%rax),%xmm0
  unpcklpd %xmm10,%xmm0
  mulpd  %xmm8,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  movapd %xmm2,%xmm0
  movapd -0x320(%rax),%xmm2
  mulpd  %xmm8,%xmm0
  movhpd -0x310(%rax),%xmm2
  movapd %xmm2,%xmm8
  unpckhpd %xmm9,%xmm2
  unpcklpd %xmm9,%xmm8
  addsd  %xmm0,%xmm6
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm6
  movupd -0x68(%rdx),%xmm0
  movapd -0x2f0(%rax),%xmm10
  movlpd -0x2f8(%rax),%xmm10
  movapd -0x2c0(%rax),%xmm9
  mulpd  %xmm0,%xmm8
  movhpd -0x2b0(%rax),%xmm9
  addsd  %xmm8,%xmm7
  movapd %xmm8,%xmm0
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm7
  movapd -0x310(%rax),%xmm0
  movlpd -0x318(%rax),%xmm0
  unpcklpd %xmm10,%xmm0
  movapd -0x2b0(%rax),%xmm10
  movlpd -0x2b8(%rax),%xmm10
  mulpd  %xmm8,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  movapd %xmm2,%xmm0
  movapd -0x2e0(%rax),%xmm2
  mulpd  %xmm8,%xmm0
  movhpd -0x2d0(%rax),%xmm2
  movapd %xmm2,%xmm8
  unpckhpd %xmm9,%xmm2
  unpcklpd %xmm9,%xmm8
  movapd -0x280(%rax),%xmm9
  movhpd -0x270(%rax),%xmm9
  addsd  %xmm0,%xmm6
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm6
  movupd -0x58(%rdx),%xmm0
  mulpd  %xmm0,%xmm8
  addsd  %xmm8,%xmm7
  movapd %xmm8,%xmm0
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm7
  movapd -0x2d0(%rax),%xmm0
  movlpd -0x2d8(%rax),%xmm0
  unpcklpd %xmm10,%xmm0
  movapd -0x270(%rax),%xmm10
  movlpd -0x278(%rax),%xmm10
  mulpd  %xmm8,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  movapd %xmm2,%xmm0
  movapd -0x2a0(%rax),%xmm2
  mulpd  %xmm8,%xmm0
  movhpd -0x290(%rax),%xmm2
  movapd %xmm2,%xmm8
  unpcklpd %xmm9,%xmm8
  addsd  %xmm0,%xmm6
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm6
  movupd -0x48(%rdx),%xmm0
  mulpd  %xmm0,%xmm8
  addsd  %xmm8,%xmm7
  movapd %xmm8,%xmm0
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm7
  movapd -0x290(%rax),%xmm0
  movlpd -0x298(%rax),%xmm0
  unpcklpd %xmm10,%xmm0
  movapd -0x230(%rax),%xmm10
  movlpd -0x238(%rax),%xmm10
  mulpd  %xmm8,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm2,%xmm1
  movupd -0x38(%rdx),%xmm2
  unpckhpd %xmm9,%xmm1
  movapd -0x240(%rax),%xmm9
  mulpd  %xmm8,%xmm1
  movhpd -0x230(%rax),%xmm9
  addsd  %xmm1,%xmm6
  unpckhpd %xmm1,%xmm1
  addsd  %xmm1,%xmm6
  movapd -0x260(%rax),%xmm1
  movhpd -0x250(%rax),%xmm1
  movapd %xmm1,%xmm8
  unpckhpd %xmm9,%xmm1
  unpcklpd %xmm9,%xmm8
  mulpd  %xmm2,%xmm8
  addsd  %xmm8,%xmm7
  mulpd  %xmm8,%xmm1
  movapd %xmm8,%xmm2
  unpckhpd %xmm2,%xmm2
  addsd  %xmm2,%xmm7
  movapd -0x250(%rax),%xmm2
  movlpd -0x258(%rax),%xmm2
  unpcklpd %xmm10,%xmm2
  addsd  %xmm1,%xmm6
  unpckhpd %xmm1,%xmm1
  mulpd  %xmm8,%xmm2
  addsd  %xmm1,%xmm6
  addsd  %xmm2,%xmm0
  unpckhpd %xmm2,%xmm2
  addsd  %xmm0,%xmm2
  movapd -0x220(%rax),%xmm0
  movapd -0x200(%rax),%xmm9
  movapd -0x1f0(%rax),%xmm10
  movupd -0x28(%rdx),%xmm1
  movhpd -0x210(%rax),%xmm0
  movhpd -0x1f0(%rax),%xmm9
  movlpd -0x1f8(%rax),%xmm10
  movapd %xmm0,%xmm8
  unpckhpd %xmm9,%xmm0
  unpcklpd %xmm9,%xmm8
  movapd -0x1c0(%rax),%xmm9
  mulpd  %xmm1,%xmm8
  movhpd -0x1b0(%rax),%xmm9
  mulpd  %xmm8,%xmm0
  addsd  %xmm8,%xmm7
  movapd %xmm8,%xmm1
  unpckhpd %xmm1,%xmm1
  addsd  %xmm1,%xmm7
  movapd -0x210(%rax),%xmm1
  movlpd -0x218(%rax),%xmm1
  addsd  %xmm0,%xmm6
  unpcklpd %xmm10,%xmm1
  unpckhpd %xmm0,%xmm0
  movapd -0x1e0(%rax),%xmm10
  mulpd  %xmm8,%xmm1
  movupd -0x18(%rdx),%xmm8
  movhpd -0x1d0(%rax),%xmm10
  addsd  %xmm0,%xmm6
  movapd %xmm10,%xmm0
  unpcklpd %xmm9,%xmm0
  mulpd  %xmm0,%xmm8
  addsd  %xmm1,%xmm2
  unpckhpd %xmm1,%xmm1
  addsd  %xmm2,%xmm1
  movapd %xmm8,%xmm2
  addsd  %xmm7,%xmm2
  movapd %xmm8,%xmm7
  unpckhpd %xmm7,%xmm7
  movapd %xmm7,%xmm0
  movapd -0x1b0(%rax),%xmm7
  movlpd -0x1b8(%rax),%xmm7
  addsd  %xmm2,%xmm0
  movapd -0x1d0(%rax),%xmm2
  movlpd -0x1d8(%rax),%xmm2
  unpcklpd %xmm7,%xmm2
  mulpd  %xmm8,%xmm2
  addsd  %xmm2,%xmm1
  unpckhpd %xmm2,%xmm2
  addsd  %xmm1,%xmm2
  movapd %xmm10,%xmm1
  unpckhpd %xmm9,%xmm1
  mulpd  %xmm8,%xmm1
  movsd  -0x198(%rax),%xmm8
  addsd  %xmm1,%xmm6
  unpckhpd %xmm1,%xmm1
  addsd  %xmm6,%xmm1
  movsd  -0x8(%rcx),%xmm6
  mulsd  -0x1a0(%rax),%xmm6
  mulsd  %xmm6,%xmm8
  addsd  %xmm6,%xmm0
  mulsd  -0x190(%rax),%xmm6
  addsd  %xmm2,%xmm8
  addsd  %xmm1,%xmm6
  cmp    %rax,%rbp
  jne    L23
  movsd  %xmm6,0x20(%rsp)
  movsd  %xmm8,0x18(%rsp)
  movsd  %xmm5,0x10(%rsp)
  movsd  %xmm4,0x8(%rsp)
  call   <FABS@plt>
  movslq (%r15,%rbx,4),%rax
  pxor   %xmm3,%xmm3
  movsd  0x8(%rsp),%xmm4
  mulsd  0x30(%rsp),%xmm0
  movsd  0x10(%rsp),%xmm5
  cmp    $0x13,%eax
  movsd  0x18(%rsp),%xmm8
  movsd  0x20(%rsp),%xmm6
  jg     L38
  addsd  0x70(%rsp,%rax,8),%xmm0
L38:
  movsd  D7(%rip),%xmm1
  add    $0x280,%r14
  divsd  %xmm0,%xmm1
  mulsd  %xmm1,%xmm8
  mulsd  %xmm6,%xmm1
  movsd  0x30(%rsp),%xmm6
  mulsd  %xmm6,%xmm8
  movapd %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl 0x0(%r13,%rbx,4),%xmm1
  mulsd  %xmm6,%xmm0
  add    $0x1,%rbx
  movapd %xmm1,%xmm2
  mulsd  %xmm8,%xmm2
  mulsd  %xmm8,%xmm8
  addsd  %xmm2,%xmm5
  subsd  %xmm8,%xmm0
  mulsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm4
  cmp    %r12,%rbx
  jne    L47
L55:
  mov    0x60(%rsp),%rax
  movsd  %xmm5,(%rax)
  mov    0x68(%rsp),%rax
  movsd  %xmm4,(%rax)
  mov    0x1118(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L65
  add    $0x1128,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L78:
  pxor   %xmm4,%xmm4
  movapd %xmm4,%xmm5
  jmp    L55
L65:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D7
type: f64
name: parse_data
arguments: tag: D18
type: f64

tool: D7: 1

tool: D18: 0.25

assistant: ```c
void coreGTRGAMMAPROTINVAR(double *gammaRates, double *EIGN, double *sumtable, int upper, int *wrptr, volatile double *ext_dlnLdlz, volatile double *ext_d2lnLdlz2, double lz, double *frequencies, double propInvar, int *iptr) {
  double *sum, diagptable[512];
  int i, l, j;
  double dlnLdlz = 0;
  double d2lnLdlz2 = 0;
  double ki, kisqr;
  double freqs[20];
  double scaler = 0.25 * (1.0 - propInvar);
  double tmp;
  double inv_Li, dlnLidlz, d2lnLidlz2;
  for (i = 0; i < 20; i++)
    freqs[i] = frequencies[i] * propInvar;
  for (i = 0; i < 4; i++) {
    ki = gammaRates[i];
    kisqr = ki * ki;
    for (l = 1; l < 20; l++) {
      diagptable[i * 128 + l * 4] = exp(EIGN[l - 1] * ki * lz);
      diagptable[i * 128 + l * 4 + 1] = EIGN[l - 1] * ki;
      diagptable[i * 128 + l * 4 + 2] = EIGN[l - 1] * EIGN[l - 1] * kisqr;
    }
  }
  for (i = 0; i < upper; i++) {
    sum = &sumtable[i * 80];
    inv_Li = 0.0;
    dlnLidlz = 0.0;
    d2lnLidlz2 = 0.0;
    for (j = 0; j < 4; j++) {
      inv_Li += sum[j * 20];
      for (l = 1; l < 20; l++) {
        inv_Li += (tmp = diagptable[j * 128 + l * 4] * sum[j * 20 + l]);
        dlnLidlz += tmp * diagptable[j * 128 + l * 4 + 1];
        d2lnLidlz2 += tmp * diagptable[j * 128 + l * 4 + 2];
      }
    }
    inv_Li = FABS(inv_Li) * scaler;
    if (iptr[i] < 20)
      inv_Li += freqs[iptr[i]];
    inv_Li = 1.0 / inv_Li;
    dlnLidlz *= inv_Li;
    d2lnLidlz2 *= inv_Li;
    dlnLidlz *= scaler;
    d2lnLidlz2 *= scaler;
    dlnLdlz += wrptr[i] * dlnLidlz;
    d2lnLdlz2 += wrptr[i] * (d2lnLidlz2 - dlnLidlz * dlnLidlz);
  }
  *ext_dlnLdlz = dlnLdlz;
  *ext_d2lnLdlz2 = d2lnLdlz2;
}
```