#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 */
int /*<<< orphan*/ dgemv_(char *, int *, int *, double *, double *, int *,
                          double *, int *, double *, double *, int *);
int /*<<< orphan*/ dpotrf_(char *, int *, double *, int *, int *);
int /*<<< orphan*/ dsyrk_(char *, char *, int *, int *, double *, double *,
                          int *, double *, double *, int *);
int /*<<< orphan*/ dtrsv_(char *, char *, char *, int *, double *, int *,
                          double *, int *);
int /*<<< orphan*/ exit(int);
scalar_t__ fgls_malloc_impl(char *, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ free(double *);
int log(double);
int /*<<< orphan*/ memcpy(double *, double *, int);
double sqrt(double);
int /*<<< orphan*/ stderr;
double variance(double *, int);
double polygenic_REML_logLik_eig(int n, int widthXL, double *X, double *Y,
                                 double *Z, double *W, double *ZtX, double *ZtY,
                                 double sigma, double h2, double *loglik,
                                 double *res_sigma, double *beta) {
  double alpha, gamma, *ZtY_upd, *ZtX_upd, *YmXB, *V, *D, det,
      ZERO = 0.0, ONE = 1.0, MINUS_ONE = -1.0;
  int wXL = widthXL, iONE = 1, info, i, j;
  V = (double *)fgls_malloc_impl(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/src/"
      "REML.c",
      139, wXL * wXL * sizeof(double));
  ZtY_upd = (double *)fgls_malloc_impl(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/src/"
      "REML.c",
      140, n * sizeof(double));
  ZtX_upd = (double *)fgls_malloc_impl(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/src/"
      "REML.c",
      141, n * wXL * sizeof(double));
  D = (double *)fgls_malloc_impl(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/src/"
      "REML.c",
      142, n * sizeof(double));
  YmXB = (double *)fgls_malloc_impl(
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/src/"
      "REML.c",
      143, n * sizeof(double));
  alpha = h2;
  gamma = (1 - h2);
  det = 0.0;
  for (i = 0; i < n; i++) {
    D[i] = alpha * W[i] + gamma;
    det += log(D[i]);
    D[i] = sqrt(1.0 / D[i]);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < wXL; j++)
      ZtX_upd[j * n + i] = ZtX[j * n + i] * D[i];
    ZtY_upd[i] = ZtY[i] * D[i];
  }
  dgemv_("T", &n, &widthXL, &ONE, ZtX_upd, &n, ZtY_upd, &iONE, &ZERO, beta,
         &iONE);
  dsyrk_("L", "T", &wXL, &n, &ONE, ZtX_upd, &n, &ZERO, V, &wXL);
  dpotrf_("L", &wXL, V, &wXL, &info);
  if (info != 0) {
    fprintf(stderr,
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/"
            "src/REML.c"
            ": [ERROR] inv(V) y failed - info: %d\n",
            info);
    exit(-1);
  }
  dtrsv_("L", "N", "N", &wXL, V, &wXL, beta, &iONE);
  dtrsv_("L", "T", "N", &wXL, V, &wXL, beta, &iONE);
  memcpy(YmXB, Y, n * sizeof(double));
  dgemv_("N", &n, &wXL, &MINUS_ONE, X, &n, beta, &iONE, &ONE, YmXB, &iONE);
  *res_sigma = variance(YmXB, n);
  dgemv_("T", &n, &n, &ONE, Z, &n, YmXB, &iONE, &ZERO, ZtY_upd, &iONE);
  *loglik = 0.0;
  for (i = 0; i < n; i++)
    *loglik += ZtY_upd[i] * D[i] * D[i] * ZtY_upd[i];
  *loglik = (*loglik) / (*res_sigma);
  *loglik = det + n * log(*res_sigma) + (*loglik);
  free(V);
  free(ZtY_upd);
  free(ZtX_upd);
  free(YmXB);
  free(D);
  return *loglik;
}


