user: Converte this assembly snippet into its equivalent C code:

```asm
<makeP_FlexLG4>:
  endbr64
  push   %r15
  mov    %r9,%r15
  push   %r14
  mov    %ecx,%r14d
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  xor    %edi,%edi
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x4a8,%rsp
  movsd  %xmm0,0x30(%rsp)
  movsd  %xmm1,0x38(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x498(%rsp)
  mov    0x4e0(%rsp),%eax
  imul   %eax,%eax
  cmpl   $0x40,0x4e0(%rsp)
  setle  %dil
  mov    %eax,0x7c(%rsp)
  call   <assert@plt>
  test   %r14d,%r14d
  jle    L13
  lea    -0x1(%r14),%eax
  mov    %rbx,0x70(%rsp)
  mov    %r15,%r11
  mov    0x4e0(%rsp),%r15d
  lea    0x8(%r12,%rax,8),%rax
  mov    %r12,0x20(%rsp)
  mov    %rax,0x80(%rsp)
  movslq 0x4e0(%rsp),%rax
  movl   $0x0,0x64(%rsp)
  shl    $0x3,%rax
  mov    %r13,0x88(%rsp)
  mov    %rax,0x28(%rsp)
  mov    0x4e0(%rsp),%eax
  mov    %rbp,0x68(%rsp)
  lea    -0x1(%rax),%esi
  mov    %esi,%eax
  mov    %esi,0x14(%rsp)
  shr    %eax
  sub    $0x1,%eax
  add    $0x1,%rax
  shl    $0x4,%rax
  mov    %rax,0x40(%rsp)
  mov    %esi,%eax
  and    $0xfffffffe,%esi
  movslq %esi,%rbx
  mov    %eax,%esi
  mov    0x4e0(%rsp),%eax
  or     $0x1,%esi
  mov    %rbx,%rbp
  sub    $0x2,%eax
  mov    %esi,%r14d
  mov    %eax,0x78(%rsp)
  nopl   (%rax)
L56:
  cmp    $0x1,%r15d
  jle    L79
  mov    0x68(%rsp),%rax
  mov    0x78(%rsp),%esi
  xor    %r12d,%r12d
  mov    %ebp,0x48(%rsp)
  mov    %r11,0x50(%rsp)
  lea    0x290(%rsp),%rdi
  lea    0x90(%rsp),%r13
  movsd  (%rax),%xmm3
  mov    0x70(%rsp),%rax
  mov    %r14d,0x60(%rsp)
  mov    %rsi,%r14
  mov    %rbx,0x58(%rsp)
  mov    %r12,%rbx
  mov    %rdi,%r12
  mov    (%rax),%rax
  movsd  %xmm3,0x18(%rsp)
  mov    %rax,%rbp
  nopw   0x0(%rax,%rax,1)
L121:
  movsd  0x18(%rsp),%xmm1
  mulsd  0x0(%rbp,%rbx,8),%xmm1
  movsd  0x30(%rsp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm1,0x8(%rsp)
  call   <exp@plt>
  movsd  0x8(%rsp),%xmm1
  mulsd  0x38(%rsp),%xmm1
  movsd  %xmm0,0x0(%r13,%rbx,8)
  movapd %xmm1,%xmm0
  call   <exp@plt>
  mov    %rbx,%rdx
  movsd  %xmm0,(%r12,%rbx,8)
  add    $0x1,%rbx
  cmp    %r14,%rdx
  jne    L121
  mov    0x48(%rsp),%ebp
  mov    0x60(%rsp),%r14d
  mov    0x50(%rsp),%r11
  mov    0x58(%rsp),%rbx
L79:
  test   %r15d,%r15d
  jle    L129
  movslq 0x64(%rsp),%rax
  xor    %r10d,%r10d
  mov    0x88(%rsp),%r13
  xor    %edi,%edi
  mov    %r10d,0x8(%rsp)
  lea    0x8(,%rax,8),%rcx
  mov    %rax,%r12
  mov    0x78(%rsp),%eax
  lea    (%r11,%rcx,1),%rsi
  add    %r13,%rcx
  mov    %rax,0x58(%rsp)
  nopl   (%rax)
L20:
  mov    D9(%rip),%rax
  mov    %rax,-0x8(%rcx)
  mov    %rax,-0x8(%rsi)
  cmp    $0x1,%r15d
  je     L88
  mov    0x20(%rsp),%rax
  lea    0x8(%rcx),%r8
  mov    (%rax),%r10
  movslq %edi,%rax
  shl    $0x3,%rax
  cmp    %r8,%rsi
  setne  %r8b
  cmp    $0x2,%r15d
  lea    (%r10,%rax,1),%rdx
  setne  %r9b
  and    %r9d,%r8d
  lea    0x8(%r10,%rax,1),%r9
  cmp    %r9,%rsi
  setne  %r9b
  test   %r9b,%r8b
  je     L138
  lea    0x10(%r10,%rax,1),%rax
  cmp    %rax,%rcx
  lea    0x10(%rcx),%rax
  setae  %r8b
  cmp    %rax,%rdx
  setae  %al
  or     %r8b,%al
  je     L138
  mov    %edi,0x18(%rsp)
  mov    0x40(%rsp),%rdi
  xor    %eax,%eax
  lea    0x90(%rsp),%r9
  lea    0x290(%rsp),%r8
  nopl   0x0(%rax)
L10:
  movupd (%rdx,%rax,1),%xmm0
  mulpd  (%r9,%rax,1),%xmm0
  movups %xmm0,(%rcx,%rax,1)
  movupd (%rdx,%rax,1),%xmm0
  mulpd  (%r8,%rax,1),%xmm0
  movups %xmm0,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %rdi,%rax
  jne    L10
  mov    0x18(%rsp),%edi
  cmp    %ebp,0x14(%rsp)
  je     L88
  movsd  0x90(%rsp,%rbx,8),%xmm0
  lea    (%rdi,%rbp,1),%eax
  cltq
  lea    (%r10,%rax,8),%rdx
  lea    (%r12,%r14,1),%eax
  mulsd  (%rdx),%xmm0
  cltq
  movsd  %xmm0,0x0(%r13,%rax,8)
  movsd  0x290(%rsp,%rbx,8),%xmm0
  mulsd  (%rdx),%xmm0
  movsd  %xmm0,(%r11,%rax,8)
L88:
  mov    0x28(%rsp),%rdx
  addl   $0x1,0x8(%rsp)
  add    %r15d,%r12d
  mov    0x8(%rsp),%eax
  add    0x14(%rsp),%edi
  add    %rdx,%rsi
  add    %rdx,%rcx
  cmp    %eax,%r15d
  jne    L20
L129:
  addq   $0x8,0x20(%rsp)
  mov    0x7c(%rsp),%esi
  addq   $0x8,0x68(%rsp)
  mov    0x20(%rsp),%rax
  add    %esi,0x64(%rsp)
  addq   $0x8,0x70(%rsp)
  cmp    0x80(%rsp),%rax
  jne    L56
L13:
  mov    0x498(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L107
  add    $0x4a8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L138:
  lea    -0x8(%rsi),%rax
  mov    %rcx,0x48(%rsp)
  lea    0x90(%rsp),%r9
  mov    %ebp,0x60(%rsp)
  lea    0x290(%rsp),%r8
  lea    -0x8(%rcx),%r10
  mov    %rax,0x18(%rsp)
  mov    0x18(%rsp),%rbp
  xor    %eax,%eax
  mov    %rsi,0x50(%rsp)
  mov    0x58(%rsp),%rsi
  nopw   0x0(%rax,%rax,1)
L74:
  movsd  (%r9,%rax,8),%xmm0
  mulsd  (%rdx,%rax,8),%xmm0
  mov    %rax,%rcx
  movsd  %xmm0,0x8(%r10,%rax,8)
  movsd  (%r8,%rax,8),%xmm0
  mulsd  (%rdx,%rax,8),%xmm0
  movsd  %xmm0,0x8(%rbp,%rax,8)
  add    $0x1,%rax
  cmp    %rcx,%rsi
  jne    L74
  mov    0x48(%rsp),%rcx
  mov    0x60(%rsp),%ebp
  mov    0x50(%rsp),%rsi
  jmp    L88
L107:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: data_label: D9
type_infered: f64

tool: D9: 1

assistant: ```c
void makeP_FlexLG4(double z1, double z2, double *rptr, double *EI[4], double *EIGN[4], int numberOfCategories, double *left, double *right, const int numStates) {
  int i, j, k;
  const int rates = numStates - 1, statesSquare = numStates * numStates;
  double d1[64], d2[64];
  assert(numStates <= 64);
  for (i = 0; i < numberOfCategories; i++) {
    for (j = 0; j < rates; j++) {
      d1[j] = exp(rptr[i] * EIGN[i][j] * z1);
      d2[j] = exp(rptr[i] * EIGN[i][j] * z2);
    }
    for (j = 0; j < numStates; j++) {
      left[statesSquare * i + numStates * j] = 1.0;
      right[statesSquare * i + numStates * j] = 1.0;
      for (k = 1; k < numStates; k++) {
        left[statesSquare * i + numStates * j + k] = d1[k - 1] * EI[i][rates * j + (k - 1)];
        right[statesSquare * i + numStates * j + k] = d2[k - 1] * EI[i][rates * j + (k - 1)];
      }
    }
  }
}
```