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

```asm
<DiscreteGamma>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rsi,%rbx
  movsd  %xmm0,0x28(%rsp)
  movsd  %xmm1,(%rsp)
  pxor   %xmm2,%xmm2
  cvtsi2sd %edx,%xmm2
  movsd  %xmm2,0x18(%rsp)
  divsd  %xmm1,%xmm0
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,0x20(%rsp)
  cmp    $0x1,%edx
  je     L29
  mov    %rdi,%rbp
  mov    %edx,%r12d
  test   %ecx,%ecx
  je     L66
  test   %edx,%edx
  jle    L89
  movsd  D64(%rip),%xmm1
  movsd  0x18(%rsp),%xmm6
  movapd %xmm6,%xmm0
  addsd  %xmm6,%xmm0
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rsp)
  movsd  0x28(%rsp),%xmm7
  addsd  %xmm7,%xmm7
  movsd  %xmm7,0x8(%rsp)
  lea    -0x1(%rdx),%r15d
  mov    %edx,%r14d
  mov    $0x0,%r13d
L40:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r13d,%xmm0
  addsd  %xmm0,%xmm0
  addsd  D64(%rip),%xmm0
  mulsd  0x10(%rsp),%xmm0
  cvttsd2si %xmm0,%edi
  movsd  0x8(%rsp),%xmm0
  call   <PointChi2@plt>
  movsd  (%rsp),%xmm3
  movapd %xmm3,%xmm1
  addsd  %xmm3,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx,%r13,8)
  add    $0x1,%r13
  cmp    %r14,%r13
  jne    L40
  mov    %rbx,%rax
  lea    0x8(%rbx,%r15,8),%rdx
  pxor   %xmm0,%xmm0
L90:
  addsd  (%rbx),%xmm0
  add    $0x8,%rbx
  cmp    %rdx,%rbx
  jne    L90
  movsd  0x20(%rsp),%xmm1
  divsd  %xmm0,%xmm1
L133:
  movapd %xmm1,%xmm0
  mulsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L133
L41:
  movsd  D64(%rip),%xmm0
  divsd  0x18(%rsp),%xmm0
  mov    $0x0,%eax
L107:
  movsd  %xmm0,0x0(%rbp,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L107
L89:
  mov    $0x0,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L29:
  mov    D64(%rip),%rax
  mov    %rax,(%rsi)
  jmp    L89
L66:
  movsd  0x28(%rsp),%xmm7
  addsd  D64(%rip),%xmm7
  movapd %xmm7,%xmm0
  movsd  %xmm7,0x8(%rsp)
  call   <LnGamma@plt>
  movsd  %xmm0,0x10(%rsp)
  lea    -0x1(%r12),%r15d
  test   %r15d,%r15d
  jle    L72
  movsd  0x28(%rsp),%xmm6
  addsd  %xmm6,%xmm6
  movsd  %xmm6,0x28(%rsp)
  lea    -0x2(%r12),%r14d
  mov    $0x0,%r13d
L12:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r13d,%xmm0
  addsd  D64(%rip),%xmm0
  divsd  0x18(%rsp),%xmm0
  cvttsd2si %xmm0,%edi
  movsd  0x28(%rsp),%xmm0
  call   <PointChi2@plt>
  movsd  (%rsp),%xmm5
  movapd %xmm5,%xmm1
  addsd  %xmm5,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x0(%rbp,%r13,8)
  mov    %r13,%rax
  add    $0x1,%r13
  cmp    %r14,%rax
  jne    L12
  mov    %rbp,%r13
  lea    0x8(%rbp,%r14,8),%r14
L10:
  movsd  (%rsp),%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  0x10(%rsp),%xmm2
  movsd  0x8(%rsp),%xmm1
  call   <IncompleteGamma@plt>
  movsd  %xmm0,0x0(%r13)
  add    $0x8,%r13
  cmp    %r14,%r13
  jne    L10
L72:
  movsd  0x20(%rsp),%xmm4
  movapd %xmm4,%xmm0
  mulsd  0x0(%rbp),%xmm0
  movsd  %xmm0,(%rbx)
  movslq %r12d,%rax
  movsd  D64(%rip),%xmm0
  subsd  -0x10(%rbp,%rax,8),%xmm0
  mulsd  %xmm4,%xmm0
  movsd  %xmm0,-0x8(%rbx,%rax,8)
  cmp    $0x1,%r15d
  jle    L33
  lea    -0x3(%r12),%edx
  add    $0x2,%rdx
  mov    $0x1,%eax
L21:
  movsd  0x0(%rbp,%rax,8),%xmm0
  subsd  -0x8(%rbp,%rax,8),%xmm0
  mulsd  0x20(%rsp),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L21
L33:
  test   %r12d,%r12d
  jg     L41
  jmp    L89
```

tool_calls: name: read_data
arguments: data_label: D64
data_type: f64

tool: D64: 1

assistant: ```c
int DiscreteGamma(double freqK[], double rK[], double alfa, double beta, int K, int median) {
  int i;
  double gap05 = 1.0 / (2.0 * K), t, factor = alfa / beta * K, lnga1;
  if (K == 1) {
    rK[0] = 1.0;
    return 0;
  }
  if (median) {
    for (i = 0; i < K; i++)
      rK[i] = PointChi2((i * 2.0 + 1) * gap05, 2.0 * (alfa)) / (2.0 * (beta));
    for (i = 0, t = 0; i < K; i++)
      t += rK[i];
    for (i = 0; i < K; i++)
      rK[i] *= factor / t;
  } else {
    lnga1 = LnGamma(alfa + 1);
    for (i = 0; i < K - 1; i++)
      freqK[i] = PointChi2((i + 1.0) / K, 2.0 * (alfa)) / (2.0 * (beta));
    for (i = 0; i < K - 1; i++)
      freqK[i] = IncompleteGamma(freqK[i] * beta, alfa + 1, lnga1);
    rK[0] = freqK[0] * factor;
    rK[K - 1] = (1 - freqK[K - 2]) * factor;
    for (i = 1; i < K - 1; i++)
      rK[i] = (freqK[i] - freqK[i - 1]) * factor;
  }
  for (i = 0; i < K; i++)
    freqK[i] = 1.0 / K;
  return (0);
}
```