#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 *malloc(int);
int /*<<< orphan*/ printf(char *);
void spline(double *x, double *y, int n, double yp1, double ypn, double *y2) {
  double *u;
  double sig, p, qn, un;
  int i, k;
  u = malloc(sizeof(double) * (unsigned int)n);
  if (u == NULL) {
    printf("Out Of Memory in spline - ERROR");
    return;
  }
  if (yp1 > 0.99E30) {
    y2[0] = 0;
    u[0] = 0;
  } else {
    y2[0] = -0.5;
    u[0] = (3.0 / (x[1] - x[0])) * ((y[1] - y[0]) / (x[1] - x[0]) - yp1);
  }
  for (i = 1; i < (n - 1); i++) {
    sig = (x[i] - x[i - 1]) / (x[i + 1] - x[i - 1]);
    p = sig * y2[i - 1] + 2.0;
    y2[i] = (sig - 1.0) / p;
    u[i] = (6.0 *
                ((y[i + 1] - y[i]) / (x[i + 1] - x[i]) -
                 (y[i] - y[i - 1]) / (x[i] - x[i - 1])) /
                (x[i + 1] - x[i - 1]) -
            sig * u[i - 1]) /
           p;
  }
  if (ypn > 0.99E30) {
    qn = 0;
    un = 0;
  } else {
    qn = 0.5;
    un = (3.0 / (x[n - 1] - x[n - 2])) *
         (ypn - (y[n - 1] - y[n - 2]) / (x[n - 1] - x[n - 2]));
  }
  y2[n - 1] = (un - qn * u[n - 2]) / (qn * y2[n - 2] + 1.0);
  for (k = n - 2; k >= 0; k--)
    y2[k] = y2[k] * y2[k + 1] + u[k];
  free(u);
}


