#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 */
double math_diff3(double const, double const, double const, double const,
                  double const, double const);
void math_pchip_initialise(int der, int n, const double *x, const double *y,
                           double *m) {
  if (n >= 3) {
    m[0] = (y[1] - y[0]) / (x[1] - x[0]);
    n--;
    x++;
    y++;
    m++;
  }
  if (n == 1) {
    if (!der)
      m[0] = 0;
  } else if (n == 2) {
    if (!der) {
      const double d = (y[1] - y[0]) / (x[1] - x[0]);
      m[0] = m[1] = d;
    }
  } else {
    int i;
    for (i = 1; i < n - 1; i++) {
      const double h1 = x[i] - x[i - 1];
      if (der) {
        const double a = m[i] / h1;
        const double b = m[i + 1] / h1;
        const double c = 2 * a + b - 3.;
        if (3 * a * (a + b - 2.) >= c * c)
          continue;
      }
      const double h2 = x[i + 1] - x[i];
      const double S1 = (y[i] - y[i - 1]) / h1;
      const double S2 = (y[i + 1] - y[i]) / h2;
      const double tmp = S1 * S2;
      if (tmp > 0) {
        const double a = (h1 + 2 * h2) / (3 * (h1 + h2));
        m[i] = tmp / ((1 - a) * S1 + a * S2);
      } else {
        m[i] = 0.;
      }
    }
    if (!der) {
      m[0] = math_diff3(x[0], x[1], x[2], y[0], y[1], y[2]);
      m[n - 1] = math_diff3(x[n - 1], x[n - 2], x[n - 3], y[n - 1], y[n - 2],
                            y[n - 3]);
    }
  }
}


