#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*/ assert(int);
int /*<<< orphan*/ free(double *);
double getY(double *, int);
double getY2(double *, int);
double *malloc(int);
int /*<<< orphan*/ setY2(double *, int, double);
void spline(double *x, double *y, int n, double yp1, double ypn, double *y2,
            double *YY2) {
  int i, k;
  double p, qn, sig, un, *u, tmp;
  u = malloc(n * sizeof(double));
  if (yp1 > 0.99e30) {
    u[0] = 0.0;
    setY2(YY2, 0, 0.0);
  } else {
    setY2(YY2, 0, -0.5);
    assert(x[1] != x[0]);
    tmp = 1 / (x[1] - x[0]);
    u[0] = (3.0 * tmp) * ((getY(YY2, 1) - getY(YY2, 0)) * tmp - yp1);
  }
  for (i = 1; i <= n - 2; i++) {
    assert(x[i + 1] != x[i - 1]);
    sig = (x[i] - x[i - 1]) / (x[i + 1] - x[i - 1]);
    p = sig * getY2(YY2, i - 1) + 2.0;
    assert(p != 0.0);
    setY2(YY2, i, (sig - 1.0) / p);
    assert(x[i + 1] != x[i]);
    assert(x[i] != x[i - 1]);
    u[i] = (getY(YY2, i + 1) - getY(YY2, i)) / (x[i + 1] - x[i]) -
           (getY(YY2, i) - getY(YY2, i - 1)) / (x[i] - x[i - 1]);
    u[i] = (6.0 * u[i] / (x[i + 1] - x[i - 1]) - sig * u[i - 1]) / p;
  }
  qn = un = 0.0;
  assert((qn * getY2(YY2, n - 2) + 1.0) != 0.0);
  setY2(YY2, n - 1, (un - qn * u[n - 2]) / (qn * getY2(YY2, n - 2) + 1.0));
  for (k = n - 2; k >= 0; k--)
    setY2(YY2, k, getY2(YY2, k) * getY2(YY2, k + 1) + u[k]);
  free(u);
}