x86 assembly (clang, -O0):
<spline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    117f <spline+0x4f>
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
jmp    1584 <spline+0x454>
movsd  -0x20(%rbp),%xmm0
movsd  0xe74(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b1 <spline+0x81>
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    1215 <spline+0xe5>
mov    -0x30(%rbp),%rax
movsd  0xe53(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm1
movsd  0xe2e(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm2
divsd  %xmm2,%xmm1
subsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13da <spline+0x2aa>
mov    -0x8(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd94(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xd6e(%rip),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x5c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  0xcd0(%rip),%xmm1
mulsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x48(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    121c <spline+0xec>
movsd  -0x28(%rbp),%xmm0
movsd  0xc19(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1406 <spline+0x2d6>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    14a1 <spline+0x371>
movsd  0xc0a(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  0xbc9(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xb21(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x60(%rbp)
cmpl   $0x0,-0x60(%rbp)
jl     157b <spline+0x44b>
mov    -0x30(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x60(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x38(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x60(%rbp)
jmp    1522 <spline+0x3f2>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spline>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r12
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x0(,%r14,8),%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     1187 <spline+0x57>
movsd  0x8(%rsp),%xmm3
ucomisd 0xe8d(%rip),%xmm3
jbe    119e <spline+0x6e>
movq   $0x0,(%r12)
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
jmp    11ec <spline+0xbc>
lea    0xec2(%rip),%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <printf@plt>
movabs $0xbfe0000000000000,%rcx
mov    %rcx,(%r12)
movsd  0x8(%rbx),%xmm0
subsd  (%rbx),%xmm0
movsd  0x8(%r15),%xmm1
subsd  (%r15),%xmm1
movapd 0xe78(%rip),%xmm2
unpcklpd %xmm1,%xmm2
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
subsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe1c(%rip),%xmm0
movsd  %xmm1,(%rax)
lea    -0x1(%r14),%ecx
cmp    $0x3,%r14d
jl     12ea <spline+0x1ba>
mov    %ecx,%edx
movsd  (%rbx),%xmm4
movsd  0x8(%rbx),%xmm5
mov    $0x1,%esi
movsd  0xdf9(%rip),%xmm8
movsd  0xdf8(%rip),%xmm9
movsd  0xdf7(%rip),%xmm10
nopl   0x0(%rax)
subsd  %xmm4,%xmm5
movsd  0x8(%rbx,%rsi,8),%xmm2
subsd  %xmm4,%xmm2
divsd  %xmm2,%xmm5
mulsd  %xmm5,%xmm0
addsd  %xmm8,%xmm0
movapd %xmm5,%xmm6
addsd  %xmm9,%xmm6
divsd  %xmm0,%xmm6
movsd  %xmm6,(%r12,%rsi,8)
movupd (%r15,%rsi,8),%xmm2
mulsd  %xmm1,%xmm5
movapd %xmm2,%xmm1
shufpd $0x1,%xmm2,%xmm1
movupd (%rbx,%rsi,8),%xmm4
movapd %xmm4,%xmm7
shufpd $0x1,%xmm4,%xmm7
movhpd -0x8(%r15,%rsi,8),%xmm2
subpd  %xmm2,%xmm1
movsd  -0x8(%rbx,%rsi,8),%xmm2
movapd %xmm4,%xmm3
unpcklpd %xmm2,%xmm3
subpd  %xmm3,%xmm7
divpd  %xmm7,%xmm1
movapd %xmm1,%xmm3
unpckhpd %xmm1,%xmm3
subsd  %xmm3,%xmm1
mulsd  %xmm10,%xmm1
movapd %xmm4,%xmm3
unpckhpd %xmm4,%xmm3
movapd %xmm3,%xmm7
subsd  %xmm2,%xmm7
divsd  %xmm7,%xmm1
subsd  %xmm5,%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rax,%rsi,8)
lea    0x1(%rsi),%rdi
movapd %xmm6,%xmm0
movapd %xmm3,%xmm5
mov    %rdi,%rsi
cmp    %rdi,%rdx
jne    1230 <spline+0x100>
movsd  0x10(%rsp),%xmm3
ucomisd 0xd08(%rip),%xmm3
jbe    130e <spline+0x1de>
lea    -0x2(%r14),%edx
movslq %edx,%rsi
movslq %ecx,%rcx
xorpd  %xmm0,%xmm0
xorpd  %xmm3,%xmm3
jmp    1360 <spline+0x230>
movslq %ecx,%rcx
movsd  (%rbx,%rcx,8),%xmm0
lea    -0x2(%r14),%edx
movslq %r14d,%rdi
subsd  -0x10(%rbx,%rdi,8),%xmm0
lea    -0x2(%rdi),%rsi
movsd  (%r15,%rcx,8),%xmm1
subsd  -0x10(%r15,%rdi,8),%xmm1
movapd 0xd04(%rip),%xmm2
unpcklpd %xmm1,%xmm2
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
subsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm3
movsd  0xcc8(%rip),%xmm0
movsd  (%rax,%rsi,8),%xmm1
mulsd  %xmm0,%xmm1
mulsd  (%r12,%rsi,8),%xmm0
addsd  0xcb9(%rip),%xmm0
subsd  %xmm1,%xmm3
divsd  %xmm0,%xmm3
movsd  %xmm3,(%r12,%rcx,8)
cmp    $0x2,%r14d
jl     13f6 <spline+0x2c6>
mov    %edx,%ecx
test   $0x1,%dl
jne    13ae <spline+0x27e>
movsd  (%r12,%rcx,8),%xmm0
mulsd  0x8(%r12,%rcx,8),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%r12,%rcx,8)
add    $0xffffffffffffffff,%rcx
test   %edx,%edx
je     13f6 <spline+0x2c6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rcx,8),%xmm0
mulsd  0x8(%r12,%rcx,8),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%r12,%rcx,8)
mulsd  -0x8(%r12,%rcx,8),%xmm0
addsd  -0x8(%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%r12,%rcx,8)
add    $0xfffffffffffffffe,%rcx
cmp    $0xffffffffffffffff,%rcx
jne    13c0 <spline+0x290>
mov    %rax,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
@.str = [32 x i8] c"Out Of Memory in spline - ERROR\00"
define void @spline(double* nocapture %0, double* nocapture %1, i32 %2, double %3, double %4, double* nocapture %5) {
%7 = shl i32 %2, 3
%8 = tail call double* @malloc(i32 %7)
%9 = icmp eq double* %8, null
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %170
12: ; preds = %6
%13 = fcmp ogt double %3, 9.900000e+29
br i1 %13, label %14, label %15
14: ; preds = %12
store double 0.000000e+00, double* %5
br label %32
15: ; preds = %12
store double -5.000000e-01, double* %5
%16 = getelementptr inbounds double, double* %0, i64 1
%17 = load double, double* %16
%18 = load double, double* %0
%19 = fsub double %17, %18
%20 = getelementptr inbounds double, double* %1, i64 1
%21 = load double, double* %20
%22 = load double, double* %1
%23 = fsub double %21, %22
%24 = insertelement <2 x double> <double 3.000000e+00, double poison>, double %23, i64 1
%25 = insertelement <2 x double> poison, double %19, i64 0
%26 = shufflevector <2 x double> %25, <2 x double> poison, <2 x i32> zeroinitializer
%27 = fdiv <2 x double> %24, %26
%28 = extractelement <2 x double> %27, i64 1
%29 = fsub double %28, %3
%30 = extractelement <2 x double> %27, i64 0
%31 = fmul double %30, %29
br label %32
32: ; preds = %15, %14
%33 = phi double [ -5.000000e-01, %15 ], [ 0.000000e+00, %14 ]
%34 = phi double [ %31, %15 ], [ 0.000000e+00, %14 ]
store double %34, double* %8
%35 = add i32 %2, -1
%36 = icmp sgt i32 %2, 2
br i1 %36, label %37, label %89
37: ; preds = %32
%38 = zext i32 %35 to i64
%39 = getelementptr inbounds double, double* %0, i64 1
%40 = load double, double* %39
%41 = load double, double* %0
br label %42
42: ; preds = %37, %42
%43 = phi double [ %34, %37 ], [ %86, %42 ]
%44 = phi double [ %33, %37 ], [ %59, %42 ]
%45 = phi double [ %41, %37 ], [ %73, %42 ]
%46 = phi double [ %40, %37 ], [ %81, %42 ]
%47 = phi i64 [ 1, %37 ], [ %52, %42 ]
%48 = getelementptr inbounds double, double* %0, i64 %47
%49 = add nsw i64 %47, -1
%50 = getelementptr inbounds double, double* %0, i64 %49
%51 = fsub double %46, %45
%52 = add nuw nsw i64 %47, 1
%53 = getelementptr inbounds double, double* %0, i64 %52
%54 = load double, double* %53
%55 = fsub double %54, %45
%56 = fdiv double %51, %55
%57 = tail call double @llvm.fmuladd.f64(double %56, double %44, double 2.000000e+00)
%58 = fadd double %56, -1.000000e+00
%59 = fdiv double %58, %57
%60 = getelementptr inbounds double, double* %5, i64 %47
store double %59, double* %60
%61 = getelementptr inbounds double, double* %1, i64 %47
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = shufflevector <2 x double> %63, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%65 = bitcast double* %48 to <2 x double>*
%66 = load <2 x double>, <2 x double>* %65
%67 = shufflevector <2 x double> %66, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%68 = getelementptr inbounds double, double* %1, i64 %49
%69 = load double, double* %68
%70 = insertelement <2 x double> %63, double %69, i64 1
%71 = fsub <2 x double> %64, %70
%72 = load double, double* %50
%73 = extractelement <2 x double> %66, i64 0
%74 = insertelement <2 x double> %66, double %72, i64 1
%75 = fsub <2 x double> %67, %74
%76 = fdiv <2 x double> %71, %75
%77 = shufflevector <2 x double> %76, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%78 = fsub <2 x double> %76, %77
%79 = extractelement <2 x double> %78, i64 0
%80 = fmul double %79, 6.000000e+00
%81 = extractelement <2 x double> %66, i64 1
%82 = fsub double %81, %72
%83 = fdiv double %80, %82
%84 = fneg double %56
%85 = tail call double @llvm.fmuladd.f64(double %84, double %43, double %83)
%86 = fdiv double %85, %57
%87 = getelementptr inbounds double, double* %8, i64 %47
store double %86, double* %87
%88 = icmp eq i64 %52, %38
br i1 %88, label %89, label %42
89: ; preds = %42, %32
%90 = fcmp ogt double %4, 9.900000e+29
br i1 %90, label %91, label %95
91: ; preds = %89
%92 = add nsw i32 %2, -2
%93 = sext i32 %92 to i64
%94 = sext i32 %35 to i64
br label %117
95: ; preds = %89
%96 = sext i32 %35 to i64
%97 = getelementptr inbounds double, double* %0, i64 %96
%98 = load double, double* %97
%99 = add nsw i32 %2, -2
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %0, i64 %100
%102 = load double, double* %101
%103 = fsub double %98, %102
%104 = getelementptr inbounds double, double* %1, i64 %96
%105 = load double, double* %104
%106 = getelementptr inbounds double, double* %1, i64 %100
%107 = load double, double* %106
%108 = fsub double %105, %107
%109 = insertelement <2 x double> <double 3.000000e+00, double poison>, double %108, i64 1
%110 = insertelement <2 x double> poison, double %103, i64 0
%111 = shufflevector <2 x double> %110, <2 x double> poison, <2 x i32> zeroinitializer
%112 = fdiv <2 x double> %109, %111
%113 = extractelement <2 x double> %112, i64 1
%114 = fsub double %4, %113
%115 = extractelement <2 x double> %112, i64 0
%116 = fmul double %115, %114
br label %117
117: ; preds = %91, %95
%118 = phi i64 [ %94, %91 ], [ %96, %95 ]
%119 = phi i64 [ %93, %91 ], [ %100, %95 ]
%120 = phi i32 [ %92, %91 ], [ %99, %95 ]
%121 = phi double [ 0.000000e+00, %91 ], [ 5.000000e-01, %95 ]
%122 = phi double [ 0.000000e+00, %91 ], [ %116, %95 ]
%123 = getelementptr inbounds double, double* %8, i64 %119
%124 = load double, double* %123
%125 = fneg double %121
%126 = tail call double @llvm.fmuladd.f64(double %125, double %124, double %122)
%127 = getelementptr inbounds double, double* %5, i64 %119
%128 = load double, double* %127
%129 = tail call double @llvm.fmuladd.f64(double %121, double %128, double 1.000000e+00)
%130 = fdiv double %126, %129
%131 = getelementptr inbounds double, double* %5, i64 %118
store double %130, double* %131
%132 = icmp sgt i32 %2, 1
br i1 %132, label %133, label %168
133: ; preds = %117
%134 = zext i32 %120 to i64
%135 = and i64 %134, 1
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %147
137: ; preds = %133
%138 = getelementptr inbounds double, double* %5, i64 %134
%139 = load double, double* %138
%140 = add nuw nsw i64 %134, 1
%141 = getelementptr inbounds double, double* %5, i64 %140
%142 = load double, double* %141
%143 = getelementptr inbounds double, double* %8, i64 %134
%144 = load double, double* %143
%145 = tail call double @llvm.fmuladd.f64(double %139, double %142, double %144)
store double %145, double* %138
%146 = add nsw i64 %134, -1
br label %147
147: ; preds = %137, %133
%148 = phi i64 [ %134, %133 ], [ %146, %137 ]
%149 = icmp eq i32 %120, 0
br i1 %149, label %168, label %150
150: ; preds = %147, %150
%151 = phi i64 [ %166, %150 ], [ %148, %147 ]
%152 = getelementptr inbounds double, double* %5, i64 %151
%153 = load double, double* %152
%154 = add nuw nsw i64 %151, 1
%155 = getelementptr inbounds double, double* %5, i64 %154
%156 = load double, double* %155
%157 = getelementptr inbounds double, double* %8, i64 %151
%158 = load double, double* %157
%159 = tail call double @llvm.fmuladd.f64(double %153, double %156, double %158)
store double %159, double* %152
%160 = add nsw i64 %151, -1
%161 = getelementptr inbounds double, double* %5, i64 %160
%162 = load double, double* %161
%163 = getelementptr inbounds double, double* %8, i64 %160
%164 = load double, double* %163
%165 = tail call double @llvm.fmuladd.f64(double %162, double %159, double %164)
store double %165, double* %161
%166 = add nsw i64 %151, -2
%167 = icmp eq i64 %160, 0
br i1 %167, label %168, label %150
168: ; preds = %147, %150, %117
%169 = tail call i32 @free(double* %8)
br label %170
170: ; preds = %168, %10
ret void
}