x86 assembly (clang, -O0):
<math_pchip_initialise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     1192 <math_pchip_initialise+0x82>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    11b6 <math_pchip_initialise+0xa6>
cmpl   $0x0,-0x4(%rbp)
jne    11b1 <math_pchip_initialise+0xa1>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    14f3 <math_pchip_initialise+0x3e3>
cmpl   $0x2,-0x8(%rbp)
jne    1210 <math_pchip_initialise+0x100>
cmpl   $0x0,-0x4(%rbp)
jne    120b <math_pchip_initialise+0xfb>
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    14ee <math_pchip_initialise+0x3de>
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    141b <math_pchip_initialise+0x30b>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     12f1 <math_pchip_initialise+0x1e1>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd65(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xd54(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
addsd  -0x48(%rbp),%xmm1
movsd  0xd35(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jb     12ec <math_pchip_initialise+0x1dc>
jmp    140d <math_pchip_initialise+0x2fd>
jmp    12f1 <math_pchip_initialise+0x1e1>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13f8 <math_pchip_initialise+0x2e8>
movsd  -0x38(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm2
addsd  -0x58(%rbp),%xmm2
movsd  0xc5c(%rip),%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  0xc4a(%rip),%xmm1
subsd  -0x78(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm3
movsd  -0x78(%rbp),%xmm2
mulsd  -0x68(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1408 <math_pchip_initialise+0x2f8>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    140d <math_pchip_initialise+0x2fd>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1217 <math_pchip_initialise+0x107>
cmpl   $0x0,-0x4(%rbp)
jne    14e9 <math_pchip_initialise+0x3d9>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm3
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm4
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm5
call   1030 <math_diff3@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm4
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm5
call   1030 <math_diff3@plt>
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    14ee <math_pchip_initialise+0x3de>
jmp    14f3 <math_pchip_initialise+0x3e3>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_pchip_initialise>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %esi,%r12d
cmp    $0x3,%esi
jl     1156 <math_pchip_initialise+0x46>
movsd  0x8(%r15),%xmm0
subsd  (%r15),%xmm0
add    $0x8,%r15
movsd  0x8(%rbx),%xmm1
subsd  (%rbx),%xmm1
add    $0x8,%rbx
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0xffffffff,%r12d
add    $0x8,%r14
cmp    $0x1,%r12d
je     1192 <math_pchip_initialise+0x82>
cmp    $0x2,%r12d
jne    11a6 <math_pchip_initialise+0x96>
test   %edi,%edi
jne    1338 <math_pchip_initialise+0x228>
movsd  0x8(%r15),%xmm0
subsd  (%r15),%xmm0
movsd  0x8(%rbx),%xmm1
subsd  (%rbx),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r14)
movsd  %xmm0,(%r14)
jmp    1338 <math_pchip_initialise+0x228>
test   %edi,%edi
jne    1338 <math_pchip_initialise+0x228>
movq   $0x0,(%r14)
jmp    1338 <math_pchip_initialise+0x228>
lea    -0x1(%r12),%ebp
cmp    $0x3,%r12d
jl     12d5 <math_pchip_initialise+0x1c5>
mov    %ebp,%eax
mov    $0x1,%ecx
movsd  0xe44(%rip),%xmm0
movsd  0xe4b(%rip),%xmm8
movsd  0xe2a(%rip),%xmm9
movsd  0xe32(%rip),%xmm3
jmp    11f2 <math_pchip_initialise+0xe2>
movsd  %xmm7,(%r14,%rcx,8)
mov    %rdx,%rcx
cmp    %rax,%rdx
je     12d5 <math_pchip_initialise+0x1c5>
movsd  (%rbx,%rcx,8),%xmm5
movapd %xmm5,%xmm4
subsd  -0x8(%rbx,%rcx,8),%xmm4
lea    0x1(%rcx),%rdx
test   %edi,%edi
je     124e <math_pchip_initialise+0x13e>
movupd (%r14,%rcx,8),%xmm1
movapd %xmm4,%xmm2
unpcklpd %xmm4,%xmm2
divpd  %xmm2,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
movapd %xmm1,%xmm6
addsd  %xmm1,%xmm6
addsd  %xmm2,%xmm6
addsd  %xmm9,%xmm6
addsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm6,%xmm6
ucomisd %xmm6,%xmm2
jae    11e6 <math_pchip_initialise+0xd6>
movsd  (%rbx,%rdx,8),%xmm6
subsd  %xmm5,%xmm6
movupd -0x8(%r15,%rcx,8),%xmm1
movsd  (%r15,%rdx,8),%xmm2
movapd %xmm1,%xmm5
shufpd $0x1,%xmm2,%xmm5
subpd  %xmm1,%xmm5
movapd %xmm4,%xmm1
unpcklpd %xmm6,%xmm1
divpd  %xmm1,%xmm5
movapd %xmm5,%xmm1
unpckhpd %xmm5,%xmm1
movapd %xmm5,%xmm2
mulsd  %xmm1,%xmm2
xorpd  %xmm7,%xmm7
ucomisd %xmm7,%xmm2
jbe    11e0 <math_pchip_initialise+0xd0>
movapd %xmm6,%xmm7
addsd  %xmm6,%xmm7
addsd  %xmm4,%xmm7
addsd  %xmm6,%xmm4
mulsd  %xmm0,%xmm4
divsd  %xmm4,%xmm7
movapd %xmm8,%xmm4
subsd  %xmm7,%xmm4
mulsd  %xmm1,%xmm7
mulsd  %xmm5,%xmm4
addsd  %xmm7,%xmm4
divsd  %xmm4,%xmm2
movapd %xmm2,%xmm7
jmp    11e0 <math_pchip_initialise+0xd0>
test   %edi,%edi
jne    1338 <math_pchip_initialise+0x228>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
movsd  0x10(%rbx),%xmm2
movsd  (%r15),%xmm3
movsd  0x8(%r15),%xmm4
movsd  0x10(%r15),%xmm5
call   1030 <math_diff3@plt>
movsd  %xmm0,(%r14)
movslq %ebp,%rbp
movsd  (%rbx,%rbp,8),%xmm0
movslq %r12d,%rax
movsd  -0x18(%rbx,%rax,8),%xmm2
movsd  -0x10(%rbx,%rax,8),%xmm1
movsd  (%r15,%rbp,8),%xmm3
movsd  -0x18(%r15,%rax,8),%xmm5
movsd  -0x10(%r15,%rax,8),%xmm4
call   1030 <math_diff3@plt>
movsd  %xmm0,(%r14,%rbp,8)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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