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

```asm
<Rates4Sites>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  movsd  %xmm0,-0x40(%rbp)
  mov    %esi,-0x44(%rbp)
  mov    %edx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  mov    %r8,-0x58(%rbp)
  mov    -0x44(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  pxor   %xmm0,%xmm0
  ucomisd -0x40(%rbp),%xmm0
  jp     L79
  pxor   %xmm0,%xmm0
  ucomisd -0x40(%rbp),%xmm0
  jne    L79
  cmpq   $0x0,-0x38(%rbp)
  je     L125
  movl   $0x0,-0x24(%rbp)
  jmp    L0
L67:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  D18(%rip),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x24(%rbp)
L0:
  mov    -0x24(%rbp),%eax
  cmp    -0x48(%rbp),%eax
  jl     L67
  jmp    L125
L79:
  cmpl   $0x1,-0x44(%rbp)
  jle    L133
  mov    -0x44(%rbp),%edx
  movsd  -0x40(%rbp),%xmm0
  mov    -0x40(%rbp),%rdi
  mov    -0x10(%rbp),%rsi
  mov    -0x8(%rbp),%rax
  mov    $0x0,%ecx
  movapd %xmm0,%xmm1
  movq   %rdi,%xmm0
  mov    %rax,%rdi
  call   <DiscreteGamma@plt>
  mov    -0x44(%rbp),%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  lea    (%rdx,%rax,1),%rdi
  mov    -0x18(%rbp),%rcx
  mov    -0x8(%rbp),%rdx
  mov    -0x44(%rbp),%esi
  mov    -0x48(%rbp),%eax
  mov    %rdi,%r8
  mov    %eax,%edi
  call   <MultiNomial@plt>
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L88
L99:
  movl   $0x0,-0x1c(%rbp)
  jmp    L26
L163:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x10(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x24(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x24(%rbp)
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rcx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x1c(%rbp)
L26:
  mov    -0x20(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0x1c(%rbp)
  jl     L163
  addl   $0x1,-0x20(%rbp)
L88:
  mov    -0x20(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L99
  jmp    L33
L133:
  movl   $0x0,-0x24(%rbp)
  jmp    L44
L141:
  mov    -0x40(%rbp),%rax
  movq   %rax,%xmm0
  call   <rndgamma@plt>
  movq   %xmm0,%rax
  mov    -0x24(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  movq   %rax,%xmm0
  divsd  -0x40(%rbp),%xmm0
  movsd  %xmm0,(%rdx)
  addl   $0x1,-0x24(%rbp)
L44:
  mov    -0x24(%rbp),%eax
  cmp    -0x48(%rbp),%eax
  jl     L141
L33:
  cmpl   $0x0,-0x4c(%rbp)
  je     L125
  movl   $0x1,-0x24(%rbp)
  jmp    L30
L31:
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x24(%rbp)
L30:
  mov    -0x24(%rbp),%eax
  cmp    -0x48(%rbp),%eax
  jl     L31
  mov    -0x48(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  movsd  D18(%rip),%xmm0
  divsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    -0x48(%rbp),%edx
  mov    -0x38(%rbp),%rcx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <abyx@plt>
L125:
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D18
datatype: byte[8]

tool: {"D18": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x3f]}

assistant: ```c
int Rates4Sites(double rates[], double alpha, int ncatG, int ls, int cdf, double space[]) {
  int h, ir, j, *counts = (int *)(space + 2 * ncatG);
  double *rK = space, *freqK = space + ncatG;
  if (alpha == 0) {
    if (rates)
      for (h = 0; h < ls; h++)
        rates[h] = 1;
  } else {
    if (ncatG > 1) {
      DiscreteGamma(freqK, rK, alpha, alpha, ncatG, 0);
      MultiNomial(ls, ncatG, freqK, counts, space + 3 * ncatG);
      for (ir = 0, h = 0; ir < ncatG; ir++)
        for (j = 0; j < counts[ir]; j++)
          rates[h++] = rK[ir];
    } else
      for (h = 0; h < ls; h++)
        rates[h] = rndgamma(alpha) / alpha;
    if (cdf) {
      for (h = 1; h < ls; h++)
        rates[h] += rates[h - 1];
      abyx(1 / rates[ls - 1], rates, ls);
    }
  }
  return (0);
}
```