user: 请从给定的汇编指令推导出C源代码：

```asm
<ancestralGamma>:
  endbr64
  push   %r15
  imul   %ecx,%r9d
  push   %r14
  movslq %r8d,%r14
  push   %r13
  mov    %r14d,%eax
  push   %r12
  imul   %r14d,%eax
  mov    %r14,%r12
  push   %rbp
  mov    %rdi,%rbp
  lea    0x0(,%r14,8),%edi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x38,%rsp
  mov    %eax,0x20(%rsp)
  movslq %r9d,%rax
  mov    %rsi,(%rsp)
  mov    %rax,0x8(%rsp)
  mov    %r14,0x10(%rsp)
  call   <rax_malloc@plt>
  mov    %rax,%r11
  test   %r14d,%r14d
  jle    L52
  lea    0x0(,%r14,8),%rdx
  xor    %esi,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    %rax,%r11
L52:
  mov    0x10(%rsp),%rax
  mov    %r12d,%r13d
  pxor   %xmm4,%xmm4
  mov    %rbp,%r10
  mov    %r11,0x28(%rsp)
  and    $0xfffffffe,%r13d
  xor    %edi,%edi
  movapd %xmm4,%xmm3
  lea    0x0(,%rax,8),%r14
  lea    -0x1(%r12),%eax
  mov    %r11,0x18(%rsp)
  lea    0x8(%r11,%rax,8),%r15
  mov    %r12d,%eax
  movl   $0x4,0x24(%rsp)
  shr    %eax
  lea    -0x1(%rax),%r9d
  xor    %eax,%eax
  add    $0x1,%r9
  mov    %eax,%r11d
  shl    $0x4,%r9
L87:
  test   %r12d,%r12d
  jle    L44
  movslq %r11d,%rax
  mov    0x18(%rsp),%r8
  mov    %r11d,%ecx
  lea    (%rbx,%rax,8),%rsi
  nopl   0x0(%rax,%rax,1)
L126:
  cmp    $0x1,%r12d
  je     L42
  xor    %eax,%eax
  movapd %xmm4,%xmm0
  nopl   0x0(%rax,%rax,1)
L112:
  movupd (%r10,%rax,1),%xmm2
  movupd (%rsi,%rax,1),%xmm5
  add    $0x10,%rax
  mulpd  %xmm5,%xmm2
  addsd  %xmm2,%xmm0
  unpckhpd %xmm2,%xmm2
  addsd  %xmm2,%xmm0
  cmp    %r9,%rax
  jne    L112
  movslq %r13d,%rax
  cmp    %r12d,%r13d
  je     L122
L74:
  lea    (%rcx,%rax,1),%edx
  add    %rdi,%rax
  movslq %edx,%rdx
  movsd  (%rbx,%rdx,8),%xmm1
  mulsd  0x0(%rbp,%rax,8),%xmm1
  addsd  %xmm1,%xmm0
L122:
  movsd  (%r8),%xmm1
  add    $0x8,%r8
  addsd  %xmm0,%xmm3
  add    %r12d,%ecx
  add    %r14,%rsi
  addsd  %xmm0,%xmm1
  movsd  %xmm1,-0x8(%r8)
  cmp    %r15,%r8
  jne    L126
L44:
  add    0x10(%rsp),%rdi
  add    %r14,%r10
  add    0x20(%rsp),%r11d
  subl   $0x1,0x24(%rsp)
  jne    L87
  mov    0x18(%rsp),%r11
  test   %r12d,%r12d
  jle    L81
  mov    0x8(%rsp),%rax
  mov    (%rsp),%rdi
  lea    0x8(%r11),%rcx
  shl    $0x3,%rax
  lea    (%rdi,%rax,1),%rdx
  cmp    %rcx,%rdx
  je     L75
  cmp    $0x1,%r12d
  je     L75
  movapd %xmm3,%xmm1
  add    %r11,%r9
  mov    %r11,%rax
  sub    %r11,%rdx
  unpcklpd %xmm1,%xmm1
  nopl   0x0(%rax)
L61:
  movupd (%rax),%xmm0
  divpd  %xmm1,%xmm0
  movups %xmm0,(%rdx,%rax,1)
  add    $0x10,%rax
  cmp    %r9,%rax
  jne    L61
  cmp    %r12d,%r13d
  je     L81
  movslq %r13d,%r13
  mov    0x8(%rsp),%rax
  mov    (%rsp),%rbx
  movsd  (%r11,%r13,8),%xmm0
  add    %r13,%rax
  divsd  %xmm3,%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
L81:
  add    $0x38,%rsp
  mov    %r11,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <rax_free@plt>
  xchg   %ax,%ax
L42:
  movapd %xmm4,%xmm0
  xor    %eax,%eax
  jmp    L74
L75:
  mov    0x28(%rsp),%rdx
  sub    %r11,%rax
  add    (%rsp),%rax
L104:
  movsd  (%rdx),%xmm0
  divsd  %xmm3,%xmm0
  movsd  %xmm0,(%rax,%rdx,1)
  add    $0x8,%rdx
  cmp    %r15,%rdx
  jne    L104
  jmp    L81
```

assistant: ```c
void ancestralGamma(double *_v, double *sumBuffer, double *diagptable, int i, int numStates, int gammaStates) {
  int statesSquare = numStates * numStates, k, j, l;
  double *v, *ancestral = &sumBuffer[gammaStates * i], sum = 0.0, *term = (double *)rax_malloc(sizeof(double) * numStates);
  for (l = 0; l < numStates; l++)
    term[l] = 0.0;
  for (k = 0; k < 4; k++) {
    v = &(_v[numStates * k]);
    for (l = 0; l < numStates; l++) {
      double al = 0.0;
      for (j = 0; j < numStates; j++)
        al += v[j] * diagptable[k * statesSquare + l * numStates + j];
      term[l] += al;
      sum += al;
    }
  }
  for (l = 0; l < numStates; l++)
    ancestral[l] = term[l] / sum;
  rax_free(term);
}
```