#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fast_inverse(double *, int, double *);
int /*<<< orphan*/ free(double *);
void calc_beta_k0(double *C, float *R, double *beta, double *CCt,
                  double *var_beta, int M, int N, int D, double *var_res) {
  int i, j, d, d2;
  double *m_beta = (double *)calloc(M * D, sizeof(double));
  double *inv_CCt = (double *)calloc(D * D, sizeof(double));
  double res, tmp;
  for (d = 0; d < D; d++)
    for (j = 0; j < M; j++)
      beta[d * M + j] = 0;
  for (i = 0; i < N; i++) {
    for (d = 0; d < D; d++) {
      for (j = 0; j < M; j++)
        m_beta[d * M + j] += C[d * N + i] * (double)(R[i * M + j]);
    }
  }
  if (D == 1) {
    inv_CCt[0] = 1.0 / CCt[0];
  } else {
    fast_inverse(CCt, D, inv_CCt);
  }
  for (d = 0; d < D; d++)
    for (d2 = 0; d2 < D; d2++)
      for (j = 0; j < M; j++)
        beta[d * M + j] += inv_CCt[d * D + d2] * m_beta[d2 * M + j];
  *var_res = 0.0;
  for (j = 0; j < M; j++) {
    res = 0.0;
    for (i = 0; i < N; i++) {
      tmp = 0.0;
      for (d = 0; d < D; d++)
        tmp += C[d * N + i] * beta[d * M + j];
      res += ((double)R[i * M + j] - tmp) * ((double)R[i * M + j] - tmp);
    }
    *var_res += res;
    for (d = 0; d < D; d++)
      var_beta[d * M + j] = res / ((N - 2) * CCt[d * (D + 1)]);
  }
  *var_res /= (N * M - 1);
  free(m_beta);
  free(inv_CCt);
}


