#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*/ free(double *);
double log(double);
double *malloc(int);
double LevinsonTrenchZoharSolve(double *r, double *x, double *y, int N) {
  double *a, e, log_det, xi, lmba, a_temp;
  int n, j;
  a = malloc(N * sizeof(double));
  a[0] = 1.;
  e = r[0];
  x[0] = y[0] / r[0];
  log_det = log(e);
  for (n = 1; n < N; n++) {
    xi = 0;
    for (j = 0; j < n; j++) {
      xi -= (r[n - j] * a[j]);
    }
    xi /= e;
    a[n] = 0.;
    for (j = 0; j <= (n) >> 1; j++) {
      a_temp = a[j];
      a[j] += (xi * a[n - j]);
      if (j != (n - j))
        a[n - j] += (xi * a_temp);
    }
    e = e * (1. - (xi * xi));
    log_det += log(e);
    lmba = 0;
    for (j = 0; j < n; j++) {
      lmba += (r[n - j] * x[j]);
    }
    lmba = y[n] - lmba;
    x[n] = 0.;
    for (j = 0; j <= n; j++) {
      x[j] += (lmba / e) * a[n - j];
    }
  }
  free(a);
  return log_det;
}


x86 assembly (clang, -O0):
<LevinsonTrenchZoharSolve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsd  0xe9a(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
divsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
call   1050 <log@plt>
movsd  %xmm0,-0x38(%rbp)
movl   $0x1,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    142b <LevinsonTrenchZoharSolve+0x2fb>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    1222 <LevinsonTrenchZoharSolve+0xf2>
mov    -0x8(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x40(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    11c0 <LevinsonTrenchZoharSolve+0x90>
movsd  -0x30(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x54(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    -0x54(%rbp),%ecx
sar    $0x1,%ecx
cmp    %ecx,%eax
jg     12ed <LevinsonTrenchZoharSolve+0x1bd>
mov    -0x28(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x28(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    -0x58(%rbp),%ecx
cmp    %ecx,%eax
je     12da <LevinsonTrenchZoharSolve+0x1aa>
movsd  -0x40(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mov    -0x28(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    12df <LevinsonTrenchZoharSolve+0x1af>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    124c <LevinsonTrenchZoharSolve+0x11c>
movsd  -0x30(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xce1(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <log@plt>
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    139a <LevinsonTrenchZoharSolve+0x26a>
mov    -0x8(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    134f <LevinsonTrenchZoharSolve+0x21f>
mov    -0x18(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x54(%rbp),%eax
jg     1418 <LevinsonTrenchZoharSolve+0x2e8>
movsd  -0x48(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x54(%rbp),%ecx
sub    -0x58(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    13c8 <LevinsonTrenchZoharSolve+0x298>
jmp    141d <LevinsonTrenchZoharSolve+0x2ed>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11a5 <LevinsonTrenchZoharSolve+0x75>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x38(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LevinsonTrenchZoharSolve>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %ecx,%r13d
mov    %rdx,%rbp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x0(,%r13,8),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rbx)
movsd  (%r15),%xmm0
mov    %rbp,0x58(%rsp)
movsd  0x0(%rbp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
movsd  %xmm0,0x8(%rsp)
call   1050 <log@plt>
cmp    $0x2,%r13d
jl     14c8 <LevinsonTrenchZoharSolve+0x398>
mov    %r13d,%eax
mov    %rax,0x50(%rsp)
mov    %r15,0x40(%rsp)
lea    0x8(%r15),%rbp
mov    %rbx,%rax
add    $0x8,%rax
mov    %rax,0x48(%rsp)
lea    0x18(%r14),%rax
mov    %rax,0x38(%rsp)
lea    0x10(%r14),%rax
mov    %rax,0x30(%rsp)
mov    $0x2,%r15d
mov    $0x1,%r9d
xor    %r8d,%r8d
mov    %rbx,%r12
mov    %r14,0x18(%rsp)
movsd  0x8(%rsp),%xmm7
jmp    121d <LevinsonTrenchZoharSolve+0xed>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x1,%r9
add    $0x1,%r15
add    $0x1,%r8
add    $0x8,%rbp
add    $0x8,%r12
cmp    0x50(%rsp),%r9
je     14c8 <LevinsonTrenchZoharSolve+0x398>
mov    %r9,%rax
shr    %rax
test   %r8,%r8
movsd  %xmm0,0x10(%rsp)
je     1270 <LevinsonTrenchZoharSolve+0x140>
lea    (%rax,%rax,1),%rdx
neg    %rdx
xorpd  %xmm0,%xmm0
mov    0x48(%rsp),%rsi
xor    %ecx,%ecx
movsd  0x0(%rbp,%rcx,8),%xmm1
mulsd  -0x8(%rsi),%xmm1
movsd  -0x8(%rbp,%rcx,8),%xmm2
subsd  %xmm1,%xmm0
mulsd  (%rsi),%xmm2
subsd  %xmm2,%xmm0
add    $0xfffffffffffffffe,%rcx
add    $0x10,%rsi
cmp    %rcx,%rdx
jne    1240 <LevinsonTrenchZoharSolve+0x110>
neg    %rcx
jmp    1276 <LevinsonTrenchZoharSolve+0x146>
nop
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
mov    %r15,%rdi
and    $0xfffffffffffffffc,%rdi
mov    %r9d,%r13d
and    $0x3,%r13d
mov    %r9,%r14
and    $0xfffffffffffffffc,%r14
test   $0x1,%r9b
je     12aa <LevinsonTrenchZoharSolve+0x17a>
mov    %r9,%rdx
sub    %rcx,%rdx
mov    0x40(%rsp),%rsi
movsd  (%rsi,%rdx,8),%xmm1
mulsd  (%rbx,%rcx,8),%xmm1
subsd  %xmm1,%xmm0
mov    %r8,0x60(%rsp)
neg    %rdi
neg    %r14
add    $0x1,%rax
divsd  %xmm7,%xmm0
movq   $0x0,(%rbx,%r9,8)
mov    %r9,%rcx
xor    %edx,%edx
jmp    12dd <LevinsonTrenchZoharSolve+0x1ad>
nopl   0x0(%rax)
add    $0x1,%rdx
add    $0xffffffffffffffff,%rcx
cmp    %rdx,%rax
je     1310 <LevinsonTrenchZoharSolve+0x1e0>
movsd  (%rbx,%rdx,8),%xmm1
movsd  (%rbx,%rcx,8),%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rbx,%rdx,8)
mov    %ecx,%esi
cmp    %rsi,%rdx
je     12d0 <LevinsonTrenchZoharSolve+0x1a0>
mulsd  %xmm0,%xmm1
addsd  (%rbx,%rcx,8),%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
jmp    12d0 <LevinsonTrenchZoharSolve+0x1a0>
nopl   0x0(%rax,%rax,1)
mov    %rdi,0x20(%rsp)
mov    %r9,0x28(%rsp)
mulsd  %xmm0,%xmm0
movsd  0xcda(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm7
movsd  %xmm7,0x8(%rsp)
movapd %xmm7,%xmm0
call   1050 <log@plt>
mov    0x60(%rsp),%r8
xorpd  %xmm1,%xmm1
cmp    $0x3,%r8
jae    1350 <LevinsonTrenchZoharSolve+0x220>
xor    %eax,%eax
jmp    13ab <LevinsonTrenchZoharSolve+0x27b>
mov    0x38(%rsp),%rcx
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rax,8),%xmm2
mulsd  -0x18(%rcx),%xmm2
addsd  %xmm1,%xmm2
movsd  -0x8(%rbp,%rax,8),%xmm3
mulsd  -0x10(%rcx),%xmm3
addsd  %xmm2,%xmm3
movsd  -0x10(%rbp,%rax,8),%xmm2
mulsd  -0x8(%rcx),%xmm2
movsd  -0x18(%rbp,%rax,8),%xmm1
addsd  %xmm3,%xmm2
mulsd  (%rcx),%xmm1
addsd  %xmm2,%xmm1
add    $0xfffffffffffffffc,%rax
add    $0x20,%rcx
cmp    %rax,%r14
jne    1360 <LevinsonTrenchZoharSolve+0x230>
neg    %rax
mov    0x18(%rsp),%rsi
movsd  0x8(%rsp),%xmm7
mov    0x28(%rsp),%r9
mov    0x20(%rsp),%rdi
test   $0x3,%r9b
je     13fa <LevinsonTrenchZoharSolve+0x2ca>
lea    (%rsi,%rax,8),%rcx
shl    $0x3,%rax
mov    %rbp,%rdx
sub    %rax,%rdx
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movsd  (%rdx),%xmm2
mulsd  (%rcx,%rax,8),%xmm2
addsd  %xmm2,%xmm1
add    $0x1,%rax
add    $0xfffffffffffffff8,%rdx
cmp    %rax,%r13
jne    13e0 <LevinsonTrenchZoharSolve+0x2b0>
mov    0x58(%rsp),%rax
movsd  (%rax,%r9,8),%xmm2
subsd  %xmm1,%xmm2
movq   $0x0,(%rsi,%r9,8)
divsd  %xmm7,%xmm2
cmp    $0x4,%r15
jae    1420 <LevinsonTrenchZoharSolve+0x2f0>
xor    %eax,%eax
jmp    148f <LevinsonTrenchZoharSolve+0x35f>
nop
mov    %r15,%rax
movabs $0x7ffffffffffffffc,%rcx
ff ff 7f
and    %rcx,%rax
movapd %xmm2,%xmm1
unpcklpd %xmm2,%xmm1
mov    0x30(%rsp),%rcx
xor    %edx,%edx
nop
movupd -0x10(%r12,%rdx,8),%xmm3
movupd (%r12,%rdx,8),%xmm4
shufpd $0x1,%xmm4,%xmm4
shufpd $0x1,%xmm3,%xmm3
movupd -0x10(%rcx),%xmm5
movupd (%rcx),%xmm6
mulpd  %xmm1,%xmm4
addpd  %xmm5,%xmm4
mulpd  %xmm1,%xmm3
addpd  %xmm6,%xmm3
movupd %xmm4,-0x10(%rcx)
movupd %xmm3,(%rcx)
add    $0xfffffffffffffffc,%rdx
add    $0x20,%rcx
cmp    %rdx,%rdi
jne    1440 <LevinsonTrenchZoharSolve+0x310>
cmp    %rax,%r15
je     11f0 <LevinsonTrenchZoharSolve+0xc0>
lea    (%rsi,%rax,8),%rcx
neg    %rax
cs nopw 0x0(%rax,%rax,1)
movsd  0x8(%r12,%rax,8),%xmm1
mulsd  %xmm2,%xmm1
addsd  (%rcx),%xmm1
movsd  %xmm1,(%rcx)
add    $0xffffffffffffffff,%rax
add    $0x8,%rcx
mov    %r15,%rdx
add    %rax,%rdx
jne    14a0 <LevinsonTrenchZoharSolve+0x370>
jmp    11f0 <LevinsonTrenchZoharSolve+0xc0>
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
call   1030 <free@plt>
movsd  0x10(%rsp),%xmm0
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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