user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<seq_gen_DiscreteGamma>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%rbx
  movapd %xmm0,%xmm6
  movsd  %xmm0,0x28(%rsp)
  movsd  %xmm1,(%rsp)
  mov    %edx,%r12d
  pxor   %xmm7,%xmm7
  cvtsi2sd %edx,%xmm7
  movsd  %xmm7,0x20(%rsp)
  divsd  %xmm1,%xmm0
  mulsd  %xmm7,%xmm0
  movsd  %xmm0,0x18(%rsp)
  test   %ecx,%ecx
  je     L58
  test   %edx,%edx
  jle    L100
  movsd  D34(%rip),%xmm1
  movapd %xmm7,%xmm0
  addsd  %xmm7,%xmm0
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x10(%rsp)
  addsd  %xmm6,%xmm6
  movsd  %xmm6,0x8(%rsp)
  lea    -0x1(%rdx),%r15d
  mov    %edx,%r14d
  mov    $0x0,%r13d
L13:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r13d,%xmm0
  addsd  %xmm0,%xmm0
  addsd  D34(%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    L13
  mov    %rbx,%rax
  lea    0x8(%rbx,%r15,8),%rdx
  pxor   %xmm0,%xmm0
L60:
  addsd  (%rbx),%xmm0
  add    $0x8,%rbx
  cmp    %rdx,%rbx
  jne    L60
  movsd  0x18(%rsp),%xmm1
  divsd  %xmm0,%xmm1
L87:
  movapd %xmm1,%xmm0
  mulsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L87
L124:
  movsd  D34(%rip),%xmm0
  divsd  0x20(%rsp),%xmm0
  mov    $0x0,%eax
L121:
  movsd  %xmm0,0x0(%rbp,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L121
L100:
  mov    $0x0,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L58:
  movsd  0x28(%rsp),%xmm6
  addsd  D34(%rip),%xmm6
  movapd %xmm6,%xmm0
  movsd  %xmm6,0x8(%rsp)
  call   <seq_gen_LnGamma@plt>
  movsd  %xmm0,0x10(%rsp)
  lea    -0x1(%r12),%r15d
  test   %r15d,%r15d
  jle    L49
  movsd  0x28(%rsp),%xmm2
  addsd  %xmm2,%xmm2
  movsd  %xmm2,0x28(%rsp)
  lea    -0x2(%r12),%r14d
  mov    $0x0,%r13d
L61:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r13d,%xmm0
  addsd  D34(%rip),%xmm0
  divsd  0x20(%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    L61
  mov    %rbp,%r13
  lea    0x8(%rbp,%r14,8),%r14
L25:
  movsd  (%rsp),%xmm0
  mulsd  0x0(%r13),%xmm0
  movsd  0x10(%rsp),%xmm2
  movsd  0x8(%rsp),%xmm1
  call   <seq_gen_IncompleteGamma@plt>
  movsd  %xmm0,0x0(%r13)
  add    $0x8,%r13
  cmp    %r14,%r13
  jne    L25
L49:
  movsd  0x18(%rsp),%xmm4
  movapd %xmm4,%xmm0
  mulsd  0x0(%rbp),%xmm0
  movsd  %xmm0,(%rbx)
  movslq %r12d,%rax
  movsd  D34(%rip),%xmm0
  subsd  -0x10(%rbp,%rax,8),%xmm0
  mulsd  %xmm4,%xmm0
  movsd  %xmm0,-0x8(%rbx,%rax,8)
  cmp    $0x1,%r15d
  jle    L68
  lea    -0x3(%r12),%edx
  add    $0x2,%rdx
  mov    $0x1,%eax
L21:
  movsd  0x0(%rbp,%rax,8),%xmm0
  subsd  -0x8(%rbp,%rax,8),%xmm0
  mulsd  0x18(%rsp),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L21
L68:
  test   %r12d,%r12d
  jg     L124
  jmp    L100
```

tool_calls: name: unpack_data
arguments: tag: D34
type: f64

tool: D34: 1

assistant: ```c
int seq_gen_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 (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 = seq_gen_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] = seq_gen_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);
}
```