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

```asm
<initGeneric>:
  endbr64
  push   %r15
  movslq %edi,%rdi
  push   %r14
  lea    0x0(,%rdi,8),%r15
  push   %r13
  push   %r12
  mov    %rdi,%r12
  mov    %r15,%rdi
  push   %rbp
  push   %rbx
  sub    $0xe8,%rsp
  mov    0x120(%rsp),%rax
  mov    %rsi,0x90(%rsp)
  mov    %edx,0x5c(%rsp)
  mov    %rax,0xa0(%rsp)
  mov    0x128(%rsp),%rax
  mov    %rcx,0x10(%rsp)
  mov    %rax,0xa8(%rsp)
  mov    0x130(%rsp),%rax
  mov    %r8,0x98(%rsp)
  mov    %rax,0x18(%rsp)
  mov    0x138(%rsp),%rax
  mov    %r9,0x60(%rsp)
  mov    %rax,0x20(%rsp)
  mov    0x140(%rsp),%eax
  mov    %eax,0x70(%rsp)
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  cltq
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  movslq %eax,%r14
  xor    %eax,%eax
  mov    %r14,0x30(%rsp)
  call   <rax_malloc@plt>
  movslq %eax,%r11
  test   %r12d,%r12d
  jle    L361
  mov    %r12d,%esi
  sub    %r11,%r14
  mov    %r12d,0x40(%rsp)
  mov    0x28(%rsp),%r12
  mov    %rsi,0x38(%rsp)
  shl    $0x3,%rsi
  mov    %r14,%rbp
  mov    %r11,%rbx
  mov    %rsi,0x8(%rsp)
  lea    (%rsi,%r11,1),%r13
  mov    %r11,%r14
  nopw   0x0(%rax,%rax,1)
L301:
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  cltq
  mov    %rax,(%rbx)
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  cltq
  mov    %rax,0x0(%rbp,%rbx,1)
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    %r12,%rdx
  mov    %r12,%rcx
  sub    %r14,%rdx
  cltq
  mov    %rax,(%rdx,%rbx,1)
  add    $0x8,%rbx
  cmp    %r13,%rbx
  jne    L301
  mov    %r14,%r11
  mov    %r15,%rdi
  xor    %eax,%eax
  mov    %rcx,%r14
  mov    %r11,0xb0(%rsp)
  mov    0x40(%rsp),%r12d
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  movslq %eax,%rbp
  xor    %eax,%eax
  mov    %rbp,0x88(%rsp)
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  cltq
  mov    %rax,0x50(%rsp)
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  cltq
  mov    %rax,0x40(%rsp)
  mov    %rax,0x80(%rsp)
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  cltq
  mov    %rax,0x68(%rsp)
  mov    %rax,0x78(%rsp)
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    0xa8(%rsp),%r15
  mov    0xb0(%rsp),%r11
  cltq
  mov    %rax,0x48(%rsp)
  mov    0x8(%rsp),%rax
  sub    %rbp,%r15
  lea    (%rax,%rbp,1),%rdx
  mov    %rbp,%rax
  nopw   0x0(%rax,%rax,1)
L160:
  movsd  (%r15,%rax,1),%xmm0
  add    $0x8,%rax
  movsd  %xmm0,-0x8(%rax)
  cmp    %rdx,%rax
  jne    L160
  mov    0x38(%rsp),%rax
  mov    0x8(%rsp),%r13
  mov    %r11,%r15
  add    0x28(%rsp),%r13
  lea    0x0(,%rax,8),%rbx
  xchg   %ax,%ax
L141:
  mov    (%r14),%rdi
  mov    %rbx,%rdx
  xor    %esi,%esi
  add    $0x8,%r14
  call   <memset@plt>
  cmp    %r13,%r14
  jne    L141
  mov    %r15,%r11
  cmp    $0x1,%r12d
  je     L289
  lea    -0x2(%r12),%r10d
  mov    0x18(%rsp),%r13
  xor    %edi,%edi
  xor    %r8d,%r8d
  mov    0x28(%rsp),%r14
  add    $0x2,%r10
  mov    $0x1,%esi
  lea    0x1(%r12),%ebx
  nopl   0x0(%rax)
L521:
  mov    %esi,%r9d
  cmp    %esi,%r12d
  jle    L318
  mov    %r14,%rax
  sub    %rdi,%rax
  mov    (%rax),%rcx
  movslq %r8d,%rax
  lea    (%rdi,%rax,8),%rdx
  mov    %rsi,%rax
  add    %r13,%rdx
  cs nopw 0x0(%rax,%rax,1)
L407:
  movsd  -0x8(%rdx,%rax,8),%xmm0
  movsd  %xmm0,(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L407
  mov    %ebx,%eax
  sub    %r9d,%eax
  lea    -0x1(%r8,%rax,1),%r8d
L318:
  add    $0x1,%rsi
  sub    $0x8,%rdi
  cmp    %r10,%rsi
  jne    L521
L289:
  mov    0x28(%rsp),%rbx
  mov    0x10(%rsp),%rsi
  mov    $0x1,%r10d
  movslq 0x70(%rsp),%rax
  mov    0x38(%rsp),%r13
  mov    (%rbx),%rdi
  lea    (%rsi,%rax,8),%r9
  lea    -0x1(%r12),%eax
  movq   $0x0,(%rdi)
  lea    0x8(%rbx),%rsi
  mov    %eax,0x8(%rsp)
  mov    %rax,0x10(%rsp)
  cmp    %r13,%r10
  je     L223
  nopw   0x0(%rax,%rax,1)
L466:
  mov    (%rsi),%rcx
  lea    0x0(,%r10,8),%r8
  movq   $0x0,(%rcx,%r10,8)
  test   %r10d,%r10d
  jle    L514
  mov    %rbx,%rax
  mov    %rdi,%rdx
  sub    %rbx,%rcx
  jmp    L234
  nopl   0x0(%rax,%rax,1)
L192:
  mov    (%rax),%rdx
L234:
  movsd  (%rdx,%r8,1),%xmm0
  movsd  %xmm0,(%rcx,%rax,1)
  add    $0x8,%rax
  cmp    %rsi,%rax
  jne    L192
L514:
  add    $0x1,%r10
  add    $0x8,%rsi
  cmp    %r13,%r10
  jne    L466
L223:
  mov    0x38(%rsp),%r8
  mov    0x28(%rsp),%rsi
  mov    %rbp,%r13
  mov    %rbp,%rdx
  movq   $0x0,(%r9)
  pxor   %xmm2,%xmm2
  lea    0x0(%rbp,%r8,8),%rcx
  movapd %xmm2,%xmm1
  sub    %rbp,%rsi
  nopl   0x0(%rax,%rax,1)
L280:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L378:
  movsd  (%rdx),%xmm0
  mulsd  (%rdi,%rax,8),%xmm0
  mulsd  0x0(%rbp,%rax,8),%xmm0
  add    $0x1,%rax
  addsd  %xmm0,%xmm1
  movsd  %xmm1,(%r9)
  cmp    %r8,%rax
  jne    L378
  add    $0x8,%rdx
  cmp    %rcx,%rdx
  je     L337
  mov    (%rsi,%rdx,1),%rdi
  jmp    L280
L337:
  mov    0x38(%rsp),%rax
  lea    0x0(,%rax,8),%r8
  xor    %eax,%eax
  nop
L24:
  mov    (%rax,%r11,1),%rdx
  movq   $0x0,(%rdx,%rax,1)
  add    $0x8,%rax
  cmp    %r8,%rax
  jne    L24
  xor    %edi,%edi
  mov    %r8,0x70(%rsp)
  xor    %r10d,%r10d
  xor    %r9d,%r9d
  mov    %edi,%r8d
  cmp    0x10(%rsp),%rdi
  je     L415
L175:
  lea    -0x2(%r12),%eax
  mov    %r11,%rsi
  mov    $0x8,%ebx
  sub    %edi,%eax
  lea    0x0(,%rdi,8),%r14
  sub    %r10,%rsi
  sub    %r10,%rbx
  lea    0x2(%rdi,%rax,1),%rcx
  movslq %r9d,%rax
  lea    (%r10,%rax,8),%r15
  shl    $0x3,%rcx
  add    0x18(%rsp),%r15
  nopw   0x0(%rax,%rax,1)
L441:
  movsd  0x0(%r13),%xmm0
  mulsd  0x0(%rbp,%rbx,1),%xmm0
  movsd  -0x8(%r15,%rbx,1),%xmm1
  ucomisd %xmm0,%xmm2
  ja     L319
  sqrtsd %xmm0,%xmm0
L291:
  mulsd  %xmm1,%xmm0
  mov    (%rbx,%r11,1),%rax
  mov    (%rsi),%rdx
  movsd  %xmm0,(%rax,%r14,1)
  add    %rbx,%rax
  movsd  %xmm0,(%rdx,%rbx,1)
  movsd  0x0(%rbp,%rbx,1),%xmm3
  add    %r14,%rdx
  add    $0x8,%rbx
  movsd  (%rdx),%xmm0
  mulsd  %xmm1,%xmm3
  subsd  %xmm3,%xmm0
  movsd  %xmm0,(%rdx)
  mulsd  0x0(%r13),%xmm1
  movsd  (%rax),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rax)
  cmp    %rcx,%rbx
  jne    L441
  add    0x8(%rsp),%r9d
  add    $0x1,%rdi
  add    $0x8,%r13
  sub    $0x8,%r10
  sub    %r8d,%r9d
  mov    %edi,%r8d
  cmp    0x10(%rsp),%rdi
  jne    L175
L415:
  mov    0x70(%rsp),%r8
  mov    0x50(%rsp),%rcx
  mov    %r11,%rdi
  mov    %r12d,%esi
  mov    0x40(%rsp),%rdx
  xor    %eax,%eax
  mov    %r11,0x10(%rsp)
  mov    %r8,0x18(%rsp)
  call   <makeEigen@plt>
  mov    0x10(%rsp),%r11
  mov    0x18(%rsp),%r8
  pxor   %xmm2,%xmm2
  lea    (%r11,%r8,1),%rbx
  mov    %r11,%r14
  mov    %r8,%r15
  cs nopw 0x0(%rax,%rax,1)
L402:
  xor    %r13d,%r13d
  nopl   0x0(%rax,%rax,1)
L413:
  movsd  0x0(%rbp,%r13,1),%xmm0
  ucomisd %xmm0,%xmm2
  ja     L502
  sqrtsd %xmm0,%xmm0
L47:
  mov    (%r14),%rax
  add    %r13,%rax
  add    $0x8,%r13
  mulsd  (%rax),%xmm0
  movsd  %xmm0,(%rax)
  cmp    %r15,%r13
  jne    L413
  add    $0x8,%r14
  cmp    %r14,%rbx
  jne    L402
  mov    0x40(%rsp),%rax
  mov    0x38(%rsp),%rdi
  mov    %r15,%r8
  xor    %esi,%esi
  movsd  D31(%rip),%xmm1
  jmp    L149
  cs nopw 0x0(%rax,%rax,1)
L299:
  add    $0x1,%rsi
  add    $0x8,%rax
  cmp    %rdi,%rsi
  je     L164
L149:
  movsd  (%rax),%xmm0
  lea    0x0(,%rsi,8),%rcx
  comisd %xmm1,%xmm0
  jbe    L299
  mov    (%r11),%r9
  test   %esi,%esi
  je     L401
  mov    0x40(%rsp),%rsi
  mov    (%r11,%rcx,1),%rdx
  movsd  (%rsi),%xmm1
  movsd  %xmm1,(%rax)
  xor    %eax,%eax
  movapd %xmm2,%xmm1
  movsd  %xmm0,(%rsi)
  nopl   (%rax)
L564:
  movsd  (%rdx,%rax,8),%xmm0
  movsd  (%r9,%rax,8),%xmm3
  movsd  %xmm3,(%rdx,%rax,8)
  addsd  %xmm0,%xmm1
  movsd  %xmm0,(%r9,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L564
  xor    %eax,%eax
  nopl   (%rax)
L52:
  movsd  (%r9,%rax,8),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,(%r9,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L52
L401:
  movq   D11(%rip),%xmm3
  movsd  D39(%rip),%xmm1
  xor    %ecx,%ecx
  mov    0x48(%rsp),%r10
  mov    0x40(%rsp),%rbp
  mov    0x68(%rsp),%r13
  mov    0x30(%rsp),%r14
  nop
L394:
  movsd  0x0(%rbp,%rcx,1),%xmm0
  mov    (%r14,%rcx,1),%rdi
  mov    %r11,%rax
  mov    %r9,%rdx
  xorpd  %xmm3,%xmm0
  mov    %rdi,%rsi
  movsd  %xmm0,(%r10,%rcx,1)
  sub    %r11,%rsi
  jmp    L428
  nopw   0x0(%rax,%rax,1)
L384:
  mov    (%rax),%rdx
L428:
  movsd  (%rdx,%rcx,1),%xmm0
  movsd  %xmm0,(%rsi,%rax,1)
  add    $0x8,%rax
  cmp    %rax,%rbx
  jne    L384
  movapd %xmm1,%xmm0
  divsd  (%rdi),%xmm0
  movsd  %xmm0,0x0(%r13,%rcx,1)
  add    $0x8,%rcx
  cmp    %r8,%rcx
  jne    L394
  cmp    $0x1,%r12d
  jle    L306
  mov    0x48(%rsp),%rbp
  mov    0x98(%rsp),%r13
  mov    $0x1,%ebx
  mov    %r11,%r14
  nopl   0x0(%rax)
L260:
  movsd  0x0(%rbp,%rbx,8),%xmm0
  xor    %edi,%edi
  comisd %xmm2,%xmm0
  movsd  %xmm0,-0x8(%r13,%rbx,8)
  seta   %dil
  xor    %eax,%eax
  add    $0x1,%rbx
  call   <assert@plt>
  cmp    %ebx,%r12d
  pxor   %xmm2,%xmm2
  jg     L260
  mov    %r14,%r11
L306:
  mov    0x8(%rsp),%eax
  test   %r12d,%r12d
  mov    0x30(%rsp),%rdi
  mov    0x60(%rsp),%rdx
  lea    0x8(,%rax,8),%r8
  mov    $0x8,%eax
  cmovle %rax,%r8
  xor    %esi,%esi
  nopw   0x0(%rax,%rax,1)
L552:
  mov    (%rdi),%rcx
  xor    %eax,%eax
  nopl   (%rax)
L571:
  movsd  (%rcx,%rax,8),%xmm0
  movsd  %xmm0,(%rdx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L571
  add    $0x1,%esi
  add    %r8,%rdx
  add    $0x8,%rdi
  cmp    %esi,%r12d
  jg     L552
  lea    -0x2(%r12),%edi
  mov    0x68(%rsp),%rdx
  xor    %r10d,%r10d
  xor    %r9d,%r9d
  mov    0x60(%rsp),%rbp
  mov    0x8(%rsp),%ebx
  xor    %r8d,%r8d
  add    $0x2,%rdi
  mov    0xa0(%rsp),%r13
  nopw   0x0(%rax,%rax,1)
L56:
  cmp    $0x1,%r12d
  jle    L152
  movslq %r9d,%rax
  lea    0x0(%rbp,%rax,8),%rsi
  movslq %r10d,%rax
  lea    0x0(%r13,%rax,8),%rcx
  mov    $0x1,%eax
  nopl   0x0(%rax,%rax,1)
L517:
  movsd  (%rsi,%rax,8),%xmm0
  mulsd  (%rdx),%xmm0
  movsd  %xmm0,-0x8(%rcx,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdi
  jne    L517
L152:
  add    $0x1,%r8d
  add    %r12d,%r9d
  add    $0x8,%rdx
  add    %ebx,%r10d
  cmp    %r8d,%r12d
  jg     L56
L565:
  mov    0x5c(%rsp),%eax
  test   %eax,%eax
  jle    L94
  sub    $0x1,%eax
  xor    %ebx,%ebx
  lea    -0x1(%r12),%r13d
  mov    %r11,0x10(%rsp)
  mov    0x90(%rsp),%r14
  lea    0x8(,%r13,8),%rbp
  lea    0x4(%r14,%rax,4),%rax
  mov    %rax,0x8(%rsp)
  mov    %r14,%rax
  mov    %ebx,%r14d
  mov    %rax,%rbx
  jmp    L102
  nopl   0x0(%rax,%rax,1)
L205:
  add    $0x4,%rbx
  add    %r12d,%r14d
  cmp    %rbx,0x8(%rsp)
  je     L495
L102:
  mov    (%rbx),%r15d
  test   %r12d,%r12d
  jle    L205
  mov    0x20(%rsp),%rsi
  movslq %r14d,%rax
  mov    %rbp,%rdx
  lea    (%rsi,%rax,8),%rdi
  xor    %esi,%esi
  call   <memset@plt>
  mov    %rax,%rdi
  test   %r15d,%r15d
  je     L205
  mov    0x30(%rsp),%r10
  xor    %edx,%edx
  jmp    L273
  nopl   (%rax)
L104:
  add    $0x1,%edx
  add    $0x8,%r10
  cmp    %edx,%r12d
  je     L205
L273:
  bt     %edx,%r15d
  jae    L104
  mov    (%r10),%rsi
  xor    %eax,%eax
  nop
L456:
  movsd  (%rdi,%rax,8),%xmm0
  addsd  (%rsi,%rax,8),%xmm0
  mov    %rax,%rcx
  movsd  %xmm0,(%rdi,%rax,8)
  add    $0x1,%rax
  cmp    %r13,%rcx
  jne    L456
  jmp    L104
  nopl   (%rax)
L495:
  mov    0x20(%rsp),%r9
  mov    0x10(%rsp),%r11
  xor    %esi,%esi
  xor    %ecx,%ecx
  movsd  D16(%rip),%xmm1
  mov    0x5c(%rsp),%r8d
  lea    0x8(%r9),%rdi
  nop
L444:
  test   %r12d,%r12d
  jle    L275
  movslq %esi,%rdx
  lea    (%r9,%rdx,8),%rax
  add    %r13,%rdx
  lea    (%rdi,%rdx,8),%rdx
  nopl   0x0(%rax,%rax,1)
L358:
  movsd  (%rax),%xmm0
  comisd %xmm1,%xmm0
  jbe    L174
  movsd  %xmm1,(%rax)
L174:
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L358
L275:
  add    $0x1,%ecx
  add    %r12d,%esi
  cmp    %ecx,%r8d
  jne    L444
L94:
  test   %r12d,%r12d
  jle    L493
  mov    0x30(%rsp),%r14
  mov    %r12d,%r12d
  mov    %r11,%rbx
  mov    0x28(%rsp),%r13
  mov    %r11,%r15
  lea    (%r14,%r12,8),%rbp
  sub    %r14,%rbx
  mov    %r14,%r12
  nopl   0x0(%rax)
L195:
  mov    (%r12),%rdi
  xor    %eax,%eax
  call   <rax_free@plt>
  mov    (%rbx,%r12,1),%rdi
  xor    %eax,%eax
  call   <rax_free@plt>
  mov    %r13,%rax
  sub    %r14,%rax
  mov    (%rax,%r12,1),%rdi
  xor    %eax,%eax
  add    $0x8,%r12
  call   <rax_free@plt>
  cmp    %r12,%rbp
  jne    L195
  mov    %r15,%r11
L493:
  mov    0x28(%rsp),%rdi
  xor    %eax,%eax
  mov    %r11,0x8(%rsp)
  call   <rax_free@plt>
  mov    0x8(%rsp),%rdi
  xor    %eax,%eax
  call   <rax_free@plt>
  mov    0x30(%rsp),%rdi
  xor    %eax,%eax
  call   <rax_free@plt>
  mov    0x88(%rsp),%rdi
  xor    %eax,%eax
  call   <rax_free@plt>
  mov    0x50(%rsp),%rdi
  xor    %eax,%eax
  call   <rax_free@plt>
  mov    0x80(%rsp),%rdi
  xor    %eax,%eax
  call   <rax_free@plt>
  mov    0x78(%rsp),%rdi
  xor    %eax,%eax
  call   <rax_free@plt>
  mov    0x48(%rsp),%rdi
  xor    %eax,%eax
  add    $0xe8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10c0 <rax_free@plt>
L164:
  mov    (%r11),%r9
  jmp    L401
L361:
  mov    %r15,%rdi
  xor    %eax,%eax
  mov    %r11,0x8(%rsp)
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  cltq
  mov    %rax,0x88(%rsp)
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  movslq %eax,%rbx
  xor    %eax,%eax
  mov    %rbx,0x50(%rsp)
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  movslq %eax,%r14
  xor    %eax,%eax
  mov    %r14,0x80(%rsp)
  call   <rax_malloc@plt>
  mov    %r15,%rdi
  cltq
  mov    %rax,0x78(%rsp)
  xor    %eax,%eax
  call   <rax_malloc@plt>
  mov    0x10(%rsp),%rsi
  mov    %rbx,%rcx
  mov    %r14,%rdx
  cltq
  mov    0x8(%rsp),%rdi
  mov    %rax,0x48(%rsp)
  movslq 0x70(%rsp),%rax
  movq   $0x0,(%rsi,%rax,8)
  mov    %r12d,%esi
  xor    %eax,%eax
  call   <makeEigen@plt>
  mov    0x8(%rsp),%r11
  jmp    L565
L319:
  mov    %r11,0xd8(%rsp)
  mov    %r8d,0xd4(%rsp)
  mov    %rsi,0xc8(%rsp)
  mov    %rcx,0xc0(%rsp)
  mov    %r9d,0xd0(%rsp)
  mov    %rdi,0xb8(%rsp)
  mov    %r10,0xb0(%rsp)
  movsd  %xmm1,0xa8(%rsp)
  call   <sqrt@plt>
  mov    0xd8(%rsp),%r11
  mov    0xd4(%rsp),%r8d
  pxor   %xmm2,%xmm2
  mov    0xc8(%rsp),%rsi
  mov    0xc0(%rsp),%rcx
  mov    0xd0(%rsp),%r9d
  mov    0xb8(%rsp),%rdi
  mov    0xb0(%rsp),%r10
  movsd  0xa8(%rsp),%xmm1
  jmp    L291
L502:
  mov    %r11,0x10(%rsp)
  call   <sqrt@plt>
  mov    0x10(%rsp),%r11
  pxor   %xmm2,%xmm2
  jmp    L47
```

