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

```asm
<DiscreteGamma>:
  endbr64
  movapd %xmm0,%xmm2
  pxor   %xmm6,%xmm6
  push   %r15
  divsd  %xmm1,%xmm0
  cvtsi2sd %edx,%xmm6
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x48,%rsp
  movsd  %xmm1,0x30(%rsp)
  movsd  %xmm6,0x20(%rsp)
  mulsd  %xmm6,%xmm0
  movsd  %xmm0,0x28(%rsp)
  cmp    $0x1,%edx
  je     L97
  mov    %rdi,%rbp
  mov    %edx,%r12d
  test   %ecx,%ecx
  je     L36
  test   %edx,%edx
  jle    L54
  movsd  0x20(%rsp),%xmm3
  addsd  %xmm2,%xmm2
  mov    %edx,%r14d
  xor    %r13d,%r13d
  movsd  D25(%rip),%xmm7
  lea    -0x1(%rdx),%r15d
  movapd %xmm3,%xmm0
  addsd  %xmm3,%xmm0
  movsd  %xmm7,(%rsp)
  movsd  %xmm2,0x10(%rsp)
  movsd  0x30(%rsp),%xmm2
  divsd  %xmm0,%xmm7
  addsd  %xmm2,%xmm2
  movsd  %xmm2,0x8(%rsp)
  movsd  %xmm7,0x18(%rsp)
  nopl   0x0(%rax,%rax,1)
L127:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r13d,%xmm0
  addsd  %xmm0,%xmm0
  addsd  (%rsp),%xmm0
  mulsd  0x18(%rsp),%xmm0
  cvttsd2si %xmm0,%edi
  movsd  0x10(%rsp),%xmm0
  call   <PointChi2@plt>
  divsd  0x8(%rsp),%xmm0
  movsd  %xmm0,(%rbx,%r13,8)
  add    $0x1,%r13
  cmp    %r13,%r14
  jne    L127
  lea    0x8(%rbx,%r15,8),%rdx
  mov    %rbx,%rax
  pxor   %xmm0,%xmm0
L12:
  addsd  (%rax),%xmm0
  add    $0x8,%rax
  cmp    %rax,%rdx
  jne    L12
  movsd  0x28(%rsp),%xmm1
  divsd  %xmm0,%xmm1
  nopw   0x0(%rax,%rax,1)
L87:
  movsd  (%rbx),%xmm0
  add    $0x8,%rbx
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbx)
  cmp    %rbx,%rdx
  jne    L87
L24:
  xor    %eax,%eax
  movsd  (%rsp),%xmm0
  divsd  0x20(%rsp),%xmm0
  nopl   0x0(%rax,%rax,1)
L64:
  movsd  %xmm0,0x0(%rbp,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L64
L54:
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L36:
  movsd  D25(%rip),%xmm5
  movsd  %xmm2,0x8(%rsp)
  lea    -0x1(%r12),%r14d
  movsd  %xmm5,(%rsp)
  addsd  %xmm2,%xmm5
  movapd %xmm5,%xmm0
  movsd  %xmm5,0x10(%rsp)
  call   <LnGamma@plt>
  movsd  %xmm0,0x18(%rsp)
  test   %r14d,%r14d
  jle    L17
  movsd  0x30(%rsp),%xmm3
  movsd  0x8(%rsp),%xmm2
  lea    -0x2(%r12),%r13d
  xor    %r15d,%r15d
  movapd %xmm3,%xmm4
  addsd  %xmm2,%xmm2
  addsd  %xmm3,%xmm4
  movsd  %xmm2,0x38(%rsp)
  movsd  %xmm4,0x8(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L110:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r15d,%xmm0
  addsd  (%rsp),%xmm0
  divsd  0x20(%rsp),%xmm0
  cvttsd2si %xmm0,%edi
  movsd  0x38(%rsp),%xmm0
  call   <PointChi2@plt>
  mov    %r15,%rax
  divsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x0(%rbp,%r15,8)
  add    $0x1,%r15
  cmp    %r13,%rax
  jne    L110
  mov    %rbp,%r15
  lea    0x8(%rbp,%r13,8),%r13
  nopl   0x0(%rax)
L53:
  movsd  0x30(%rsp),%xmm0
  mulsd  (%r15),%xmm0
  add    $0x8,%r15
  movsd  0x18(%rsp),%xmm2
  movsd  0x10(%rsp),%xmm1
  call   <IncompleteGamma@plt>
  movsd  %xmm0,-0x8(%r15)
  cmp    %r13,%r15
  jne    L53
  movsd  0x0(%rbp),%xmm0
  movsd  0x28(%rsp),%xmm4
  movslq %r12d,%rax
  mulsd  %xmm4,%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%rsp),%xmm0
  subsd  -0x10(%rbp,%rax,8),%xmm0
  mulsd  %xmm4,%xmm0
  movsd  %xmm0,-0x8(%rbx,%rax,8)
  cmp    $0x1,%r14d
  jle    L37
  lea    -0x3(%r12),%edx
  mov    $0x1,%eax
  add    $0x2,%rdx
  nopw   0x0(%rax,%rax,1)
L74:
  movsd  0x0(%rbp,%rax,8),%xmm0
  subsd  -0x8(%rbp,%rax,8),%xmm0
  mulsd  0x28(%rsp),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L74
L37:
  test   %r12d,%r12d
  jg     L24
  jmp    L54
  cs nopw 0x0(%rax,%rax,1)
L97:
  mov    D25(%rip),%rax
  mov    %rax,(%rsi)
  jmp    L54
L17:
  movsd  0x0(%rbp),%xmm0
  movsd  0x28(%rsp),%xmm5
  movslq %r12d,%rax
  mulsd  %xmm5,%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%rsp),%xmm0
  subsd  -0x10(%rbp,%rax,8),%xmm0
  mulsd  %xmm5,%xmm0
  movsd  %xmm0,-0x8(%rbx,%rax,8)
  jmp    L37
```

tool_calls: name: parse_data
arguments: data_label: D25
datatype: f64

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