user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<DiscreteGammaMedian>:
  endbr64
  push   %r14
  push   %r13
  mov    %esi,%r13d
  push   %r12
  mov    %rdi,%r12
  xor    %edi,%edi
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  test   %esi,%esi
  setne  %dil
  xor    %eax,%eax
  movsd  %xmm1,0x10(%rsp)
  movsd  %xmm0,0x8(%rsp)
  call   <assert@plt>
  xor    %edi,%edi
  test   %r12,%r12
  setne  %dil
  xor    %eax,%eax
  call   <assert@plt>
  movsd  0x8(%rsp),%xmm5
  pxor   %xmm7,%xmm7
  xor    %edi,%edi
  comisd %xmm7,%xmm5
  seta   %dil
  xor    %eax,%eax
  call   <assert@plt>
  movsd  0x10(%rsp),%xmm1
  pxor   %xmm5,%xmm5
  xor    %edi,%edi
  comisd %xmm5,%xmm1
  seta   %dil
  xor    %eax,%eax
  call   <assert@plt>
  cmp    $0x1,%r13d
  jbe    L16
  mov    %r13d,%eax
  pxor   %xmm7,%xmm7
  mov    %r12,%rbp
  mov    %r12,%rbx
  cvtsi2sd %rax,%xmm7
  movsd  D10(%rip),%xmm0
  movsd  D5(%rip),%xmm3
  mov    $0x1,%eax
  movapd %xmm0,%xmm6
  addsd  0x8(%rsp),%xmm0
  divsd  %xmm7,%xmm6
  movsd  %xmm7,0x28(%rsp)
  mulsd  %xmm6,%xmm3
  movsd  %xmm6,0x20(%rsp)
  movsd  %xmm3,0x10(%rsp)
  call   <LnGamma@plt>
  movsd  0x8(%rsp),%xmm1
  lea    -0x1(%r13),%eax
  movsd  0x10(%rsp),%xmm3
  lea    0x8(%r12,%rax,8),%r14
  pxor   %xmm2,%xmm2
  addsd  %xmm1,%xmm1
  xchg   %ax,%ax
L34:
  movapd %xmm3,%xmm0
  mov    $0x2,%eax
  add    $0x8,%rbx
  movsd  %xmm2,0x18(%rsp)
  movsd  %xmm1,0x10(%rsp)
  movsd  %xmm3,0x8(%rsp)
  call   <PointChi2@plt>
  pxor   %xmm0,%xmm0
  movsd  0x18(%rsp),%xmm2
  movsd  0x8(%rsp),%xmm3
  cvtsi2sd %eax,%xmm0
  addsd  0x20(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm1
  movsd  %xmm0,-0x8(%rbx)
  cmp    %r14,%rbx
  addsd  %xmm0,%xmm2
  jne    L34
  mov    %r13d,%eax
  divsd  0x28(%rsp),%xmm2
  movapd %xmm2,%xmm1
  shr    %eax
  unpcklpd %xmm1,%xmm1
  sub    $0x1,%eax
  shl    $0x4,%rax
  lea    0x10(%r12,%rax,1),%rax
  nopl   0x0(%rax)
L39:
  movupd 0x0(%rbp),%xmm0
  add    $0x10,%rbp
  divpd  %xmm1,%xmm0
  movups %xmm0,-0x10(%rbp)
  cmp    %rbp,%rax
  jne    L39
  mov    %r13d,%eax
  and    $0xfffffffe,%eax
  and    $0x1,%r13d
  je     L23
  lea    (%r12,%rax,8),%rax
  movsd  (%rax),%xmm0
  divsd  %xmm2,%xmm0
  movsd  %xmm0,(%rax)
L23:
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopw   0x0(%rax,%rax,1)
L16:
  mov    D10(%rip),%rax
  mov    %rax,(%r12)
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D10
type_guessed: f64
name: extract_symbolic_data
arguments: tag: D5
type_guessed: f64

tool: D10: 1

tool: D5: 0.5

assistant: ```c
void DiscreteGammaMedian(double rates[], const double alpha, const double beta, unsigned n_cat) {
  unsigned i;
  double total = 0.0;
  const double cat_freq = 1.0 / ((double)n_cat);
  double prop = cat_freq * 0.5;
  double lnga1;
  assert(n_cat > 0);
  assert(rates != 0L);
  assert(alpha > 0.0);
  assert(beta > 0.0);
  if (n_cat < 2) {
    rates[0] = 1.0;
    return;
  }
  lnga1 = LnGamma(alpha + 1.0);
  for (i = 0; i < n_cat; ++i) {
    rates[i] = PointChi2(prop, 2.0 * alpha);
    total += rates[i];
    prop += cat_freq;
  }
  total /= (double)n_cat;
  for (i = 0; i < n_cat; ++i)
    rates[i] /= total;
}
```