x86 assembly (clang, -O0):
<calc_beta_k0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
imul   0x18(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x48(%rbp)
mov    0x18(%rbp),%edi
imul   0x18(%rbp),%edi
mov    $0x8,%esi
call   1050 <calloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    11e4 <calc_beta_k0+0xb4>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11d1 <calc_beta_k0+0xa1>
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    119e <calc_beta_k0+0x6e>
jmp    11d6 <calc_beta_k0+0xa6>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    118b <calc_beta_k0+0x5b>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    12a4 <calc_beta_k0+0x174>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    1291 <calc_beta_k0+0x161>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    127e <calc_beta_k0+0x14e>
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   0x10(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm2
mov    -0x48(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1211 <calc_beta_k0+0xe1>
jmp    1283 <calc_beta_k0+0x153>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11fe <calc_beta_k0+0xce>
jmp    1296 <calc_beta_k0+0x166>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11eb <calc_beta_k0+0xbb>
cmpl   $0x1,0x18(%rbp)
jne    12cb <calc_beta_k0+0x19b>
mov    -0x20(%rbp),%rax
movsd  0xd46(%rip),%xmm0
divsd  (%rax),%xmm0
mov    -0x50(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    12db <calc_beta_k0+0x1ab>
mov    -0x20(%rbp),%rdi
mov    0x18(%rbp),%esi
mov    -0x50(%rbp),%rdx
call   1040 <fast_inverse@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    1397 <calc_beta_k0+0x267>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    1384 <calc_beta_k0+0x254>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1371 <calc_beta_k0+0x241>
mov    -0x50(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   0x18(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1308 <calc_beta_k0+0x1d8>
jmp    1376 <calc_beta_k0+0x246>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12f5 <calc_beta_k0+0x1c5>
jmp    1389 <calc_beta_k0+0x259>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12e2 <calc_beta_k0+0x1b2>
mov    0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    151b <calc_beta_k0+0x3eb>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    1495 <calc_beta_k0+0x365>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    1437 <calc_beta_k0+0x307>
mov    -0x8(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   0x10(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    13df <calc_beta_k0+0x2af>
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x60(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm1
cvtss2sd %xmm1,%xmm2
subsd  -0x60(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    13c4 <calc_beta_k0+0x294>
movsd  -0x58(%rbp),%xmm0
mov    0x20(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x18(%rbp),%eax
jge    1508 <calc_beta_k0+0x3d8>
movsd  -0x58(%rbp),%xmm0
mov    0x10(%rbp),%eax
sub    $0x2,%eax
cvtsi2sd %eax,%xmm1
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    0x18(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    14ad <calc_beta_k0+0x37d>
jmp    150d <calc_beta_k0+0x3dd>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    13a9 <calc_beta_k0+0x279>
mov    0x10(%rbp),%eax
imul   -0x2c(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_beta_k0>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %r9d,%r12d
mov    %r8,0x98(%rsp)
mov    %rcx,0x58(%rsp)
mov    %rdx,0x28(%rsp)
mov    %rsi,0x70(%rsp)
mov    %rdi,0x68(%rsp)
mov    0x110(%rsp),%rax
mov    %rax,0xa0(%rsp)
mov    0x108(%rsp),%ebx
mov    0x100(%rsp),%eax
mov    %rax,0x60(%rsp)
mov    %ebx,%edi
imul   %r9d,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,0x38(%rsp)
mov    %ebx,%edi
imul   %ebx,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,0x40(%rsp)
mov    %r12d,%r15d
mov    %ebx,%ebp
mov    %ebx,0x24(%rsp)
test   %ebx,%ebx
mov    %rbp,0x10(%rsp)
mov    %r12,0x8(%rsp)
jle    123b <calc_beta_k0+0xfb>
lea    0x0(,%r15,8),%rax
mov    %rax,(%rsp)
lea    -0x1(%rbp),%rax
mov    %ebp,%r14d
and    $0x3,%r14d
xor    %r13d,%r13d
cmp    $0x3,%rax
jae    1a6d <calc_beta_k0+0x92d>
xor    %ebx,%ebx
test   %r14,%r14
mov    0x8(%rsp),%r12
mov    (%rsp),%r13
je     123b <calc_beta_k0+0xfb>
imul   %r12d,%ebx
jmp    121e <calc_beta_k0+0xde>
nopl   (%rax)
mov    0x8(%rsp),%r12
add    %r12d,%ebx
add    $0xffffffffffffffff,%r14
je     123b <calc_beta_k0+0xfb>
test   %r12d,%r12d
jle    1210 <calc_beta_k0+0xd0>
movslq %ebx,%rax
mov    0x28(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1050 <memset@plt>
jmp    1210 <calc_beta_k0+0xd0>
mov    0x60(%rsp),%rax
mov    %eax,%ecx
mov    %rcx,0x50(%rsp)
movslq %r12d,%rcx
mov    %rcx,(%rsp)
test   %eax,%eax
mov    0x68(%rsp),%rdi
jle    14b7 <calc_beta_k0+0x377>
mov    %r15d,%eax
and    $0xfffffffc,%eax
mov    %rax,0x90(%rsp)
mov    %r15,%rax
neg    %rax
mov    %rax,0x18(%rsp)
mov    0x70(%rsp),%rcx
lea    0x8(%rcx),%rdx
mov    (%rsp),%rsi
lea    0x0(,%rsi,4),%rax
mov    %rax,0x88(%rsp)
mov    0x38(%rsp),%rax
lea    0x10(%rax),%rbx
mov    %rbx,0x80(%rsp)
lea    0x0(,%rsi,8),%r13
lea    0x0(,%r15,4),%r12
and    $0xfffffffffffffff0,%r12
add    $0x8,%rax
mov    %rax,0x78(%rsp)
xor    %r8d,%r8d
mov    %rcx,%rax
jmp    12f1 <calc_beta_k0+0x1b1>
nopw   0x0(%rax,%rax,1)
mov    0x88(%rsp),%rcx
add    %rcx,%rdx
add    %rcx,%rax
mov    0x30(%rsp),%rcx
mov    %rcx,%r8
cmp    0x50(%rsp),%rcx
je     14b7 <calc_beta_k0+0x377>
lea    0x1(%r8),%rcx
mov    %rcx,0x30(%rsp)
cmpl   $0x0,0x24(%rsp)
jle    12d0 <calc_beta_k0+0x190>
mov    %r8,%rcx
imul   (%rsp),%rcx
mov    %rcx,0x48(%rsp)
mov    0x78(%rsp),%rcx
mov    0x80(%rsp),%r11
xor    %r9d,%r9d
jmp    132f <calc_beta_k0+0x1ef>
add    $0x1,%r9
add    %r13,%r11
add    %r13,%rcx
cmp    %rbp,%r9
je     12d0 <calc_beta_k0+0x190>
cmpl   $0x0,0x8(%rsp)
jle    1320 <calc_beta_k0+0x1e0>
mov    %r9,%r14
imul   (%rsp),%r14
mov    %r9,%rsi
imul   0x50(%rsp),%rsi
lea    (%r8,%rsi,1),%rbx
cmpl   $0x4,0x8(%rsp)
jae    1360 <calc_beta_k0+0x220>
xor    %esi,%esi
jmp    1410 <calc_beta_k0+0x2d0>
nopl   0x0(%rax)
add    0x30(%rsp),%rsi
mov    0x38(%rsp),%rbp
lea    0x0(,%r14,8),%r10
add    %rbp,%r10
lea    (%rdi,%rsi,8),%rsi
cmp    %rsi,%r10
jae    139f <calc_beta_k0+0x25f>
lea    (%r14,%r15,1),%rsi
lea    0x0(,%rsi,8),%rsi
add    %rbp,%rsi
lea    (%rdi,%rbx,8),%rbp
cmp    %rsi,%rbp
jae    139f <calc_beta_k0+0x25f>
xor    %esi,%esi
mov    0x10(%rsp),%rbp
jmp    1410 <calc_beta_k0+0x2d0>
movsd  (%rdi,%rbx,8),%xmm0
unpcklpd %xmm0,%xmm0
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
cvtps2pd -0x8(%rdx,%rsi,1),%xmm1
cvtps2pd (%rdx,%rsi,1),%xmm2
movupd -0x10(%r11,%rsi,2),%xmm3
movupd (%r11,%rsi,2),%xmm4
mulpd  %xmm0,%xmm1
addpd  %xmm3,%xmm1
mulpd  %xmm0,%xmm2
addpd  %xmm4,%xmm2
movupd %xmm1,-0x10(%r11,%rsi,2)
movupd %xmm2,(%r11,%rsi,2)
add    $0x10,%rsi
cmp    %rsi,%r12
jne    13b0 <calc_beta_k0+0x270>
mov    0x90(%rsp),%rbp
mov    %rbp,%rsi
cmp    %r15,%rbp
mov    0x10(%rsp),%rbp
je     1320 <calc_beta_k0+0x1e0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rsi,%r10
test   $0x1,%r15b
je     145c <calc_beta_k0+0x31c>
mov    0x48(%rsp),%rdi
lea    (%rsi,%rdi,1),%rbp
mov    0x70(%rsp),%rdi
movss  (%rdi,%rbp,4),%xmm0
mov    0x68(%rsp),%rdi
cvtss2sd %xmm0,%xmm0
add    %rsi,%r14
mulsd  (%rdi,%rbx,8),%xmm0
mov    0x38(%rsp),%rbp
addsd  0x0(%rbp,%r14,8),%xmm0
movsd  %xmm0,0x0(%rbp,%r14,8)
mov    0x10(%rsp),%rbp
mov    %rsi,%r10
or     $0x1,%r10
not    %rsi
cmp    0x18(%rsp),%rsi
je     1320 <calc_beta_k0+0x1e0>
nopw   0x0(%rax,%rax,1)
movss  (%rax,%r10,4),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  (%rdi,%rbx,8),%xmm0
addsd  -0x8(%rcx,%r10,8),%xmm0
movsd  %xmm0,-0x8(%rcx,%r10,8)
movss  0x4(%rax,%r10,4),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  (%rdi,%rbx,8),%xmm0
addsd  (%rcx,%r10,8),%xmm0
movsd  %xmm0,(%rcx,%r10,8)
add    $0x2,%r10
cmp    %r10,%r15
jne    1470 <calc_beta_k0+0x330>
jmp    1320 <calc_beta_k0+0x1e0>
mov    0x24(%rsp),%ebp
cmp    $0x1,%ebp
jne    14dc <calc_beta_k0+0x39c>
movsd  0xb38(%rip),%xmm0
mov    0x58(%rsp),%rax
divsd  (%rax),%xmm0
mov    0x40(%rsp),%rbx
movsd  %xmm0,(%rbx)
jmp    14f0 <calc_beta_k0+0x3b0>
mov    0x58(%rsp),%rdi
mov    %ebp,%esi
mov    0x40(%rsp),%rbx
mov    %rbx,%rdx
call   1040 <fast_inverse@plt>
mov    0x38(%rsp),%r8
test   %ebp,%ebp
mov    0x10(%rsp),%rbp
mov    0x8(%rsp),%rdx
jle    17c1 <calc_beta_k0+0x681>
mov    %r15d,%eax
and    $0xfffffffc,%eax
mov    %rax,0xb8(%rsp)
mov    %r15,%rax
neg    %rax
mov    %rax,0x90(%rsp)
lea    0x10(%r8),%rax
mov    %rax,0xa8(%rsp)
mov    (%rsp),%rax
lea    0x0(,%rax,8),%rax
mov    %rax,0x18(%rsp)
mov    0x28(%rsp),%rax
lea    0x10(%rax),%r12
lea    0x0(,%r15,8),%r9
and    $0xffffffffffffffe0,%r9
add    $0x8,%rax
xor    %esi,%esi
jmp    1583 <calc_beta_k0+0x443>
nopl   (%rax)
mov    0xb0(%rsp),%rsi
add    $0x1,%rsi
mov    0x18(%rsp),%rcx
add    %rcx,%r12
add    %rcx,%rax
cmp    %rbp,%rsi
mov    %rdi,%r8
je     17c1 <calc_beta_k0+0x681>
mov    %rsi,%rcx
imul   (%rsp),%rcx
mov    0x28(%rsp),%r10
lea    (%r10,%rcx,8),%rdi
mov    %rdi,0x88(%rsp)
mov    %rcx,0xc0(%rsp)
add    %r15,%rcx
lea    (%r10,%rcx,8),%rcx
mov    %rcx,0x80(%rsp)
mov    %rsi,0xb0(%rsp)
imul   %rbp,%rsi
mov    %rsi,0x30(%rsp)
lea    0x1(%rsi),%rcx
mov    %rcx,0x78(%rsp)
mov    %r8,%rdi
mov    %r8,%r11
mov    0xa8(%rsp),%r14
xor    %ecx,%ecx
jmp    15fe <calc_beta_k0+0x4be>
nop
add    $0x1,%rcx
mov    %rdx,%rsi
mov    0x18(%rsp),%rdx
add    %rdx,%r14
add    %rdx,%r11
mov    %rsi,%rdx
cmp    %rbp,%rcx
je     1560 <calc_beta_k0+0x420>
test   %edx,%edx
jle    15e0 <calc_beta_k0+0x4a0>
mov    0x30(%rsp),%rsi
lea    (%rsi,%rcx,1),%r13
mov    %rcx,%r10
imul   (%rsp),%r10
cmp    $0x4,%edx
jae    1620 <calc_beta_k0+0x4e0>
xor    %esi,%esi
jmp    1720 <calc_beta_k0+0x5e0>
nop
mov    0x78(%rsp),%rdx
lea    (%rdx,%rcx,1),%rsi
lea    (%r10,%r15,1),%rbp
lea    (%rbx,%r13,8),%r8
lea    (%rbx,%rsi,8),%rsi
lea    (%rdi,%r10,8),%rbx
lea    (%rdi,%rbp,8),%rbp
mov    0x88(%rsp),%rdi
cmp    %rsi,%rdi
setb   0x48(%rsp)
mov    0x80(%rsp),%rdx
cmp    %rdx,%r8
setb   %sil
cmp    %rbp,%rdi
setb   %r8b
cmp    %rdx,%rbx
setb   %bpl
test   %sil,0x48(%rsp)
jne    1709 <calc_beta_k0+0x5c9>
mov    $0x0,%esi
and    %bpl,%r8b
mov    0x8(%rsp),%rdx
mov    0x38(%rsp),%rdi
mov    0x40(%rsp),%rbx
mov    0x10(%rsp),%rbp
jne    1720 <calc_beta_k0+0x5e0>
mov    %rdx,%r8
movsd  (%rbx,%r13,8),%xmm0
unpcklpd %xmm0,%xmm0
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
movupd -0x10(%r14,%rsi,1),%xmm1
movupd (%r14,%rsi,1),%xmm2
movupd -0x10(%r12,%rsi,1),%xmm3
movupd (%r12,%rsi,1),%xmm4
mulpd  %xmm0,%xmm1
addpd  %xmm3,%xmm1
mulpd  %xmm0,%xmm2
addpd  %xmm4,%xmm2
movupd %xmm1,-0x10(%r12,%rsi,1)
movupd %xmm2,(%r12,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%r9
jne    16b0 <calc_beta_k0+0x570>
mov    0xb8(%rsp),%rdx
mov    %rdx,%rsi
cmp    %r15,%rdx
mov    %r8,%rdx
je     15e0 <calc_beta_k0+0x4a0>
jmp    1720 <calc_beta_k0+0x5e0>
xor    %esi,%esi
mov    0x8(%rsp),%rdx
mov    0x38(%rsp),%rdi
mov    0x40(%rsp),%rbx
mov    0x10(%rsp),%rbp
nop
mov    %rsi,%r8
test   $0x1,%r15b
je     1764 <calc_beta_k0+0x624>
movsd  (%rbx,%r13,8),%xmm0
add    %rsi,%r10
mov    0xc0(%rsp),%rdx
lea    (%rsi,%rdx,1),%rbp
mulsd  (%rdi,%r10,8),%xmm0
mov    0x28(%rsp),%rdx
addsd  (%rdx,%rbp,8),%xmm0
movsd  %xmm0,(%rdx,%rbp,8)
mov    0x10(%rsp),%rbp
mov    0x8(%rsp),%rdx
mov    %rsi,%r8
or     $0x1,%r8
not    %rsi
cmp    0x90(%rsp),%rsi
je     15e0 <calc_beta_k0+0x4a0>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%rbx,%r13,8),%xmm0
mulsd  (%r11,%r8,8),%xmm0
addsd  -0x8(%rax,%r8,8),%xmm0
movsd  %xmm0,-0x8(%rax,%r8,8)
movsd  (%rbx,%r13,8),%xmm0
mulsd  0x8(%r11,%r8,8),%xmm0
addsd  (%rax,%r8,8),%xmm0
movsd  %xmm0,(%rax,%r8,8)
add    $0x2,%r8
cmp    %r8,%r15
jne    1780 <calc_beta_k0+0x640>
jmp    15e0 <calc_beta_k0+0x4a0>
mov    0xa0(%rsp),%r11
movq   $0x0,(%r11)
test   %edx,%edx
jle    1a2b <calc_beta_k0+0x8eb>
mov    0x60(%rsp),%rcx
lea    -0x2(%rcx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    0x24(%rsp),%r14d
movslq %r14d,%r10
add    $0x1,%r10
mov    %r10,0x30(%rsp)
movslq %ecx,%r9
lea    -0x1(%rbp),%rax
mov    %rax,(%rsp)
mov    %ebp,%esi
and    $0xfffffffe,%esi
mov    %r9,%rdi
shl    $0x4,%rdi
mov    %r15,%rax
shl    $0x4,%rax
shl    $0x4,%r10
xor    %r13d,%r13d
mov    0x98(%rsp),%rcx
mov    %rcx,0x18(%rsp)
mov    0x28(%rsp),%r8
jmp    185c <calc_beta_k0+0x71c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13
add    $0x8,%r8
addq   $0x8,0x18(%rsp)
cmp    %r15,%r13
mov    0x8(%rsp),%rdx
je     1a1f <calc_beta_k0+0x8df>
cmpl   $0x0,0x60(%rsp)
mov    0x70(%rsp),%rcx
xorpd  %xmm1,%xmm1
jle    1950 <calc_beta_k0+0x810>
mov    0x68(%rsp),%r12
xor    %ebp,%ebp
jmp    18b2 <calc_beta_k0+0x772>
nopl   0x0(%rax)
mov    %rbp,%rdx
imul   %r15,%rdx
add    %r13,%rdx
movss  (%rcx,%rdx,4),%xmm3
cvtss2sd %xmm3,%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm3,%xmm3
addsd  %xmm3,%xmm1
add    $0x1,%rbp
add    $0x8,%r12
cmp    0x50(%rsp),%rbp
je     1950 <calc_beta_k0+0x810>
xorpd  %xmm2,%xmm2
test   %r14d,%r14d
jle    1880 <calc_beta_k0+0x740>
cmpq   $0x0,(%rsp)
je     1900 <calc_beta_k0+0x7c0>
xorpd  %xmm2,%xmm2
mov    %r8,%r14
mov    %r12,%rbx
xor    %r11d,%r11d
nop
movsd  (%rbx),%xmm3
mulsd  (%r14),%xmm3
addsd  %xmm2,%xmm3
movsd  (%rbx,%r9,8),%xmm2
mulsd  (%r14,%r15,8),%xmm2
addsd  %xmm3,%xmm2
add    $0x2,%r11
add    %rdi,%rbx
add    %rax,%r14
cmp    %r11,%rsi
jne    18d0 <calc_beta_k0+0x790>
jmp    1907 <calc_beta_k0+0x7c7>
xchg   %ax,%ax
xorpd  %xmm2,%xmm2
xor    %r11d,%r11d
testb  $0x1,0x10(%rsp)
mov    0x24(%rsp),%r14d
je     1880 <calc_beta_k0+0x740>
mov    %r11,%rbx
imul   %r9,%rbx
add    %rbp,%rbx
mov    0x68(%rsp),%rcx
movsd  (%rcx,%rbx,8),%xmm3
imul   %r15,%r11
add    %r13,%r11
mov    0x28(%rsp),%rcx
mulsd  (%rcx,%r11,8),%xmm3
mov    0x70(%rsp),%rcx
addsd  %xmm3,%xmm2
jmp    1880 <calc_beta_k0+0x740>
nopl   0x0(%rax,%rax,1)
mov    0xa0(%rsp),%r11
movsd  (%r11),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%r11)
test   %r14d,%r14d
mov    0x30(%rsp),%r12
jle    1840 <calc_beta_k0+0x700>
cmpq   $0x0,(%rsp)
je     19e0 <calc_beta_k0+0x8a0>
mov    0x18(%rsp),%rbx
mov    0x58(%rsp),%rbp
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
movsd  0x0(%rbp),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
movsd  %xmm3,(%rbx)
movsd  0x0(%rbp,%r12,8),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm1,%xmm3
divsd  %xmm2,%xmm3
movsd  %xmm3,(%rbx,%r15,8)
add    $0x2,%rcx
add    %r10,%rbp
add    %rax,%rbx
cmp    %rcx,%rsi
jne    1990 <calc_beta_k0+0x850>
testb  $0x1,0x10(%rsp)
je     1840 <calc_beta_k0+0x700>
jmp    19ed <calc_beta_k0+0x8ad>
nopw   0x0(%rax,%rax,1)
xor    %ecx,%ecx
testb  $0x1,0x10(%rsp)
je     1840 <calc_beta_k0+0x700>
mov    %rcx,%rdx
imul   %r12,%rdx
mov    0x58(%rsp),%rbx
movsd  (%rbx,%rdx,8),%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
imul   %r15,%rcx
add    %r13,%rcx
mov    0x98(%rsp),%rdx
movsd  %xmm1,(%rdx,%rcx,8)
jmp    1840 <calc_beta_k0+0x700>
movsd  (%r11),%xmm0
mov    0x38(%rsp),%r8
jmp    1a2f <calc_beta_k0+0x8ef>
xorpd  %xmm0,%xmm0
mov    0x60(%rsp),%rax
imul   %edx,%eax
add    $0xffffffff,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r11)
mov    %r8,%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    %ebp,%eax
and    $0xfffffffc,%eax
mov    %rax,0x50(%rsp)
mov    0x8(%rsp),%rax
lea    0x0(,%rax,4),%ecx
mov    %ecx,0x18(%rsp)
lea    (%rax,%rax,1),%ecx
mov    %rcx,0x30(%rsp)
lea    (%rax,%rax,2),%eax
mov    %rax,0x48(%rsp)
xor    %ebx,%ebx
jmp    1ab4 <calc_beta_k0+0x974>
nopl   0x0(%rax,%rax,1)
add    $0x4,%rbx
add    0x18(%rsp),%r13d
cmp    %rbx,0x50(%rsp)
je     11f9 <calc_beta_k0+0xb9>
mov    0x8(%rsp),%r12
test   %r12d,%r12d
jle    1aa0 <calc_beta_k0+0x960>
movslq %r13d,%rax
mov    0x28(%rsp),%rbp
lea    0x0(,%rax,8),%rdi
add    %rbp,%rdi
xor    %esi,%esi
mov    (%rsp),%rdx
call   1050 <memset@plt>
lea    (%r12,%r13,1),%eax
cltq
mov    %rbp,%r12
lea    0x0(,%rax,8),%rdi
add    %rbp,%rdi
xor    %esi,%esi
mov    (%rsp),%rbp
mov    %rbp,%rdx
call   1050 <memset@plt>
mov    0x30(%rsp),%rax
add    %r13d,%eax
cltq
lea    (%r12,%rax,8),%rdi
xor    %esi,%esi
mov    %rbp,%rdx
mov    %rbp,%r12
call   1050 <memset@plt>
mov    0x48(%rsp),%rax
add    %r13d,%eax
cltq
mov    0x28(%rsp),%rcx
lea    (%rcx,%rax,8),%rdi
mov    0x10(%rsp),%rbp
xor    %esi,%esi
mov    %r12,%rdx
call   1050 <memset@plt>
jmp    1aa0 <calc_beta_k0+0x960>

LLVM IR (-O0):
define void @calc_beta_k0(double* %0, float* %1, double* %2, double* %3, double* %4, i32 %5, i32 %6, i32 %7, double* %8) {
%10 = alloca double*
%11 = alloca float*
%12 = alloca double*
%13 = alloca double*
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca double*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca double*
%24 = alloca double*
%25 = alloca double
%26 = alloca double
store double* %0, double** %10
store float* %1, float** %11
store double* %2, double** %12
store double* %3, double** %13
store double* %4, double** %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store double* %8, double** %18
%27 = load i32, i32* %15
%28 = load i32, i32* %17
%29 = mul nsw i32 %27, %28
%30 = call i64 @calloc(i32 %29, i32 8)
%31 = inttoptr i64 %30 to double*
store double* %31, double** %23
%32 = load i32, i32* %17
%33 = load i32, i32* %17
%34 = mul nsw i32 %32, %33
%35 = call i64 @calloc(i32 %34, i32 8)
%36 = inttoptr i64 %35 to double*
store double* %36, double** %24
store i32 0, i32* %21
br label %37
37: ; preds = %59, %9
%38 = load i32, i32* %21
%39 = load i32, i32* %17
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %62
41: ; preds = %37
store i32 0, i32* %20
br label %42
42: ; preds = %55, %41
%43 = load i32, i32* %20
%44 = load i32, i32* %15
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %58
46: ; preds = %42
%47 = load double*, double** %12
%48 = load i32, i32* %21
%49 = load i32, i32* %15
%50 = mul nsw i32 %48, %49
%51 = load i32, i32* %20
%52 = add nsw i32 %50, %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %47, i64 %53
store double 0.000000e+00, double* %54
br label %55
55: ; preds = %46
%56 = load i32, i32* %20
%57 = add nsw i32 %56, 1
store i32 %57, i32* %20
br label %42
58: ; preds = %42
br label %59
59: ; preds = %58
%60 = load i32, i32* %21
%61 = add nsw i32 %60, 1
store i32 %61, i32* %21
br label %37
62: ; preds = %37
store i32 0, i32* %19
br label %63
63: ; preds = %115, %62
%64 = load i32, i32* %19
%65 = load i32, i32* %16
%66 = icmp slt i32 %64, %65
br i1 %66, label %67, label %118
67: ; preds = %63
store i32 0, i32* %21
br label %68
68: ; preds = %111, %67
%69 = load i32, i32* %21
%70 = load i32, i32* %17
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %114
72: ; preds = %68
store i32 0, i32* %20
br label %73
73: ; preds = %107, %72
%74 = load i32, i32* %20
%75 = load i32, i32* %15
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %110
77: ; preds = %73
%78 = load double*, double** %10
%79 = load i32, i32* %21
%80 = load i32, i32* %16
%81 = mul nsw i32 %79, %80
%82 = load i32, i32* %19
%83 = add nsw i32 %81, %82
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %78, i64 %84
%86 = load double, double* %85
%87 = load float*, float** %11
%88 = load i32, i32* %19
%89 = load i32, i32* %15
%90 = mul nsw i32 %88, %89
%91 = load i32, i32* %20
%92 = add nsw i32 %90, %91
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds float, float* %87, i64 %93
%95 = load float, float* %94
%96 = fpext float %95 to double
%97 = load double*, double** %23
%98 = load i32, i32* %21
%99 = load i32, i32* %15
%100 = mul nsw i32 %98, %99
%101 = load i32, i32* %20
%102 = add nsw i32 %100, %101
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %97, i64 %103
%105 = load double, double* %104
%106 = call double @llvm.fmuladd.f64(double %86, double %96, double %105)
store double %106, double* %104
br label %107
107: ; preds = %77
%108 = load i32, i32* %20
%109 = add nsw i32 %108, 1
store i32 %109, i32* %20
br label %73
110: ; preds = %73
br label %111
111: ; preds = %110
%112 = load i32, i32* %21
%113 = add nsw i32 %112, 1
store i32 %113, i32* %21
br label %68
114: ; preds = %68
br label %115
115: ; preds = %114
%116 = load i32, i32* %19
%117 = add nsw i32 %116, 1
store i32 %117, i32* %19
br label %63
118: ; preds = %63
%119 = load i32, i32* %17
%120 = icmp eq i32 %119, 1
br i1 %120, label %121, label %128
121: ; preds = %118
%122 = load double*, double** %13
%123 = getelementptr inbounds double, double* %122, i64 0
%124 = load double, double* %123
%125 = fdiv double 1.000000e+00, %124
%126 = load double*, double** %24
%127 = getelementptr inbounds double, double* %126, i64 0
store double %125, double* %127
br label %133
128: ; preds = %118
%129 = load double*, double** %13
%130 = load i32, i32* %17
%131 = load double*, double** %24
%132 = call i32 @fast_inverse(double* %129, i32 %130, double* %131)
br label %133
133: ; preds = %128, %121
store i32 0, i32* %21
br label %134
134: ; preds = %185, %133
%135 = load i32, i32* %21
%136 = load i32, i32* %17
%137 = icmp slt i32 %135, %136
br i1 %137, label %138, label %188
138: ; preds = %134
store i32 0, i32* %22
br label %139
139: ; preds = %181, %138
%140 = load i32, i32* %22
%141 = load i32, i32* %17
%142 = icmp slt i32 %140, %141
br i1 %142, label %143, label %184
143: ; preds = %139
store i32 0, i32* %20
br label %144
144: ; preds = %177, %143
%145 = load i32, i32* %20
%146 = load i32, i32* %15
%147 = icmp slt i32 %145, %146
br i1 %147, label %148, label %180
148: ; preds = %144
%149 = load double*, double** %24
%150 = load i32, i32* %21
%151 = load i32, i32* %17
%152 = mul nsw i32 %150, %151
%153 = load i32, i32* %22
%154 = add nsw i32 %152, %153
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds double, double* %149, i64 %155
%157 = load double, double* %156
%158 = load double*, double** %23
%159 = load i32, i32* %22
%160 = load i32, i32* %15
%161 = mul nsw i32 %159, %160
%162 = load i32, i32* %20
%163 = add nsw i32 %161, %162
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds double, double* %158, i64 %164
%166 = load double, double* %165
%167 = load double*, double** %12
%168 = load i32, i32* %21
%169 = load i32, i32* %15
%170 = mul nsw i32 %168, %169
%171 = load i32, i32* %20
%172 = add nsw i32 %170, %171
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds double, double* %167, i64 %173
%175 = load double, double* %174
%176 = call double @llvm.fmuladd.f64(double %157, double %166, double %175)
store double %176, double* %174
br label %177
177: ; preds = %148
%178 = load i32, i32* %20
%179 = add nsw i32 %178, 1
store i32 %179, i32* %20
br label %144
180: ; preds = %144
br label %181
181: ; preds = %180
%182 = load i32, i32* %22
%183 = add nsw i32 %182, 1
store i32 %183, i32* %22
br label %139
184: ; preds = %139
br label %185
185: ; preds = %184
%186 = load i32, i32* %21
%187 = add nsw i32 %186, 1
store i32 %187, i32* %21
br label %134
188: ; preds = %134
%189 = load double*, double** %18
store double 0.000000e+00, double* %189
store i32 0, i32* %20
br label %190
190: ; preds = %294, %188
%191 = load i32, i32* %20
%192 = load i32, i32* %15
%193 = icmp slt i32 %191, %192
br i1 %193, label %194, label %297
194: ; preds = %190
store double 0.000000e+00, double* %25
store i32 0, i32* %19
br label %195
195: ; preds = %255, %194
%196 = load i32, i32* %19
%197 = load i32, i32* %16
%198 = icmp slt i32 %196, %197
br i1 %198, label %199, label %258
199: ; preds = %195
store double 0.000000e+00, double* %26
store i32 0, i32* %21
br label %200
200: ; preds = %225, %199
%201 = load i32, i32* %21
%202 = load i32, i32* %17
%203 = icmp slt i32 %201, %202
br i1 %203, label %204, label %228
204: ; preds = %200
%205 = load double*, double** %10
%206 = load i32, i32* %21
%207 = load i32, i32* %16
%208 = mul nsw i32 %206, %207
%209 = load i32, i32* %19
%210 = add nsw i32 %208, %209
%211 = sext i32 %210 to i64
%212 = getelementptr inbounds double, double* %205, i64 %211
%213 = load double, double* %212
%214 = load double*, double** %12
%215 = load i32, i32* %21
%216 = load i32, i32* %15
%217 = mul nsw i32 %215, %216
%218 = load i32, i32* %20
%219 = add nsw i32 %217, %218
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds double, double* %214, i64 %220
%222 = load double, double* %221
%223 = load double, double* %26
%224 = call double @llvm.fmuladd.f64(double %213, double %222, double %223)
store double %224, double* %26
br label %225
225: ; preds = %204
%226 = load i32, i32* %21
%227 = add nsw i32 %226, 1
store i32 %227, i32* %21
br label %200
228: ; preds = %200
%229 = load float*, float** %11
%230 = load i32, i32* %19
%231 = load i32, i32* %15
%232 = mul nsw i32 %230, %231
%233 = load i32, i32* %20
%234 = add nsw i32 %232, %233
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds float, float* %229, i64 %235
%237 = load float, float* %236
%238 = fpext float %237 to double
%239 = load double, double* %26
%240 = fsub double %238, %239
%241 = load float*, float** %11
%242 = load i32, i32* %19
%243 = load i32, i32* %15
%244 = mul nsw i32 %242, %243
%245 = load i32, i32* %20
%246 = add nsw i32 %244, %245
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds float, float* %241, i64 %247
%249 = load float, float* %248
%250 = fpext float %249 to double
%251 = load double, double* %26
%252 = fsub double %250, %251
%253 = load double, double* %25
%254 = call double @llvm.fmuladd.f64(double %240, double %252, double %253)
store double %254, double* %25
br label %255
255: ; preds = %228
%256 = load i32, i32* %19
%257 = add nsw i32 %256, 1
store i32 %257, i32* %19
br label %195
258: ; preds = %195
%259 = load double, double* %25
%260 = load double*, double** %18
%261 = load double, double* %260
%262 = fadd double %261, %259
store double %262, double* %260
store i32 0, i32* %21
br label %263
263: ; preds = %290, %258
%264 = load i32, i32* %21
%265 = load i32, i32* %17
%266 = icmp slt i32 %264, %265
br i1 %266, label %267, label %293
267: ; preds = %263
%268 = load double, double* %25
%269 = load i32, i32* %16
%270 = sub nsw i32 %269, 2
%271 = sitofp i32 %270 to double
%272 = load double*, double** %13
%273 = load i32, i32* %21
%274 = load i32, i32* %17
%275 = add nsw i32 %274, 1
%276 = mul nsw i32 %273, %275
%277 = sext i32 %276 to i64
%278 = getelementptr inbounds double, double* %272, i64 %277
%279 = load double, double* %278
%280 = fmul double %271, %279
%281 = fdiv double %268, %280
%282 = load double*, double** %14
%283 = load i32, i32* %21
%284 = load i32, i32* %15
%285 = mul nsw i32 %283, %284
%286 = load i32, i32* %20
%287 = add nsw i32 %285, %286
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds double, double* %282, i64 %288
store double %281, double* %289
br label %290
290: ; preds = %267
%291 = load i32, i32* %21
%292 = add nsw i32 %291, 1
store i32 %292, i32* %21
br label %263
293: ; preds = %263
br label %294
294: ; preds = %293
%295 = load i32, i32* %20
%296 = add nsw i32 %295, 1
store i32 %296, i32* %20
br label %190
297: ; preds = %190
%298 = load i32, i32* %16
%299 = load i32, i32* %15
%300 = mul nsw i32 %298, %299
%301 = sub nsw i32 %300, 1
%302 = sitofp i32 %301 to double
%303 = load double*, double** %18
%304 = load double, double* %303
%305 = fdiv double %304, %302
store double %305, double* %303
%306 = load double*, double** %23
%307 = call i32 @free(double* %306)
%308 = load double*, double** %24
%309 = call i32 @free(double* %308)
ret void
}

LLVM IR (-O2):
define void @calc_beta_k0(double* nocapture %0, float* nocapture %1, double* nocapture %2, double* %3, double* nocapture writeonly %4, i32 %5, i32 %6, i32 %7, double* nocapture %8) {
%10 = mul nsw i32 %7, %5
%11 = tail call i64 @calloc(i32 %10, i32 8)
%12 = inttoptr i64 %11 to double*
%13 = mul nsw i32 %7, %7
%14 = tail call i64 @calloc(i32 %13, i32 8)
%15 = inttoptr i64 %14 to double*
%16 = icmp sgt i32 %7, 0
br i1 %16, label %17, label %70
17: ; preds = %9
%18 = icmp sgt i32 %5, 0
%19 = zext i32 %5 to i64
%20 = shl nuw nsw i64 %19, 3
%21 = zext i32 %7 to i64
%22 = add nsw i64 %21, -1
%23 = and i64 %21, 3
%24 = icmp ult i64 %22, 3
br i1 %24, label %54, label %25
25: ; preds = %17
%26 = and i64 %21, 4294967292
br label %27
27: ; preds = %85, %25
%28 = phi i64 [ 0, %25 ], [ %86, %85 ]
%29 = phi i64 [ 0, %25 ], [ %87, %85 ]
br i1 %18, label %30, label %85
30: ; preds = %27
%31 = trunc i64 %28 to i32
%32 = mul i32 %31, %5
%33 = sext i32 %32 to i64
%34 = getelementptr double, double* %2, i64 %33
%35 = bitcast double* %34 to i8*
%36 = trunc i64 %28 to i32
%37 = or i32 %36, 1
%38 = mul i32 %37, %5
%39 = sext i32 %38 to i64
%40 = getelementptr double, double* %2, i64 %39
%41 = bitcast double* %40 to i8*
%42 = trunc i64 %28 to i32
%43 = or i32 %42, 2
%44 = mul i32 %43, %5
%45 = sext i32 %44 to i64
%46 = getelementptr double, double* %2, i64 %45
%47 = bitcast double* %46 to i8*
%48 = trunc i64 %28 to i32
%49 = or i32 %48, 3
%50 = mul i32 %49, %5
%51 = sext i32 %50 to i64
%52 = getelementptr double, double* %2, i64 %51
%53 = bitcast double* %52 to i8*
br label %85
54: ; preds = %85, %17
%55 = phi i64 [ 0, %17 ], [ %86, %85 ]
%56 = icmp eq i64 %23, 0
br i1 %56, label %70, label %57
57: ; preds = %54, %66
%58 = phi i64 [ %67, %66 ], [ %55, %54 ]
%59 = phi i64 [ %68, %66 ], [ 0, %54 ]
br i1 %18, label %60, label %66
60: ; preds = %57
%61 = trunc i64 %58 to i32
%62 = mul i32 %61, %5
%63 = sext i32 %62 to i64
%64 = getelementptr double, double* %2, i64 %63
%65 = bitcast double* %64 to i8*
br label %66
66: ; preds = %60, %57
%67 = add nuw nsw i64 %58, 1
%68 = add i64 %59, 1
%69 = icmp eq i64 %68, %23
br i1 %69, label %70, label %57
70: ; preds = %54, %66, %9
%71 = icmp sgt i32 %6, 0
br i1 %71, label %72, label %191
72: ; preds = %70
%73 = icmp sgt i32 %5, 0
%74 = zext i32 %6 to i64
%75 = sext i32 %5 to i64
%76 = zext i32 %6 to i64
%77 = zext i32 %7 to i64
%78 = zext i32 %5 to i64
%79 = icmp ult i32 %5, 4
%80 = and i64 %78, 4294967292
%81 = icmp eq i64 %80, %78
%82 = and i64 %78, 1
%83 = icmp eq i64 %82, 0
%84 = sub nsw i64 0, %78
br label %89
85: ; preds = %27, %30
%86 = add nuw nsw i64 %28, 4
%87 = add i64 %29, 4
%88 = icmp eq i64 %87, %26
br i1 %88, label %54, label %27
89: ; preds = %72, %188
%90 = phi i64 [ 0, %72 ], [ %189, %188 ]
%91 = add nuw i64 %90, 1
br i1 %16, label %92, label %188
92: ; preds = %89
%93 = mul nsw i64 %90, %75
br label %94
94: ; preds = %92, %185
%95 = phi i64 [ 0, %92 ], [ %186, %185 ]
%96 = mul i64 %95, %75
%97 = getelementptr double, double* %12, i64 %96
%98 = add i64 %96, %78
%99 = getelementptr double, double* %12, i64 %98
%100 = mul i64 %95, %76
%101 = add i64 %90, %100
%102 = getelementptr double, double* %0, i64 %101
%103 = add i64 %91, %100
%104 = getelementptr double, double* %0, i64 %103
br i1 %73, label %105, label %185
105: ; preds = %94
%106 = mul nsw i64 %95, %74
%107 = add nuw nsw i64 %106, %90
%108 = getelementptr inbounds double, double* %0, i64 %107
%109 = mul nsw i64 %95, %75
br i1 %79, label %145, label %110
110: ; preds = %105
%111 = icmp ult double* %97, %104
%112 = icmp ult double* %102, %99
%113 = and i1 %111, %112
br i1 %113, label %145, label %114
114: ; preds = %110
%115 = load double, double* %108
%116 = insertelement <2 x double> poison, double %115, i64 0
%117 = shufflevector <2 x double> %116, <2 x double> poison, <2 x i32> zeroinitializer
%118 = insertelement <2 x double> poison, double %115, i64 0
%119 = shufflevector <2 x double> %118, <2 x double> poison, <2 x i32> zeroinitializer
br label %120
120: ; preds = %120, %114
%121 = phi i64 [ 0, %114 ], [ %142, %120 ]
%122 = add nsw i64 %121, %93
%123 = getelementptr inbounds float, float* %1, i64 %122
%124 = bitcast float* %123 to <2 x float>*
%125 = load <2 x float>, <2 x float>* %124
%126 = getelementptr inbounds float, float* %123, i64 2
%127 = bitcast float* %126 to <2 x float>*
%128 = load <2 x float>, <2 x float>* %127
%129 = fpext <2 x float> %125 to <2 x double>
%130 = fpext <2 x float> %128 to <2 x double>
%131 = add nsw i64 %121, %109
%132 = getelementptr inbounds double, double* %12, i64 %131
%133 = bitcast double* %132 to <2 x double>*
%134 = load <2 x double>, <2 x double>* %133
%135 = getelementptr inbounds double, double* %132, i64 2
%136 = bitcast double* %135 to <2 x double>*
%137 = load <2 x double>, <2 x double>* %136
%138 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %117, <2 x double> %129, <2 x double> %134)
%139 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %119, <2 x double> %130, <2 x double> %137)
%140 = bitcast double* %132 to <2 x double>*
store <2 x double> %138, <2 x double>* %140
%141 = bitcast double* %135 to <2 x double>*
store <2 x double> %139, <2 x double>* %141
%142 = add nuw i64 %121, 4
%143 = icmp eq i64 %142, %80
br i1 %143, label %144, label %120
144: ; preds = %120
br i1 %81, label %185, label %145
145: ; preds = %110, %105, %144
%146 = phi i64 [ 0, %110 ], [ 0, %105 ], [ %80, %144 ]
%147 = xor i64 %146, -1
br i1 %83, label %159, label %148
148: ; preds = %145
%149 = load double, double* %108
%150 = add nsw i64 %146, %93
%151 = getelementptr inbounds float, float* %1, i64 %150
%152 = load float, float* %151
%153 = fpext float %152 to double
%154 = add nsw i64 %146, %109
%155 = getelementptr inbounds double, double* %12, i64 %154
%156 = load double, double* %155
%157 = tail call double @llvm.fmuladd.f64(double %149, double %153, double %156)
store double %157, double* %155
%158 = or i64 %146, 1
br label %159
159: ; preds = %148, %145
%160 = phi i64 [ %146, %145 ], [ %158, %148 ]
%161 = icmp eq i64 %147, %84
br i1 %161, label %185, label %162
162: ; preds = %159, %162
%163 = phi i64 [ %183, %162 ], [ %160, %159 ]
%164 = load double, double* %108
%165 = add nsw i64 %163, %93
%166 = getelementptr inbounds float, float* %1, i64 %165
%167 = load float, float* %166
%168 = fpext float %167 to double
%169 = add nsw i64 %163, %109
%170 = getelementptr inbounds double, double* %12, i64 %169
%171 = load double, double* %170
%172 = tail call double @llvm.fmuladd.f64(double %164, double %168, double %171)
store double %172, double* %170
%173 = add nuw nsw i64 %163, 1
%174 = load double, double* %108
%175 = add nsw i64 %173, %93
%176 = getelementptr inbounds float, float* %1, i64 %175
%177 = load float, float* %176
%178 = fpext float %177 to double
%179 = add nsw i64 %173, %109
%180 = getelementptr inbounds double, double* %12, i64 %179
%181 = load double, double* %180
%182 = tail call double @llvm.fmuladd.f64(double %174, double %178, double %181)
store double %182, double* %180
%183 = add nuw nsw i64 %163, 2
%184 = icmp eq i64 %183, %78
br i1 %184, label %185, label %162
185: ; preds = %159, %162, %144, %94
%186 = add nuw nsw i64 %95, 1
%187 = icmp eq i64 %186, %77
br i1 %187, label %188, label %94
188: ; preds = %185, %89
%189 = add nuw nsw i64 %90, 1
%190 = icmp eq i64 %189, %76
br i1 %190, label %191, label %89
191: ; preds = %188, %70
%192 = icmp eq i32 %7, 1
br i1 %192, label %193, label %196
193: ; preds = %191
%194 = load double, double* %3
%195 = fdiv double 1.000000e+00, %194
store double %195, double* %15
br label %198
196: ; preds = %191
%197 = tail call i32 @fast_inverse(double* %3, i32 %7, double* %15)
br label %198
198: ; preds = %196, %193
br i1 %16, label %199, label %315
199: ; preds = %198
%200 = icmp sgt i32 %5, 0
%201 = sext i32 %5 to i64
%202 = zext i32 %7 to i64
%203 = zext i32 %7 to i64
%204 = zext i32 %5 to i64
%205 = icmp ult i32 %5, 4
%206 = and i64 %204, 4294967292
%207 = icmp eq i64 %206, %204
%208 = and i64 %204, 1
%209 = icmp eq i64 %208, 0
%210 = sub nsw i64 0, %204
br label %211
211: ; preds = %312, %199
%212 = phi i64 [ 0, %199 ], [ %313, %312 ]
%213 = mul i64 %212, %201
%214 = getelementptr double, double* %2, i64 %213
%215 = add i64 %213, %204
%216 = getelementptr double, double* %2, i64 %215
%217 = mul i64 %212, %203
%218 = add i64 %217, 1
%219 = mul nsw i64 %212, %202
%220 = mul nsw i64 %212, %201
br label %221
221: ; preds = %211, %309
%222 = phi i64 [ 0, %211 ], [ %310, %309 ]
%223 = add i64 %217, %222
%224 = getelementptr double, double* %15, i64 %223
%225 = add i64 %218, %222
%226 = getelementptr double, double* %15, i64 %225
%227 = mul i64 %222, %201
%228 = getelementptr double, double* %12, i64 %227
%229 = add i64 %227, %204
%230 = getelementptr double, double* %12, i64 %229
br i1 %200, label %231, label %309
231: ; preds = %221
%232 = add nuw nsw i64 %222, %219
%233 = getelementptr inbounds double, double* %15, i64 %232
%234 = mul nsw i64 %222, %201
br i1 %205, label %272, label %235
235: ; preds = %231
%236 = icmp ult double* %214, %226
%237 = icmp ult double* %224, %216
%238 = and i1 %236, %237
%239 = icmp ult double* %214, %230
%240 = icmp ult double* %228, %216
%241 = and i1 %239, %240
%242 = or i1 %238, %241
br i1 %242, label %272, label %243
243: ; preds = %235
%244 = load double, double* %233
%245 = insertelement <2 x double> poison, double %244, i64 0
%246 = shufflevector <2 x double> %245, <2 x double> poison, <2 x i32> zeroinitializer
%247 = insertelement <2 x double> poison, double %244, i64 0
%248 = shufflevector <2 x double> %247, <2 x double> poison, <2 x i32> zeroinitializer
br label %249
249: ; preds = %249, %243
%250 = phi i64 [ 0, %243 ], [ %269, %249 ]
%251 = add nsw i64 %250, %234
%252 = getelementptr inbounds double, double* %12, i64 %251
%253 = bitcast double* %252 to <2 x double>*
%254 = load <2 x double>, <2 x double>* %253
%255 = getelementptr inbounds double, double* %252, i64 2
%256 = bitcast double* %255 to <2 x double>*
%257 = load <2 x double>, <2 x double>* %256
%258 = add nsw i64 %250, %220
%259 = getelementptr inbounds double, double* %2, i64 %258
%260 = bitcast double* %259 to <2 x double>*
%261 = load <2 x double>, <2 x double>* %260
%262 = getelementptr inbounds double, double* %259, i64 2
%263 = bitcast double* %262 to <2 x double>*
%264 = load <2 x double>, <2 x double>* %263
%265 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %246, <2 x double> %254, <2 x double> %261)
%266 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %248, <2 x double> %257, <2 x double> %264)
%267 = bitcast double* %259 to <2 x double>*
store <2 x double> %265, <2 x double>* %267
%268 = bitcast double* %262 to <2 x double>*
store <2 x double> %266, <2 x double>* %268
%269 = add nuw i64 %250, 4
%270 = icmp eq i64 %269, %206
br i1 %270, label %271, label %249
271: ; preds = %249
br i1 %207, label %309, label %272
272: ; preds = %235, %231, %271
%273 = phi i64 [ 0, %235 ], [ 0, %231 ], [ %206, %271 ]
%274 = xor i64 %273, -1
br i1 %209, label %285, label %275
275: ; preds = %272
%276 = load double, double* %233
%277 = add nsw i64 %273, %234
%278 = getelementptr inbounds double, double* %12, i64 %277
%279 = load double, double* %278
%280 = add nsw i64 %273, %220
%281 = getelementptr inbounds double, double* %2, i64 %280
%282 = load double, double* %281
%283 = tail call double @llvm.fmuladd.f64(double %276, double %279, double %282)
store double %283, double* %281
%284 = or i64 %273, 1
br label %285
285: ; preds = %275, %272
%286 = phi i64 [ %273, %272 ], [ %284, %275 ]
%287 = icmp eq i64 %274, %210
br i1 %287, label %309, label %288
288: ; preds = %285, %288
%289 = phi i64 [ %307, %288 ], [ %286, %285 ]
%290 = load double, double* %233
%291 = add nsw i64 %289, %234
%292 = getelementptr inbounds double, double* %12, i64 %291
%293 = load double, double* %292
%294 = add nsw i64 %289, %220
%295 = getelementptr inbounds double, double* %2, i64 %294
%296 = load double, double* %295
%297 = tail call double @llvm.fmuladd.f64(double %290, double %293, double %296)
store double %297, double* %295
%298 = add nuw nsw i64 %289, 1
%299 = load double, double* %233
%300 = add nsw i64 %298, %234
%301 = getelementptr inbounds double, double* %12, i64 %300
%302 = load double, double* %301
%303 = add nsw i64 %298, %220
%304 = getelementptr inbounds double, double* %2, i64 %303
%305 = load double, double* %304
%306 = tail call double @llvm.fmuladd.f64(double %299, double %302, double %305)
store double %306, double* %304
%307 = add nuw nsw i64 %289, 2
%308 = icmp eq i64 %307, %204
br i1 %308, label %309, label %288
309: ; preds = %285, %288, %271, %221
%310 = add nuw nsw i64 %222, 1
%311 = icmp eq i64 %310, %203
br i1 %311, label %312, label %221
312: ; preds = %309
%313 = add nuw nsw i64 %212, 1
%314 = icmp eq i64 %313, %203
br i1 %314, label %315, label %211
315: ; preds = %312, %198
store double 0.000000e+00, double* %8
%316 = icmp sgt i32 %5, 0
br i1 %316, label %317, label %437
317: ; preds = %315
%318 = add nsw i32 %6, -2
%319 = sitofp i32 %318 to double
%320 = add nsw i32 %7, 1
%321 = sext i32 %6 to i64
%322 = zext i32 %5 to i64
%323 = sext i32 %320 to i64
%324 = zext i32 %5 to i64
%325 = zext i32 %6 to i64
%326 = zext i32 %7 to i64
%327 = add nsw i64 %326, -1
%328 = and i64 %326, 1
%329 = icmp eq i64 %327, 0
%330 = and i64 %326, 4294967294
%331 = icmp eq i64 %328, 0
%332 = and i64 %326, 1
%333 = icmp eq i64 %327, 0
%334 = and i64 %326, 4294967294
%335 = icmp eq i64 %332, 0
br label %336
336: ; preds = %317, %432
%337 = phi i64 [ 0, %317 ], [ %433, %432 ]
br i1 %71, label %338, label %393
338: ; preds = %336, %382
%339 = phi i64 [ %391, %382 ], [ 0, %336 ]
%340 = phi double [ %390, %382 ], [ 0.000000e+00, %336 ]
br i1 %16, label %341, label %382
341: ; preds = %338
br i1 %329, label %368, label %342
342: ; preds = %341, %342
%343 = phi i64 [ %365, %342 ], [ 0, %341 ]
%344 = phi double [ %364, %342 ], [ 0.000000e+00, %341 ]
%345 = phi i64 [ %366, %342 ], [ 0, %341 ]
%346 = mul nsw i64 %343, %321
%347 = add nsw i64 %346, %339
%348 = getelementptr inbounds double, double* %0, i64 %347
%349 = load double, double* %348
%350 = mul nsw i64 %343, %322
%351 = add nuw nsw i64 %350, %337
%352 = getelementptr inbounds double, double* %2, i64 %351
%353 = load double, double* %352
%354 = tail call double @llvm.fmuladd.f64(double %349, double %353, double %344)
%355 = or i64 %343, 1
%356 = mul nsw i64 %355, %321
%357 = add nsw i64 %356, %339
%358 = getelementptr inbounds double, double* %0, i64 %357
%359 = load double, double* %358
%360 = mul nsw i64 %355, %322
%361 = add nuw nsw i64 %360, %337
%362 = getelementptr inbounds double, double* %2, i64 %361
%363 = load double, double* %362
%364 = tail call double @llvm.fmuladd.f64(double %359, double %363, double %354)
%365 = add nuw nsw i64 %343, 2
%366 = add i64 %345, 2
%367 = icmp eq i64 %366, %330
br i1 %367, label %368, label %342
368: ; preds = %342, %341
%369 = phi double [ undef, %341 ], [ %364, %342 ]
%370 = phi i64 [ 0, %341 ], [ %365, %342 ]
%371 = phi double [ 0.000000e+00, %341 ], [ %364, %342 ]
br i1 %331, label %382, label %372
372: ; preds = %368
%373 = mul nsw i64 %370, %321
%374 = add nsw i64 %373, %339
%375 = getelementptr inbounds double, double* %0, i64 %374
%376 = load double, double* %375
%377 = mul nsw i64 %370, %322
%378 = add nuw nsw i64 %377, %337
%379 = getelementptr inbounds double, double* %2, i64 %378
%380 = load double, double* %379
%381 = tail call double @llvm.fmuladd.f64(double %376, double %380, double %371)
br label %382
382: ; preds = %372, %368, %338
%383 = phi double [ 0.000000e+00, %338 ], [ %369, %368 ], [ %381, %372 ]
%384 = mul nsw i64 %339, %322
%385 = add nuw nsw i64 %384, %337
%386 = getelementptr inbounds float, float* %1, i64 %385
%387 = load float, float* %386
%388 = fpext float %387 to double
%389 = fsub double %388, %383
%390 = tail call double @llvm.fmuladd.f64(double %389, double %389, double %340)
%391 = add nuw nsw i64 %339, 1
%392 = icmp eq i64 %391, %325
br i1 %392, label %393, label %338
393: ; preds = %382, %336
%394 = phi double [ 0.000000e+00, %336 ], [ %390, %382 ]
%395 = load double, double* %8
%396 = fadd double %394, %395
store double %396, double* %8
br i1 %16, label %397, label %432
397: ; preds = %393
br i1 %333, label %421, label %398
398: ; preds = %397, %398
%399 = phi i64 [ %418, %398 ], [ 0, %397 ]
%400 = phi i64 [ %419, %398 ], [ 0, %397 ]
%401 = mul nsw i64 %399, %323
%402 = getelementptr inbounds double, double* %3, i64 %401
%403 = load double, double* %402
%404 = fmul double %403, %319
%405 = fdiv double %394, %404
%406 = mul nsw i64 %399, %322
%407 = add nuw nsw i64 %406, %337
%408 = getelementptr inbounds double, double* %4, i64 %407
store double %405, double* %408
%409 = or i64 %399, 1
%410 = mul nsw i64 %409, %323
%411 = getelementptr inbounds double, double* %3, i64 %410
%412 = load double, double* %411
%413 = fmul double %412, %319
%414 = fdiv double %394, %413
%415 = mul nsw i64 %409, %322
%416 = add nuw nsw i64 %415, %337
%417 = getelementptr inbounds double, double* %4, i64 %416
store double %414, double* %417
%418 = add nuw nsw i64 %399, 2
%419 = add i64 %400, 2
%420 = icmp eq i64 %419, %334
br i1 %420, label %421, label %398
421: ; preds = %398, %397
%422 = phi i64 [ 0, %397 ], [ %418, %398 ]
br i1 %335, label %432, label %423
423: ; preds = %421
%424 = mul nsw i64 %422, %323
%425 = getelementptr inbounds double, double* %3, i64 %424
%426 = load double, double* %425
%427 = fmul double %426, %319
%428 = fdiv double %394, %427
%429 = mul nsw i64 %422, %322
%430 = add nuw nsw i64 %429, %337
%431 = getelementptr inbounds double, double* %4, i64 %430
store double %428, double* %431
br label %432
432: ; preds = %423, %421, %393
%433 = add nuw nsw i64 %337, 1
%434 = icmp eq i64 %433, %324
br i1 %434, label %435, label %336
435: ; preds = %432
%436 = load double, double* %8
br label %437
437: ; preds = %435, %315
%438 = phi double [ %436, %435 ], [ 0.000000e+00, %315 ]
%439 = mul nsw i32 %6, %5
%440 = add nsw i32 %439, -1
%441 = sitofp i32 %440 to double
%442 = fdiv double %438, %441
store double %442, double* %8
%443 = tail call i32 @free(double* %12)
%444 = tail call i32 @free(double* %15)
ret void
}