user: Translate the below assembly code into C programming language:

```asm
<core_site_likelihood_derivatives>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%r10d
  mov    %esi,%edi
  mov    %rcx,%rsi
  mov    0x30(%rsp),%rbx
  mov    0x38(%rsp),%r11
  mov    0x40(%rsp),%rax
  mov    0x48(%rsp),%rcx
  movq   $0x0,0x10(%rcx)
  movq   $0x0,0x8(%rcx)
  movq   $0x0,(%rcx)
  test   %edx,%edx
  je     L85
  mov    %r8,%rbp
  mov    %edi,%edi
  lea    0x0(,%rdi,8),%r8
  mov    %rbx,%rdi
  lea    -0x1(%rdx),%edx
  lea    0x8(%rbx,%rdx,8),%r12
  lea    -0x1(%r10),%ebx
  add    $0x1,%rbx
  shl    $0x5,%rbx
  pxor   %xmm5,%xmm5
  movsd  D0(%rip),%xmm6
  jmp    L32
L7:
  pxor   %xmm1,%xmm1
  movapd %xmm1,%xmm3
  movapd %xmm1,%xmm2
  jmp    L33
L28:
  movapd %xmm6,%xmm4
  subsd  %xmm0,%xmm4
  mulsd  %xmm4,%xmm2
  addsd  %xmm7,%xmm2
  mulsd  %xmm4,%xmm1
  mulsd  %xmm4,%xmm3
L63:
  mulsd  (%rsi),%xmm2
  addsd  (%rcx),%xmm2
  movsd  %xmm2,(%rcx)
  mulsd  (%rsi),%xmm1
  addsd  0x8(%rcx),%xmm1
  movsd  %xmm1,0x8(%rcx)
  mulsd  (%rsi),%xmm3
  addsd  0x10(%rcx),%xmm3
  movsd  %xmm3,0x10(%rcx)
  add    %r8,%r11
  add    $0x8,%rdi
  add    $0x8,%rsi
  add    $0x8,%r9
  cmp    %r12,%rdi
  je     L85
L32:
  mov    (%rdi),%r14
  test   %r10d,%r10d
  je     L7
  mov    %r11,%rdx
  lea    (%rax,%rbx,1),%r13
  pxor   %xmm1,%xmm1
  movapd %xmm1,%xmm3
  movapd %xmm1,%xmm2
L26:
  movsd  (%rdx),%xmm0
  movapd %xmm0,%xmm4
  mulsd  (%rax),%xmm4
  addsd  %xmm4,%xmm2
  movapd %xmm0,%xmm4
  mulsd  0x8(%rax),%xmm4
  addsd  %xmm4,%xmm1
  mulsd  0x10(%rax),%xmm0
  addsd  %xmm0,%xmm3
  add    $0x20,%rax
  add    $0x8,%rdx
  cmp    %r13,%rax
  jne    L26
  mov    %r13,%rax
L33:
  movsd  (%r9),%xmm0
  comisd %xmm5,%xmm0
  jbe    L63
  mov    0x0(%rbp),%edx
  pxor   %xmm7,%xmm7
  cmp    $0xffffffff,%edx
  je     L28
  movslq %edx,%rdx
  movapd %xmm0,%xmm7
  mulsd  (%r14,%rdx,8),%xmm7
  jmp    L28
L85:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D0
datatype: f64

tool: D0: 1

assistant: ```c
void core_site_likelihood_derivatives(unsigned int states, unsigned int states_padded, unsigned int rate_cats, const double *rate_weights, const int *invariant, const double *prop_invar, double *const *freqs, const double *sumtable, const double *diagptable, double *site_lk) {
  unsigned int i, j;
  double inv_site_lk = 0.0;
  double cat_sitelk[3];
  const double *sum = sumtable;
  const double *diagp = diagptable;
  const double *t_freqs;
  double t_prop_invar;
  site_lk[0] = site_lk[1] = site_lk[2] = 0;
  for (i = 0; i < rate_cats; ++i) {
    t_freqs = freqs[i];
    cat_sitelk[0] = cat_sitelk[1] = cat_sitelk[2] = 0;
    for (j = 0; j < states; ++j) {
      cat_sitelk[0] += sum[j] * diagp[0];
      cat_sitelk[1] += sum[j] * diagp[1];
      cat_sitelk[2] += sum[j] * diagp[2];
      diagp += 4;
    }
    t_prop_invar = prop_invar[i];
    if (t_prop_invar > 0) {
      inv_site_lk = (invariant[0] == -1) ? 0 : t_freqs[invariant[0]] * t_prop_invar;
      cat_sitelk[0] = cat_sitelk[0] * (1. - t_prop_invar) + inv_site_lk;
      cat_sitelk[1] = cat_sitelk[1] * (1. - t_prop_invar);
      cat_sitelk[2] = cat_sitelk[2] * (1. - t_prop_invar);
    }
    site_lk[0] += cat_sitelk[0] * rate_weights[i];
    site_lk[1] += cat_sitelk[1] * rate_weights[i];
    site_lk[2] += cat_sitelk[2] * rate_weights[i];
    sum += states_padded;
  }
}
```