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

```asm
<seq_gen_DiscreteGamma>:
  endbr64
  movapd %xmm0,%xmm2
  pxor   %xmm7,%xmm7
  push   %r15
  mov    %rsi,%r15
  divsd  %xmm1,%xmm0
  cvtsi2sd %edx,%xmm7
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edx,%ebx
  sub    $0x58,%rsp
  movsd  %xmm1,0x20(%rsp)
  movsd  %xmm7,0x28(%rsp)
  mulsd  %xmm7,%xmm0
  movsd  %xmm0,0x18(%rsp)
  test   %ecx,%ecx
  je     L81
  test   %edx,%edx
  jle    L188
  movapd %xmm7,%xmm0
  movapd %xmm1,%xmm6
  addsd  %xmm2,%xmm2
  movslq %edx,%r12
  addsd  %xmm7,%xmm0
  movsd  D8(%rip),%xmm5
  addsd  %xmm1,%xmm6
  xor    %r13d,%r13d
  movsd  %xmm5,0x8(%rsp)
  movq   %xmm2,%rbp
  divsd  %xmm0,%xmm5
  movsd  %xmm6,0x10(%rsp)
  movsd  %xmm5,0x20(%rsp)
  nopl   (%rax)
L46:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r13d,%xmm0
  addsd  %xmm0,%xmm0
  addsd  0x8(%rsp),%xmm0
  mulsd  0x20(%rsp),%xmm0
  cvttsd2si %xmm0,%edi
  movq   %rbp,%xmm0
  call   <PointChi2@plt>
  divsd  0x10(%rsp),%xmm0
  movsd  %xmm0,(%r15,%r13,8)
  add    $0x1,%r13
  cmp    %r13,%r12
  jne    L46
  cmp    $0x1,%ebx
  je     L98
  mov    %ebx,%edx
  lea    0x10(%r15),%rcx
  pxor   %xmm0,%xmm0
  mov    %r15,%rax
  shr    %edx
  sub    $0x1,%edx
  shl    $0x4,%rdx
  add    %rcx,%rdx
  xchg   %ax,%ax
L84:
  movsd  (%rax),%xmm1
  add    $0x10,%rax
  addsd  %xmm1,%xmm0
  movsd  -0x8(%rax),%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rax,%rdx
  jne    L84
  mov    %ebx,%eax
  and    $0xfffffffe,%eax
  cmp    %eax,%ebx
  je     L223
L153:
  cltq
  movsd  0x18(%rsp),%xmm1
  addsd  (%r15,%rax,8),%xmm0
  divsd  %xmm0,%xmm1
  cmp    $0x1,%ebx
  je     L96
  lea    0x10(%r15),%rcx
L177:
  mov    %ebx,%edx
  movapd %xmm1,%xmm2
  mov    %r15,%rax
  shr    %edx
  unpcklpd %xmm2,%xmm2
  sub    $0x1,%edx
  shl    $0x4,%rdx
  add    %rcx,%rdx
  nop
L250:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  mulpd  %xmm2,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rax,%rdx
  jne    L250
  mov    %ebx,%eax
  and    $0xfffffffe,%eax
  cmp    %eax,%ebx
  je     L224
L202:
  cltq
  lea    (%r15,%rax,8),%rax
  mulsd  (%rax),%xmm1
  movsd  %xmm1,(%rax)
L124:
  test   %ebx,%ebx
  mov    $0x1,%ecx
  movsd  0x8(%rsp),%xmm0
  divsd  0x28(%rsp),%xmm0
  cmovg  %ebx,%ecx
  cmp    $0x1,%ebx
  jle    L296
L115:
  mov    %ecx,%edx
  movapd %xmm0,%xmm1
  mov    %r14,%rax
  shr    %edx
  unpcklpd %xmm1,%xmm1
  sub    $0x1,%edx
  shl    $0x4,%rdx
  lea    0x10(%r14,%rdx,1),%rdx
  nopw   0x0(%rax,%rax,1)
L78:
  movups %xmm1,(%rax)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L78
  mov    %ecx,%eax
  and    $0xfffffffe,%eax
  and    $0x1,%ecx
  je     L188
L160:
  cltq
  movsd  %xmm0,(%r14,%rax,8)
L188:
  add    $0x58,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L96:
  xor    %eax,%eax
  jmp    L202
  nopw   0x0(%rax,%rax,1)
L81:
  movsd  D8(%rip),%xmm4
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm4,0x8(%rsp)
  addsd  %xmm2,%xmm4
  movapd %xmm4,%xmm0
  movsd  %xmm4,0x30(%rsp)
  call   <seq_gen_LnGamma@plt>
  lea    -0x1(%rbx),%eax
  mov    %eax,0x4c(%rsp)
  movsd  %xmm0,0x38(%rsp)
  test   %eax,%eax
  jle    L159
  movsd  0x10(%rsp),%xmm2
  lea    -0x2(%rbx),%ebp
  xor    %r13d,%r13d
  mov    %rbp,%r12
  addsd  %xmm2,%xmm2
  movsd  %xmm2,0x40(%rsp)
  movsd  0x20(%rsp),%xmm2
  movapd %xmm2,%xmm5
  addsd  %xmm2,%xmm5
  movsd  %xmm5,0x10(%rsp)
  nopl   0x0(%rax)
L192:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r13d,%xmm0
  addsd  0x8(%rsp),%xmm0
  divsd  0x28(%rsp),%xmm0
  cvttsd2si %xmm0,%edi
  movsd  0x40(%rsp),%xmm0
  call   <PointChi2@plt>
  mov    %r13,%rdx
  divsd  0x10(%rsp),%xmm0
  movsd  %xmm0,(%r14,%r13,8)
  add    $0x1,%r13
  cmp    %rbp,%rdx
  jne    L192
  mov    %r14,%r13
  lea    0x8(%r14,%rbp,8),%rbp
  nopl   0x0(%rax)
L215:
  movsd  0x20(%rsp),%xmm0
  mulsd  0x0(%r13),%xmm0
  add    $0x8,%r13
  movsd  0x38(%rsp),%xmm2
  movsd  0x30(%rsp),%xmm1
  call   <seq_gen_IncompleteGamma@plt>
  movsd  %xmm0,-0x8(%r13)
  cmp    %rbp,%r13
  jne    L215
  movsd  (%r14),%xmm0
  movsd  0x18(%rsp),%xmm3
  movslq %ebx,%rax
  cmpl   $0x1,0x4c(%rsp)
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,(%r15)
  movsd  0x8(%rsp),%xmm0
  subsd  -0x10(%r14,%rax,8),%xmm0
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,-0x8(%r15,%rax,8)
  jle    L276
  mov    %r15,%rax
  sub    %r14,%rax
  cmp    $0x8,%rax
  jbe    L161
  cmp    $0x3,%ebx
  je     L161
  mov    %r12d,%eax
  movapd %xmm3,%xmm1
  shr    %eax
  unpcklpd %xmm1,%xmm1
  lea    -0x1(%rax),%edx
  mov    $0x8,%eax
  shl    $0x4,%rdx
  add    $0x18,%rdx
  nopl   0x0(%rax)
L26:
  movupd (%r14,%rax,1),%xmm0
  movupd -0x8(%r14,%rax,1),%xmm4
  subpd  %xmm4,%xmm0
  mulpd  %xmm1,%xmm0
  movups %xmm0,(%r15,%rax,1)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L26
  mov    %r12d,%eax
  or     $0x1,%eax
  and    $0x1,%r12d
  je     L276
  cltq
  movsd  (%r14,%rax,8),%xmm0
  subsd  -0x8(%r14,%rax,8),%xmm0
  mulsd  0x18(%rsp),%xmm0
  movsd  %xmm0,(%r15,%rax,8)
L276:
  test   %ebx,%ebx
  jg     L124
  jmp    L188
  nop
L224:
  test   %ebx,%ebx
  mov    $0x1,%ecx
  movsd  0x8(%rsp),%xmm0
  divsd  0x28(%rsp),%xmm0
  cmovg  %ebx,%ecx
  jmp    L115
  nopl   0x0(%rax,%rax,1)
L223:
  movsd  0x18(%rsp),%xmm1
  divsd  %xmm0,%xmm1
  jmp    L177
L296:
  xor    %eax,%eax
  jmp    L160
L98:
  pxor   %xmm0,%xmm0
  xor    %eax,%eax
  jmp    L153
L161:
  lea    -0x3(%rbx),%edx
  mov    $0x1,%eax
  add    $0x2,%rdx
  nopl   (%rax)
L227:
  movsd  (%r14,%rax,8),%xmm0
  subsd  -0x8(%r14,%rax,8),%xmm0
  mulsd  0x18(%rsp),%xmm0
  movsd  %xmm0,(%r15,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L227
  jmp    L276
L159:
  movsd  (%r14),%xmm0
  movsd  0x18(%rsp),%xmm3
  movslq %ebx,%rax
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,(%r15)
  movsd  0x8(%rsp),%xmm0
  subsd  -0x10(%r14,%rax,8),%xmm0
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,-0x8(%r15,%rax,8)
  jmp    L276
```

tool_calls: name: unpack_data
arguments: data_label: D8
datatype: f64

tool: D8: 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);
}
```