#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*/ cholesky(double *, double *, int);
int /*<<< orphan*/ fatalx(char *, int, ...);
int /*<<< orphan*/ free(double *);
double gauss();
int /*<<< orphan*/ mulmat(double *, double *, double *, int, int, int);
double ranchi(int);
double sqrt(double);
int /*<<< orphan*/ transpose(double *, double *, int, int);
double vdot(double *, double *, int);
double raninvwis(double *wis, int t, int d, double *s) {
  double *b, *n, *v, *cf, *ww, y;
  int i, j;
  if (t < d) {
    fatalx("(raninvwis) d.o.f. too small %d %d\n", t, d);
  }
  if ((b = (double *)calloc((d * d), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", d * d);
  if ((n = (double *)calloc((d * d), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", d * d);
  if ((v = (double *)calloc((d), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", d);
  if ((cf = (double *)calloc((d * d), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", d * d);
  if ((ww = (double *)calloc((d * d), sizeof(double))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", d * d);
  for (i = 0; i < d; i++) {
    v[i] = ranchi(t - i);
    for (j = 0; j < i; j++) {
      n[i * d + j] = n[j * d + i] = gauss();
    }
  }
  y = b[0] = v[0];
  for (j = 1; j < d; j++) {
    b[j * d + 0] = b[j] = sqrt(y) * n[j];
  }
  for (j = 1; j < d; j++) {
    b[j * d + j] = v[j];
    for (i = 0; i < j; i++) {
      y = n[i * d + j];
      b[j * d + j] += y * y;
      b[j * d + i] = b[i * d + j] =
          y * sqrt(v[i]) + vdot(n + i * d, n + j * d, i - 1);
    }
  }
  cholesky(cf, s, d);
  mulmat(ww, cf, b, d, d, d);
  transpose(cf, cf, d, d);
  mulmat(wis, ww, cf, d, d, d);
  free(b);
  free(n);
  free(v);
  free(cf);
  free(ww);
}


x86 assembly (clang, -O0):
<raninvwis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11d6 <raninvwis+0x36>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
mov    -0x18(%rbp),%edi
imul   -0x18(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    120a <raninvwis+0x6a>
mov    -0x18(%rbp),%esi
imul   -0x18(%rbp),%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
mov    -0x18(%rbp),%edi
imul   -0x18(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    123e <raninvwis+0x9e>
mov    -0x18(%rbp),%esi
imul   -0x18(%rbp),%esi
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
mov    -0x18(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    126a <raninvwis+0xca>
mov    -0x18(%rbp),%esi
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
mov    -0x18(%rbp),%edi
imul   -0x18(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    129e <raninvwis+0xfe>
mov    -0x18(%rbp),%esi
imul   -0x18(%rbp),%esi
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
mov    -0x18(%rbp),%edi
imul   -0x18(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    12d2 <raninvwis+0x132>
mov    -0x18(%rbp),%esi
imul   -0x18(%rbp),%esi
lea    0xd59(%rip),%rdi
mov    $0x0,%al
call   1040 <fatalx@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1364 <raninvwis+0x1c4>
mov    -0x14(%rbp),%edi
sub    -0x54(%rbp),%edi
call   10a0 <ranchi@plt>
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1351 <raninvwis+0x1b1>
mov    $0x0,%al
call   1050 <gauss@plt>
mov    -0x30(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1304 <raninvwis+0x164>
jmp    1356 <raninvwis+0x1b6>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    12d9 <raninvwis+0x139>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    13d4 <raninvwis+0x234>
movsd  -0x50(%rbp),%xmm0
call   10b0 <sqrt@plt>
mov    -0x30(%rbp),%rax
movslq -0x58(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1380 <raninvwis+0x1e0>
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    151b <raninvwis+0x37b>
mov    -0x38(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x58(%rbp),%eax
jge    1508 <raninvwis+0x368>
mov    -0x30(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mov    -0x28(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   10b0 <sqrt@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x54(%rbp),%eax
imul   -0x18(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rsi
mov    -0x58(%rbp),%eax
imul   -0x18(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x54(%rbp),%edx
sub    $0x1,%edx
call   1090 <vdot@plt>
movsd  -0x68(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x54(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x18(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1411 <raninvwis+0x271>
jmp    150d <raninvwis+0x36d>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    13db <raninvwis+0x23b>
mov    -0x40(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1060 <cholesky@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x18(%rbp),%r9d
call   10c0 <mulmat@plt>
mov    -0x40(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x18(%rbp),%ecx
call   1080 <transpose@plt>
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x18(%rbp),%r9d
call   10c0 <mulmat@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raninvwis>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rcx,%r14
mov    %edx,%r13d
mov    %rdi,%r15
mov    %esi,0x8(%rsp)
cmp    %edx,%esi
jge    11d4 <raninvwis+0x34>
lea    0xe42(%rip),%rdi
mov    0x8(%rsp),%esi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <fatalx@plt>
mov    %r13d,%r12d
imul   %r13d,%r12d
mov    %r12d,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,(%rsp)
test   %rax,%rax
jne    1202 <raninvwis+0x62>
lea    0xe34(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <fatalx@plt>
mov    %r12d,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1228 <raninvwis+0x88>
lea    0xe0e(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <fatalx@plt>
mov    %r13d,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,0x18(%rsp)
test   %rax,%rax
jne    1250 <raninvwis+0xb0>
lea    0xde6(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <fatalx@plt>
mov    %r12d,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1276 <raninvwis+0xd6>
lea    0xdc0(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <fatalx@plt>
mov    %r12d,%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,0x48(%rsp)
test   %rax,%rax
jne    129e <raninvwis+0xfe>
lea    0xd98(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <fatalx@plt>
test   %r13d,%r13d
mov    %rbp,0x30(%rsp)
mov    %r15,0x60(%rsp)
mov    %r14,0x58(%rsp)
mov    %rbx,0x50(%rsp)
jle    13a9 <raninvwis+0x209>
mov    %r13d,0x14(%rsp)
mov    %r13d,%ecx
lea    0x0(,%rcx,8),%r12
mov    %rbp,%r14
mov    %rbp,%r13
xor    %ebx,%ebx
mov    %rcx,0x38(%rsp)
jmp    12f5 <raninvwis+0x155>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    %r12,%r13
add    $0x8,%r14
mov    0x38(%rsp),%rcx
cmp    %rcx,%rbx
je     1341 <raninvwis+0x1a1>
mov    0x8(%rsp),%edi
sub    %ebx,%edi
call   10a0 <ranchi@plt>
mov    0x18(%rsp),%rax
movsd  %xmm0,(%rax,%rbx,8)
test   %rbx,%rbx
je     12e0 <raninvwis+0x140>
mov    %r14,%rbp
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1050 <gauss@plt>
movsd  %xmm0,0x0(%rbp)
movsd  %xmm0,0x0(%r13,%r15,8)
add    $0x1,%r15
add    %r12,%rbp
cmp    %r15,%rbx
jne    1320 <raninvwis+0x180>
jmp    12e0 <raninvwis+0x140>
mov    0x18(%rsp),%rax
movsd  (%rax),%xmm1
mov    (%rsp),%rdx
movsd  %xmm1,(%rdx)
mov    0x14(%rsp),%r13d
cmp    $0x2,%r13d
jl     1600 <raninvwis+0x460>
lea    -0x1(%rcx),%rax
mov    %rax,0x20(%rsp)
mov    $0x1,%ebx
cmp    $0x2,%r13d
jne    13bf <raninvwis+0x21f>
testb  $0x1,0x20(%rsp)
mov    0x14(%rsp),%r13d
mov    0x38(%rsp),%rbp
je     14b6 <raninvwis+0x316>
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
mov    0x30(%rsp),%r14
jb     1492 <raninvwis+0x2f2>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    149f <raninvwis+0x2ff>
mov    0x18(%rsp),%rax
movsd  (%rax),%xmm0
mov    (%rsp),%rdx
movsd  %xmm0,(%rdx)
jmp    1600 <raninvwis+0x460>
mov    0x38(%rsp),%r15
lea    (%rdx,%r15,8),%r13
shl    $0x4,%r15
mov    0x20(%rsp),%r12
and    $0xfffffffffffffffe,%r12
neg    %r12
mov    $0x1,%ebx
sqrtsd %xmm1,%xmm2
xorpd  %xmm3,%xmm3
mov    %r15,%rbp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm2,0x28(%rsp)
mov    0x30(%rsp),%r14
jmp    142e <raninvwis+0x28e>
nopl   0x0(%rax,%rax,1)
mulsd  0x8(%r14,%rbx,8),%xmm0
movsd  %xmm0,0x8(%rdx,%rbx,8)
movsd  %xmm0,(%rdx,%rbp,1)
add    %r15,%r13
add    %r15,%rbp
lea    (%r12,%rbx,1),%rax
add    $0x2,%rax
add    $0x2,%rbx
cmp    $0x1,%rax
je     1375 <raninvwis+0x1d5>
ucomisd %xmm3,%xmm1
movapd %xmm2,%xmm0
jae    1455 <raninvwis+0x2b5>
movapd %xmm1,%xmm0
call   10b0 <sqrt@plt>
xorpd  %xmm3,%xmm3
movsd  0x28(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
mov    (%rsp),%rdx
mulsd  (%r14,%rbx,8),%xmm0
movsd  %xmm0,(%rdx,%rbx,8)
movsd  %xmm0,0x0(%r13)
ucomisd %xmm3,%xmm1
movapd %xmm2,%xmm0
jae    1400 <raninvwis+0x260>
movapd %xmm1,%xmm0
call   10b0 <sqrt@plt>
xorpd  %xmm3,%xmm3
movsd  0x28(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
mov    (%rsp),%rdx
jmp    1400 <raninvwis+0x260>
movapd %xmm1,%xmm0
call   10b0 <sqrt@plt>
mov    (%rsp),%rdx
mulsd  (%r14,%rbx,8),%xmm0
movsd  %xmm0,(%rdx,%rbx,8)
mov    %rbp,%rax
imul   %rbx,%rax
movsd  %xmm0,(%rdx,%rax,8)
cmp    $0x2,%r13d
jl     1600 <raninvwis+0x460>
lea    (%rdx,%rbp,8),%rax
mov    %rax,0x20(%rsp)
lea    0x0(,%rbp,8),%r12
mov    $0x1,%esi
mov    $0x8,%r14d
xor    %eax,%eax
mov    %rax,0x40(%rsp)
jmp    151f <raninvwis+0x37f>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x68(%rsp),%rsi
add    $0x1,%rsi
add    %r12,0x20(%rsp)
add    $0x8,%r14
addq   $0x1,0x40(%rsp)
mov    0x38(%rsp),%rbp
cmp    %rbp,%rsi
mov    0x14(%rsp),%r13d
mov    (%rsp),%rdx
je     1600 <raninvwis+0x460>
mov    0x18(%rsp),%rax
movsd  (%rax,%rsi,8),%xmm0
mov    %rsi,%rax
imul   %rbp,%rax
mov    %esi,%ecx
imul   %r13d,%ecx
movslq %ecx,%r15
mov    %rsi,0x68(%rsp)
add    %rsi,%r15
movsd  %xmm0,(%rdx,%r15,8)
mov    0x30(%rsp),%rbx
lea    (%rbx,%rax,8),%rax
mov    %rax,0x70(%rsp)
mov    %rdx,%r13
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%r14,1),%xmm2
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rdx,%r15,8)
mov    0x18(%rsp),%rax
movsd  (%rax,%rbp,8),%xmm0
ucomisd 0xa76(%rip),%xmm0
movsd  %xmm2,0x8(%rsp)
jb     15a0 <raninvwis+0x400>
sqrtsd %xmm0,%xmm0
jmp    15a5 <raninvwis+0x405>
nopl   0x0(%rax,%rax,1)
call   10b0 <sqrt@plt>
movsd  %xmm0,0x28(%rsp)
lea    -0x1(%rbp),%edx
mov    %rbx,%rdi
mov    0x70(%rsp),%rsi
call   1090 <vdot@plt>
movsd  0x8(%rsp),%xmm1
mulsd  0x28(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%r13,%r14,1)
mov    0x20(%rsp),%rax
movsd  %xmm1,(%rax,%rbp,8)
cmp    %rbp,0x40(%rsp)
je     14f0 <raninvwis+0x350>
mov    (%rsp),%rdx
movsd  (%rdx,%r15,8),%xmm0
add    %r12,%rbx
add    %r12,%r13
add    $0x1,%rbp
jmp    1560 <raninvwis+0x3c0>
mov    %rdx,%r14
mov    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    0x58(%rsp),%rsi
mov    %r13d,%edx
call   1060 <cholesky@plt>
mov    0x48(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r13d,%ecx
mov    %r13d,%r8d
mov    %r13d,%r9d
call   10c0 <mulmat@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r13d,%edx
mov    %r13d,%ecx
call   1080 <transpose@plt>
mov    0x60(%rsp),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r13d,%ecx
mov    %r13d,%r8d
mov    %r13d,%r9d
call   10c0 <mulmat@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

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

LLVM IR (-O2):
@.str = [36 x i8] c"(raninvwis) d.o.f. too small %d %d\0A\00"
@.str.1 = [41 x i8] c"Unable to allocate %d unit(s) for item \0A\00"
define double @raninvwis(double* %0, i32 %1, i32 %2, double* %3) {
%5 = icmp slt i32 %1, %2
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (i8*, i32, ...) @fatalx(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
br label %8
8: ; preds = %6, %4
%9 = mul nsw i32 %2, %2
%10 = tail call i64 @calloc(i32 %9, i32 8)
%11 = inttoptr i64 %10 to double*
%12 = icmp eq i64 %10, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 (i8*, i32, ...) @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %15
15: ; preds = %13, %8
%16 = tail call i64 @calloc(i32 %9, i32 8)
%17 = inttoptr i64 %16 to double*
%18 = icmp eq i64 %16, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = tail call i32 (i8*, i32, ...) @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %21
21: ; preds = %19, %15
%22 = tail call i64 @calloc(i32 %2, i32 8)
%23 = inttoptr i64 %22 to double*
%24 = icmp eq i64 %22, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = tail call i32 (i8*, i32, ...) @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %2)
br label %27
27: ; preds = %25, %21
%28 = tail call i64 @calloc(i32 %9, i32 8)
%29 = inttoptr i64 %28 to double*
%30 = icmp eq i64 %28, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = tail call i32 (i8*, i32, ...) @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %33
33: ; preds = %31, %27
%34 = tail call i64 @calloc(i32 %9, i32 8)
%35 = inttoptr i64 %34 to double*
%36 = icmp eq i64 %34, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = tail call i32 (i8*, i32, ...) @fatalx(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %39
39: ; preds = %37, %33
%40 = icmp sgt i32 %2, 0
br i1 %40, label %43, label %41
41: ; preds = %39
%42 = load double, double* %23
store double %42, double* %11
br label %151
43: ; preds = %39
%44 = zext i32 %2 to i64
%45 = zext i32 %2 to i64
br label %46
46: ; preds = %43, %65
%47 = phi i64 [ 0, %43 ], [ %66, %65 ]
%48 = trunc i64 %47 to i32
%49 = sub i32 %1, %48
%50 = tail call double @ranchi(i32 %49)
%51 = getelementptr inbounds double, double* %23, i64 %47
store double %50, double* %51
%52 = icmp eq i64 %47, 0
br i1 %52, label %65, label %53
53: ; preds = %46
%54 = mul nsw i64 %47, %44
br label %55
55: ; preds = %53, %55
%56 = phi i64 [ 0, %53 ], [ %63, %55 ]
%57 = tail call double (...) @gauss()
%58 = mul nsw i64 %56, %44
%59 = add nuw nsw i64 %58, %47
%60 = getelementptr inbounds double, double* %17, i64 %59
store double %57, double* %60
%61 = add nuw nsw i64 %56, %54
%62 = getelementptr inbounds double, double* %17, i64 %61
store double %57, double* %62
%63 = add nuw nsw i64 %56, 1
%64 = icmp eq i64 %63, %47
br i1 %64, label %65, label %55
65: ; preds = %55, %46
%66 = add nuw nsw i64 %47, 1
%67 = icmp eq i64 %66, %45
br i1 %67, label %68, label %46
68: ; preds = %65
%69 = load double, double* %23
store double %69, double* %11
%70 = icmp sgt i32 %2, 1
br i1 %70, label %71, label %151
71: ; preds = %68
%72 = zext i32 %2 to i64
%73 = add nsw i64 %45, -1
%74 = and i64 %73, 1
%75 = icmp eq i32 %2, 2
br i1 %75, label %78, label %76
76: ; preds = %71
%77 = and i64 %73, -2
br label %93
78: ; preds = %93, %71
%79 = phi i64 [ 1, %71 ], [ %111, %93 ]
%80 = icmp eq i64 %74, 0
br i1 %80, label %89, label %81
81: ; preds = %78
%82 = tail call double @sqrt(double %69)
%83 = getelementptr inbounds double, double* %17, i64 %79
%84 = load double, double* %83
%85 = fmul double %82, %84
%86 = getelementptr inbounds double, double* %11, i64 %79
store double %85, double* %86
%87 = mul nsw i64 %79, %72
%88 = getelementptr inbounds double, double* %11, i64 %87
store double %85, double* %88
br label %89
89: ; preds = %78, %81
br i1 %70, label %90, label %151
90: ; preds = %89
%91 = zext i32 %2 to i64
%92 = zext i32 %2 to i64
br label %114
93: ; preds = %93, %76
%94 = phi i64 [ 1, %76 ], [ %111, %93 ]
%95 = phi i64 [ 0, %76 ], [ %112, %93 ]
%96 = tail call double @sqrt(double %69)
%97 = getelementptr inbounds double, double* %17, i64 %94
%98 = load double, double* %97
%99 = fmul double %96, %98
%100 = getelementptr inbounds double, double* %11, i64 %94
store double %99, double* %100
%101 = mul nsw i64 %94, %72
%102 = getelementptr inbounds double, double* %11, i64 %101
store double %99, double* %102
%103 = add nuw nsw i64 %94, 1
%104 = tail call double @sqrt(double %69)
%105 = getelementptr inbounds double, double* %17, i64 %103
%106 = load double, double* %105
%107 = fmul double %104, %106
%108 = getelementptr inbounds double, double* %11, i64 %103
store double %107, double* %108
%109 = mul nsw i64 %103, %72
%110 = getelementptr inbounds double, double* %11, i64 %109
store double %107, double* %110
%111 = add nuw nsw i64 %94, 2
%112 = add i64 %95, 2
%113 = icmp eq i64 %112, %77
br i1 %113, label %78, label %93
114: ; preds = %90, %148
%115 = phi i64 [ 1, %90 ], [ %149, %148 ]
%116 = trunc i64 %115 to i32
%117 = getelementptr inbounds double, double* %23, i64 %115
%118 = load double, double* %117
%119 = mul nsw i64 %115, %91
%120 = mul nsw i32 %116, %2
%121 = sext i32 %120 to i64
%122 = add nsw i64 %115, %121
%123 = getelementptr inbounds double, double* %11, i64 %122
store double %118, double* %123
%124 = getelementptr inbounds double, double* %17, i64 %119
br label %125
125: ; preds = %146, %114
%126 = phi double [ %118, %114 ], [ %147, %146 ]
%127 = phi i64 [ 0, %114 ], [ %144, %146 ]
%128 = mul nsw i64 %127, %91
%129 = add nuw nsw i64 %128, %115
%130 = getelementptr inbounds double, double* %17, i64 %129
%131 = load double, double* %130
%132 = tail call double @llvm.fmuladd.f64(double %131, double %131, double %126)
store double %132, double* %123
%133 = getelementptr inbounds double, double* %23, i64 %127
%134 = load double, double* %133
%135 = tail call double @sqrt(double %134)
%136 = getelementptr inbounds double, double* %17, i64 %128
%137 = trunc i64 %127 to i32
%138 = add i32 %137, -1
%139 = tail call double @vdot(double* %136, double* %124, i32 %138)
%140 = tail call double @llvm.fmuladd.f64(double %131, double %135, double %139)
%141 = getelementptr inbounds double, double* %11, i64 %129
store double %140, double* %141
%142 = add nuw nsw i64 %127, %119
%143 = getelementptr inbounds double, double* %11, i64 %142
store double %140, double* %143
%144 = add nuw nsw i64 %127, 1
%145 = icmp eq i64 %144, %115
br i1 %145, label %148, label %146
146: ; preds = %125
%147 = load double, double* %123
br label %125
148: ; preds = %125
%149 = add nuw nsw i64 %115, 1
%150 = icmp eq i64 %149, %92
br i1 %150, label %151, label %114
151: ; preds = %148, %68, %41, %89
%152 = tail call i32 @cholesky(double* %29, double* %3, i32 %2)
%153 = tail call i32 @mulmat(double* %35, double* %29, double* %11, i32 %2, i32 %2, i32 %2)
%154 = tail call i32 @transpose(double* %29, double* %29, i32 %2, i32 %2)
%155 = tail call i32 @mulmat(double* %0, double* %35, double* %29, i32 %2, i32 %2, i32 %2)
%156 = tail call i32 @free(double* %11)
%157 = tail call i32 @free(double* %17)
%158 = tail call i32 @free(double* %23)
%159 = tail call i32 @free(double* %29)
%160 = tail call i32 @free(double* %35)
ret double undef
}