x86 assembly (clang, -O0):
<polygenic_REML_logLik_eig>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0xd8,%rsp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
movsd  %xmm1,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xded(%rip),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xde5(%rip),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x10(%rbp),%eax
mov    %eax,-0x9c(%rbp)
movl   $0x1,-0xa0(%rbp)
mov    -0x9c(%rbp),%eax
imul   -0x9c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
lea    0xdb6(%rip),%rdi
mov    $0x8b,%esi
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,-0x70(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
lea    0xd97(%rip),%rdi
mov    $0x8c,%esi
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,-0x58(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x9c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edx
lea    0xd70(%rip),%rdi
mov    $0x8d,%esi
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,-0x60(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
lea    0xd51(%rip),%rdi
mov    $0x8e,%esi
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,-0x78(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
lea    0xd32(%rip),%rdi
mov    $0x8f,%esi
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd02(%rip),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0xa8(%rbp)
mov    -0xa8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13bf <polygenic_REML_logLik_eig+0x1ff>
movsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0xa8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x78(%rbp),%rax
movslq -0xa8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x78(%rbp),%rax
movslq -0xa8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   10c0 <log@plt>
cvtsi2sd %eax,%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x78(%rbp),%rax
movslq -0xa8(%rbp),%rcx
movsd  0xc6f(%rip),%xmm0
divsd  (%rax,%rcx,8),%xmm0
call   10d0 <sqrt@plt>
mov    -0x78(%rbp),%rax
movslq -0xa8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    131a <polygenic_REML_logLik_eig+0x15a>
movl   $0x0,-0xa8(%rbp)
mov    -0xa8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1494 <polygenic_REML_logLik_eig+0x2d4>
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0x9c(%rbp),%eax
jge    1450 <polygenic_REML_logLik_eig+0x290>
mov    0x10(%rbp),%rax
mov    -0xac(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0xa8(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x78(%rbp),%rax
movslq -0xa8(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
mov    -0xac(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0xa8(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    13e2 <polygenic_REML_logLik_eig+0x222>
mov    0x18(%rbp),%rax
movslq -0xa8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x78(%rbp),%rax
movslq -0xa8(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0xa8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    13c9 <polygenic_REML_logLik_eig+0x209>
mov    -0x60(%rbp),%r8
mov    -0x58(%rbp),%rbx
mov    0x30(%rbp),%r10
lea    0xbf5(%rip),%rdi
lea    -0xc(%rbp),%r9
lea    -0x10(%rbp),%rdx
lea    -0x90(%rbp),%rcx
lea    -0xa0(%rbp),%rax
lea    -0x88(%rbp),%r11
mov    %r9,%rsi
mov    %rbx,(%rsp)
mov    %rax,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1090 <dgemv_@plt>
mov    -0x60(%rbp),%r9
mov    -0x70(%rbp),%r10
lea    0xbab(%rip),%rdi
lea    0xba2(%rip),%rsi
lea    -0x9c(%rbp),%rax
lea    -0xc(%rbp),%rbx
lea    -0x90(%rbp),%r8
lea    -0x88(%rbp),%r11
mov    %rax,%rdx
mov    %rbx,%rcx
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   10b0 <dsyrk_@plt>
mov    -0x70(%rbp),%rdx
lea    0xb62(%rip),%rdi
lea    -0x9c(%rbp),%rcx
lea    -0xa4(%rbp),%r8
mov    %rcx,%rsi
call   1040 <dpotrf_@plt>
cmpl   $0x0,-0xa4(%rbp)
je     1584 <polygenic_REML_logLik_eig+0x3c4>
mov    0x2a7a(%rip),%rax
mov    (%rax),%edi
mov    -0xa4(%rbp),%edx
lea    0xb2b(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x70(%rbp),%r8
mov    0x30(%rbp),%r10
lea    0xb0b(%rip),%rdi
lea    0xbb7(%rip),%rdx
lea    -0x9c(%rbp),%r9
lea    -0xa0(%rbp),%rax
mov    %rdx,%rsi
mov    %r9,%rcx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <dtrsv_@plt>
mov    -0x70(%rbp),%r8
mov    0x30(%rbp),%r10
lea    0xad3(%rip),%rdi
lea    0xaca(%rip),%rsi
lea    0xb78(%rip),%rdx
lea    -0x9c(%rbp),%r9
lea    -0xa0(%rbp),%rax
mov    %r9,%rcx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <dtrsv_@plt>
mov    -0x68(%rbp),%rdi
mov    -0x20(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
call   1080 <memcpy@plt>
mov    -0x18(%rbp),%r8
mov    0x30(%rbp),%rbx
mov    -0x68(%rbp),%r10
lea    0xb2f(%rip),%rdi
lea    -0xc(%rbp),%r9
lea    -0x9c(%rbp),%rdx
lea    -0x98(%rbp),%rcx
lea    -0xa0(%rbp),%rax
lea    -0x90(%rbp),%r11
mov    %r9,%rsi
mov    %rbx,(%rsp)
mov    %rax,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1090 <dgemv_@plt>
mov    -0x68(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <variance@plt>
mov    0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%r8
mov    -0x68(%rbp),%rbx
mov    -0x58(%rbp),%r10
lea    0xa13(%rip),%rdi
lea    -0xc(%rbp),%r9
lea    -0x90(%rbp),%rcx
lea    -0xa0(%rbp),%rax
lea    -0x88(%rbp),%r11
mov    %r9,%rsi
mov    %r9,%rdx
mov    %rbx,(%rsp)
mov    %rax,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1090 <dgemv_@plt>
mov    0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0xa8(%rbp)
mov    -0xa8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1751 <polygenic_REML_logLik_eig+0x591>
mov    -0x58(%rbp),%rax
movslq -0xa8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x78(%rbp),%rax
movslq -0xa8(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x78(%rbp),%rax
movslq -0xa8(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0xa8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    16da <polygenic_REML_logLik_eig+0x51a>
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    0x28(%rbp),%rax
divsd  (%rax),%xmm0
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0xc(%rbp),%eax
mov    %eax,-0xb0(%rbp)
mov    0x28(%rbp),%rax
movsd  (%rax),%xmm0
call   10c0 <log@plt>
movsd  -0xb8(%rbp),%xmm0
ff
mov    %eax,%ecx
mov    -0xb0(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
mov    0x20(%rbp),%rax
addsd  (%rax),%xmm0
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
add    $0xd8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<polygenic_REML_logLik_eig>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
movsd  %xmm1,0x48(%rsp)
mov    %r9,%r14
mov    %r8,0x70(%rsp)
mov    %rcx,0x60(%rsp)
mov    %rdx,0x68(%rsp)
mov    %esi,%r15d
mov    %edi,%ebx
mov    %edi,(%rsp)
mov    %esi,0x3c(%rsp)
movq   $0x0,0x30(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x50(%rsp)
movabs $0xbff0000000000000,%rax
mov    %rax,0x80(%rsp)
mov    %esi,0x14(%rsp)
movl   $0x1,0x4(%rsp)
mov    %esi,%edx
imul   %esi,%edx
shl    $0x3,%edx
lea    0xdd6(%rip),%rbp
mov    %rbp,%rdi
mov    $0x8b,%esi
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,0x18(%rsp)
lea    0x0(,%rbx,8),%r13d
mov    %rbp,%rdi
mov    $0x8c,%esi
mov    %r13d,%edx
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,0x28(%rsp)
mov    %r13d,%edx
imul   %r15d,%edx
mov    %rbp,%rdi
mov    $0x8d,%esi
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,0x8(%rsp)
mov    %rbp,%rdi
mov    $0x8e,%esi
mov    %r13d,%edx
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,%r12
mov    %rbp,%rdi
mov    $0x8f,%esi
mov    %r13d,%edx
call   10a0 <fgls_malloc_impl@plt>
mov    %rax,0x40(%rsp)
test   %ebx,%ebx
jle    144b <polygenic_REML_logLik_eig+0x28b>
movsd  0xd46(%rip),%xmm0
movsd  0x48(%rsp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,0x78(%rsp)
mov    %rbx,0x58(%rsp)
mov    %ebx,%r13d
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
jmp    1311 <polygenic_REML_logLik_eig+0x151>
call   10d0 <sqrt@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movsd  0x20(%rsp),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x20(%rsp)
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r13
movsd  0x48(%rsp),%xmm1
je     134c <polygenic_REML_logLik_eig+0x18c>
movsd  (%r14,%rbx,8),%xmm0
mulsd  %xmm1,%xmm0
addsd  0x78(%rsp),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
call   10c0 <log@plt>
mov    %eax,%ebp
movsd  0xcca(%rip),%xmm0
divsd  (%r12,%rbx,8),%xmm0
ucomisd 0xcc4(%rip),%xmm0
jb     12e0 <polygenic_REML_logLik_eig+0x120>
sqrtsd %xmm0,%xmm0
jmp    12e5 <polygenic_REML_logLik_eig+0x125>
cmpl   $0x0,0x58(%rsp)
jle    1455 <polygenic_REML_logLik_eig+0x295>
mov    %r15d,%r8d
mov    %r8d,%r9d
and    $0xfffffffe,%r9d
mov    0x8(%rsp),%r14
lea    (%r14,%r13,8),%rdx
mov    %r13,%r10
shl    $0x4,%r10
mov    0xc0(%rsp),%rbx
lea    (%rbx,%r13,8),%rdi
xor    %ebp,%ebp
mov    %r14,%rax
mov    0x28(%rsp),%r11
jmp    13c6 <polygenic_REML_logLik_eig+0x206>
nopl   0x0(%rax)
mov    0xc8(%rsp),%rcx
movsd  (%rcx,%rbp,8),%xmm0
mulsd  (%r12,%rbp,8),%xmm0
movsd  %xmm0,(%r11,%rbp,8)
add    $0x1,%rbp
add    $0x8,%rdx
add    $0x8,%rdi
add    $0x8,%rbx
add    $0x8,%rax
cmp    %r13,%rbp
je     1455 <polygenic_REML_logLik_eig+0x295>
test   %r15d,%r15d
jle    1390 <polygenic_REML_logLik_eig+0x1d0>
cmp    $0x1,%r15d
jne    13e0 <polygenic_REML_logLik_eig+0x220>
xor    %ecx,%ecx
jmp    141c <polygenic_REML_logLik_eig+0x25c>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %esi,%esi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rbx,%rsi,1),%xmm0
mulsd  (%r12,%rbp,8),%xmm0
movsd  %xmm0,(%rax,%rsi,1)
movsd  (%rdi,%rsi,1),%xmm0
mulsd  (%r12,%rbp,8),%xmm0
movsd  %xmm0,(%rdx,%rsi,1)
add    $0x2,%rcx
add    %r10,%rsi
cmp    %rcx,%r9
jne    13f0 <polygenic_REML_logLik_eig+0x230>
test   $0x1,%r8b
je     1390 <polygenic_REML_logLik_eig+0x1d0>
imul   %r13,%rcx
add    %rbp,%rcx
mov    0xc0(%rsp),%rsi
movsd  (%rsi,%rcx,8),%xmm0
mulsd  (%r12,%rbp,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
jmp    1390 <polygenic_REML_logLik_eig+0x1d0>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
mov    0x18(%rsp),%r14
sub    $0x8,%rsp
lea    0xc(%rsp),%rbp
lea    0x38(%rsp),%r10
lea    0xc2d(%rip),%rdi
lea    0x44(%rsp),%rdx
lea    0x58(%rsp),%r13
lea    0x8(%rsp),%r15
mov    %r15,%rsi
mov    %r13,%rcx
mov    0x10(%rsp),%rbx
mov    %rbx,%r8
mov    %r15,%r9
push   %rbp
mov    0xf0(%rsp),%rax
push   %rax
push   %r10
push   %rbp
push   0x50(%rsp)
call   1090 <dgemv_@plt>
add    $0x30,%rsp
lea    0x14(%rsp),%rbp
lea    0xbe9(%rip),%rdi
lea    0xbe0(%rip),%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r13,%r8
mov    %rbx,%r9
push   %rbp
push   %r14
lea    0x40(%rsp),%rax
push   %rax
push   %r15
call   10b0 <dsyrk_@plt>
add    $0x20,%rsp
lea    0x38(%rsp),%r8
lea    0xbb6(%rip),%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
call   1040 <dpotrf_@plt>
mov    0x38(%rsp),%edx
test   %edx,%edx
jne    1758 <polygenic_REML_logLik_eig+0x598>
mov    %r14,%rbx
mov    0xd0(%rsp),%r15
lea    0xb8a(%rip),%rdi
lea    0xc36(%rip),%r14
lea    0x14(%rsp),%rbp
mov    %r14,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
mov    %rbx,%r8
mov    %rbp,%r9
lea    0x4(%rsp),%rax
push   %rax
mov    0xe8(%rsp),%rax
push   %rax
mov    %rax,%r13
call   1060 <dtrsv_@plt>
add    $0x10,%rsp
lea    0xb4b(%rip),%rsi
lea    0xb46(%rip),%rdi
mov    %r14,%rdx
mov    %rbp,%rcx
mov    %rbx,%r8
mov    %rbp,%r9
lea    0x4(%rsp),%rbx
push   %rbx
push   %r13
call   1060 <dtrsv_@plt>
add    $0x10,%rsp
mov    (%rsp),%edx
shl    $0x3,%edx
mov    0x40(%rsp),%r13
mov    %r13,%rdi
mov    0x60(%rsp),%rsi
call   1080 <memcpy@plt>
sub    $0x8,%rsp
lea    0x88(%rsp),%rcx
lea    0x8(%rsp),%r14
lea    0xbac(%rip),%rdi
mov    %r14,%rsi
mov    %rbp,%rdx
mov    0x70(%rsp),%r8
mov    %r14,%r9
push   %rbx
push   %r13
lea    0x68(%rsp),%rbp
push   %rbp
push   %rbx
push   0x108(%rsp)
call   1090 <dgemv_@plt>
add    $0x30,%rsp
mov    (%rsp),%esi
mov    %r13,%rdi
call   1050 <variance@plt>
mov    0xd8(%rsp),%rax
movsd  %xmm0,(%rax)
sub    $0x8,%rsp
lea    0xaad(%rip),%rdi
mov    %r14,%rsi
mov    %r14,%rdx
mov    %rbp,%rcx
mov    0x78(%rsp),%r8
mov    %r14,%r9
mov    %rbx,%rbp
push   %rbx
mov    0x38(%rsp),%rbx
push   %rbx
lea    0x48(%rsp),%rax
push   %rax
push   %rbp
push   %r13
call   1090 <dgemv_@plt>
add    $0x30,%rsp
movq   $0x0,(%r15)
mov    (%rsp),%ebp
test   %ebp,%ebp
jle    163c <polygenic_REML_logLik_eig+0x47c>
cmp    $0x1,%ebp
jne    164a <polygenic_REML_logLik_eig+0x48a>
xorpd  %xmm0,%xmm0
xor    %eax,%eax
mov    0x8(%rsp),%r14
jmp    16b3 <polygenic_REML_logLik_eig+0x4f3>
xorpd  %xmm0,%xmm0
mov    0x8(%rsp),%r14
jmp    16dd <polygenic_REML_logLik_eig+0x51d>
mov    %ebp,%ecx
and    $0xfffffffe,%ecx
xorpd  %xmm0,%xmm0
xor    %eax,%eax
mov    0x8(%rsp),%r14
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%rax,8),%xmm1
movsd  (%r12,%rax,8),%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm0,%xmm3
movsd  %xmm3,(%r15)
movsd  0x8(%rbx,%rax,8),%xmm1
movsd  0x8(%r12,%rax,8),%xmm2
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm3,%xmm0
movsd  %xmm0,(%r15)
add    $0x2,%rax
cmp    %rax,%rcx
jne    1660 <polygenic_REML_logLik_eig+0x4a0>
test   $0x1,%bpl
je     16dd <polygenic_REML_logLik_eig+0x51d>
movsd  (%rbx,%rax,8),%xmm1
movsd  (%r12,%rax,8),%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm3,%xmm0
movsd  %xmm0,(%r15)
mov    0xd8(%rsp),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,(%r15)
movsd  (%rax),%xmm0
call   10c0 <log@plt>
imul   %ebp,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm1
addsd  (%r15),%xmm1
movsd  %xmm1,(%r15)
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
movsd  (%r15),%xmm0
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2881(%rip),%rax
mov    (%rax),%edi
lea    0x938(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/src/REML.c\00"
@.str.1 = [2 x i8] c"T\00"
@.str.2 = [2 x i8] c"L\00"
@stderr = global i32 0
@.str.3 = [177 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/src/REML.c: [ERROR] inv(V) y failed - info: %d\0A\00"
@.str.4 = [2 x i8] c"N\00"
define double @polygenic_REML_logLik_eig(i32 %0, i32 %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double %8, double %9, double* %10, double* %11, double* %12) {
%14 = alloca i32
%15 = alloca i32
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double
%23 = alloca double
%24 = alloca double*
%25 = alloca double*
%26 = alloca double*
%27 = alloca double
%28 = alloca double
%29 = alloca double*
%30 = alloca double*
%31 = alloca double*
%32 = alloca double*
%33 = alloca double*
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca i32
%42 = alloca i32
store i32 %0, i32* %14
store i32 %1, i32* %15
store double* %2, double** %16
store double* %3, double** %17
store double* %4, double** %18
store double* %5, double** %19
store double* %6, double** %20
store double* %7, double** %21
store double %8, double* %22
store double %9, double* %23
store double* %10, double** %24
store double* %11, double** %25
store double* %12, double** %26
store double 0.000000e+00, double* %35
store double 1.000000e+00, double* %36
store double -1.000000e+00, double* %37
%43 = load i32, i32* %15
store i32 %43, i32* %38
store i32 1, i32* %39
%44 = load i32, i32* %38
%45 = load i32, i32* %38
%46 = mul nsw i32 %44, %45
%47 = sext i32 %46 to i64
%48 = mul i64 %47, 8
%49 = trunc i64 %48 to i32
%50 = call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 139, i32 %49)
%51 = inttoptr i64 %50 to double*
store double* %51, double** %32
%52 = load i32, i32* %14
%53 = sext i32 %52 to i64
%54 = mul i64 %53, 8
%55 = trunc i64 %54 to i32
%56 = call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 140, i32 %55)
%57 = inttoptr i64 %56 to double*
store double* %57, double** %29
%58 = load i32, i32* %14
%59 = load i32, i32* %38
%60 = mul nsw i32 %58, %59
%61 = sext i32 %60 to i64
%62 = mul i64 %61, 8
%63 = trunc i64 %62 to i32
%64 = call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 141, i32 %63)
%65 = inttoptr i64 %64 to double*
store double* %65, double** %30
%66 = load i32, i32* %14
%67 = sext i32 %66 to i64
%68 = mul i64 %67, 8
%69 = trunc i64 %68 to i32
%70 = call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 142, i32 %69)
%71 = inttoptr i64 %70 to double*
store double* %71, double** %33
%72 = load i32, i32* %14
%73 = sext i32 %72 to i64
%74 = mul i64 %73, 8
%75 = trunc i64 %74 to i32
%76 = call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 143, i32 %75)
%77 = inttoptr i64 %76 to double*
store double* %77, double** %31
%78 = load double, double* %23
store double %78, double* %27
%79 = load double, double* %23
%80 = fsub double 1.000000e+00, %79
store double %80, double* %28
store double 0.000000e+00, double* %34
store i32 0, i32* %41
br label %81
81: ; preds = %118, %13
%82 = load i32, i32* %41
%83 = load i32, i32* %14
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %121
85: ; preds = %81
%86 = load double, double* %27
%87 = load double*, double** %19
%88 = load i32, i32* %41
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %87, i64 %89
%91 = load double, double* %90
%92 = load double, double* %28
%93 = call double @llvm.fmuladd.f64(double %86, double %91, double %92)
%94 = load double*, double** %33
%95 = load i32, i32* %41
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
store double %93, double* %97
%98 = load double*, double** %33
%99 = load i32, i32* %41
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
%102 = load double, double* %101
%103 = call i32 @log(double %102)
%104 = sitofp i32 %103 to double
%105 = load double, double* %34
%106 = fadd double %105, %104
store double %106, double* %34
%107 = load double*, double** %33
%108 = load i32, i32* %41
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds double, double* %107, i64 %109
%111 = load double, double* %110
%112 = fdiv double 1.000000e+00, %111
%113 = call double @sqrt(double %112)
%114 = load double*, double** %33
%115 = load i32, i32* %41
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %114, i64 %116
store double %113, double* %117
br label %118
118: ; preds = %85
%119 = load i32, i32* %41
%120 = add nsw i32 %119, 1
store i32 %120, i32* %41
br label %81
121: ; preds = %81
store i32 0, i32* %41
br label %122
122: ; preds = %174, %121
%123 = load i32, i32* %41
%124 = load i32, i32* %14
%125 = icmp slt i32 %123, %124
br i1 %125, label %126, label %177
126: ; preds = %122
store i32 0, i32* %42
br label %127
127: ; preds = %155, %126
%128 = load i32, i32* %42
%129 = load i32, i32* %38
%130 = icmp slt i32 %128, %129
br i1 %130, label %131, label %158
131: ; preds = %127
%132 = load double*, double** %20
%133 = load i32, i32* %42
%134 = load i32, i32* %14
%135 = mul nsw i32 %133, %134
%136 = load i32, i32* %41
%137 = add nsw i32 %135, %136
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %132, i64 %138
%140 = load double, double* %139
%141 = load double*, double** %33
%142 = load i32, i32* %41
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %141, i64 %143
%145 = load double, double* %144
%146 = fmul double %140, %145
%147 = load double*, double** %30
%148 = load i32, i32* %42
%149 = load i32, i32* %14
%150 = mul nsw i32 %148, %149
%151 = load i32, i32* %41
%152 = add nsw i32 %150, %151
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double, double* %147, i64 %153
store double %146, double* %154
br label %155
155: ; preds = %131
%156 = load i32, i32* %42
%157 = add nsw i32 %156, 1
store i32 %157, i32* %42
br label %127
158: ; preds = %127
%159 = load double*, double** %21
%160 = load i32, i32* %41
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds double, double* %159, i64 %161
%163 = load double, double* %162
%164 = load double*, double** %33
%165 = load i32, i32* %41
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds double, double* %164, i64 %166
%168 = load double, double* %167
%169 = fmul double %163, %168
%170 = load double*, double** %29
%171 = load i32, i32* %41
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %170, i64 %172
store double %169, double* %173
br label %174
174: ; preds = %158
%175 = load i32, i32* %41
%176 = add nsw i32 %175, 1
store i32 %176, i32* %41
br label %122
177: ; preds = %122
%178 = load double*, double** %30
%179 = load double*, double** %29
%180 = load double*, double** %26
%181 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %14, i32* %15, double* %36, double* %178, i32* %14, double* %179, i32* %39, double* %35, double* %180, i32* %39)
%182 = load double*, double** %30
%183 = load double*, double** %32
%184 = call i32 @dsyrk_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %38, i32* %14, double* %36, double* %182, i32* %14, double* %35, double* %183, i32* %38)
%185 = load double*, double** %32
%186 = call i32 @dpotrf_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %38, double* %185, i32* %38, i32* %40)
%187 = load i32, i32* %40
%188 = icmp ne i32 %187, 0
br i1 %188, label %189, label %194
189: ; preds = %177
%190 = load i32, i32* @stderr
%191 = load i32, i32* %40
%192 = call i32 @fprintf(i32 %190, i8* getelementptr inbounds ([177 x i8], [177 x i8]* @.str.3, i64 0, i64 0), i32 %191)
%193 = call i32 @exit(i32 -1)
unreachable
194: ; preds = %177
%195 = load double*, double** %32
%196 = load double*, double** %26
%197 = call i32 @dtrsv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* %38, double* %195, i32* %38, double* %196, i32* %39)
%198 = load double*, double** %32
%199 = load double*, double** %26
%200 = call i32 @dtrsv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* %38, double* %198, i32* %38, double* %199, i32* %39)
%201 = load double*, double** %31
%202 = load double*, double** %17
%203 = load i32, i32* %14
%204 = sext i32 %203 to i64
%205 = mul i64 %204, 8
%206 = trunc i64 %205 to i32
%207 = call i32 @memcpy(double* %201, double* %202, i32 %206)
%208 = load double*, double** %16
%209 = load double*, double** %26
%210 = load double*, double** %31
%211 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* %14, i32* %38, double* %37, double* %208, i32* %14, double* %209, i32* %39, double* %36, double* %210, i32* %39)
%212 = load double*, double** %31
%213 = load i32, i32* %14
%214 = call double @variance(double* %212, i32 %213)
%215 = load double*, double** %25
store double %214, double* %215
%216 = load double*, double** %18
%217 = load double*, double** %31
%218 = load double*, double** %29
%219 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %14, i32* %14, double* %36, double* %216, i32* %14, double* %217, i32* %39, double* %35, double* %218, i32* %39)
%220 = load double*, double** %24
store double 0.000000e+00, double* %220
store i32 0, i32* %41
br label %221
221: ; preds = %251, %194
%222 = load i32, i32* %41
%223 = load i32, i32* %14
%224 = icmp slt i32 %222, %223
br i1 %224, label %225, label %254
225: ; preds = %221
%226 = load double*, double** %29
%227 = load i32, i32* %41
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds double, double* %226, i64 %228
%230 = load double, double* %229
%231 = load double*, double** %33
%232 = load i32, i32* %41
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds double, double* %231, i64 %233
%235 = load double, double* %234
%236 = fmul double %230, %235
%237 = load double*, double** %33
%238 = load i32, i32* %41
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds double, double* %237, i64 %239
%241 = load double, double* %240
%242 = fmul double %236, %241
%243 = load double*, double** %29
%244 = load i32, i32* %41
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds double, double* %243, i64 %245
%247 = load double, double* %246
%248 = load double*, double** %24
%249 = load double, double* %248
%250 = call double @llvm.fmuladd.f64(double %242, double %247, double %249)
store double %250, double* %248
br label %251
251: ; preds = %225
%252 = load i32, i32* %41
%253 = add nsw i32 %252, 1
store i32 %253, i32* %41
br label %221
254: ; preds = %221
%255 = load double*, double** %24
%256 = load double, double* %255
%257 = load double*, double** %25
%258 = load double, double* %257
%259 = fdiv double %256, %258
%260 = load double*, double** %24
store double %259, double* %260
%261 = load double, double* %34
%262 = load i32, i32* %14
%263 = load double*, double** %25
%264 = load double, double* %263
%265 = call i32 @log(double %264)
%266 = mul nsw i32 %262, %265
%267 = sitofp i32 %266 to double
%268 = fadd double %261, %267
%269 = load double*, double** %24
%270 = load double, double* %269
%271 = fadd double %268, %270
%272 = load double*, double** %24
store double %271, double* %272
%273 = load double*, double** %32
%274 = call i32 @free(double* %273)
%275 = load double*, double** %29
%276 = call i32 @free(double* %275)
%277 = load double*, double** %30
%278 = call i32 @free(double* %277)
%279 = load double*, double** %31
%280 = call i32 @free(double* %279)
%281 = load double*, double** %33
%282 = call i32 @free(double* %281)
%283 = load double*, double** %24
%284 = load double, double* %283
ret double %284
}

LLVM IR (-O2):
@.str = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/src/REML.c\00"
@.str.1 = [2 x i8] c"T\00"
@.str.2 = [2 x i8] c"L\00"
@stderr = global i32 0
@.str.3 = [177 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lucasb-eyer/OmicABEL/refs/heads/master/src/REML.c: [ERROR] inv(V) y failed - info: %d\0A\00"
@.str.4 = [2 x i8] c"N\00"
define double @polygenic_REML_logLik_eig(i32 %0, i32 %1, double* %2, double* %3, double* %4, double* nocapture %5, double* nocapture %6, double* nocapture %7, double %8, double %9, double* nocapture %10, double* nocapture %11, double* %12) {
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 %0, i32* %14
store i32 %1, i32* %15
%22 = bitcast double* %16 to i8*
store double 0.000000e+00, double* %16
%23 = bitcast double* %17 to i8*
store double 1.000000e+00, double* %17
%24 = bitcast double* %18 to i8*
store double -1.000000e+00, double* %18
%25 = bitcast i32* %19 to i8*
store i32 %1, i32* %19
%26 = bitcast i32* %20 to i8*
store i32 1, i32* %20
%27 = bitcast i32* %21 to i8*
%28 = shl i32 %1, 3
%29 = mul i32 %28, %1
%30 = tail call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 139, i32 %29)
%31 = inttoptr i64 %30 to double*
%32 = shl i32 %0, 3
%33 = tail call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 140, i32 %32)
%34 = inttoptr i64 %33 to double*
%35 = mul i32 %32, %1
%36 = tail call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 141, i32 %35)
%37 = inttoptr i64 %36 to double*
%38 = tail call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 142, i32 %32)
%39 = inttoptr i64 %38 to double*
%40 = tail call i64 @fgls_malloc_impl(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0), i32 143, i32 %32)
%41 = inttoptr i64 %40 to double*
%42 = fsub double 1.000000e+00, %9
%43 = icmp sgt i32 %0, 0
br i1 %43, label %44, label %115
44: ; preds = %13
%45 = zext i32 %0 to i64
br label %56
46: ; preds = %56
br i1 %43, label %47, label %115
47: ; preds = %46
%48 = icmp sgt i32 %1, 0
%49 = zext i32 %0 to i64
%50 = zext i32 %0 to i64
%51 = zext i32 %1 to i64
%52 = and i64 %51, 1
%53 = icmp eq i32 %1, 1
%54 = and i64 %51, 4294967294
%55 = icmp eq i64 %52, 0
br label %71
56: ; preds = %44, %56
%57 = phi i64 [ 0, %44 ], [ %69, %56 ]
%58 = phi double [ 0.000000e+00, %44 ], [ %65, %56 ]
%59 = getelementptr inbounds double, double* %5, i64 %57
%60 = load double, double* %59
%61 = tail call double @llvm.fmuladd.f64(double %9, double %60, double %42)
%62 = getelementptr inbounds double, double* %39, i64 %57
store double %61, double* %62
%63 = tail call i32 @log(double %61)
%64 = sitofp i32 %63 to double
%65 = fadd double %58, %64
%66 = load double, double* %62
%67 = fdiv double 1.000000e+00, %66
%68 = tail call double @sqrt(double %67)
store double %68, double* %62
%69 = add nuw nsw i64 %57, 1
%70 = icmp eq i64 %69, %45
br i1 %70, label %46, label %56
71: ; preds = %47, %106
%72 = phi i64 [ 0, %47 ], [ %113, %106 ]
br i1 %48, label %73, label %106
73: ; preds = %71
%74 = getelementptr inbounds double, double* %39, i64 %72
br i1 %53, label %96, label %75
75: ; preds = %73, %75
%76 = phi i64 [ %93, %75 ], [ 0, %73 ]
%77 = phi i64 [ %94, %75 ], [ 0, %73 ]
%78 = mul nsw i64 %76, %49
%79 = add nuw nsw i64 %78, %72
%80 = getelementptr inbounds double, double* %6, i64 %79
%81 = load double, double* %80
%82 = load double, double* %74
%83 = fmul double %81, %82
%84 = getelementptr inbounds double, double* %37, i64 %79
store double %83, double* %84
%85 = or i64 %76, 1
%86 = mul nsw i64 %85, %49
%87 = add nuw nsw i64 %86, %72
%88 = getelementptr inbounds double, double* %6, i64 %87
%89 = load double, double* %88
%90 = load double, double* %74
%91 = fmul double %89, %90
%92 = getelementptr inbounds double, double* %37, i64 %87
store double %91, double* %92
%93 = add nuw nsw i64 %76, 2
%94 = add i64 %77, 2
%95 = icmp eq i64 %94, %54
br i1 %95, label %96, label %75
96: ; preds = %75, %73
%97 = phi i64 [ 0, %73 ], [ %93, %75 ]
br i1 %55, label %106, label %98
98: ; preds = %96
%99 = mul nsw i64 %97, %49
%100 = add nuw nsw i64 %99, %72
%101 = getelementptr inbounds double, double* %6, i64 %100
%102 = load double, double* %101
%103 = load double, double* %74
%104 = fmul double %102, %103
%105 = getelementptr inbounds double, double* %37, i64 %100
store double %104, double* %105
br label %106
106: ; preds = %98, %96, %71
%107 = getelementptr inbounds double, double* %7, i64 %72
%108 = load double, double* %107
%109 = getelementptr inbounds double, double* %39, i64 %72
%110 = load double, double* %109
%111 = fmul double %108, %110
%112 = getelementptr inbounds double, double* %34, i64 %72
store double %111, double* %112
%113 = add nuw nsw i64 %72, 1
%114 = icmp eq i64 %113, %50
br i1 %114, label %115, label %71
115: ; preds = %106, %13, %46
%116 = phi double [ %65, %46 ], [ 0.000000e+00, %13 ], [ %65, %106 ]
%117 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %14, i32* %15, double* %17, double* %37, i32* %14, double* %34, i32* %20, double* %16, double* %12, i32* %20)
%118 = call i32 @dsyrk_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %19, i32* %14, double* %17, double* %37, i32* %14, double* %16, double* %31, i32* %19)
%119 = call i32 @dpotrf_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32* %19, double* %31, i32* %19, i32* %21)
%120 = load i32, i32* %21
%121 = icmp eq i32 %120, 0
br i1 %121, label %126, label %122
122: ; preds = %115
%123 = load i32, i32* @stderr
%124 = call i32 @fprintf(i32 %123, i8* getelementptr inbounds ([177 x i8], [177 x i8]* @.str.3, i64 0, i64 0), i32 %120)
%125 = call i32 @exit(i32 -1)
unreachable
126: ; preds = %115
%127 = call i32 @dtrsv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* %19, double* %31, i32* %19, double* %12, i32* %20)
%128 = call i32 @dtrsv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* %19, double* %31, i32* %19, double* %12, i32* %20)
%129 = load i32, i32* %14
%130 = shl i32 %129, 3
%131 = call i32 @memcpy(double* %41, double* %3, i32 %130)
%132 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i32* %14, i32* %19, double* %18, double* %2, i32* %14, double* %12, i32* %20, double* %17, double* %41, i32* %20)
%133 = load i32, i32* %14
%134 = call double @variance(double* %41, i32 %133)
store double %134, double* %11
%135 = call i32 @dgemv_(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32* %14, i32* %14, double* %17, double* %4, i32* %14, double* %41, i32* %20, double* %16, double* %34, i32* %20)
store double 0.000000e+00, double* %10
%136 = load i32, i32* %14
%137 = icmp sgt i32 %136, 0
br i1 %137, label %138, label %179
138: ; preds = %126
%139 = zext i32 %136 to i64
%140 = and i64 %139, 1
%141 = icmp eq i32 %136, 1
br i1 %141, label %166, label %142
142: ; preds = %138
%143 = and i64 %139, 4294967294
br label %144
144: ; preds = %144, %142
%145 = phi double [ 0.000000e+00, %142 ], [ %162, %144 ]
%146 = phi i64 [ 0, %142 ], [ %163, %144 ]
%147 = phi i64 [ 0, %142 ], [ %164, %144 ]
%148 = getelementptr inbounds double, double* %34, i64 %146
%149 = load double, double* %148
%150 = getelementptr inbounds double, double* %39, i64 %146
%151 = load double, double* %150
%152 = fmul double %149, %151
%153 = fmul double %151, %152
%154 = call double @llvm.fmuladd.f64(double %153, double %149, double %145)
store double %154, double* %10
%155 = or i64 %146, 1
%156 = getelementptr inbounds double, double* %34, i64 %155
%157 = load double, double* %156
%158 = getelementptr inbounds double, double* %39, i64 %155
%159 = load double, double* %158
%160 = fmul double %157, %159
%161 = fmul double %159, %160
%162 = call double @llvm.fmuladd.f64(double %161, double %157, double %154)
store double %162, double* %10
%163 = add nuw nsw i64 %146, 2
%164 = add i64 %147, 2
%165 = icmp eq i64 %164, %143
br i1 %165, label %166, label %144
166: ; preds = %144, %138
%167 = phi double [ undef, %138 ], [ %162, %144 ]
%168 = phi double [ 0.000000e+00, %138 ], [ %162, %144 ]
%169 = phi i64 [ 0, %138 ], [ %163, %144 ]
%170 = icmp eq i64 %140, 0
br i1 %170, label %179, label %171
171: ; preds = %166
%172 = getelementptr inbounds double, double* %34, i64 %169
%173 = load double, double* %172
%174 = getelementptr inbounds double, double* %39, i64 %169
%175 = load double, double* %174
%176 = fmul double %173, %175
%177 = fmul double %175, %176
%178 = call double @llvm.fmuladd.f64(double %177, double %173, double %168)
store double %178, double* %10
br label %179
179: ; preds = %171, %166, %126
%180 = phi double [ 0.000000e+00, %126 ], [ %167, %166 ], [ %178, %171 ]
%181 = load double, double* %11
%182 = fdiv double %180, %181
store double %182, double* %10
%183 = load double, double* %11
%184 = call i32 @log(double %183)
%185 = mul nsw i32 %184, %136
%186 = sitofp i32 %185 to double
%187 = fadd double %116, %186
%188 = load double, double* %10
%189 = fadd double %188, %187
store double %189, double* %10
%190 = call i32 @free(double* %31)
%191 = call i32 @free(double* %34)
%192 = call i32 @free(double* %37)
%193 = call i32 @free(double* %41)
%194 = call i32 @free(double* %39)
%195 = load double, double* %10
ret double %195
}