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

```asm
<DiscreteGamma>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x68,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  movsd  %xmm0,-0x58(%rbp)
  movsd  %xmm1,-0x60(%rbp)
  mov    %edx,-0x64(%rbp)
  mov    %ecx,-0x68(%rbp)
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x64(%rbp),%xmm0
  movapd %xmm0,%xmm1
  addsd  %xmm0,%xmm1
  movsd  D19(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x58(%rbp),%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x60(%rbp),%xmm1
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x64(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  cmpl   $0x1,-0x64(%rbp)
  jne    L72
  mov    -0x50(%rbp),%rax
  movsd  D19(%rip),%xmm0
  movsd  %xmm0,(%rax)
  mov    $0x0,%eax
  jmp    L32
L72:
  cmpl   $0x0,-0x68(%rbp)
  je     L24
  movl   $0x0,-0x34(%rbp)
  jmp    L123
L162:
  movsd  -0x58(%rbp),%xmm0
  addsd  %xmm0,%xmm0
  movq   %xmm0,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sdl -0x34(%rbp),%xmm0
  movapd %xmm0,%xmm1
  addsd  %xmm0,%xmm1
  movsd  D19(%rip),%xmm0
  addsd  %xmm1,%xmm0
  mulsd  -0x28(%rbp),%xmm0
  cvttsd2si %xmm0,%eax
  movq   %rdx,%xmm0
  mov    %eax,%edi
  call   <PointChi2@plt>
  movq   %xmm0,%rax
  movsd  -0x60(%rbp),%xmm0
  movapd %xmm0,%xmm1
  addsd  %xmm0,%xmm1
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x50(%rbp),%rdx
  add    %rcx,%rdx
  movq   %rax,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdx)
  addl   $0x1,-0x34(%rbp)
L123:
  mov    -0x34(%rbp),%eax
  cmp    -0x64(%rbp),%eax
  jl     L162
  movl   $0x0,-0x34(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  jmp    L84
L35:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0x30(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  addl   $0x1,-0x34(%rbp)
L84:
  mov    -0x34(%rbp),%eax
  cmp    -0x64(%rbp),%eax
  jl     L35
  movl   $0x0,-0x34(%rbp)
  jmp    L171
L128:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  -0x20(%rbp),%xmm0
  divsd  -0x30(%rbp),%xmm0
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L171:
  mov    -0x34(%rbp),%eax
  cmp    -0x64(%rbp),%eax
  jl     L128
  jmp    L143
L24:
  movsd  -0x58(%rbp),%xmm1
  movsd  D19(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <LnGamma@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x34(%rbp)
  jmp    L142
L167:
  movsd  -0x58(%rbp),%xmm0
  addsd  %xmm0,%xmm0
  movq   %xmm0,%rdx
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x34(%rbp),%xmm1
  movsd  D19(%rip),%xmm0
  addsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x64(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  movq   %rdx,%xmm0
  mov    %eax,%edi
  call   <PointChi2@plt>
  movq   %xmm0,%rax
  movsd  -0x60(%rbp),%xmm0
  movapd %xmm0,%xmm1
  addsd  %xmm0,%xmm1
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x48(%rbp),%rdx
  add    %rcx,%rdx
  movq   %rax,%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdx)
  addl   $0x1,-0x34(%rbp)
L142:
  mov    -0x64(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x34(%rbp)
  jl     L167
  movl   $0x0,-0x34(%rbp)
  jmp    L148
L85:
  movsd  -0x58(%rbp),%xmm1
  movsd  D19(%rip),%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x60(%rbp),%xmm0
  movq   %xmm0,%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x48(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  movsd  -0x18(%rbp),%xmm0
  movapd %xmm0,%xmm2
  movq   %rax,%xmm0
  call   <IncompleteGamma@plt>
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  addl   $0x1,-0x34(%rbp)
L148:
  mov    -0x64(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x34(%rbp)
  jl     L85
  mov    -0x48(%rbp),%rax
  movsd  (%rax),%xmm0
  mulsd  -0x20(%rbp),%xmm0
  mov    -0x50(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    -0x64(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x10(%rax),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D19(%rip),%xmm0
  subsd  %xmm1,%xmm0
  mov    -0x64(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  movl   $0x1,-0x34(%rbp)
  jmp    L152
L31:
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x34(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mulsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L152:
  mov    -0x64(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x34(%rbp)
  jl     L31
L143:
  movl   $0x0,-0x34(%rbp)
  jmp    L169
L26:
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x64(%rbp),%xmm1
  mov    -0x34(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movsd  D19(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x34(%rbp)
L169:
  mov    -0x34(%rbp),%eax
  cmp    -0x64(%rbp),%eax
  jl     L26
  mov    $0x0,%eax
L32:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D19
data_type: f64

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