#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*/ thomas(double *, double *, double *, double *, int);
void spline(double *D, const double *y, int n) {
  int i;
  double *a, *b, *c;
  a = malloc(3 * n * sizeof(double));
  b = a + n;
  c = b + n;
  if (n < 4) {
    a[0] = 0;
    b[0] = 2;
    c[0] = 1;
    D[0] = 3 * (y[1] - y[0]);
    a[n - 1] = 1;
    b[n - 1] = 2;
    c[n - 1] = 0;
    D[n - 1] = 3 * (y[n - 1] - y[n - 2]);
  } else {
    a[0] = 0;
    b[0] = 2;
    c[0] = 4;
    D[0] = -5 * y[0] + 4 * y[1] + y[2];
    a[n - 1] = 4;
    b[n - 1] = 2;
    c[n - 1] = 0;
    D[n - 1] = 5 * y[n - 1] - 4 * y[n - 2] - y[n - 3];
  }
  for (i = 1; i < n - 1; ++i) {
    a[i] = 1;
    b[i] = 4;
    c[i] = 1;
    D[i] = 3 * (y[i + 1] - y[i - 1]);
  }
  thomas(D, a, b, c, n);
  free(a);
}


x86 assembly (clang, -O0):
<spline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
imul   $0x3,-0x14(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1268 <spline+0x138>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xe71(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  0xe79(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
movsd  0xe54(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xe3b(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xe09(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  0xdd3(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    138d <spline+0x25d>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movsd  0xd91(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  0xd79(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0xd61(%rip),%xmm1
mulsd  0x8(%rax),%xmm1
movsd  0xd64(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
addsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xd26(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xd14(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  0xccb(%rip),%xmm1
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xc9f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    142f <spline+0x2ff>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  0xc73(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  0xc3e(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  0xc49(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  0xc10(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1394 <spline+0x264>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x14(%rbp),%r8d
call   1050 <thomas@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %edx,%ebx
mov    %rsi,%r13
mov    %rdi,%r15
lea    0x0(,%rbx,8),%eax
lea    (%rax,%rax,2),%edi
call   1040 <malloc@plt>
mov    %rax,%r12
movslq %ebx,%rdi
lea    (%rax,%rdi,8),%rdx
lea    (%rdx,%rdi,8),%rcx
movq   $0x0,(%rax)
movabs $0x4000000000000000,%rax
mov    %rax,(%r12,%rdi,8)
movabs $0x4010000000000000,%r10
movabs $0x3ff0000000000000,%r9
cmp    $0x4,%edi
mov    %rbx,0x40(%rsp)
jge    11f4 <spline+0xc4>
mov    %r9,(%rcx)
movsd  0x8(%r13),%xmm0
subsd  0x0(%r13),%xmm0
movsd  0xe73(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
lea    -0x1(%rbx),%esi
movslq %esi,%rsi
mov    %r9,(%r12,%rsi,8)
mov    %rax,(%rdx,%rsi,8)
movq   $0x0,(%rcx,%rsi,8)
movsd  0x0(%r13,%rsi,8),%xmm0
subsd  -0x10(%r13,%rdi,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%r15,%rsi,8)
mov    $0x2,%r14d
cmp    $0x3,%ebx
je     126b <spline+0x13b>
jmp    12fb <spline+0x1cb>
mov    %r10,(%rcx)
movsd  0x0(%r13),%xmm0
movsd  0x8(%r13),%xmm1
mulsd  0xdf5(%rip),%xmm1
mulsd  0xdf5(%rip),%xmm0
addsd  %xmm1,%xmm0
addsd  0x10(%r13),%xmm0
movsd  %xmm0,(%r15)
lea    -0x1(%rbx),%r14d
mov    %r10,(%r12,%r14,8)
mov    %rax,(%rdx,%r14,8)
movq   $0x0,(%rcx,%r14,8)
lea    -0x2(%rbx),%eax
movsd  0x0(%r13,%rax,8),%xmm0
mulsd  0xdc8(%rip),%xmm0
movsd  0x0(%r13,%r14,8),%xmm1
mulsd  0xdc1(%rip),%xmm1
addsd  %xmm0,%xmm1
lea    -0x3(%rbx),%eax
subsd  0x0(%r13,%rax,8),%xmm1
movsd  %xmm1,(%r15,%r14,8)
mov    %rdx,0x28(%rsp)
mov    %rcx,0x20(%rsp)
lea    -0x1(%r14),%rax
mov    $0x1,%r11d
mov    %rax,0x38(%rsp)
cmp    $0x2,%rax
jae    1321 <spline+0x1f1>
lea    (%r15,%r11,8),%r8
lea    (%r11,%rdi,2),%rax
lea    (%r12,%rax,8),%rsi
add    %r11,%rdi
lea    (%r12,%rdi,8),%rbp
lea    (%r12,%r11,8),%rbx
lea    0x8(,%r11,8),%rax
add    %r13,%rax
sub    %r11,%r14
xor    %edi,%edi
movsd  0xd63(%rip),%xmm0
mov    0x20(%rsp),%rcx
mov    0x28(%rsp),%rdx
nopw   0x0(%rax,%rax,1)
mov    %r9,(%rbx,%rdi,8)
mov    %r10,0x0(%rbp,%rdi,8)
mov    %r9,(%rsi,%rdi,8)
movsd  (%rax,%rdi,8),%xmm1
subsd  -0x10(%rax,%rdi,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%r8,%rdi,8)
add    $0x1,%rdi
cmp    %rdi,%r14
jne    12d0 <spline+0x1a0>
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x40(%rsp),%r8
call   1050 <thomas@plt>
mov    %r12,%rdi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
lea    0x8(%r12),%rax
lea    (%r12,%r14,8),%rdx
lea    (%r12,%rdi,8),%r8
add    $0x8,%r8
lea    (%r14,%rdi,1),%rcx
lea    (%r12,%rcx,8),%rbp
mov    %rbp,0x10(%rsp)
mov    %rdi,%rcx
shl    $0x4,%rcx
mov    %rcx,0x30(%rsp)
lea    (%r12,%rcx,1),%rsi
add    $0x8,%rsi
lea    (%r14,%rdi,2),%rcx
lea    (%r12,%rcx,8),%rbx
cmp    %rbp,%rax
setb   0x18(%rsp)
cmp    %rdx,%r8
setb   0xf(%rsp)
cmp    %rbx,%rax
setb   %bpl
cmp    %rdx,%rsi
lea    0x8(%r15),%rcx
setb   0xe(%rsp)
cmp    %rbx,%r8
lea    (%r15,%r14,8),%rdx
setb   %bl
cmp    0x10(%rsp),%rsi
lea    0x10(%r13),%rsi
lea    0x8(%r13,%r14,8),%rax
setb   %r8b
cmp    %rax,%rcx
setb   %al
cmp    %rdx,%rsi
lea    -0x8(%r13,%r14,8),%rsi
setb   0x10(%rsp)
cmp    %rsi,%rcx
setb   %sil
cmp    %r13,%rdx
seta   %dl
mov    0xf(%rsp),%cl
test   %cl,0x18(%rsp)
jne    128e <spline+0x15e>
and    0xe(%rsp),%bpl
jne    128e <spline+0x15e>
and    %r8b,%bl
jne    128e <spline+0x15e>
and    0x10(%rsp),%al
jne    128e <spline+0x15e>
and    %dl,%sil
jne    128e <spline+0x15e>
mov    0x38(%rsp),%r11
mov    %r11,%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,0x18(%rsp)
add    $0xfffffffffffffffe,%rax
mov    %rax,%r8
shr    %r8
add    $0x1,%r8
test   %rax,%rax
je     1529 <spline+0x3f9>
mov    %r8,%rbp
and    $0xfffffffffffffffe,%rbp
mov    0x30(%rsp),%rax
lea    (%rax,%r12,1),%rsi
add    $0x18,%rsi
lea    (%r12,%rdi,8),%rbx
add    $0x18,%rbx
xor    %eax,%eax
movapd 0xbf3(%rip),%xmm0
movapd 0xbfb(%rip),%xmm1
movapd 0xc03(%rip),%xmm2
mov    0x20(%rsp),%rcx
mov    0x28(%rsp),%rdx
nopw   0x0(%rax,%rax,1)
movupd %xmm0,0x8(%r12,%rax,8)
movupd %xmm1,-0x10(%rbx,%rax,8)
movupd %xmm0,-0x10(%rsi,%rax,8)
movupd 0x0(%r13,%rax,8),%xmm3
movupd 0x10(%r13,%rax,8),%xmm4
subpd  %xmm3,%xmm4
mulpd  %xmm2,%xmm4
movupd %xmm4,0x8(%r15,%rax,8)
movupd %xmm0,0x18(%r12,%rax,8)
movupd %xmm1,(%rbx,%rax,8)
movupd %xmm0,(%rsi,%rax,8)
movupd 0x10(%r13,%rax,8),%xmm3
movupd 0x20(%r13,%rax,8),%xmm4
subpd  %xmm3,%xmm4
mulpd  %xmm2,%xmm4
movupd %xmm4,0x18(%r15,%rax,8)
add    $0x4,%rax
add    $0xfffffffffffffffe,%rbp
jne    1460 <spline+0x330>
test   $0x1,%r8b
je     1515 <spline+0x3e5>
lea    0x0(,%rax,8),%rsi
or     $0x8,%rsi
movaps 0xb4f(%rip),%xmm0
movups %xmm0,(%r12,%rsi,1)
movaps 0xb53(%rip),%xmm1
movups %xmm1,(%rdx,%rsi,1)
movups %xmm0,(%rcx,%rsi,1)
movupd 0x0(%r13,%rax,8),%xmm0
movupd 0x10(%r13,%rax,8),%xmm1
subpd  %xmm0,%xmm1
mulpd  0xb41(%rip),%xmm1
movupd %xmm1,(%r15,%rsi,1)
cmp    0x18(%rsp),%r11
je     12fb <spline+0x1cb>
or     $0x1,%r11
jmp    128e <spline+0x15e>
xor    %eax,%eax
mov    0x20(%rsp),%rcx
mov    0x28(%rsp),%rdx
test   $0x1,%r8b
jne    14ce <spline+0x39e>
jmp    1515 <spline+0x3e5>

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

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