tool_calls: name: read_data
arguments: label: D31
type_guessed: byte[8]
name: read_data
arguments: label: D11
type_guessed: f32[2]
name: read_data
arguments: label: D39
type_guessed: f32[2]
name: read_data
arguments: label: D16
type_guessed: f64

tool: {"D31": [0x3a,0x8c,0x30,0xe2,0x8e,0x79,0x45,0xbe]}

tool: {"D11": [0.0,-0.0]}

tool: {"D39": [0.0,1.875]}

tool: D16: 0.999999999

assistant: ```c
void initGeneric(const int n, const unsigned int *valueVector, int valueVectorLength, double *fracchanges, double *ext_EIGN, double *EV, double *EI, double *frequencies, double *ext_initialRates, double *tipVector, int model) {
  double **r, **a, **EIGV, *initialRates = ext_initialRates, *f, *e, *d, *invfreq, *EIGN, *eptr;
  int i, j, k, m, l;
  r = (double **)rax_malloc(n * sizeof(double *));
  EIGV = (double **)rax_malloc(n * sizeof(double *));
  a = (double **)rax_malloc(n * sizeof(double *));
  for (i = 0; i < n; i++) {
    a[i] = (double *)rax_malloc(n * sizeof(double));
    EIGV[i] = (double *)rax_malloc(n * sizeof(double));
    r[i] = (double *)rax_malloc(n * sizeof(double));
  }
  f = (double *)rax_malloc(n * sizeof(double));
  e = (double *)rax_malloc(n * sizeof(double));
  d = (double *)rax_malloc(n * sizeof(double));
  invfreq = (double *)rax_malloc(n * sizeof(double));
  EIGN = (double *)rax_malloc(n * sizeof(double));
  for (l = 0; l < n; l++)
    f[l] = frequencies[l];
  i = 0;
  for (j = 0; j < n; j++)
    for (k = 0; k < n; k++)
      r[j][k] = 0.0;
  for (j = 0; j < n - 1; j++)
    for (k = j + 1; k < n; k++)
      r[j][k] = initialRates[i++];
  for (j = 0; j < n; j++) {
    r[j][j] = 0.0;
    for (k = 0; k < j; k++)
      r[j][k] = r[k][j];
  }
  fracchanges[model] = 0.0;
  for (j = 0; j < n; j++)
    for (k = 0; k < n; k++)
      fracchanges[model] += f[j] * r[j][k] * f[k];
  m = 0;
  for (i = 0; i < n; i++)
    a[i][i] = 0;
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      double factor = initialRates[m++];
      a[i][j] = a[j][i] = factor * sqrt(f[i] * f[j]);
      a[i][i] -= factor * f[j];
      a[j][j] -= factor * f[i];
    }
  }
  makeEigen(a, n, d, e);
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      a[i][j] *= sqrt(f[j]);
  for (i = 0; i < n; i++) {
    if (d[i] > -1e-8) {
      if (i != 0) {
        double tmp = d[i], sum = 0;
        d[i] = d[0];
        d[0] = tmp;
        for (j = 0; j < n; j++) {
          tmp = a[i][j];
          a[i][j] = a[0][j];
          sum += (a[0][j] = tmp);
        }
        for (j = 0; j < n; j++)
          a[0][j] /= sum;
      }
      break;
    }
  }
  for (i = 0; i < n; i++) {
    EIGN[i] = -d[i];
    for (j = 0; j < n; j++)
      EIGV[i][j] = a[j][i];
    invfreq[i] = 1 / EIGV[i][0];
  }
  for (l = 1; l < n; l++) {
    ext_EIGN[(l - 1)] = EIGN[l];
    assert(ext_EIGN[(l - 1)] > 0.0);
  }
  eptr = EV;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++) {
      *eptr++ = EIGV[i][j];
    }
  for (i = 0; i < n; i++)
    for (j = 1; j < n; j++)
      EI[i * (n - 1) + (j - 1)] = EV[i * n + j] * invfreq[i];
  for (i = 0; i < valueVectorLength; i++) {
    unsigned int value = valueVector[i];
    for (j = 0; j < n; j++)
      tipVector[i * n + j] = 0;
    if (value > 0) {
      for (j = 0; j < n; j++) {
        if ((value >> j) & 1) {
          int l;
          for (l = 0; l < n; l++)
            tipVector[i * n + l] += EIGV[j][l];
        }
      }
    }
  }
  for (i = 0; i < valueVectorLength; i++) {
    for (j = 0; j < n; j++)
      if (tipVector[i * n + j] > 0.999999999)
        tipVector[i * n + j] = 0.999999999;
  }
  for (i = 0; i < n; i++) {
    rax_free(EIGV[i]);
    rax_free(a[i]);
    rax_free(r[i]);
  }
  rax_free(r);
  rax_free(a);
  rax_free(EIGV);
  rax_free(f);
  rax_free(e);
  rax_free(d);
  rax_free(invfreq);
  rax_free(EIGN);
}
```