#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*/ chol_backward(double *, int, double *, double *, double *);
int /*<<< orphan*/ chol_forward(double *, int, double *, double *, double *);
int choldc(double *, int, double *);
int /*<<< orphan*/ cholsb(double *, int, double *, double *, double *);
int solve_reduced(int n, int m, double h_x[], double h_y[], double a[],
                  double x_x[], double x_y[], double c_x[], double c_y[],
                  double workspace[], int step) {
  int i, j, k;
  int ierr = 0;
  double *p_x;
  double *p_y;
  double *t_a;
  double *t_c;
  double *t_y;
  p_x = workspace;
  p_y = p_x + n;
  t_a = p_y + m;
  t_c = t_a + n * m;
  t_y = t_c + n;
  if (step == 1) {
    ierr = choldc(h_x, n, p_x);
    if (ierr)
      return ierr;
    for (i = 0; i < m; i++)
      chol_forward(h_x, n, p_x, a + i * n, t_a + i * n);
    for (i = 0; i < m; i++)
      for (j = i; j < m; j++)
        for (k = 0; k < n; k++)
          h_y[m * i + j] += t_a[n * j + k] * t_a[n * i + k];
    ierr = choldc(h_y, m, p_y);
    if (ierr)
      return ierr;
  }
  chol_forward(h_x, n, p_x, c_x, t_c);
  for (i = 0; i < m; i++) {
    t_y[i] = c_y[i];
    for (j = 0; j < n; j++)
      t_y[i] += t_a[i * n + j] * t_c[j];
  }
  cholsb(h_y, m, p_y, t_y, x_y);
  for (i = 0; i < n; i++) {
    t_c[i] = -t_c[i];
    for (j = 0; j < m; j++)
      t_c[i] += t_a[j * n + i] * x_y[j];
  }
  chol_backward(h_x, n, p_x, t_c, x_x);
  return ierr;
}


