double **choleskyDecomposition(double **matrix, int n) {
  int i, j, k, info, *ipvt;
  double *a, *work, **result;
  a = (double *)Malloc(n * n * sizeof(double));
  work = (double *)Malloc(n * sizeof(double));
  ipvt = (int *)Malloc(n * sizeof(int));
  k = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      a[k] = matrix[i][j];
      k++;
    }
    ipvt[i] = 0;
  }
  info = linpackDCHDC(a, n, n, work, ipvt);
  result = matrixNew(n, n);
  if (info != n) {
    k = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        result[i][j] = i != j ? 0.0 : sqrt(matrix[i][j]);
        k++;
      }
    }
  } else {
    k = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        result[i][j] = i < j ? 0.0 : a[k];
        k++;
      }
    }
  }
  free(ipvt);
  free(work);
  free(a);
  return (result);
}


x86 assembly (clang, -O0):
<choleskyDecomposition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
movslq %eax,%rdi
shl    $0x3,%rdi
mov    $0x0,%al
call   1040 <Malloc@plt>
cltq
mov    %rax,-0x30(%rbp)
movslq -0xc(%rbp),%rdi
shl    $0x3,%rdi
mov    $0x0,%al
call   1040 <Malloc@plt>
cltq
mov    %rax,-0x38(%rbp)
movslq -0xc(%rbp),%rdi
shl    $0x2,%rdi
mov    $0x0,%al
call   1040 <Malloc@plt>
cltq
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1227 <choleskyDecomposition+0xd7>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    120a <choleskyDecomposition+0xba>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c5 <choleskyDecomposition+0x75>
mov    -0x28(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11b2 <choleskyDecomposition+0x62>
mov    -0x30(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x38(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    $0x0,%al
call   1050 <linpackDCHDC@plt>
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x0,%al
call   1070 <matrixNew@plt>
cltq
mov    %rax,-0x40(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1310 <choleskyDecomposition+0x1c0>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    130b <choleskyDecomposition+0x1bb>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12f8 <choleskyDecomposition+0x1a8>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     12a8 <choleskyDecomposition+0x158>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    12c7 <choleskyDecomposition+0x177>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1283 <choleskyDecomposition+0x133>
jmp    12fd <choleskyDecomposition+0x1ad>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1270 <choleskyDecomposition+0x120>
jmp    13b1 <choleskyDecomposition+0x261>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13ac <choleskyDecomposition+0x25c>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1399 <choleskyDecomposition+0x249>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1356 <choleskyDecomposition+0x206>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1368 <choleskyDecomposition+0x218>
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1331 <choleskyDecomposition+0x1e1>
jmp    139e <choleskyDecomposition+0x24e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    131e <choleskyDecomposition+0x1ce>
jmp    13b1 <choleskyDecomposition+0x261>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<choleskyDecomposition>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %esi,%ebp
mov    %rdi,0x18(%rsp)
mov    %esi,%edi
imul   %edi,%edi
shl    $0x3,%rdi
xor    %eax,%eax
call   1040 <Malloc@plt>
movslq %eax,%rbx
mov    %ebp,0xc(%rsp)
movslq %ebp,%rbp
lea    0x0(,%rbp,8),%rdi
xor    %eax,%eax
call   1040 <Malloc@plt>
cltq
mov    %rax,0x20(%rsp)
lea    0x0(,%rbp,4),%rdi
xor    %eax,%eax
call   1040 <Malloc@plt>
movslq %eax,%r8
test   %ebp,%ebp
mov    %r8,0x28(%rsp)
jle    13d3 <choleskyDecomposition+0x283>
mov    0xc(%rsp),%eax
lea    (%rbx,%rax,8),%r15
mov    %eax,%r13d
and    $0xfffffffc,%r13d
lea    -0x4(%r13),%rcx
mov    %rcx,0x10(%rsp)
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %ecx,%r14d
and    $0x3,%r14d
and    $0xfffffffffffffffc,%rcx
mov    %rcx,0x38(%rsp)
mov    %eax,%r11d
and    $0x3,%r11d
lea    0x70(%rbx),%rcx
mov    %rcx,0x30(%rsp)
lea    0x10(%rbx),%rcx
mov    %rcx,0x40(%rsp)
mov    %r14,%rdi
shl    $0x5,%rdi
lea    0x18(%rbx),%r12
xor    %r9d,%r9d
xor    %r10d,%r10d
jmp    1225 <choleskyDecomposition+0xd5>
movl   $0x0,(%r8,%r9,4)
add    $0x1,%r9
cmp    %rax,%r9
je     13d3 <choleskyDecomposition+0x283>
mov    0x18(%rsp),%rcx
mov    (%rcx,%r9,8),%rbp
movslq %r10d,%r10
cmpl   $0x4,0xc(%rsp)
jb     125d <choleskyDecomposition+0x10d>
lea    (%rbx,%r10,8),%rcx
lea    0x0(,%rax,8),%rdx
add    %rbp,%rdx
cmp    %rdx,%rcx
jae    1300 <choleskyDecomposition+0x1b0>
lea    (%r15,%r10,8),%rcx
cmp    %rcx,%rbp
jae    1300 <choleskyDecomposition+0x1b0>
xor    %edx,%edx
mov    %rdx,%rsi
not    %rsi
add    %rax,%rsi
test   %r11,%r11
je     128a <choleskyDecomposition+0x13a>
mov    %r11,%rcx
movsd  0x0(%rbp,%rdx,8),%xmm0
movsd  %xmm0,(%rbx,%r10,8)
add    $0x1,%r10
add    $0x1,%rdx
add    $0xffffffffffffffff,%rcx
jne    1270 <choleskyDecomposition+0x120>
cmp    $0x3,%rsi
jb     1210 <choleskyDecomposition+0xc0>
lea    (%r12,%r10,8),%rcx
mov    %rax,%rsi
sub    %rdx,%rsi
lea    0x18(%rbp,%rdx,8),%rbp
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  -0x18(%rbp,%rdx,8),%xmm0
movsd  %xmm0,-0x18(%rcx,%rdx,8)
movsd  -0x10(%rbp,%rdx,8),%xmm0
movsd  %xmm0,-0x10(%rcx,%rdx,8)
movsd  -0x8(%rbp,%rdx,8),%xmm0
movsd  %xmm0,-0x8(%rcx,%rdx,8)
movsd  0x0(%rbp,%rdx,8),%xmm0
movsd  %xmm0,(%rcx,%rdx,8)
add    $0x4,%rdx
cmp    %rdx,%rsi
jne    12b0 <choleskyDecomposition+0x160>
add    %rdx,%r10
mov    0x28(%rsp),%r8
jmp    1210 <choleskyDecomposition+0xc0>
cs nopw 0x0(%rax,%rax,1)
nop
cmpq   $0xc,0x10(%rsp)
jae    130c <choleskyDecomposition+0x1bc>
xor    %edx,%edx
jmp    137d <choleskyDecomposition+0x22d>
mov    0x30(%rsp),%rcx
lea    (%rcx,%r10,8),%rsi
mov    0x38(%rsp),%rcx
xor    %edx,%edx
nopl   0x0(%rax)
movups 0x0(%rbp,%rdx,8),%xmm0
movups 0x10(%rbp,%rdx,8),%xmm1
movups %xmm0,-0x70(%rsi,%rdx,8)
movups %xmm1,-0x60(%rsi,%rdx,8)
movups 0x20(%rbp,%rdx,8),%xmm0
movups 0x30(%rbp,%rdx,8),%xmm1
movups %xmm0,-0x50(%rsi,%rdx,8)
movups %xmm1,-0x40(%rsi,%rdx,8)
movups 0x40(%rbp,%rdx,8),%xmm0
movups 0x50(%rbp,%rdx,8),%xmm1
movups %xmm0,-0x30(%rsi,%rdx,8)
movups %xmm1,-0x20(%rsi,%rdx,8)
movupd 0x60(%rbp,%rdx,8),%xmm0
movupd 0x70(%rbp,%rdx,8),%xmm1
movupd %xmm0,-0x10(%rsi,%rdx,8)
movupd %xmm1,(%rsi,%rdx,8)
add    $0x10,%rdx
add    $0xfffffffffffffffc,%rcx
jne    1320 <choleskyDecomposition+0x1d0>
test   %r14,%r14
je     13bf <choleskyDecomposition+0x26f>
lea    0x10(,%rdx,8),%rcx
add    %rbp,%rcx
add    %r10,%rdx
mov    0x40(%rsp),%rsi
lea    (%rsi,%rdx,8),%rdx
xor    %esi,%esi
nopl   0x0(%rax,%rax,1)
movupd -0x10(%rcx,%rsi,1),%xmm0
movupd (%rcx,%rsi,1),%xmm1
movupd %xmm0,-0x10(%rdx,%rsi,1)
movupd %xmm1,(%rdx,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%rdi
jne    13a0 <choleskyDecomposition+0x250>
add    %r13,%r10
mov    %r13,%rdx
cmp    %rax,%r13
je     1210 <choleskyDecomposition+0xc0>
jmp    125f <choleskyDecomposition+0x10f>
mov    %rbx,%rdi
mov    0xc(%rsp),%r15d
mov    %r15d,%esi
mov    %r15d,%edx
mov    0x20(%rsp),%rcx
xor    %eax,%eax
call   1050 <linpackDCHDC@plt>
mov    %eax,%r14d
mov    %r15d,%edi
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <matrixNew@plt>
movslq %eax,%rbp
cmp    %r15d,%r14d
jne    14d1 <choleskyDecomposition+0x381>
test   %r15d,%r15d
jle    1625 <choleskyDecomposition+0x4d5>
mov    %r15d,%r9d
mov    %r9d,%ecx
and    $0xfffffffe,%ecx
lea    0x8(%rbx),%r8
xor    %esi,%esi
xor    %r10d,%r10d
jmp    1446 <choleskyDecomposition+0x2f6>
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,(%rdx,%rax,8)
add    $0x1,%r10
add    $0x1,%rsi
cmp    %r9,%rsi
je     1625 <choleskyDecomposition+0x4d5>
mov    0x0(%rbp,%rsi,8),%rdx
movslq %r10d,%r10
cmp    $0x1,%r15d
jne    1460 <choleskyDecomposition+0x310>
xor    %eax,%eax
test   $0x1,%r9b
je     1439 <choleskyDecomposition+0x2e9>
jmp    14b9 <choleskyDecomposition+0x369>
xchg   %ax,%ax
lea    (%r8,%r10,8),%rdi
xor    %eax,%eax
jmp    147f <choleskyDecomposition+0x32f>
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rdx,%rax,8)
add    $0x2,%rax
cmp    %rax,%rcx
je     14b0 <choleskyDecomposition+0x360>
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
cmp    %rax,%rsi
jb     1492 <choleskyDecomposition+0x342>
movsd  -0x8(%rdi,%rax,8),%xmm1
movsd  %xmm1,(%rdx,%rax,8)
cmp    %rax,%rsi
jbe    1470 <choleskyDecomposition+0x320>
movsd  (%rdi,%rax,8),%xmm0
jmp    1470 <choleskyDecomposition+0x320>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    %rax,%r10
test   $0x1,%r9b
je     1439 <choleskyDecomposition+0x2e9>
xorpd  %xmm0,%xmm0
cmp    %rax,%rsi
jb     1430 <choleskyDecomposition+0x2e0>
movsd  (%rbx,%r10,8),%xmm0
jmp    1430 <choleskyDecomposition+0x2e0>
test   %r15d,%r15d
jle    1625 <choleskyDecomposition+0x4d5>
mov    %r15d,%eax
mov    %eax,%r14d
and    $0xfffffffe,%r14d
xor    %r12d,%r12d
xorpd  %xmm1,%xmm1
mov    %rax,0x10(%rsp)
jmp    1518 <choleskyDecomposition+0x3c8>
call   1060 <sqrt@plt>
xorpd  %xmm1,%xmm1
mov    0x0(%rbp,%r12,8),%rax
movsd  %xmm0,(%rax,%r13,8)
mov    0x10(%rsp),%rax
add    $0x1,%r12
cmp    %rax,%r12
je     1625 <choleskyDecomposition+0x4d5>
cmp    $0x1,%r15d
jne    1530 <choleskyDecomposition+0x3e0>
xor    %r13d,%r13d
test   $0x1,%al
je     150b <choleskyDecomposition+0x3bb>
jmp    15f6 <choleskyDecomposition+0x4a6>
nopw   0x0(%rax,%rax,1)
xor    %r15d,%r15d
jmp    1562 <choleskyDecomposition+0x412>
cs nopw 0x0(%rax,%rax,1)
nop
call   1060 <sqrt@plt>
xorpd  %xmm1,%xmm1
movapd %xmm0,%xmm2
mov    0x0(%rbp,%r12,8),%rax
movsd  %xmm2,0x8(%rax,%r13,8)
add    $0x1,%r15
cmp    %r14,%r15
je     15e0 <choleskyDecomposition+0x490>
mov    %r15,%r13
xorpd  %xmm2,%xmm2
xorpd  %xmm0,%xmm0
cmp    %r15,%r12
jne    159d <choleskyDecomposition+0x44d>
mov    0x18(%rsp),%rax
mov    (%rax,%r12,8),%rax
movsd  (%rax,%r12,8),%xmm0
ucomisd %xmm1,%xmm0
jb     1590 <choleskyDecomposition+0x440>
sqrtsd %xmm0,%xmm0
jmp    159d <choleskyDecomposition+0x44d>
nopl   (%rax)
call   1060 <sqrt@plt>
xorpd  %xmm2,%xmm2
xorpd  %xmm1,%xmm1
mov    0x0(%rbp,%r12,8),%rax
movsd  %xmm0,(%rax,%r13,8)
lea    0x1(%r13),%r15
cmp    %r15,%r12
jne    154d <choleskyDecomposition+0x3fd>
mov    0x18(%rsp),%rax
mov    (%rax,%r12,8),%rax
movsd  (%rax,%r12,8),%xmm0
ucomisd %xmm1,%xmm0
jb     1540 <choleskyDecomposition+0x3f0>
xorps  %xmm2,%xmm2
sqrtsd %xmm0,%xmm2
jmp    154d <choleskyDecomposition+0x3fd>
cs nopw 0x0(%rax,%rax,1)
add    $0x2,%r13
mov    0xc(%rsp),%r15d
mov    0x10(%rsp),%rax
test   $0x1,%al
je     150b <choleskyDecomposition+0x3bb>
xorpd  %xmm0,%xmm0
cmp    %r13,%r12
jne    14fb <choleskyDecomposition+0x3ab>
mov    0x18(%rsp),%rax
mov    (%rax,%r12,8),%rax
movsd  (%rax,%r12,8),%xmm0
ucomisd %xmm1,%xmm0
jb     14f2 <choleskyDecomposition+0x3a2>
sqrtsd %xmm0,%xmm0
jmp    14fb <choleskyDecomposition+0x3ab>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double** @choleskyDecomposition(double** %0, i32 %1) {
%3 = alloca double**
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double**
store double** %0, double*** %3
store i32 %1, i32* %4
%13 = load i32, i32* %4
%14 = load i32, i32* %4
%15 = mul nsw i32 %13, %14
%16 = sext i32 %15 to i64
%17 = mul i64 %16, 8
%18 = call i32 (i64, ...) bitcast (i32 (...)* @Malloc to i32 (i64, ...)*)(i64 %17)
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to double*
store double* %20, double** %10
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = mul i64 %22, 8
%24 = call i32 (i64, ...) bitcast (i32 (...)* @Malloc to i32 (i64, ...)*)(i64 %23)
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to double*
store double* %26, double** %11
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = mul i64 %28, 4
%30 = call i32 (i64, ...) bitcast (i32 (...)* @Malloc to i32 (i64, ...)*)(i64 %29)
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i32*
store i32* %32, i32** %9
store i32 0, i32* %7
store i32 0, i32* %5
br label %33
33: ; preds = %66, %2
%34 = load i32, i32* %5
%35 = load i32, i32* %4
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %69
37: ; preds = %33
store i32 0, i32* %6
br label %38
38: ; preds = %58, %37
%39 = load i32, i32* %6
%40 = load i32, i32* %4
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %61
42: ; preds = %38
%43 = load double**, double*** %3
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double*, double** %43, i64 %45
%47 = load double*, double** %46
%48 = load i32, i32* %6
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = load double*, double** %10
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
store double %51, double* %55
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %58
58: ; preds = %42
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
store i32 %60, i32* %6
br label %38
61: ; preds = %38
%62 = load i32*, i32** %9
%63 = load i32, i32* %5
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i32, i32* %62, i64 %64
store i32 0, i32* %65
br label %66
66: ; preds = %61
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
store i32 %68, i32* %5
br label %33
69: ; preds = %33
%70 = load double*, double** %10
%71 = load i32, i32* %4
%72 = load i32, i32* %4
%73 = load double*, double** %11
%74 = load i32*, i32** %9
%75 = call i32 (double*, i32, i32, double*, i32*, ...) bitcast (i32 (...)* @linpackDCHDC to i32 (double*, i32, i32, double*, i32*, ...)*)(double* %70, i32 %71, i32 %72, double* %73, i32* %74)
store i32 %75, i32* %8
%76 = load i32, i32* %4
%77 = load i32, i32* %4
%78 = call i32 (i32, i32, ...) bitcast (i32 (...)* @matrixNew to i32 (i32, i32, ...)*)(i32 %76, i32 %77)
%79 = sext i32 %78 to i64
%80 = inttoptr i64 %79 to double**
store double** %80, double*** %12
%81 = load i32, i32* %8
%82 = load i32, i32* %4
%83 = icmp ne i32 %81, %82
br i1 %83, label %84, label %130
84: ; preds = %69
store i32 0, i32* %7
store i32 0, i32* %5
br label %85
85: ; preds = %126, %84
%86 = load i32, i32* %5
%87 = load i32, i32* %4
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %129
89: ; preds = %85
store i32 0, i32* %6
br label %90
90: ; preds = %122, %89
%91 = load i32, i32* %6
%92 = load i32, i32* %4
%93 = icmp slt i32 %91, %92
br i1 %93, label %94, label %125
94: ; preds = %90
%95 = load i32, i32* %5
%96 = load i32, i32* %6
%97 = icmp ne i32 %95, %96
br i1 %97, label %98, label %99
98: ; preds = %94
br label %110
99: ; preds = %94
%100 = load double**, double*** %3
%101 = load i32, i32* %5
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double*, double** %100, i64 %102
%104 = load double*, double** %103
%105 = load i32, i32* %6
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = call double @sqrt(double %108)
br label %110
110: ; preds = %99, %98
%111 = phi double [ 0.000000e+00, %98 ], [ %109, %99 ]
%112 = load double**, double*** %12
%113 = load i32, i32* %5
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double*, double** %112, i64 %114
%116 = load double*, double** %115
%117 = load i32, i32* %6
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %116, i64 %118
store double %111, double* %119
%120 = load i32, i32* %7
%121 = add nsw i32 %120, 1
store i32 %121, i32* %7
br label %122
122: ; preds = %110
%123 = load i32, i32* %6
%124 = add nsw i32 %123, 1
store i32 %124, i32* %6
br label %90
125: ; preds = %90
br label %126
126: ; preds = %125
%127 = load i32, i32* %5
%128 = add nsw i32 %127, 1
store i32 %128, i32* %5
br label %85
129: ; preds = %85
br label %171
130: ; preds = %69
store i32 0, i32* %7
store i32 0, i32* %5
br label %131
131: ; preds = %167, %130
%132 = load i32, i32* %5
%133 = load i32, i32* %4
%134 = icmp slt i32 %132, %133
br i1 %134, label %135, label %170
135: ; preds = %131
store i32 0, i32* %6
br label %136
136: ; preds = %163, %135
%137 = load i32, i32* %6
%138 = load i32, i32* %4
%139 = icmp slt i32 %137, %138
br i1 %139, label %140, label %166
140: ; preds = %136
%141 = load i32, i32* %5
%142 = load i32, i32* %6
%143 = icmp slt i32 %141, %142
br i1 %143, label %144, label %145
144: ; preds = %140
br label %151
145: ; preds = %140
%146 = load double*, double** %10
%147 = load i32, i32* %7
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %146, i64 %148
%150 = load double, double* %149
br label %151
151: ; preds = %145, %144
%152 = phi double [ 0.000000e+00, %144 ], [ %150, %145 ]
%153 = load double**, double*** %12
%154 = load i32, i32* %5
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds double*, double** %153, i64 %155
%157 = load double*, double** %156
%158 = load i32, i32* %6
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds double, double* %157, i64 %159
store double %152, double* %160
%161 = load i32, i32* %7
%162 = add nsw i32 %161, 1
store i32 %162, i32* %7
br label %163
163: ; preds = %151
%164 = load i32, i32* %6
%165 = add nsw i32 %164, 1
store i32 %165, i32* %6
br label %136
166: ; preds = %136
br label %167
167: ; preds = %166
%168 = load i32, i32* %5
%169 = add nsw i32 %168, 1
store i32 %169, i32* %5
br label %131
170: ; preds = %131
br label %171
171: ; preds = %170, %129
%172 = load i32*, i32** %9
%173 = bitcast i32* %172 to i8*
%174 = load double*, double** %11
%175 = bitcast double* %174 to i8*
%176 = load double*, double** %10
%177 = bitcast double* %176 to i8*
%178 = load double**, double*** %12
ret double** %178
}

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