x86 assembly (clang, -O0):
<spline>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%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    %r8,-0x38(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xe58(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11d0 <spline+0x70>
mov    -0x68(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
xorps  %xmm0,%xmm0
call   1040 <setY2@plt>
jmp    129e <spline+0x13e>
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
movsd  0xe3a(%rip),%xmm0
call   1040 <setY2@plt>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
ucomisd (%rax),%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm1
movsd  0xdf1(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xdd8(%rip),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x38(%rbp),%rdi
mov    $0x1,%esi
call   1070 <getY@plt>
movsd  %xmm0,-0x80(%rbp)
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
call   1070 <getY@plt>
movsd  -0x80(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x78(%rbp),%xmm0
subsd  %xmm2,%xmm1
movsd  -0x70(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x68(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     1574 <spline+0x414>
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x38(%rbp),%rdi
mov    -0x3c(%rbp),%esi
sub    $0x1,%esi
call   1080 <getY2@plt>
movaps %xmm0,%xmm1
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  0xcbd(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x38(%rbp),%rdi
mov    -0x3c(%rbp),%esi
movsd  -0x58(%rbp),%xmm0
movsd  0xc6a(%rip),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x48(%rbp),%xmm0
call   1040 <setY2@plt>
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x38(%rbp),%rdi
mov    -0x3c(%rbp),%esi
add    $0x1,%esi
call   1070 <getY@plt>
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x38(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1070 <getY@plt>
movaps %xmm0,%xmm1
movsd  -0x98(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x38(%rbp),%rdi
mov    -0x3c(%rbp),%esi
call   1070 <getY@plt>
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x38(%rbp),%rdi
mov    -0x3c(%rbp),%esi
sub    $0x1,%esi
call   1070 <getY@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x88(%rbp),%xmm0
ff
subsd  %xmm2,%xmm1
mov    -0x8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
mov    -0x68(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x68(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  0xb2f(%rip),%xmm1
mulsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mov    -0x68(%rbp),%rax
mov    -0x3c(%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    -0x68(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    12a5 <spline+0x145>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x2,%esi
call   1080 <getY2@plt>
movaps %xmm0,%xmm1
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  0xa59(%rip),%xmm1
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xac(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
mov    -0x68(%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  %xmm0,-0xa8(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
mov    -0x38(%rbp),%rdi
mov    -0x14(%rbp),%esi
sub    $0x2,%esi
call   1080 <getY2@plt>
movsd  -0xc0(%rbp),%xmm1
ff
mov    -0xb8(%rbp),%rdi
mov    -0xac(%rbp),%esi
movaps %xmm0,%xmm2
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
movsd  0x99a(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1040 <setY2@plt>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jl     170d <spline+0x5ad>
mov    -0x38(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0xd4(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%esi
call   1080 <getY2@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%esi
add    $0x1,%esi
call   1080 <getY2@plt>
mov    -0xe0(%rbp),%rdi
mov    -0xd4(%rbp),%esi
movaps %xmm0,%xmm2
movsd  -0xd0(%rbp),%xmm0
ff
mov    -0x68(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <setY2@plt>
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
jmp    168c <spline+0x52c>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r8,%rbx
movsd  %xmm0,0x10(%rsp)
mov    %edx,%r15d
mov    %rdi,%rbp
lea    0x0(,%r15,8),%edi
call   1060 <malloc@plt>
mov    %rax,%r14
movsd  0x10(%rsp),%xmm0
ucomisd 0xe62(%rip),%xmm0
jbe    11c4 <spline+0x64>
movq   $0x0,(%r14)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <setY2@plt>
jmp    1260 <spline+0x100>
movsd  0xe3c(%rip),%xmm0
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <setY2@plt>
movsd  0x0(%rbp),%xmm0
cmpneqsd 0x8(%rbp),%xmm0
movq   %xmm0,%rdi
and    $0x1,%edi
call   1050 <assert@plt>
movsd  0x8(%rbp),%xmm0
subsd  0x0(%rbp),%xmm0
movsd  0xe10(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x30(%rsp)
movsd  0xe06(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
call   1070 <getY@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <getY@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x30(%rsp),%xmm1
subsd  0x10(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  %xmm1,(%r14)
lea    -0x2(%r15),%eax
mov    %eax,0x2c(%rsp)
lea    -0x1(%r15),%r12d
mov    %r15,0x40(%rsp)
cmp    $0x3,%r15d
movsd  0x8(%rsp),%xmm1
jl     1469 <spline+0x309>
mov    %r12d,%eax
movsd  0x0(%rbp),%xmm0
add    $0xffffffffffffffff,%rax
mov    %rax,0x48(%rsp)
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm1,0x8(%rsp)
cmpneqsd 0x10(%rbp,%r13,8),%xmm0
04
movq   %xmm0,%rdi
and    $0x1,%edi
call   1050 <assert@plt>
movupd 0x8(%rbp,%r13,8),%xmm1
movsd  0x0(%rbp,%r13,8),%xmm0
unpcklpd %xmm0,%xmm0
subpd  %xmm0,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %rbx,%rdi
mov    %r13d,%esi
call   1080 <getY2@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0xd24(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
movapd %xmm0,%xmm1
cmpneqsd 0xd31(%rip),%xmm1
movq   %xmm1,%rdi
and    $0x1,%edi
call   1050 <assert@plt>
movapd 0x10(%rsp),%xmm0
addsd  0xcfe(%rip),%xmm0
divsd  0x20(%rsp),%xmm0
lea    0x1(%r13),%r15
mov    %rbx,%rdi
mov    %r15d,%esi
call   1040 <setY2@plt>
movsd  0x8(%rbp,%r13,8),%xmm0
cmpneqsd 0x10(%rbp,%r13,8),%xmm0
04
movq   %xmm0,%rdi
and    $0x1,%edi
call   1050 <assert@plt>
movsd  0x0(%rbp,%r13,8),%xmm0
cmpneqsd 0x8(%rbp,%r13,8),%xmm0
04
movq   %xmm0,%rdi
and    $0x1,%edi
call   1050 <assert@plt>
lea    0x2(%r13),%esi
mov    %rbx,%rdi
call   1070 <getY@plt>
movaps %xmm0,0x80(%rsp)
mov    %rbx,%rdi
mov    %r15d,%esi
call   1070 <getY@plt>
movaps %xmm0,0x60(%rsp)
movsd  0x8(%rbp,%r13,8),%xmm0
movaps %xmm0,0x30(%rsp)
movsd  0x10(%rbp,%r13,8),%xmm0
movapd %xmm0,0x70(%rsp)
mov    %rbx,%rdi
mov    %r15d,%esi
call   1070 <getY@plt>
movapd %xmm0,0x50(%rsp)
mov    %rbx,%rdi
mov    %r13d,%esi
call   1070 <getY@plt>
movapd 0x80(%rsp),%xmm3
unpcklpd 0x50(%rsp),%xmm3
movapd 0x60(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
subpd  %xmm1,%xmm3
movsd  0x0(%rbp,%r13,8),%xmm1
movsd  0x8(%rbp,%r13,8),%xmm0
movapd 0x70(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
movapd 0x30(%rsp),%xmm4
unpcklpd %xmm1,%xmm4
subpd  %xmm4,%xmm2
divpd  %xmm2,%xmm3
movapd %xmm3,%xmm2
unpckhpd %xmm3,%xmm2
subsd  %xmm2,%xmm3
mulsd  0xc05(%rip),%xmm3
movsd  0x10(%rbp,%r13,8),%xmm2
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm3
movapd 0x10(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
subsd  %xmm1,%xmm3
divsd  0x20(%rsp),%xmm3
movsd  %xmm3,0x8(%r14,%r13,8)
movapd %xmm3,%xmm1
mov    %r15,%r13
cmp    %r15,0x48(%rsp)
jne    12a0 <spline+0x140>
mov    %rbx,%rdi
mov    0x2c(%rsp),%ebp
mov    %ebp,%esi
call   1080 <getY2@plt>
xorpd  %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xb89(%rip),%xmm2
addsd  %xmm2,%xmm0
cmpneqsd %xmm1,%xmm0
movq   %xmm0,%rdi
and    $0x1,%edi
call   1050 <assert@plt>
movslq %ebp,%rsi
movsd  (%r14,%rsi,8),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %rbx,%rdi
call   1080 <getY2@plt>
movapd 0x10(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
movsd  0xb72(%rip),%xmm1
mulpd  %xmm2,%xmm1
xorpd  %xmm0,%xmm0
movsd  0xb3a(%rip),%xmm2
unpcklpd %xmm2,%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  %xmm1,%xmm0
mov    %rbx,%rdi
mov    %r12d,%esi
call   1040 <setY2@plt>
cmpl   $0x2,0x40(%rsp)
jl     153b <spline+0x3db>
mov    %ebp,%ebp
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %ebp,%esi
call   1080 <getY2@plt>
movsd  %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r12d,%esi
call   1080 <getY2@plt>
mulsd  0x10(%rsp),%xmm0
addsd  (%r14,%rbp,8),%xmm0
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <setY2@plt>
add    $0xffffffff,%r12d
add    $0xffffffffffffffff,%rbp
jb     1500 <spline+0x3a0>
mov    %r14,%rdi
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

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

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