x86 assembly (clang, -O0):
<solve_reduced>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movl   $0x0,-0x40(%rbp)
mov    0x28(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
movslq -0x8(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
movslq -0x8(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
cmpl   $0x1,0x30(%rbp)
jne    1345 <solve_reduced+0x205>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x48(%rbp),%rdx
call   1030 <choldc@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
je     1204 <solve_reduced+0xc4>
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    14e6 <solve_reduced+0x3a6>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    125d <solve_reduced+0x11d>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x34(%rbp),%eax
imul   -0x8(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x58(%rbp),%r8
mov    -0x34(%rbp),%eax
imul   -0x8(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
call   1050 <chol_forward@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    120b <solve_reduced+0xcb>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1318 <solve_reduced+0x1d8>
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1305 <solve_reduced+0x1c5>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12f2 <solve_reduced+0x1b2>
mov    -0x58(%rbp),%rax
mov    -0x8(%rbp),%ecx
imul   -0x38(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
mov    -0x8(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1289 <solve_reduced+0x149>
jmp    12f7 <solve_reduced+0x1b7>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1276 <solve_reduced+0x136>
jmp    130a <solve_reduced+0x1ca>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1264 <solve_reduced+0x124>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x50(%rbp),%rdx
call   1030 <choldc@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
je     1340 <solve_reduced+0x200>
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    14e6 <solve_reduced+0x3a6>
jmp    1345 <solve_reduced+0x205>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    0x18(%rbp),%rcx
mov    -0x60(%rbp),%r8
call   1050 <chol_forward@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13fb <solve_reduced+0x2bb>
mov    0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x68(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13e8 <solve_reduced+0x2a8>
mov    -0x58(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x68(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1391 <solve_reduced+0x251>
jmp    13ed <solve_reduced+0x2ad>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1364 <solve_reduced+0x224>
mov    -0x20(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x50(%rbp),%rdx
mov    -0x68(%rbp),%rcx
mov    0x10(%rbp),%r8
call   1060 <cholsb@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    14c8 <solve_reduced+0x388>
mov    -0x60(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x60(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    14b5 <solve_reduced+0x375>
mov    -0x58(%rbp),%rax
mov    -0x38(%rbp),%ecx
imul   -0x8(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x60(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    145e <solve_reduced+0x31e>
jmp    14ba <solve_reduced+0x37a>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    141a <solve_reduced+0x2da>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1040 <chol_backward@plt>
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_reduced>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,%r15
mov    %rcx,%r13
mov    %rdx,%rbp
mov    %esi,%ebx
mov    0x98(%rsp),%rdx
movslq %edi,%rax
mov    %rax,0x8(%rsp)
lea    (%rdx,%rax,8),%r14
movslq %esi,%rax
mov    %rax,0x20(%rsp)
lea    (%r14,%rax,8),%rax
mov    %rax,0x18(%rsp)
cmpl   $0x1,0xa0(%rsp)
01
mov    %edi,0x4(%rsp)
mov    %rbp,0x38(%rsp)
jne    134f <solve_reduced+0x20f>
mov    %r8,%r12
mov    %rbp,%rdi
mov    0x4(%rsp),%esi
call   1030 <choldc@plt>
test   %eax,%eax
jne    15e7 <solve_reduced+0x4a7>
mov    %r15,0x30(%rsp)
mov    %r14,0x28(%rsp)
mov    %ebx,0x10(%rsp)
test   %ebx,%ebx
jle    131b <solve_reduced+0x1db>
mov    0x10(%rsp),%r15d
mov    0x8(%rsp),%rax
mov    %r12,%rbx
lea    0x0(,%rax,8),%r12
mov    %r15,%r14
mov    0x18(%rsp),%rbp
nop
mov    0x38(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    0x98(%rsp),%rdx
mov    %rbx,%rcx
mov    %rbp,%r8
call   1050 <chol_forward@plt>
add    %r12,%rbx
add    %r12,%rbp
add    $0xffffffffffffffff,%r14
jne    11e0 <solve_reduced+0xa0>
cmpl   $0x0,0x10(%rsp)
mov    0x4(%rsp),%edi
jle    131b <solve_reduced+0x1db>
mov    %edi,%r10d
mov    %r10d,%ecx
and    $0xfffffffe,%ecx
mov    0x8(%rsp),%rax
mov    0x20(%rsp),%rdx
add    %rdx,%rax
mov    0x98(%rsp),%rdx
lea    (%rdx,%rax,8),%rbp
add    $0x8,%rbp
xor    %r8d,%r8d
mov    0x18(%rsp),%r14
jmp    1260 <solve_reduced+0x120>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r8
add    %r12,%rbp
cmp    %r15,%r8
je     131b <solve_reduced+0x1db>
mov    %r8,%r9
imul   0x8(%rsp),%r9
mov    %r8,%r11
imul   0x20(%rsp),%r11
mov    %rbp,%rdx
mov    %r8,%rbx
jmp    128c <solve_reduced+0x14c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    %r12,%rdx
cmp    %r15,%rbx
je     1250 <solve_reduced+0x110>
test   %edi,%edi
jle    1280 <solve_reduced+0x140>
lea    (%rbx,%r11,1),%rax
movsd  0x0(%r13,%rax,8),%xmm0
xor    %esi,%esi
cmp    $0x1,%edi
je     12e6 <solve_reduced+0x1a6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  -0x8(%rdx,%rsi,8),%xmm1
mulsd  -0x8(%rbp,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%r13,%rax,8)
movsd  (%rdx,%rsi,8),%xmm0
mulsd  0x0(%rbp,%rsi,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x0(%r13,%rax,8)
add    $0x2,%rsi
cmp    %rsi,%rcx
jne    12b0 <solve_reduced+0x170>
test   $0x1,%r10b
je     1280 <solve_reduced+0x140>
mov    %rbx,%rdi
imul   0x8(%rsp),%rdi
add    %rsi,%rdi
movsd  (%r14,%rdi,8),%xmm1
mov    0x4(%rsp),%edi
add    %r9,%rsi
mulsd  (%r14,%rsi,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%r13,%rax,8)
jmp    1280 <solve_reduced+0x140>
mov    %r13,%rdi
mov    0x10(%rsp),%ebx
mov    %ebx,%esi
mov    0x28(%rsp),%r14
mov    %r14,%rdx
call   1030 <choldc@plt>
mov    0x4(%rsp),%edi
test   %eax,%eax
mov    0x38(%rsp),%rbp
mov    0x98(%rsp),%rdx
mov    0x30(%rsp),%r15
jne    15e7 <solve_reduced+0x4a7>
mov    %r14,0x28(%rsp)
mov    %r15,0x30(%rsp)
mov    0x88(%rsp),%rcx
mov    0x80(%rsp),%r15
mov    %ebx,%eax
imul   %edi,%eax
movslq %eax,%rsi
mov    0x18(%rsp),%rax
mov    %rsi,0x40(%rsp)
lea    (%rax,%rsi,8),%r14
mov    0x8(%rsp),%rax
lea    (%r14,%rax,8),%r12
mov    %edi,%esi
mov    %rbp,%rdi
mov    %esi,%ebp
mov    %r14,%r8
call   1050 <chol_forward@plt>
mov    %ebx,%r11d
mov    %ebp,%eax
mov    %rax,0x10(%rsp)
mov    %ebx,%r9d
test   %ebx,%ebx
jle    14a0 <solve_reduced+0x360>
mov    0x90(%rsp),%r8
mov    0x10(%rsp),%rcx
and    $0xfffffffe,%ecx
mov    0x8(%rsp),%rsi
mov    0x20(%rsp),%rax
add    %rsi,%rax
mov    0x98(%rsp),%rdi
lea    (%rdi,%rax,8),%rdx
add    $0x8,%rdx
lea    0x0(,%rsi,8),%r10
mov    0x40(%rsp),%rsi
add    %rax,%rsi
lea    (%rdi,%rsi,8),%rdi
add    $0x8,%rdi
xor    %ebx,%ebx
mov    0x18(%rsp),%rsi
jmp    1410 <solve_reduced+0x2d0>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    %r10,%rdx
cmp    %r11,%rbx
je     14a0 <solve_reduced+0x360>
movsd  (%r8,%rbx,8),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
cmpl   $0x0,0x4(%rsp)
jle    1400 <solve_reduced+0x2c0>
cmpl   $0x1,0x4(%rsp)
jne    1430 <solve_reduced+0x2f0>
xor    %ebp,%ebp
jmp    1473 <solve_reduced+0x333>
xchg   %ax,%ax
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  -0x8(%rdx,%rbp,8),%xmm1
mulsd  -0x8(%rdi,%rbp,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rbx,8)
movsd  (%rdx,%rbp,8),%xmm0
mulsd  (%rdi,%rbp,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x2,%rbp
cmp    %rbp,%rcx
jne    1440 <solve_reduced+0x300>
testb  $0x1,0x10(%rsp)
je     1400 <solve_reduced+0x2c0>
mov    %rbx,%rax
imul   0x8(%rsp),%rax
add    %rbp,%rax
movsd  (%rsi,%rax,8),%xmm1
mulsd  (%r14,%rbp,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rbx,8)
jmp    1400 <solve_reduced+0x2c0>
mov    %r13,%rdi
mov    %r9d,%esi
mov    0x28(%rsp),%rdx
mov    %r12,%rcx
mov    %r9d,%r12d
mov    %r15,%r8
mov    %r11,%rbx
call   1060 <cholsb@plt>
cmpl   $0x0,0x4(%rsp)
mov    0x98(%rsp),%rdx
mov    0x10(%rsp),%r11
jle    15cf <solve_reduced+0x48f>
mov    %rbx,%r10
mov    %r10d,%r8d
and    $0xfffffffe,%r8d
mov    0x8(%rsp),%rax
mov    %rax,%r9
shl    $0x4,%r9
mov    0x20(%rsp),%rsi
lea    (%r9,%rsi,8),%rcx
shl    $0x3,%rsi
lea    (%rsi,%rax,8),%rsi
xor    %edi,%edi
movapd 0xafb(%rip),%xmm0
jmp    1525 <solve_reduced+0x3e5>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rdi
add    $0x8,%rcx
add    $0x8,%rsi
cmp    %r11,%rdi
je     15cf <solve_reduced+0x48f>
movsd  (%r14,%rdi,8),%xmm1
xorpd  %xmm0,%xmm1
movlpd %xmm1,(%r14,%rdi,8)
test   %r12d,%r12d
jle    1510 <solve_reduced+0x3d0>
cmp    $0x1,%r12d
jne    1550 <solve_reduced+0x410>
xor    %eax,%eax
jmp    1599 <solve_reduced+0x459>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rdx,%rbp
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%rbp,%rsi,1),%xmm2
mulsd  (%r15,%rax,8),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%r14,%rdi,8)
movsd  0x0(%rbp,%rcx,1),%xmm1
mulsd  0x8(%r15,%rax,8),%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,(%r14,%rdi,8)
add    $0x2,%rax
add    %r9,%rbp
cmp    %rax,%r8
jne    1560 <solve_reduced+0x420>
test   $0x1,%r10b
je     1510 <solve_reduced+0x3d0>
mov    %rax,%rbx
imul   0x8(%rsp),%rbx
add    %rdi,%rbx
mov    0x18(%rsp),%rbp
movsd  0x0(%rbp,%rbx,8),%xmm2
mulsd  (%r15,%rax,8),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%r14,%rdi,8)
jmp    1510 <solve_reduced+0x3d0>
mov    0x38(%rsp),%rdi
mov    0x4(%rsp),%esi
mov    %r14,%rcx
mov    0x30(%rsp),%r8
call   1040 <chol_backward@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @solve_reduced(i32 %0, i32 %1, double* %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* nocapture %8, double* %9, i32 %10) {
%12 = sext i32 %0 to i64
%13 = getelementptr inbounds double, double* %9, i64 %12
%14 = sext i32 %1 to i64
%15 = getelementptr inbounds double, double* %13, i64 %14
%16 = mul nsw i32 %1, %0
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
%19 = getelementptr double, double* %18, i64 %12
%20 = icmp eq i32 %10, 1
br i1 %20, label %21, label %98
21: ; preds = %11
%22 = tail call i32 @choldc(double* %2, i32 %0, double* %9)
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %203
24: ; preds = %21
%25 = icmp sgt i32 %1, 0
br i1 %25, label %26, label %95
26: ; preds = %24
%27 = zext i32 %1 to i64
br label %37
28: ; preds = %37
br i1 %25, label %29, label %95
29: ; preds = %28
%30 = icmp sgt i32 %0, 0
%31 = zext i32 %1 to i64
%32 = zext i32 %0 to i64
%33 = and i64 %32, 1
%34 = icmp eq i32 %0, 1
%35 = and i64 %32, 4294967294
%36 = icmp eq i64 %33, 0
br label %45
37: ; preds = %26, %37
%38 = phi i64 [ 0, %26 ], [ %43, %37 ]
%39 = mul nsw i64 %38, %12
%40 = getelementptr inbounds double, double* %4, i64 %39
%41 = getelementptr inbounds double, double* %15, i64 %39
%42 = tail call i32 @chol_forward(double* %2, i32 %0, double* %9, double* %40, double* %41)
%43 = add nuw nsw i64 %38, 1
%44 = icmp eq i64 %43, %27
br i1 %44, label %28, label %37
45: ; preds = %92, %29
%46 = phi i64 [ 0, %29 ], [ %93, %92 ]
%47 = mul nsw i64 %46, %12
%48 = mul nsw i64 %46, %14
br label %49
49: ; preds = %45, %89
%50 = phi i64 [ %46, %45 ], [ %90, %89 ]
br i1 %30, label %51, label %89
51: ; preds = %49
%52 = mul nsw i64 %50, %12
%53 = add nsw i64 %50, %48
%54 = getelementptr inbounds double, double* %3, i64 %53
%55 = load double, double* %54
br i1 %34, label %78, label %56
56: ; preds = %51, %56
%57 = phi double [ %74, %56 ], [ %55, %51 ]
%58 = phi i64 [ %75, %56 ], [ 0, %51 ]
%59 = phi i64 [ %76, %56 ], [ 0, %51 ]
%60 = add nsw i64 %58, %52
%61 = getelementptr inbounds double, double* %15, i64 %60
%62 = load double, double* %61
%63 = add nsw i64 %58, %47
%64 = getelementptr inbounds double, double* %15, i64 %63
%65 = load double, double* %64
%66 = tail call double @llvm.fmuladd.f64(double %62, double %65, double %57)
store double %66, double* %54
%67 = or i64 %58, 1
%68 = add nsw i64 %67, %52
%69 = getelementptr inbounds double, double* %15, i64 %68
%70 = load double, double* %69
%71 = add nsw i64 %67, %47
%72 = getelementptr inbounds double, double* %15, i64 %71
%73 = load double, double* %72
%74 = tail call double @llvm.fmuladd.f64(double %70, double %73, double %66)
store double %74, double* %54
%75 = add nuw nsw i64 %58, 2
%76 = add i64 %59, 2
%77 = icmp eq i64 %76, %35
br i1 %77, label %78, label %56
78: ; preds = %56, %51
%79 = phi double [ %55, %51 ], [ %74, %56 ]
%80 = phi i64 [ 0, %51 ], [ %75, %56 ]
br i1 %36, label %89, label %81
81: ; preds = %78
%82 = add nsw i64 %80, %52
%83 = getelementptr inbounds double, double* %15, i64 %82
%84 = load double, double* %83
%85 = add nsw i64 %80, %47
%86 = getelementptr inbounds double, double* %15, i64 %85
%87 = load double, double* %86
%88 = tail call double @llvm.fmuladd.f64(double %84, double %87, double %79)
store double %88, double* %54
br label %89
89: ; preds = %81, %78, %49
%90 = add nuw nsw i64 %50, 1
%91 = icmp eq i64 %90, %31
br i1 %91, label %92, label %49
92: ; preds = %89
%93 = add nuw nsw i64 %46, 1
%94 = icmp eq i64 %93, %31
br i1 %94, label %95, label %45
95: ; preds = %92, %24, %28
%96 = tail call i32 @choldc(double* %3, i32 %1, double* %13)
%97 = icmp eq i32 %96, 0
br i1 %97, label %98, label %203
98: ; preds = %95, %11
%99 = tail call i32 @chol_forward(double* %2, i32 %0, double* %9, double* %7, double* %18)
%100 = icmp sgt i32 %1, 0
br i1 %100, label %101, label %149
101: ; preds = %98
%102 = icmp sgt i32 %0, 0
%103 = zext i32 %1 to i64
%104 = zext i32 %0 to i64
%105 = and i64 %104, 1
%106 = icmp eq i32 %0, 1
%107 = and i64 %104, 4294967294
%108 = icmp eq i64 %105, 0
br label %109
109: ; preds = %101, %146
%110 = phi i64 [ 0, %101 ], [ %147, %146 ]
%111 = getelementptr inbounds double, double* %8, i64 %110
%112 = load double, double* %111
%113 = getelementptr inbounds double, double* %19, i64 %110
store double %112, double* %113
br i1 %102, label %114, label %146
114: ; preds = %109
%115 = mul nsw i64 %110, %12
br i1 %106, label %136, label %116
116: ; preds = %114, %116
%117 = phi double [ %132, %116 ], [ %112, %114 ]
%118 = phi i64 [ %133, %116 ], [ 0, %114 ]
%119 = phi i64 [ %134, %116 ], [ 0, %114 ]
%120 = add nsw i64 %118, %115
%121 = getelementptr inbounds double, double* %15, i64 %120
%122 = load double, double* %121
%123 = getelementptr inbounds double, double* %18, i64 %118
%124 = load double, double* %123
%125 = tail call double @llvm.fmuladd.f64(double %122, double %124, double %117)
store double %125, double* %113
%126 = or i64 %118, 1
%127 = add nsw i64 %126, %115
%128 = getelementptr inbounds double, double* %15, i64 %127
%129 = load double, double* %128
%130 = getelementptr inbounds double, double* %18, i64 %126
%131 = load double, double* %130
%132 = tail call double @llvm.fmuladd.f64(double %129, double %131, double %125)
store double %132, double* %113
%133 = add nuw nsw i64 %118, 2
%134 = add i64 %119, 2
%135 = icmp eq i64 %134, %107
br i1 %135, label %136, label %116
136: ; preds = %116, %114
%137 = phi double [ %112, %114 ], [ %132, %116 ]
%138 = phi i64 [ 0, %114 ], [ %133, %116 ]
br i1 %108, label %146, label %139
139: ; preds = %136
%140 = add nsw i64 %138, %115
%141 = getelementptr inbounds double, double* %15, i64 %140
%142 = load double, double* %141
%143 = getelementptr inbounds double, double* %18, i64 %138
%144 = load double, double* %143
%145 = tail call double @llvm.fmuladd.f64(double %142, double %144, double %137)
store double %145, double* %113
br label %146
146: ; preds = %139, %136, %109
%147 = add nuw nsw i64 %110, 1
%148 = icmp eq i64 %147, %103
br i1 %148, label %149, label %109
149: ; preds = %146, %98
%150 = tail call i32 @cholsb(double* %3, i32 %1, double* %13, double* %19, double* %6)
%151 = icmp sgt i32 %0, 0
br i1 %151, label %152, label %201
152: ; preds = %149
%153 = zext i32 %0 to i64
%154 = zext i32 %1 to i64
%155 = and i64 %154, 1
%156 = icmp eq i32 %1, 1
%157 = and i64 %154, 4294967294
%158 = icmp eq i64 %155, 0
br label %159
159: ; preds = %152, %198
%160 = phi i64 [ 0, %152 ], [ %199, %198 ]
%161 = getelementptr inbounds double, double* %18, i64 %160
%162 = load double, double* %161
%163 = fneg double %162
store double %163, double* %161
br i1 %100, label %164, label %198
164: ; preds = %159
br i1 %156, label %187, label %165
165: ; preds = %164, %165
%166 = phi double [ %183, %165 ], [ %163, %164 ]
%167 = phi i64 [ %184, %165 ], [ 0, %164 ]
%168 = phi i64 [ %185, %165 ], [ 0, %164 ]
%169 = mul nsw i64 %167, %12
%170 = add nsw i64 %169, %160
%171 = getelementptr inbounds double, double* %15, i64 %170
%172 = load double, double* %171
%173 = getelementptr inbounds double, double* %6, i64 %167
%174 = load double, double* %173
%175 = tail call double @llvm.fmuladd.f64(double %172, double %174, double %166)
store double %175, double* %161
%176 = or i64 %167, 1
%177 = mul nsw i64 %176, %12
%178 = add nsw i64 %177, %160
%179 = getelementptr inbounds double, double* %15, i64 %178
%180 = load double, double* %179
%181 = getelementptr inbounds double, double* %6, i64 %176
%182 = load double, double* %181
%183 = tail call double @llvm.fmuladd.f64(double %180, double %182, double %175)
store double %183, double* %161
%184 = add nuw nsw i64 %167, 2
%185 = add i64 %168, 2
%186 = icmp eq i64 %185, %157
br i1 %186, label %187, label %165
187: ; preds = %165, %164
%188 = phi double [ %163, %164 ], [ %183, %165 ]
%189 = phi i64 [ 0, %164 ], [ %184, %165 ]
br i1 %158, label %198, label %190
190: ; preds = %187
%191 = mul nsw i64 %189, %12
%192 = add nsw i64 %191, %160
%193 = getelementptr inbounds double, double* %15, i64 %192
%194 = load double, double* %193
%195 = getelementptr inbounds double, double* %6, i64 %189
%196 = load double, double* %195
%197 = tail call double @llvm.fmuladd.f64(double %194, double %196, double %188)
store double %197, double* %161
br label %198
198: ; preds = %190, %187, %159
%199 = add nuw nsw i64 %160, 1
%200 = icmp eq i64 %199, %153
br i1 %200, label %201, label %159
201: ; preds = %198, %149
%202 = tail call i32 @chol_backward(double* %2, i32 %0, double* %9, double* %18, double* %5)
br label %203
203: ; preds = %95, %21, %201
%204 = phi i32 [ 0, %201 ], [ %22, %21 ], [ %96, %95 ]
ret i32 %204
}