#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*/ error_handler(char *);
scalar_t__ fabs(double);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int nearest_index(double const, double const *, int);
void cubic_spline_sp(int size1, int size2, const double *grid1,
                     const double *grid2, const double *data1, double *data2) {
  double *delta = NULL, *d = NULL, *dh = NULL, *b = NULL, *c = NULL;
  double s, w1, w2, p;
  int i, k, n, klo, khi, kmax;
  for (i = 1; i < size1; i++) {
    if (grid1[i] <= grid1[i - 1])
      error_handler("cubic_spline_sp: grid1 is not monotonic increasing");
  }
  for (i = 0; i < size2; i++) {
    if (grid2[i] < grid1[0] || grid2[i] > grid1[size1 - 1])
      error_handler("cubic_spline_sp: grid2 lies outside grid1");
  }
  if (size1 < 2)
    error_handler(
        "cubic_spline_sp: the size of input grid should be at least 2");
  if (size1 == 2) {
    p = (data1[1] - data1[0]) / (grid1[1] - grid1[0]);
    for (i = 0; i < size2; i++)
      data2[i] = p * (grid2[i] - grid1[0]) + data1[0];
    return;
  }
  delta = (double *)malloc((size1 - 1) * sizeof(double));
  dh = (double *)malloc((size1 - 1) * sizeof(double));
  d = (double *)malloc(size1 * sizeof(double));
  for (k = 0; k < size1 - 1; k++) {
    dh[k] = grid1[k + 1] - grid1[k];
    delta[k] = (data1[k + 1] - data1[k]) / (dh[k]);
  }
  for (k = 1; k < size1 - 1; k++) {
    if (delta[k] * delta[k - 1] > 0.0) {
      w1 = 2.0 * dh[k] + dh[k - 1];
      w2 = dh[k] + 2.0 * dh[k - 1];
      d[k] = (w1 + w2) / (w1 / delta[k - 1] + w2 / delta[k]);
    } else {
      d[k] = 0.0;
    }
  }
  kmax = size1 - 1;
  d[0] =
      ((2.0 * dh[0] + dh[1]) * delta[0] - dh[0] * delta[1]) / (dh[0] + dh[1]);
  if (d[0] * delta[0] < 0.0) {
    d[0] = 0.0;
  } else {
    if (delta[0] * delta[1] < 0.0 && fabs(d[0]) > fabs(3.0 * delta[0])) {
      d[0] = 3.0 * delta[0];
    }
  }
  d[kmax] = ((2.0 * dh[kmax - 1] + dh[kmax - 2]) * delta[kmax - 1] -
             dh[kmax - 1] * delta[kmax - 2]) /
            (dh[kmax - 1] + dh[kmax - 2]);
  if (d[kmax] * delta[kmax - 1] < 0.0) {
    d[kmax] = 0.0;
  } else {
    if (delta[kmax - 1] * delta[kmax - 2] < 0.0 &&
        fabs(d[kmax]) > fabs(3.0 * delta[kmax - 1])) {
      d[kmax] = 3.0 * delta[kmax - 1];
    }
  }
  b = (double *)malloc((size1 - 1) * sizeof(double));
  c = (double *)malloc((size1 - 1) * sizeof(double));
  for (k = 0; k < size1 - 1; k++) {
    c[k] = (3.0 * delta[k] - 2.0 * d[k] - d[k + 1]) / dh[k];
    b[k] = (d[k] - 2.0 * delta[k] + d[k + 1]) / (dh[k] * dh[k]);
  }
  for (k = 0; k < size2; k++) {
    n = nearest_index(grid2[k], grid1, size1);
    if (grid1[n] < grid2[k]) {
      klo = n;
    } else {
      if (n == 0) {
        klo = n;
      } else {
        klo = n - 1;
      }
    }
    khi = klo + 1;
    s = grid2[k] - grid1[klo];
    data2[k] = data1[klo] + s * (d[klo] + s * (c[klo] + s * b[klo]));
  }
  free(c);
  free(b);
  free(d);
  free(dh);
  free(delta);
}


x86 assembly (clang, -O0):
<cubic_spline_sp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movq   $0x0,-0x50(%rbp)
movl   $0x1,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f4 <cubic_spline_sp+0xa4>
mov    -0x10(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x74(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jb     11e1 <cubic_spline_sp+0x91>
lea    0xe34(%rip),%rdi
call   1040 <error_handler@plt>
jmp    11e6 <cubic_spline_sp+0x96>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11a0 <cubic_spline_sp+0x50>
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    126a <cubic_spline_sp+0x11a>
mov    -0x18(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
ja     124b <cubic_spline_sp+0xfb>
mov    -0x18(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    1257 <cubic_spline_sp+0x107>
lea    0xdf1(%rip),%rdi
call   1040 <error_handler@plt>
jmp    125c <cubic_spline_sp+0x10c>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11fb <cubic_spline_sp+0xab>
cmpl   $0x2,-0x4(%rbp)
jge    1280 <cubic_spline_sp+0x130>
lea    0xdf2(%rip),%rdi
call   1040 <error_handler@plt>
cmpl   $0x2,-0x4(%rbp)
jne    1312 <cubic_spline_sp+0x1c2>
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%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,-0x70(%rbp)
movl   $0x0,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    130d <cubic_spline_sp+0x1bd>
movsd  -0x70(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm2
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    12bc <cubic_spline_sp+0x16c>
jmp    1a51 <cubic_spline_sp+0x901>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13de <cubic_spline_sp+0x28e>
mov    -0x10(%rbp),%rax
mov    -0x78(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x78(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x78(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x78(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x78(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    135a <cubic_spline_sp+0x20a>
movl   $0x1,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14ea <cubic_spline_sp+0x39a>
mov    -0x30(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x78(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    14c7 <cubic_spline_sp+0x377>
mov    -0x40(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x78(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%rax
mov    -0x78(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
addsd  -0x68(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x78(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm1
movsd  -0x68(%rbp),%xmm2
mov    -0x30(%rbp),%rax
movslq -0x78(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    14d7 <cubic_spline_sp+0x387>
mov    -0x38(%rbp),%rax
movslq -0x78(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    14dc <cubic_spline_sp+0x38c>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    13e5 <cubic_spline_sp+0x295>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x88(%rbp)
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
movsd  0x8(%rax),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x30(%rbp),%rax
mulsd  0x8(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x40(%rbp),%rax
addsd  0x8(%rax),%xmm1
divsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x30(%rbp),%rax
mulsd  (%rax),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1591 <cubic_spline_sp+0x441>
mov    -0x38(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    1608 <cubic_spline_sp+0x4b8>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x30(%rbp),%rax
mulsd  0x8(%rax),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1603 <cubic_spline_sp+0x4b3>
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
call   1050 <fabs@plt>
mov    %rax,-0x90(%rbp)
mov    -0x30(%rbp),%rax
movsd  0xa31(%rip),%xmm0
mulsd  (%rax),%xmm0
call   1050 <fabs@plt>
mov    %rax,%rcx
mov    -0x90(%rbp),%rax
cmp    %rcx,%rax
jle    1603 <cubic_spline_sp+0x4b3>
mov    -0x30(%rbp),%rax
movsd  0xa09(%rip),%xmm0
mulsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1608 <cubic_spline_sp+0x4b8>
mov    -0x40(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x40(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    1720 <cubic_spline_sp+0x5d0>
mov    -0x38(%rbp),%rax
movslq -0x88(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    17da <cubic_spline_sp+0x68a>
mov    -0x30(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    17d5 <cubic_spline_sp+0x685>
mov    -0x38(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1050 <fabs@plt>
mov    %rax,-0x98(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0x875(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   1050 <fabs@plt>
mov    %rax,%rcx
mov    -0x98(%rbp),%rax
cmp    %rcx,%rax
jle    17d5 <cubic_spline_sp+0x685>
mov    -0x30(%rbp),%rax
mov    -0x88(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0x840(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    17da <cubic_spline_sp+0x68a>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1902 <cubic_spline_sp+0x7b2>
mov    -0x30(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  0x7cb(%rip),%xmm1
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0x79f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
mov    -0x78(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x78(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x50(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
mov    -0x78(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%rax
movslq -0x78(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    180f <cubic_spline_sp+0x6bf>
movl   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1a24 <cubic_spline_sp+0x8d4>
mov    -0x18(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1070 <nearest_index@plt>
mov    %eax,-0x7c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    1960 <cubic_spline_sp+0x810>
mov    -0x7c(%rbp),%eax
mov    %eax,-0x80(%rbp)
jmp    1983 <cubic_spline_sp+0x833>
cmpl   $0x0,-0x7c(%rbp)
jne    1975 <cubic_spline_sp+0x825>
mov    -0x7c(%rbp),%eax
mov    %eax,-0x80(%rbp)
jmp    197e <cubic_spline_sp+0x82e>
mov    -0x7c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1983 <cubic_spline_sp+0x833>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x80(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x80(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movsd  -0x58(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x80(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm3
movsd  -0x58(%rbp),%xmm2
mov    -0x50(%rbp),%rax
movslq -0x80(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm5
movsd  -0x58(%rbp),%xmm4
mov    -0x48(%rbp),%rax
movslq -0x80(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm6
mulsd  %xmm6,%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1909 <cubic_spline_sp+0x7b9>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cubic_spline_sp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r9,%r13
mov    %r8,0x58(%rsp)
mov    %rcx,0x40(%rsp)
mov    %rdx,%r15
mov    %esi,0x34(%rsp)
mov    %edi,%r12d
cmp    $0x2,%edi
jl     11b2 <cubic_spline_sp+0x62>
mov    %r12d,%ebx
mov    $0x1,%ebp
lea    0xe97(%rip),%r14
jmp    1199 <cubic_spline_sp+0x49>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     11b2 <cubic_spline_sp+0x62>
movsd  -0x8(%r15,%rbp,8),%xmm0
ucomisd (%r15,%rbp,8),%xmm0
jb     1190 <cubic_spline_sp+0x40>
mov    %r14,%rdi
call   1040 <error_handler@plt>
jmp    1190 <cubic_spline_sp+0x40>
mov    %r12,0x28(%rsp)
cmpl   $0x0,0x34(%rsp)
mov    0x40(%rsp),%rcx
jle    1210 <cubic_spline_sp+0xc0>
mov    0x28(%rsp),%rax
add    $0xffffffff,%eax
movslq %eax,%r12
mov    0x34(%rsp),%ebx
xor    %ebp,%ebp
lea    0xe78(%rip),%r14
jmp    11f6 <cubic_spline_sp+0xa6>
nopl   (%rax)
mov    %r14,%rdi
call   1040 <error_handler@plt>
mov    0x40(%rsp),%rcx
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1210 <cubic_spline_sp+0xc0>
movsd  (%rcx,%rbp,8),%xmm0
movsd  (%r15),%xmm1
ucomisd %xmm0,%xmm1
ja     11e0 <cubic_spline_sp+0x90>
ucomisd (%r15,%r12,8),%xmm0
ja     11e0 <cubic_spline_sp+0x90>
jmp    11ed <cubic_spline_sp+0x9d>
mov    0x28(%rsp),%r12
cmp    $0x1,%r12d
jg     1231 <cubic_spline_sp+0xe1>
lea    0xe5b(%rip),%rdi
call   1040 <error_handler@plt>
mov    0x58(%rsp),%rbx
jmp    1321 <cubic_spline_sp+0x1d1>
cmp    $0x2,%r12d
mov    0x58(%rsp),%rbx
jne    1321 <cubic_spline_sp+0x1d1>
mov    0x34(%rsp),%eax
test   %eax,%eax
mov    0x40(%rsp),%rdx
jle    1934 <cubic_spline_sp+0x7e4>
movsd  (%rbx),%xmm1
movsd  0x8(%rbx),%xmm0
subsd  %xmm1,%xmm0
movsd  (%r15),%xmm2
movsd  0x8(%r15),%xmm3
subsd  %xmm2,%xmm3
divsd  %xmm3,%xmm0
movsd  (%rdx),%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,0x0(%r13)
cmp    $0x1,%eax
je     1934 <cubic_spline_sp+0x7e4>
mov    %eax,%eax
lea    -0x1(%rax),%r8
mov    $0x1,%ecx
cmp    $0x4,%r8
jae    1865 <cubic_spline_sp+0x715>
mov    %rcx,%rdx
not    %rdx
test   $0x1,%al
jne    12d1 <cubic_spline_sp+0x181>
mov    0x40(%rsp),%rsi
movsd  (%rsi,%rcx,8),%xmm1
subsd  (%r15),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rbx),%xmm1
movsd  %xmm1,0x0(%r13,%rcx,8)
add    $0x1,%rcx
add    %rax,%rdx
mov    0x40(%rsp),%rdx
je     1934 <cubic_spline_sp+0x7e4>
nop
movsd  (%rdx,%rcx,8),%xmm1
subsd  (%r15),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rbx),%xmm1
movsd  %xmm1,0x0(%r13,%rcx,8)
movsd  0x8(%rdx,%rcx,8),%xmm1
subsd  (%r15),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rbx),%xmm1
movsd  %xmm1,0x8(%r13,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rax
jne    12e0 <cubic_spline_sp+0x190>
jmp    1934 <cubic_spline_sp+0x7e4>
mov    %r15,0x38(%rsp)
lea    -0x1(%r12),%r15d
lea    -0x8(,%r12,8),%r14d
ff
mov    %r14d,%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
mov    %r14d,0x18(%rsp)
mov    %r14d,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0x0(,%r12,8),%edi
call   1060 <malloc@plt>
mov    %rax,%rsi
cmp    $0x2,%r12d
mov    %rbp,0x20(%rsp)
mov    %r14,0x60(%rsp)
mov    %rax,0x10(%rsp)
jl     1434 <cubic_spline_sp+0x2e4>
mov    %r15d,%eax
cmp    $0x2,%r15d
jae    15bc <cubic_spline_sp+0x46c>
xor    %ecx,%ecx
mov    0x38(%rsp),%rdi
nopl   0x0(%rax,%rax,1)
movsd  0x8(%rdi,%rcx,8),%xmm0
subsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
movsd  0x8(%rbx,%rcx,8),%xmm1
subsd  (%rbx,%rcx,8),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%rbp,%rcx,8)
lea    0x1(%rcx),%rdx
mov    %rdx,%rcx
cmp    %rdx,%rax
jne    1390 <cubic_spline_sp+0x240>
cmp    $0x3,%r12d
jl     1434 <cubic_spline_sp+0x2e4>
add    $0xffffffffffffffff,%rax
xor    %ecx,%ecx
jmp    13df <cubic_spline_sp+0x28f>
movsd  %xmm1,0x8(%rsi,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
je     1434 <cubic_spline_sp+0x2e4>
movupd 0x0(%rbp,%rcx,8),%xmm0
movapd %xmm0,%xmm2
unpckhpd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm2
jbe    13d0 <cubic_spline_sp+0x280>
movupd (%r14,%rcx,8),%xmm1
movapd %xmm1,%xmm2
addpd  %xmm1,%xmm2
shufpd $0x1,%xmm2,%xmm2
addpd  %xmm1,%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
addsd  %xmm2,%xmm1
divpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
addsd  %xmm2,%xmm0
divsd  %xmm0,%xmm1
jmp    13d0 <cubic_spline_sp+0x280>
movslq %r15d,%rbx
movsd  (%r14),%xmm1
movsd  0x8(%r14),%xmm2
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
movsd  0x8(%rbp),%xmm3
mulsd  %xmm1,%xmm3
mulsd  0x0(%rbp),%xmm0
subsd  %xmm3,%xmm0
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsi)
movsd  0x0(%rbp),%xmm1
movapd %xmm1,%xmm3
mulsd  %xmm0,%xmm3
xorpd  %xmm2,%xmm2
ucomisd %xmm3,%xmm2
ja     14c3 <cubic_spline_sp+0x373>
mulsd  0x8(%rbp),%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    14c7 <cubic_spline_sp+0x377>
call   1050 <fabs@plt>
mov    %rax,%r14
movsd  0x0(%rbp),%xmm0
mulsd  0xb59(%rip),%xmm0
call   1050 <fabs@plt>
mov    0x10(%rsp),%rsi
cmp    %rax,%r14
jle    14c7 <cubic_spline_sp+0x377>
movsd  0x0(%rbp),%xmm2
mulsd  0xb3d(%rip),%xmm2
movsd  %xmm2,(%rsi)
movslq %r12d,%r14
mov    0x60(%rsp),%rax
movsd  -0x18(%rax,%r14,8),%xmm1
movsd  -0x10(%rax,%r14,8),%xmm2
movapd %xmm2,%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp,%r14,8),%xmm3
mulsd  %xmm2,%xmm3
mulsd  -0x10(%rbp,%r14,8),%xmm0
subsd  %xmm3,%xmm0
addsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
movsd  %xmm0,(%rsi,%rbx,8)
movsd  -0x10(%rbp,%r14,8),%xmm1
movapd %xmm1,%xmm3
mulsd  %xmm0,%xmm3
xorpd  %xmm2,%xmm2
ucomisd %xmm3,%xmm2
ja     1576 <cubic_spline_sp+0x426>
lea    -0x3(%r14),%rax
mulsd  0x0(%rbp,%rax,8),%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    157b <cubic_spline_sp+0x42b>
add    $0xfffffffffffffffe,%r14
call   1050 <fabs@plt>
mov    %rax,0x50(%rsp)
movsd  0x0(%rbp,%r14,8),%xmm0
mulsd  0xaaa(%rip),%xmm0
call   1050 <fabs@plt>
cmp    %rax,0x50(%rsp)
jle    157b <cubic_spline_sp+0x42b>
movsd  0x0(%rbp,%r14,8),%xmm2
mulsd  0xa8f(%rip),%xmm2
mov    0x10(%rsp),%rsi
movsd  %xmm2,(%rsi,%rbx,8)
mov    0x18(%rsp),%ebx
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,%rdi
cmp    $0x2,%r12d
mov    0x60(%rsp),%r11
mov    %rax,0x18(%rsp)
jl     1a1b <cubic_spline_sp+0x8cb>
mov    %r15d,%r9d
cmp    $0x2,%r15d
jae    16d5 <cubic_spline_sp+0x585>
xor    %r8d,%r8d
jmp    198e <cubic_spline_sp+0x83e>
mov    %r15d,0x50(%rsp)
mov    %r13,0x48(%rsp)
lea    (%r14,%rax,8),%rcx
lea    0x0(,%rax,8),%r13
add    %rbp,%r13
mov    0x38(%rsp),%r15
lea    (%r15,%rax,8),%rsi
add    $0x8,%rsi
lea    (%rbx,%rax,8),%rdi
add    $0x8,%rdi
cmp    %r13,%r14
mov    %r14,%rdx
setb   %r14b
cmp    %rcx,%rbp
setb   %r12b
cmp    %rsi,%rdx
setb   %r10b
cmp    %r15,%rcx
seta   %r8b
cmp    %rdi,%rdx
setb   %r11b
cmp    %rbx,%rcx
seta   %r9b
cmp    %rsi,%rbp
setb   %sil
cmp    %r15,%r13
seta   %dl
cmp    %rdi,%rbp
setb   %dil
cmp    %rbx,%r13
seta   %bpl
xor    %ecx,%ecx
test   %r12b,%r14b
jne    1943 <cubic_spline_sp+0x7f3>
and    %r8b,%r10b
mov    0x58(%rsp),%rbx
mov    0x28(%rsp),%r12
mov    0x48(%rsp),%r13
mov    0x60(%rsp),%r14
mov    0x50(%rsp),%r15d
jne    1856 <cubic_spline_sp+0x706>
and    %r9b,%r11b
jne    1856 <cubic_spline_sp+0x706>
and    %dl,%sil
jne    1856 <cubic_spline_sp+0x706>
and    %bpl,%dil
mov    0x20(%rsp),%rbp
mov    0x10(%rsp),%rsi
mov    0x38(%rsp),%rdi
jne    1390 <cubic_spline_sp+0x240>
mov    %eax,%ecx
and    $0xfffffffe,%ecx
xor    %edx,%edx
movupd (%rdi,%rdx,8),%xmm0
movupd 0x8(%rdi,%rdx,8),%xmm1
subpd  %xmm0,%xmm1
movupd %xmm1,(%r14,%rdx,8)
movupd (%rbx,%rdx,8),%xmm0
movupd 0x8(%rbx,%rdx,8),%xmm2
subpd  %xmm0,%xmm2
divpd  %xmm1,%xmm2
movupd %xmm2,0x0(%rbp,%rdx,8)
add    $0x2,%rdx
cmp    %rdx,%rcx
jne    1690 <cubic_spline_sp+0x540>
cmp    %rax,%rcx
jne    1390 <cubic_spline_sp+0x240>
jmp    13c2 <cubic_spline_sp+0x272>
mov    %r13,0x48(%rsp)
lea    (%rdi,%r9,8),%rsi
lea    (%r14,%r9,8),%rbp
mov    0x20(%rsp),%rbx
lea    (%rbx,%r9,8),%rdx
mov    0x10(%rsp),%rcx
lea    (%rcx,%r9,8),%r10
add    $0x8,%r10
lea    (%r11,%r9,8),%r8
cmp    %rbp,%rdi
setb   0xf(%rsp)
cmp    %rsi,%r14
setb   %r15b
cmp    %rdx,%rdi
mov    %r14,%rax
setb   %r14b
cmp    %rsi,%rbx
setb   0xe(%rsp)
cmp    %r10,%rdi
setb   %r13b
cmp    %rsi,%rcx
setb   0xd(%rsp)
cmp    %r8,%rdi
setb   %r12b
cmp    %rsi,%r11
setb   %dil
cmp    %rdx,%rax
setb   %sil
cmp    %rbp,%rbx
setb   %bl
cmp    %r10,%rax
setb   %dl
cmp    %rbp,%rcx
setb   0xc(%rsp)
mov    %rax,%rcx
cmp    %r8,%rax
setb   %r10b
cmp    %rbp,%r11
setb   %al
xor    %r8d,%r8d
test   %r15b,0xf(%rsp)
jne    1970 <cubic_spline_sp+0x820>
and    0xe(%rsp),%r14b
jne    1970 <cubic_spline_sp+0x820>
and    0xd(%rsp),%r13b
mov    %rcx,%r14
jne    197f <cubic_spline_sp+0x82f>
and    %dil,%r12b
mov    0x48(%rsp),%r13
jne    1984 <cubic_spline_sp+0x834>
and    %bl,%sil
mov    0x28(%rsp),%r12
jne    1989 <cubic_spline_sp+0x839>
and    0xc(%rsp),%dl
jne    1989 <cubic_spline_sp+0x839>
and    %al,%r10b
mov    0x18(%rsp),%rdi
jne    198e <cubic_spline_sp+0x83e>
mov    %r9d,%r8d
and    $0xfffffffe,%r8d
xor    %ecx,%ecx
movapd 0x83f(%rip),%xmm0
mov    0x20(%rsp),%rax
mov    0x10(%rsp),%rdx
nopl   0x0(%rax,%rax,1)
movupd (%rax,%rcx,8),%xmm1
movupd (%rdx,%rcx,8),%xmm2
movupd 0x8(%rdx,%rcx,8),%xmm3
addpd  %xmm2,%xmm2
mulpd  %xmm0,%xmm1
subpd  %xmm2,%xmm1
subpd  %xmm3,%xmm1
movupd (%r11,%rcx,8),%xmm2
divpd  %xmm2,%xmm1
movupd %xmm1,(%rdi,%rcx,8)
movupd (%rax,%rcx,8),%xmm1
addpd  %xmm1,%xmm1
movupd (%rdx,%rcx,8),%xmm2
subpd  %xmm1,%xmm2
movupd 0x8(%rdx,%rcx,8),%xmm1
addpd  %xmm2,%xmm1
movupd (%r11,%rcx,8),%xmm2
mulpd  %xmm2,%xmm2
divpd  %xmm2,%xmm1
movupd %xmm1,(%r14,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%r8
jne    17e0 <cubic_spline_sp+0x690>
cmp    %r9,%r8
jne    198e <cubic_spline_sp+0x83e>
jmp    1a1b <cubic_spline_sp+0x8cb>
mov    0x20(%rsp),%rbp
mov    0x10(%rsp),%rsi
jmp    1386 <cubic_spline_sp+0x236>
lea    0x8(%r13),%r9
lea    0x0(,%rax,8),%rdi
add    %r13,%rdi
lea    0x8(%rdx),%r14
lea    (%rdx,%rax,8),%rbp
cmp    %r15,%r13
setb   %r10b
cmp    %r15,%rdi
seta   %r11b
cmp    %rbx,%r13
setb   %dl
cmp    %rbx,%rdi
seta   %sil
cmp    %rbp,%r9
setb   %r9b
cmp    %rdi,%r14
setb   %dil
test   %r11b,%r10b
jne    12a5 <cubic_spline_sp+0x155>
and    %sil,%dl
jne    12a5 <cubic_spline_sp+0x155>
and    %dil,%r9b
mov    0x40(%rsp),%rdx
jne    12a5 <cubic_spline_sp+0x155>
mov    %r8,%rsi
and    $0xfffffffffffffffc,%rsi
lea    0x1(%rsi),%rcx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
movsd  (%r15),%xmm2
unpcklpd %xmm2,%xmm2
movsd  (%rbx),%xmm3
unpcklpd %xmm3,%xmm3
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
movupd 0x8(%rdx,%rdi,8),%xmm4
movupd 0x18(%rdx,%rdi,8),%xmm5
subpd  %xmm2,%xmm4
subpd  %xmm2,%xmm5
mulpd  %xmm1,%xmm4
addpd  %xmm3,%xmm4
mulpd  %xmm1,%xmm5
addpd  %xmm3,%xmm5
movupd %xmm4,0x8(%r13,%rdi,8)
movupd %xmm5,0x18(%r13,%rdi,8)
add    $0x4,%rdi
cmp    %rdi,%rsi
jne    18f0 <cubic_spline_sp+0x7a0>
cmp    %rsi,%r8
jne    12a5 <cubic_spline_sp+0x155>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x58(%rsp),%rbx
mov    0x28(%rsp),%r12
mov    0x20(%rsp),%rbp
mov    0x48(%rsp),%r13
mov    0x60(%rsp),%r14
mov    0x10(%rsp),%rsi
mov    0x38(%rsp),%rdi
mov    0x50(%rsp),%r15d
jmp    1390 <cubic_spline_sp+0x240>
mov    0x48(%rsp),%r13
mov    0x28(%rsp),%r12
mov    %rcx,%r14
jmp    1989 <cubic_spline_sp+0x839>
mov    0x48(%rsp),%r13
mov    0x28(%rsp),%r12
mov    0x18(%rsp),%rdi
lea    (%r14,%r8,8),%rdx
lea    (%rdi,%r8,8),%rsi
lea    (%r11,%r8,8),%rbx
mov    0x10(%rsp),%rax
lea    (%rax,%r8,8),%rbp
add    $0x8,%rbp
mov    0x20(%rsp),%rax
lea    (%rax,%r8,8),%rcx
sub    %r8,%r9
xor    %eax,%eax
movsd  0x643(%rip),%xmm0
nopl   (%rax)
movsd  -0x8(%rbp,%rax,8),%xmm1
addsd  %xmm1,%xmm1
movsd  (%rcx,%rax,8),%xmm2
mulsd  %xmm0,%xmm2
subsd  %xmm1,%xmm2
subsd  0x0(%rbp,%rax,8),%xmm2
divsd  (%rbx,%rax,8),%xmm2
movsd  %xmm2,(%rsi,%rax,8)
movsd  -0x8(%rbp,%rax,8),%xmm1
movsd  (%rcx,%rax,8),%xmm2
addsd  %xmm2,%xmm2
subsd  %xmm2,%xmm1
addsd  0x0(%rbp,%rax,8),%xmm1
movsd  (%rbx,%rax,8),%xmm2
mulsd  %xmm2,%xmm2
divsd  %xmm2,%xmm1
movsd  %xmm1,(%rdx,%rax,8)
add    $0x1,%rax
cmp    %rax,%r9
jne    19c0 <cubic_spline_sp+0x870>
mov    %r14,0x50(%rsp)
mov    0x34(%rsp),%eax
test   %eax,%eax
mov    0x58(%rsp),%rbx
mov    0x40(%rsp),%rdx
mov    0x38(%rsp),%r15
jle    1acc <cubic_spline_sp+0x97c>
mov    %r12,%r14
mov    %eax,%ebp
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rdx,%r12,8),%xmm0
mov    %r15,%rdi
mov    %r14d,%esi
call   1070 <nearest_index@plt>
mov    0x18(%rsp),%rdi
mov    0x40(%rsp),%rdx
cltq
mov    %eax,%ecx
sub    $0x1,%ecx
mov    $0x0,%esi
cmovb  %esi,%ecx
movsd  (%rdx,%r12,8),%xmm0
ucomisd (%r15,%rax,8),%xmm0
cmova  %eax,%ecx
movslq %ecx,%rax
subsd  (%r15,%rax,8),%xmm0
mov    0x50(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rdi,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
mov    0x10(%rsp),%rcx
addsd  (%rcx,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
addsd  (%rbx,%rax,8),%xmm1
movsd  %xmm1,0x0(%r13,%r12,8)
add    $0x1,%r12
cmp    %r12,%rbp
jne    1a50 <cubic_spline_sp+0x900>
call   1030 <free@plt>
mov    0x50(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x60(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"cubic_spline_sp: grid1 is not monotonic increasing\00"
@.str.1 = [42 x i8] c"cubic_spline_sp: grid2 lies outside grid1\00"
@.str.2 = [61 x i8] c"cubic_spline_sp: the size of input grid should be at least 2\00"
define void @cubic_spline_sp(i32 %0, i32 %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%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 double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
store double* null, double** %13
store double* null, double** %14
store double* null, double** %15
store double* null, double** %16
store double* null, double** %17
store i32 1, i32* %22
br label %28
28: ; preds = %48, %6
%29 = load i32, i32* %22
%30 = load i32, i32* %7
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %51
32: ; preds = %28
%33 = load double*, double** %9
%34 = load i32, i32* %22
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = load double*, double** %9
%39 = load i32, i32* %22
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %38, i64 %41
%43 = load double, double* %42
%44 = fcmp ole double %37, %43
br i1 %44, label %45, label %47
45: ; preds = %32
%46 = call i32 @error_handler(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %47
47: ; preds = %45, %32
br label %48
48: ; preds = %47
%49 = load i32, i32* %22
%50 = add nsw i32 %49, 1
store i32 %50, i32* %22
br label %28
51: ; preds = %28
store i32 0, i32* %22
br label %52
52: ; preds = %82, %51
%53 = load i32, i32* %22
%54 = load i32, i32* %8
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %85
56: ; preds = %52
%57 = load double*, double** %10
%58 = load i32, i32* %22
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
%61 = load double, double* %60
%62 = load double*, double** %9
%63 = getelementptr inbounds double, double* %62, i64 0
%64 = load double, double* %63
%65 = fcmp olt double %61, %64
br i1 %65, label %79, label %66
66: ; preds = %56
%67 = load double*, double** %10
%68 = load i32, i32* %22
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %67, i64 %69
%71 = load double, double* %70
%72 = load double*, double** %9
%73 = load i32, i32* %7
%74 = sub nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %72, i64 %75
%77 = load double, double* %76
%78 = fcmp ogt double %71, %77
br i1 %78, label %79, label %81
79: ; preds = %66, %56
%80 = call i32 @error_handler(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
br label %81
81: ; preds = %79, %66
br label %82
82: ; preds = %81
%83 = load i32, i32* %22
%84 = add nsw i32 %83, 1
store i32 %84, i32* %22
br label %52
85: ; preds = %52
%86 = load i32, i32* %7
%87 = icmp slt i32 %86, 2
br i1 %87, label %88, label %90
88: ; preds = %85
%89 = call i32 @error_handler(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
br label %90
90: ; preds = %88, %85
%91 = load i32, i32* %7
%92 = icmp eq i32 %91, 2
br i1 %92, label %93, label %136
93: ; preds = %90
%94 = load double*, double** %11
%95 = getelementptr inbounds double, double* %94, i64 1
%96 = load double, double* %95
%97 = load double*, double** %11
%98 = getelementptr inbounds double, double* %97, i64 0
%99 = load double, double* %98
%100 = fsub double %96, %99
%101 = load double*, double** %9
%102 = getelementptr inbounds double, double* %101, i64 1
%103 = load double, double* %102
%104 = load double*, double** %9
%105 = getelementptr inbounds double, double* %104, i64 0
%106 = load double, double* %105
%107 = fsub double %103, %106
%108 = fdiv double %100, %107
store double %108, double* %21
store i32 0, i32* %22
br label %109
109: ; preds = %132, %93
%110 = load i32, i32* %22
%111 = load i32, i32* %8
%112 = icmp slt i32 %110, %111
br i1 %112, label %113, label %135
113: ; preds = %109
%114 = load double, double* %21
%115 = load double*, double** %10
%116 = load i32, i32* %22
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %115, i64 %117
%119 = load double, double* %118
%120 = load double*, double** %9
%121 = getelementptr inbounds double, double* %120, i64 0
%122 = load double, double* %121
%123 = fsub double %119, %122
%124 = load double*, double** %11
%125 = getelementptr inbounds double, double* %124, i64 0
%126 = load double, double* %125
%127 = call double @llvm.fmuladd.f64(double %114, double %123, double %126)
%128 = load double*, double** %12
%129 = load i32, i32* %22
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %128, i64 %130
store double %127, double* %131
br label %132
132: ; preds = %113
%133 = load i32, i32* %22
%134 = add nsw i32 %133, 1
store i32 %134, i32* %22
br label %109
135: ; preds = %109
br label %650
136: ; preds = %90
%137 = load i32, i32* %7
%138 = sub nsw i32 %137, 1
%139 = sext i32 %138 to i64
%140 = mul i64 %139, 8
%141 = trunc i64 %140 to i32
%142 = call i64 @malloc(i32 %141)
%143 = inttoptr i64 %142 to double*
store double* %143, double** %13
%144 = load i32, i32* %7
%145 = sub nsw i32 %144, 1
%146 = sext i32 %145 to i64
%147 = mul i64 %146, 8
%148 = trunc i64 %147 to i32
%149 = call i64 @malloc(i32 %148)
%150 = inttoptr i64 %149 to double*
store double* %150, double** %15
%151 = load i32, i32* %7
%152 = sext i32 %151 to i64
%153 = mul i64 %152, 8
%154 = trunc i64 %153 to i32
%155 = call i64 @malloc(i32 %154)
%156 = inttoptr i64 %155 to double*
store double* %156, double** %14
store i32 0, i32* %23
br label %157
157: ; preds = %201, %136
%158 = load i32, i32* %23
%159 = load i32, i32* %7
%160 = sub nsw i32 %159, 1
%161 = icmp slt i32 %158, %160
br i1 %161, label %162, label %204
162: ; preds = %157
%163 = load double*, double** %9
%164 = load i32, i32* %23
%165 = add nsw i32 %164, 1
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds double, double* %163, i64 %166
%168 = load double, double* %167
%169 = load double*, double** %9
%170 = load i32, i32* %23
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds double, double* %169, i64 %171
%173 = load double, double* %172
%174 = fsub double %168, %173
%175 = load double*, double** %15
%176 = load i32, i32* %23
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds double, double* %175, i64 %177
store double %174, double* %178
%179 = load double*, double** %11
%180 = load i32, i32* %23
%181 = add nsw i32 %180, 1
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds double, double* %179, i64 %182
%184 = load double, double* %183
%185 = load double*, double** %11
%186 = load i32, i32* %23
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds double, double* %185, i64 %187
%189 = load double, double* %188
%190 = fsub double %184, %189
%191 = load double*, double** %15
%192 = load i32, i32* %23
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds double, double* %191, i64 %193
%195 = load double, double* %194
%196 = fdiv double %190, %195
%197 = load double*, double** %13
%198 = load i32, i32* %23
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds double, double* %197, i64 %199
store double %196, double* %200
br label %201
201: ; preds = %162
%202 = load i32, i32* %23
%203 = add nsw i32 %202, 1
store i32 %203, i32* %23
br label %157
204: ; preds = %157
store i32 1, i32* %23
br label %205
205: ; preds = %279, %204
%206 = load i32, i32* %23
%207 = load i32, i32* %7
%208 = sub nsw i32 %207, 1
%209 = icmp slt i32 %206, %208
br i1 %209, label %210, label %282
210: ; preds = %205
%211 = load double*, double** %13
%212 = load i32, i32* %23
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds double, double* %211, i64 %213
%215 = load double, double* %214
%216 = load double*, double** %13
%217 = load i32, i32* %23
%218 = sub nsw i32 %217, 1
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds double, double* %216, i64 %219
%221 = load double, double* %220
%222 = fmul double %215, %221
%223 = fcmp ogt double %222, 0.000000e+00
br i1 %223, label %224, label %273
224: ; preds = %210
%225 = load double*, double** %15
%226 = load i32, i32* %23
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds double, double* %225, i64 %227
%229 = load double, double* %228
%230 = load double*, double** %15
%231 = load i32, i32* %23
%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 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %229, double %235)
store double %236, double* %19
%237 = load double*, double** %15
%238 = load i32, i32* %23
%239 = sext i32 %238 to i64
%240 = getelementptr inbounds double, double* %237, i64 %239
%241 = load double, double* %240
%242 = load double*, double** %15
%243 = load i32, i32* %23
%244 = sub nsw i32 %243, 1
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds double, double* %242, i64 %245
%247 = load double, double* %246
%248 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %247, double %241)
store double %248, double* %20
%249 = load double, double* %19
%250 = load double, double* %20
%251 = fadd double %249, %250
%252 = load double, double* %19
%253 = load double*, double** %13
%254 = load i32, i32* %23
%255 = sub nsw i32 %254, 1
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds double, double* %253, i64 %256
%258 = load double, double* %257
%259 = fdiv double %252, %258
%260 = load double, double* %20
%261 = load double*, double** %13
%262 = load i32, i32* %23
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds double, double* %261, i64 %263
%265 = load double, double* %264
%266 = fdiv double %260, %265
%267 = fadd double %259, %266
%268 = fdiv double %251, %267
%269 = load double*, double** %14
%270 = load i32, i32* %23
%271 = sext i32 %270 to i64
%272 = getelementptr inbounds double, double* %269, i64 %271
store double %268, double* %272
br label %278
273: ; preds = %210
%274 = load double*, double** %14
%275 = load i32, i32* %23
%276 = sext i32 %275 to i64
%277 = getelementptr inbounds double, double* %274, i64 %276
store double 0.000000e+00, double* %277
br label %278
278: ; preds = %273, %224
br label %279
279: ; preds = %278
%280 = load i32, i32* %23
%281 = add nsw i32 %280, 1
store i32 %281, i32* %23
br label %205
282: ; preds = %205
%283 = load i32, i32* %7
%284 = sub nsw i32 %283, 1
store i32 %284, i32* %27
%285 = load double*, double** %15
%286 = getelementptr inbounds double, double* %285, i64 0
%287 = load double, double* %286
%288 = load double*, double** %15
%289 = getelementptr inbounds double, double* %288, i64 1
%290 = load double, double* %289
%291 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %287, double %290)
%292 = load double*, double** %13
%293 = getelementptr inbounds double, double* %292, i64 0
%294 = load double, double* %293
%295 = load double*, double** %15
%296 = getelementptr inbounds double, double* %295, i64 0
%297 = load double, double* %296
%298 = load double*, double** %13
%299 = getelementptr inbounds double, double* %298, i64 1
%300 = load double, double* %299
%301 = fmul double %297, %300
%302 = fneg double %301
%303 = call double @llvm.fmuladd.f64(double %291, double %294, double %302)
%304 = load double*, double** %15
%305 = getelementptr inbounds double, double* %304, i64 0
%306 = load double, double* %305
%307 = load double*, double** %15
%308 = getelementptr inbounds double, double* %307, i64 1
%309 = load double, double* %308
%310 = fadd double %306, %309
%311 = fdiv double %303, %310
%312 = load double*, double** %14
%313 = getelementptr inbounds double, double* %312, i64 0
store double %311, double* %313
%314 = load double*, double** %14
%315 = getelementptr inbounds double, double* %314, i64 0
%316 = load double, double* %315
%317 = load double*, double** %13
%318 = getelementptr inbounds double, double* %317, i64 0
%319 = load double, double* %318
%320 = fmul double %316, %319
%321 = fcmp olt double %320, 0.000000e+00
br i1 %321, label %322, label %325
322: ; preds = %282
%323 = load double*, double** %14
%324 = getelementptr inbounds double, double* %323, i64 0
store double 0.000000e+00, double* %324
br label %353
325: ; preds = %282
%326 = load double*, double** %13
%327 = getelementptr inbounds double, double* %326, i64 0
%328 = load double, double* %327
%329 = load double*, double** %13
%330 = getelementptr inbounds double, double* %329, i64 1
%331 = load double, double* %330
%332 = fmul double %328, %331
%333 = fcmp olt double %332, 0.000000e+00
br i1 %333, label %334, label %352
334: ; preds = %325
%335 = load double*, double** %14
%336 = getelementptr inbounds double, double* %335, i64 0
%337 = load double, double* %336
%338 = call i64 @fabs(double %337)
%339 = load double*, double** %13
%340 = getelementptr inbounds double, double* %339, i64 0
%341 = load double, double* %340
%342 = fmul double 3.000000e+00, %341
%343 = call i64 @fabs(double %342)
%344 = icmp sgt i64 %338, %343
br i1 %344, label %345, label %352
345: ; preds = %334
%346 = load double*, double** %13
%347 = getelementptr inbounds double, double* %346, i64 0
%348 = load double, double* %347
%349 = fmul double 3.000000e+00, %348
%350 = load double*, double** %14
%351 = getelementptr inbounds double, double* %350, i64 0
store double %349, double* %351
br label %352
352: ; preds = %345, %334, %325
br label %353
353: ; preds = %352, %322
%354 = load double*, double** %15
%355 = load i32, i32* %27
%356 = sub nsw i32 %355, 1
%357 = sext i32 %356 to i64
%358 = getelementptr inbounds double, double* %354, i64 %357
%359 = load double, double* %358
%360 = load double*, double** %15
%361 = load i32, i32* %27
%362 = sub nsw i32 %361, 2
%363 = sext i32 %362 to i64
%364 = getelementptr inbounds double, double* %360, i64 %363
%365 = load double, double* %364
%366 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %359, double %365)
%367 = load double*, double** %13
%368 = load i32, i32* %27
%369 = sub nsw i32 %368, 1
%370 = sext i32 %369 to i64
%371 = getelementptr inbounds double, double* %367, i64 %370
%372 = load double, double* %371
%373 = load double*, double** %15
%374 = load i32, i32* %27
%375 = sub nsw i32 %374, 1
%376 = sext i32 %375 to i64
%377 = getelementptr inbounds double, double* %373, i64 %376
%378 = load double, double* %377
%379 = load double*, double** %13
%380 = load i32, i32* %27
%381 = sub nsw i32 %380, 2
%382 = sext i32 %381 to i64
%383 = getelementptr inbounds double, double* %379, i64 %382
%384 = load double, double* %383
%385 = fmul double %378, %384
%386 = fneg double %385
%387 = call double @llvm.fmuladd.f64(double %366, double %372, double %386)
%388 = load double*, double** %15
%389 = load i32, i32* %27
%390 = sub nsw i32 %389, 1
%391 = sext i32 %390 to i64
%392 = getelementptr inbounds double, double* %388, i64 %391
%393 = load double, double* %392
%394 = load double*, double** %15
%395 = load i32, i32* %27
%396 = sub nsw i32 %395, 2
%397 = sext i32 %396 to i64
%398 = getelementptr inbounds double, double* %394, i64 %397
%399 = load double, double* %398
%400 = fadd double %393, %399
%401 = fdiv double %387, %400
%402 = load double*, double** %14
%403 = load i32, i32* %27
%404 = sext i32 %403 to i64
%405 = getelementptr inbounds double, double* %402, i64 %404
store double %401, double* %405
%406 = load double*, double** %14
%407 = load i32, i32* %27
%408 = sext i32 %407 to i64
%409 = getelementptr inbounds double, double* %406, i64 %408
%410 = load double, double* %409
%411 = load double*, double** %13
%412 = load i32, i32* %27
%413 = sub nsw i32 %412, 1
%414 = sext i32 %413 to i64
%415 = getelementptr inbounds double, double* %411, i64 %414
%416 = load double, double* %415
%417 = fmul double %410, %416
%418 = fcmp olt double %417, 0.000000e+00
br i1 %418, label %419, label %424
419: ; preds = %353
%420 = load double*, double** %14
%421 = load i32, i32* %27
%422 = sext i32 %421 to i64
%423 = getelementptr inbounds double, double* %420, i64 %422
store double 0.000000e+00, double* %423
br label %468
424: ; preds = %353
%425 = load double*, double** %13
%426 = load i32, i32* %27
%427 = sub nsw i32 %426, 1
%428 = sext i32 %427 to i64
%429 = getelementptr inbounds double, double* %425, i64 %428
%430 = load double, double* %429
%431 = load double*, double** %13
%432 = load i32, i32* %27
%433 = sub nsw i32 %432, 2
%434 = sext i32 %433 to i64
%435 = getelementptr inbounds double, double* %431, i64 %434
%436 = load double, double* %435
%437 = fmul double %430, %436
%438 = fcmp olt double %437, 0.000000e+00
br i1 %438, label %439, label %467
439: ; preds = %424
%440 = load double*, double** %14
%441 = load i32, i32* %27
%442 = sext i32 %441 to i64
%443 = getelementptr inbounds double, double* %440, i64 %442
%444 = load double, double* %443
%445 = call i64 @fabs(double %444)
%446 = load double*, double** %13
%447 = load i32, i32* %27
%448 = sub nsw i32 %447, 1
%449 = sext i32 %448 to i64
%450 = getelementptr inbounds double, double* %446, i64 %449
%451 = load double, double* %450
%452 = fmul double 3.000000e+00, %451
%453 = call i64 @fabs(double %452)
%454 = icmp sgt i64 %445, %453
br i1 %454, label %455, label %467
455: ; preds = %439
%456 = load double*, double** %13
%457 = load i32, i32* %27
%458 = sub nsw i32 %457, 1
%459 = sext i32 %458 to i64
%460 = getelementptr inbounds double, double* %456, i64 %459
%461 = load double, double* %460
%462 = fmul double 3.000000e+00, %461
%463 = load double*, double** %14
%464 = load i32, i32* %27
%465 = sext i32 %464 to i64
%466 = getelementptr inbounds double, double* %463, i64 %465
store double %462, double* %466
br label %467
467: ; preds = %455, %439, %424
br label %468
468: ; preds = %467, %419
%469 = load i32, i32* %7
%470 = sub nsw i32 %469, 1
%471 = sext i32 %470 to i64
%472 = mul i64 %471, 8
%473 = trunc i64 %472 to i32
%474 = call i64 @malloc(i32 %473)
%475 = inttoptr i64 %474 to double*
store double* %475, double** %16
%476 = load i32, i32* %7
%477 = sub nsw i32 %476, 1
%478 = sext i32 %477 to i64
%479 = mul i64 %478, 8
%480 = trunc i64 %479 to i32
%481 = call i64 @malloc(i32 %480)
%482 = inttoptr i64 %481 to double*
store double* %482, double** %17
store i32 0, i32* %23
br label %483
483: ; preds = %553, %468
%484 = load i32, i32* %23
%485 = load i32, i32* %7
%486 = sub nsw i32 %485, 1
%487 = icmp slt i32 %484, %486
br i1 %487, label %488, label %556
488: ; preds = %483
%489 = load double*, double** %13
%490 = load i32, i32* %23
%491 = sext i32 %490 to i64
%492 = getelementptr inbounds double, double* %489, i64 %491
%493 = load double, double* %492
%494 = load double*, double** %14
%495 = load i32, i32* %23
%496 = sext i32 %495 to i64
%497 = getelementptr inbounds double, double* %494, i64 %496
%498 = load double, double* %497
%499 = fmul double 2.000000e+00, %498
%500 = fneg double %499
%501 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %493, double %500)
%502 = load double*, double** %14
%503 = load i32, i32* %23
%504 = add nsw i32 %503, 1
%505 = sext i32 %504 to i64
%506 = getelementptr inbounds double, double* %502, i64 %505
%507 = load double, double* %506
%508 = fsub double %501, %507
%509 = load double*, double** %15
%510 = load i32, i32* %23
%511 = sext i32 %510 to i64
%512 = getelementptr inbounds double, double* %509, i64 %511
%513 = load double, double* %512
%514 = fdiv double %508, %513
%515 = load double*, double** %17
%516 = load i32, i32* %23
%517 = sext i32 %516 to i64
%518 = getelementptr inbounds double, double* %515, i64 %517
store double %514, double* %518
%519 = load double*, double** %14
%520 = load i32, i32* %23
%521 = sext i32 %520 to i64
%522 = getelementptr inbounds double, double* %519, i64 %521
%523 = load double, double* %522
%524 = load double*, double** %13
%525 = load i32, i32* %23
%526 = sext i32 %525 to i64
%527 = getelementptr inbounds double, double* %524, i64 %526
%528 = load double, double* %527
%529 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %528, double %523)
%530 = load double*, double** %14
%531 = load i32, i32* %23
%532 = add nsw i32 %531, 1
%533 = sext i32 %532 to i64
%534 = getelementptr inbounds double, double* %530, i64 %533
%535 = load double, double* %534
%536 = fadd double %529, %535
%537 = load double*, double** %15
%538 = load i32, i32* %23
%539 = sext i32 %538 to i64
%540 = getelementptr inbounds double, double* %537, i64 %539
%541 = load double, double* %540
%542 = load double*, double** %15
%543 = load i32, i32* %23
%544 = sext i32 %543 to i64
%545 = getelementptr inbounds double, double* %542, i64 %544
%546 = load double, double* %545
%547 = fmul double %541, %546
%548 = fdiv double %536, %547
%549 = load double*, double** %16
%550 = load i32, i32* %23
%551 = sext i32 %550 to i64
%552 = getelementptr inbounds double, double* %549, i64 %551
store double %548, double* %552
br label %553
553: ; preds = %488
%554 = load i32, i32* %23
%555 = add nsw i32 %554, 1
store i32 %555, i32* %23
br label %483
556: ; preds = %483
store i32 0, i32* %23
br label %557
557: ; preds = %636, %556
%558 = load i32, i32* %23
%559 = load i32, i32* %8
%560 = icmp slt i32 %558, %559
br i1 %560, label %561, label %639
561: ; preds = %557
%562 = load double*, double** %10
%563 = load i32, i32* %23
%564 = sext i32 %563 to i64
%565 = getelementptr inbounds double, double* %562, i64 %564
%566 = load double, double* %565
%567 = load double*, double** %9
%568 = load i32, i32* %7
%569 = call i32 @nearest_index(double %566, double* %567, i32 %568)
store i32 %569, i32* %24
%570 = load double*, double** %9
%571 = load i32, i32* %24
%572 = sext i32 %571 to i64
%573 = getelementptr inbounds double, double* %570, i64 %572
%574 = load double, double* %573
%575 = load double*, double** %10
%576 = load i32, i32* %23
%577 = sext i32 %576 to i64
%578 = getelementptr inbounds double, double* %575, i64 %577
%579 = load double, double* %578
%580 = fcmp olt double %574, %579
br i1 %580, label %581, label %583
581: ; preds = %561
%582 = load i32, i32* %24
store i32 %582, i32* %25
br label %592
583: ; preds = %561
%584 = load i32, i32* %24
%585 = icmp eq i32 %584, 0
br i1 %585, label %586, label %588
586: ; preds = %583
%587 = load i32, i32* %24
store i32 %587, i32* %25
br label %591
588: ; preds = %583
%589 = load i32, i32* %24
%590 = sub nsw i32 %589, 1
store i32 %590, i32* %25
br label %591
591: ; preds = %588, %586
br label %592
592: ; preds = %591, %581
%593 = load i32, i32* %25
%594 = add nsw i32 %593, 1
store i32 %594, i32* %26
%595 = load double*, double** %10
%596 = load i32, i32* %23
%597 = sext i32 %596 to i64
%598 = getelementptr inbounds double, double* %595, i64 %597
%599 = load double, double* %598
%600 = load double*, double** %9
%601 = load i32, i32* %25
%602 = sext i32 %601 to i64
%603 = getelementptr inbounds double, double* %600, i64 %602
%604 = load double, double* %603
%605 = fsub double %599, %604
store double %605, double* %18
%606 = load double*, double** %11
%607 = load i32, i32* %25
%608 = sext i32 %607 to i64
%609 = getelementptr inbounds double, double* %606, i64 %608
%610 = load double, double* %609
%611 = load double, double* %18
%612 = load double*, double** %14
%613 = load i32, i32* %25
%614 = sext i32 %613 to i64
%615 = getelementptr inbounds double, double* %612, i64 %614
%616 = load double, double* %615
%617 = load double, double* %18
%618 = load double*, double** %17
%619 = load i32, i32* %25
%620 = sext i32 %619 to i64
%621 = getelementptr inbounds double, double* %618, i64 %620
%622 = load double, double* %621
%623 = load double, double* %18
%624 = load double*, double** %16
%625 = load i32, i32* %25
%626 = sext i32 %625 to i64
%627 = getelementptr inbounds double, double* %624, i64 %626
%628 = load double, double* %627
%629 = call double @llvm.fmuladd.f64(double %623, double %628, double %622)
%630 = call double @llvm.fmuladd.f64(double %617, double %629, double %616)
%631 = call double @llvm.fmuladd.f64(double %611, double %630, double %610)
%632 = load double*, double** %12
%633 = load i32, i32* %23
%634 = sext i32 %633 to i64
%635 = getelementptr inbounds double, double* %632, i64 %634
store double %631, double* %635
br label %636
636: ; preds = %592
%637 = load i32, i32* %23
%638 = add nsw i32 %637, 1
store i32 %638, i32* %23
br label %557
639: ; preds = %557
%640 = load double*, double** %17
%641 = call i32 @free(double* %640)
%642 = load double*, double** %16
%643 = call i32 @free(double* %642)
%644 = load double*, double** %14
%645 = call i32 @free(double* %644)
%646 = load double*, double** %15
%647 = call i32 @free(double* %646)
%648 = load double*, double** %13
%649 = call i32 @free(double* %648)
br label %650
650: ; preds = %639, %135
ret void
}

LLVM IR (-O2):
@.str = [51 x i8] c"cubic_spline_sp: grid1 is not monotonic increasing\00"
@.str.1 = [42 x i8] c"cubic_spline_sp: grid2 lies outside grid1\00"
@.str.2 = [61 x i8] c"cubic_spline_sp: the size of input grid should be at least 2\00"
define void @cubic_spline_sp(i32 %0, i32 %1, double* %2, double* nocapture %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = zext i32 %0 to i64
br label %17
10: ; preds = %27, %6
%11 = icmp sgt i32 %1, 0
br i1 %11, label %12, label %44
12: ; preds = %10
%13 = add nsw i32 %0, -1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %2, i64 %14
%16 = zext i32 %1 to i64
br label %30
17: ; preds = %8, %27
%18 = phi i64 [ 1, %8 ], [ %28, %27 ]
%19 = getelementptr inbounds double, double* %2, i64 %18
%20 = load double, double* %19
%21 = add nsw i64 %18, -1
%22 = getelementptr inbounds double, double* %2, i64 %21
%23 = load double, double* %22
%24 = fcmp ugt double %20, %23
br i1 %24, label %27, label %25
25: ; preds = %17
%26 = tail call i32 @error_handler(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %17, %25
%28 = add nuw nsw i64 %18, 1
%29 = icmp eq i64 %28, %9
br i1 %29, label %10, label %17
30: ; preds = %12, %41
%31 = phi i64 [ 0, %12 ], [ %42, %41 ]
%32 = getelementptr inbounds double, double* %3, i64 %31
%33 = load double, double* %32
%34 = load double, double* %2
%35 = fcmp olt double %33, %34
br i1 %35, label %39, label %36
36: ; preds = %30
%37 = load double, double* %15
%38 = fcmp ogt double %33, %37
br i1 %38, label %39, label %41
39: ; preds = %36, %30
%40 = tail call i32 @error_handler(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %36, %39
%42 = add nuw nsw i64 %31, 1
%43 = icmp eq i64 %42, %16
br i1 %43, label %44, label %30
44: ; preds = %41, %10
%45 = icmp slt i32 %0, 2
br i1 %45, label %46, label %48
46: ; preds = %44
%47 = tail call i32 @error_handler(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
br label %160
48: ; preds = %44
%49 = icmp eq i32 %0, 2
br i1 %49, label %50, label %160
50: ; preds = %48
%51 = getelementptr inbounds double, double* %4, i64 1
%52 = load double, double* %51
%53 = load double, double* %4
%54 = fsub double %52, %53
%55 = getelementptr inbounds double, double* %2, i64 1
%56 = load double, double* %55
%57 = load double, double* %2
%58 = fsub double %56, %57
%59 = fdiv double %54, %58
br i1 %11, label %60, label %514
60: ; preds = %50
%61 = zext i32 %1 to i64
%62 = load double, double* %3
%63 = fsub double %62, %57
%64 = tail call double @llvm.fmuladd.f64(double %59, double %63, double %53)
store double %64, double* %5
%65 = icmp eq i32 %1, 1
br i1 %65, label %514, label %66
66: ; preds = %60
%67 = add nsw i64 %61, -1
%68 = icmp ult i64 %67, 4
br i1 %68, label %123, label %69
69: ; preds = %66
%70 = getelementptr double, double* %5, i64 1
%71 = getelementptr double, double* %5, i64 %61
%72 = getelementptr double, double* %3, i64 1
%73 = getelementptr double, double* %3, i64 %61
%74 = icmp ult double* %5, %2
%75 = icmp ugt double* %71, %2
%76 = and i1 %74, %75
%77 = icmp ult double* %5, %4
%78 = icmp ugt double* %71, %4
%79 = and i1 %77, %78
%80 = or i1 %76, %79
%81 = icmp ult double* %70, %73
%82 = icmp ult double* %72, %71
%83 = and i1 %81, %82
%84 = or i1 %80, %83
br i1 %84, label %123, label %85
85: ; preds = %69
%86 = and i64 %67, -4
%87 = or i64 %86, 1
%88 = insertelement <2 x double> poison, double %59, i64 0
%89 = shufflevector <2 x double> %88, <2 x double> poison, <2 x i32> zeroinitializer
%90 = insertelement <2 x double> poison, double %59, i64 0
%91 = shufflevector <2 x double> %90, <2 x double> poison, <2 x i32> zeroinitializer
%92 = load double, double* %2
%93 = insertelement <2 x double> poison, double %92, i64 0
%94 = shufflevector <2 x double> %93, <2 x double> poison, <2 x i32> zeroinitializer
%95 = insertelement <2 x double> poison, double %92, i64 0
%96 = shufflevector <2 x double> %95, <2 x double> poison, <2 x i32> zeroinitializer
%97 = load double, double* %4
%98 = insertelement <2 x double> poison, double %97, i64 0
%99 = shufflevector <2 x double> %98, <2 x double> poison, <2 x i32> zeroinitializer
%100 = insertelement <2 x double> poison, double %97, i64 0
%101 = shufflevector <2 x double> %100, <2 x double> poison, <2 x i32> zeroinitializer
br label %102
102: ; preds = %102, %85
%103 = phi i64 [ 0, %85 ], [ %119, %102 ]
%104 = or i64 %103, 1
%105 = getelementptr inbounds double, double* %3, i64 %104
%106 = bitcast double* %105 to <2 x double>*
%107 = load <2 x double>, <2 x double>* %106
%108 = getelementptr inbounds double, double* %105, i64 2
%109 = bitcast double* %108 to <2 x double>*
%110 = load <2 x double>, <2 x double>* %109
%111 = fsub <2 x double> %107, %94
%112 = fsub <2 x double> %110, %96
%113 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %89, <2 x double> %111, <2 x double> %99)
%114 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %91, <2 x double> %112, <2 x double> %101)
%115 = getelementptr inbounds double, double* %5, i64 %104
%116 = bitcast double* %115 to <2 x double>*
store <2 x double> %113, <2 x double>* %116
%117 = getelementptr inbounds double, double* %115, i64 2
%118 = bitcast double* %117 to <2 x double>*
store <2 x double> %114, <2 x double>* %118
%119 = add nuw i64 %103, 4
%120 = icmp eq i64 %119, %86
br i1 %120, label %121, label %102
121: ; preds = %102
%122 = icmp eq i64 %67, %86
br i1 %122, label %514, label %123
123: ; preds = %69, %66, %121
%124 = phi i64 [ 1, %69 ], [ 1, %66 ], [ %87, %121 ]
%125 = xor i64 %124, -1
%126 = and i64 %61, 1
%127 = icmp eq i64 %126, 0
br i1 %127, label %128, label %137
128: ; preds = %123
%129 = load double, double* %2
%130 = load double, double* %4
%131 = getelementptr inbounds double, double* %3, i64 %124
%132 = load double, double* %131
%133 = fsub double %132, %129
%134 = tail call double @llvm.fmuladd.f64(double %59, double %133, double %130)
%135 = getelementptr inbounds double, double* %5, i64 %124
store double %134, double* %135
%136 = add nuw nsw i64 %124, 1
br label %137
137: ; preds = %128, %123
%138 = phi i64 [ %124, %123 ], [ %136, %128 ]
%139 = sub nsw i64 0, %61
%140 = icmp eq i64 %125, %139
br i1 %140, label %514, label %141
141: ; preds = %137, %141
%142 = phi i64 [ %158, %141 ], [ %138, %137 ]
%143 = load double, double* %2
%144 = load double, double* %4
%145 = getelementptr inbounds double, double* %3, i64 %142
%146 = load double, double* %145
%147 = fsub double %146, %143
%148 = tail call double @llvm.fmuladd.f64(double %59, double %147, double %144)
%149 = getelementptr inbounds double, double* %5, i64 %142
store double %148, double* %149
%150 = add nuw nsw i64 %142, 1
%151 = load double, double* %2
%152 = load double, double* %4
%153 = getelementptr inbounds double, double* %3, i64 %150
%154 = load double, double* %153
%155 = fsub double %154, %151
%156 = tail call double @llvm.fmuladd.f64(double %59, double %155, double %152)
%157 = getelementptr inbounds double, double* %5, i64 %150
store double %156, double* %157
%158 = add nuw nsw i64 %142, 2
%159 = icmp eq i64 %158, %61
br i1 %159, label %514, label %141
160: ; preds = %46, %48
%161 = add nsw i32 %0, -1
%162 = sext i32 %161 to i64
%163 = shl i32 %161, 3
%164 = tail call i64 @malloc(i32 %163)
%165 = inttoptr i64 %164 to double*
%166 = inttoptr i64 %164 to i8*
%167 = tail call i64 @malloc(i32 %163)
%168 = inttoptr i64 %167 to double*
%169 = inttoptr i64 %167 to i8*
%170 = shl i32 %0, 3
%171 = tail call i64 @malloc(i32 %170)
%172 = inttoptr i64 %171 to double*
%173 = inttoptr i64 %171 to i8*
br i1 %7, label %174, label %286
174: ; preds = %160
%175 = zext i32 %161 to i64
%176 = icmp ult i32 %161, 2
br i1 %176, label %234, label %177
177: ; preds = %174
%178 = getelementptr double, double* %168, i64 %175
%179 = bitcast double* %178 to i8*
%180 = getelementptr double, double* %165, i64 %175
%181 = bitcast double* %180 to i8*
%182 = add nuw nsw i64 %175, 1
%183 = getelementptr double, double* %2, i64 %182
%184 = bitcast double* %183 to i8*
%185 = getelementptr double, double* %4, i64 %182
%186 = bitcast double* %185 to i8*
%187 = icmp ult i8* %169, %181
%188 = icmp ult i8* %166, %179
%189 = and i1 %187, %188
%190 = icmp ult i8* %169, %184
%191 = icmp ugt double* %178, %2
%192 = and i1 %190, %191
%193 = or i1 %189, %192
%194 = icmp ult i8* %169, %186
%195 = icmp ugt double* %178, %4
%196 = and i1 %194, %195
%197 = or i1 %193, %196
%198 = icmp ult i8* %166, %184
%199 = icmp ugt double* %180, %2
%200 = and i1 %198, %199
%201 = or i1 %197, %200
%202 = icmp ult i8* %166, %186
%203 = icmp ugt double* %180, %4
%204 = and i1 %202, %203
%205 = or i1 %201, %204
br i1 %205, label %234, label %206
206: ; preds = %177
%207 = and i64 %175, 4294967294
br label %208
208: ; preds = %208, %206
%209 = phi i64 [ 0, %206 ], [ %230, %208 ]
%210 = or i64 %209, 1
%211 = getelementptr inbounds double, double* %2, i64 %210
%212 = bitcast double* %211 to <2 x double>*
%213 = load <2 x double>, <2 x double>* %212
%214 = getelementptr inbounds double, double* %2, i64 %209
%215 = bitcast double* %214 to <2 x double>*
%216 = load <2 x double>, <2 x double>* %215
%217 = fsub <2 x double> %213, %216
%218 = getelementptr inbounds double, double* %168, i64 %209
%219 = bitcast double* %218 to <2 x double>*
store <2 x double> %217, <2 x double>* %219
%220 = getelementptr inbounds double, double* %4, i64 %210
%221 = bitcast double* %220 to <2 x double>*
%222 = load <2 x double>, <2 x double>* %221
%223 = getelementptr inbounds double, double* %4, i64 %209
%224 = bitcast double* %223 to <2 x double>*
%225 = load <2 x double>, <2 x double>* %224
%226 = fsub <2 x double> %222, %225
%227 = fdiv <2 x double> %226, %217
%228 = getelementptr inbounds double, double* %165, i64 %209
%229 = bitcast double* %228 to <2 x double>*
store <2 x double> %227, <2 x double>* %229
%230 = add nuw i64 %209, 2
%231 = icmp eq i64 %230, %207
br i1 %231, label %232, label %208
232: ; preds = %208
%233 = icmp eq i64 %207, %175
br i1 %233, label %236, label %234
234: ; preds = %177, %174, %232
%235 = phi i64 [ 0, %177 ], [ 0, %174 ], [ %207, %232 ]
br label %240
236: ; preds = %240, %232
%237 = icmp sgt i32 %0, 2
br i1 %237, label %238, label %286
238: ; preds = %236
%239 = zext i32 %161 to i64
br label %257
240: ; preds = %234, %240
%241 = phi i64 [ %242, %240 ], [ %235, %234 ]
%242 = add nuw nsw i64 %241, 1
%243 = getelementptr inbounds double, double* %2, i64 %242
%244 = load double, double* %243
%245 = getelementptr inbounds double, double* %2, i64 %241
%246 = load double, double* %245
%247 = fsub double %244, %246
%248 = getelementptr inbounds double, double* %168, i64 %241
store double %247, double* %248
%249 = getelementptr inbounds double, double* %4, i64 %242
%250 = load double, double* %249
%251 = getelementptr inbounds double, double* %4, i64 %241
%252 = load double, double* %251
%253 = fsub double %250, %252
%254 = fdiv double %253, %247
%255 = getelementptr inbounds double, double* %165, i64 %241
store double %254, double* %255
%256 = icmp eq i64 %242, %175
br i1 %256, label %236, label %240
257: ; preds = %238, %281
%258 = phi i64 [ 1, %238 ], [ %284, %281 ]
%259 = add nsw i64 %258, -1
%260 = getelementptr inbounds double, double* %165, i64 %259
%261 = bitcast double* %260 to <2 x double>*
%262 = load <2 x double>, <2 x double>* %261
%263 = shufflevector <2 x double> %262, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%264 = fmul <2 x double> %263, %262
%265 = extractelement <2 x double> %264, i64 0
%266 = fcmp ogt double %265, 0.000000e+00
br i1 %266, label %267, label %281
267: ; preds = %257
%268 = getelementptr inbounds double, double* %168, i64 %259
%269 = bitcast double* %268 to <2 x double>*
%270 = load <2 x double>, <2 x double>* %269
%271 = shufflevector <2 x double> %270, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%272 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %271, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %270)
%273 = shufflevector <2 x double> %272, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%274 = fadd <2 x double> %272, %273
%275 = extractelement <2 x double> %274, i64 0
%276 = fdiv <2 x double> %272, %262
%277 = shufflevector <2 x double> %276, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%278 = fadd <2 x double> %276, %277
%279 = extractelement <2 x double> %278, i64 0
%280 = fdiv double %275, %279
br label %281
281: ; preds = %257, %267
%282 = phi double [ %280, %267 ], [ 0.000000e+00, %257 ]
%283 = getelementptr inbounds double, double* %172, i64 %258
store double %282, double* %283
%284 = add nuw nsw i64 %258, 1
%285 = icmp eq i64 %284, %239
br i1 %285, label %286, label %257
286: ; preds = %281, %160, %236
%287 = load double, double* %168
%288 = getelementptr inbounds double, double* %168, i64 1
%289 = load double, double* %288
%290 = tail call double @llvm.fmuladd.f64(double %287, double 2.000000e+00, double %289)
%291 = load double, double* %165
%292 = getelementptr inbounds double, double* %165, i64 1
%293 = load double, double* %292
%294 = fneg double %287
%295 = fmul double %293, %294
%296 = tail call double @llvm.fmuladd.f64(double %290, double %291, double %295)
%297 = fadd double %287, %289
%298 = fdiv double %296, %297
store double %298, double* %172
%299 = load double, double* %165
%300 = fmul double %299, %298
%301 = fcmp olt double %300, 0.000000e+00
br i1 %301, label %315, label %302
302: ; preds = %286
%303 = load double, double* %292
%304 = fmul double %299, %303
%305 = fcmp olt double %304, 0.000000e+00
br i1 %305, label %306, label %317
306: ; preds = %302
%307 = tail call i64 @fabs(double %298)
%308 = load double, double* %165
%309 = fmul double %308, 3.000000e+00
%310 = tail call i64 @fabs(double %309)
%311 = icmp sgt i64 %307, %310
br i1 %311, label %312, label %317
312: ; preds = %306
%313 = load double, double* %165
%314 = fmul double %313, 3.000000e+00
br label %315
315: ; preds = %286, %312
%316 = phi double [ %314, %312 ], [ 0.000000e+00, %286 ]
store double %316, double* %172
br label %317
317: ; preds = %315, %302, %306
%318 = add nsw i32 %0, -2
%319 = sext i32 %318 to i64
%320 = getelementptr inbounds double, double* %168, i64 %319
%321 = load double, double* %320
%322 = add nsw i32 %0, -3
%323 = sext i32 %322 to i64
%324 = getelementptr inbounds double, double* %168, i64 %323
%325 = load double, double* %324
%326 = tail call double @llvm.fmuladd.f64(double %321, double 2.000000e+00, double %325)
%327 = getelementptr inbounds double, double* %165, i64 %319
%328 = load double, double* %327
%329 = getelementptr inbounds double, double* %165, i64 %323
%330 = load double, double* %329
%331 = fneg double %321
%332 = fmul double %330, %331
%333 = tail call double @llvm.fmuladd.f64(double %326, double %328, double %332)
%334 = fadd double %321, %325
%335 = fdiv double %333, %334
%336 = getelementptr inbounds double, double* %172, i64 %162
store double %335, double* %336
%337 = load double, double* %327
%338 = fmul double %337, %335
%339 = fcmp olt double %338, 0.000000e+00
br i1 %339, label %353, label %340
340: ; preds = %317
%341 = load double, double* %329
%342 = fmul double %337, %341
%343 = fcmp olt double %342, 0.000000e+00
br i1 %343, label %344, label %355
344: ; preds = %340
%345 = tail call i64 @fabs(double %335)
%346 = load double, double* %327
%347 = fmul double %346, 3.000000e+00
%348 = tail call i64 @fabs(double %347)
%349 = icmp sgt i64 %345, %348
br i1 %349, label %350, label %355
350: ; preds = %344
%351 = load double, double* %327
%352 = fmul double %351, 3.000000e+00
br label %353
353: ; preds = %317, %350
%354 = phi double [ %352, %350 ], [ 0.000000e+00, %317 ]
store double %354, double* %336
br label %355
355: ; preds = %353, %340, %344
%356 = tail call i64 @malloc(i32 %163)
%357 = inttoptr i64 %356 to double*
%358 = inttoptr i64 %356 to i8*
%359 = tail call i64 @malloc(i32 %163)
%360 = inttoptr i64 %359 to double*
%361 = inttoptr i64 %359 to i8*
br i1 %7, label %362, label %447
362: ; preds = %355
%363 = zext i32 %161 to i64
%364 = icmp ult i32 %161, 2
br i1 %364, label %445, label %365
365: ; preds = %362
%366 = getelementptr double, double* %360, i64 %363
%367 = bitcast double* %366 to i8*
%368 = getelementptr double, double* %357, i64 %363
%369 = bitcast double* %368 to i8*
%370 = getelementptr double, double* %165, i64 %363
%371 = bitcast double* %370 to i8*
%372 = add nuw nsw i64 %363, 1
%373 = getelementptr double, double* %172, i64 %372
%374 = bitcast double* %373 to i8*
%375 = getelementptr double, double* %168, i64 %363
%376 = bitcast double* %375 to i8*
%377 = icmp ult i8* %361, %369
%378 = icmp ult i8* %358, %367
%379 = and i1 %377, %378
%380 = icmp ult i8* %361, %371
%381 = icmp ult i8* %166, %367
%382 = and i1 %380, %381
%383 = or i1 %379, %382
%384 = icmp ult i8* %361, %374
%385 = icmp ult i8* %173, %367
%386 = and i1 %384, %385
%387 = or i1 %383, %386
%388 = icmp ult i8* %361, %376
%389 = icmp ult i8* %169, %367
%390 = and i1 %388, %389
%391 = or i1 %387, %390
%392 = icmp ult i8* %358, %371
%393 = icmp ult i8* %166, %369
%394 = and i1 %392, %393
%395 = or i1 %391, %394
%396 = icmp ult i8* %358, %374
%397 = icmp ult i8* %173, %369
%398 = and i1 %396, %397
%399 = or i1 %395, %398
%400 = icmp ult i8* %358, %376
%401 = icmp ult i8* %169, %369
%402 = and i1 %400, %401
%403 = or i1 %399, %402
br i1 %403, label %445, label %404
404: ; preds = %365
%405 = and i64 %363, 4294967294
br label %406
406: ; preds = %406, %404
%407 = phi i64 [ 0, %404 ], [ %441, %406 ]
%408 = getelementptr inbounds double, double* %165, i64 %407
%409 = bitcast double* %408 to <2 x double>*
%410 = load <2 x double>, <2 x double>* %409
%411 = getelementptr inbounds double, double* %172, i64 %407
%412 = bitcast double* %411 to <2 x double>*
%413 = load <2 x double>, <2 x double>* %412
%414 = fmul <2 x double> %413, <double -2.000000e+00, double -2.000000e+00>
%415 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %410, <2 x double> <double 3.000000e+00, double 3.000000e+00>, <2 x double> %414)
%416 = or i64 %407, 1
%417 = getelementptr inbounds double, double* %172, i64 %416
%418 = bitcast double* %417 to <2 x double>*
%419 = load <2 x double>, <2 x double>* %418
%420 = fsub <2 x double> %415, %419
%421 = getelementptr inbounds double, double* %168, i64 %407
%422 = bitcast double* %421 to <2 x double>*
%423 = load <2 x double>, <2 x double>* %422
%424 = fdiv <2 x double> %420, %423
%425 = getelementptr inbounds double, double* %360, i64 %407
%426 = bitcast double* %425 to <2 x double>*
store <2 x double> %424, <2 x double>* %426
%427 = bitcast double* %411 to <2 x double>*
%428 = load <2 x double>, <2 x double>* %427
%429 = bitcast double* %408 to <2 x double>*
%430 = load <2 x double>, <2 x double>* %429
%431 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %430, <2 x double> <double -2.000000e+00, double -2.000000e+00>, <2 x double> %428)
%432 = bitcast double* %417 to <2 x double>*
%433 = load <2 x double>, <2 x double>* %432
%434 = fadd <2 x double> %431, %433
%435 = bitcast double* %421 to <2 x double>*
%436 = load <2 x double>, <2 x double>* %435
%437 = fmul <2 x double> %436, %436
%438 = fdiv <2 x double> %434, %437
%439 = getelementptr inbounds double, double* %357, i64 %407
%440 = bitcast double* %439 to <2 x double>*
store <2 x double> %438, <2 x double>* %440
%441 = add nuw i64 %407, 2
%442 = icmp eq i64 %441, %405
br i1 %442, label %443, label %406
443: ; preds = %406
%444 = icmp eq i64 %405, %363
br i1 %444, label %447, label %445
445: ; preds = %365, %362, %443
%446 = phi i64 [ 0, %365 ], [ 0, %362 ], [ %405, %443 ]
br label %450
447: ; preds = %450, %443, %355
br i1 %11, label %448, label %508
448: ; preds = %447
%449 = zext i32 %1 to i64
br label %476
450: ; preds = %445, %450
%451 = phi i64 [ %458, %450 ], [ %446, %445 ]
%452 = getelementptr inbounds double, double* %165, i64 %451
%453 = load double, double* %452
%454 = getelementptr inbounds double, double* %172, i64 %451
%455 = load double, double* %454
%456 = fmul double %455, -2.000000e+00
%457 = tail call double @llvm.fmuladd.f64(double %453, double 3.000000e+00, double %456)
%458 = add nuw nsw i64 %451, 1
%459 = getelementptr inbounds double, double* %172, i64 %458
%460 = load double, double* %459
%461 = fsub double %457, %460
%462 = getelementptr inbounds double, double* %168, i64 %451
%463 = load double, double* %462
%464 = fdiv double %461, %463
%465 = getelementptr inbounds double, double* %360, i64 %451
store double %464, double* %465
%466 = load double, double* %454
%467 = load double, double* %452
%468 = tail call double @llvm.fmuladd.f64(double %467, double -2.000000e+00, double %466)
%469 = load double, double* %459
%470 = fadd double %468, %469
%471 = load double, double* %462
%472 = fmul double %471, %471
%473 = fdiv double %470, %472
%474 = getelementptr inbounds double, double* %357, i64 %451
store double %473, double* %474
%475 = icmp eq i64 %458, %363
br i1 %475, label %447, label %450
476: ; preds = %448, %476
%477 = phi i64 [ 0, %448 ], [ %506, %476 ]
%478 = getelementptr inbounds double, double* %3, i64 %477
%479 = load double, double* %478
%480 = tail call i32 @nearest_index(double %479, double* %2, i32 %0)
%481 = sext i32 %480 to i64
%482 = getelementptr inbounds double, double* %2, i64 %481
%483 = load double, double* %482
%484 = load double, double* %478
%485 = fcmp olt double %483, %484
%486 = icmp eq i32 %480, 0
%487 = add nsw i32 %480, -1
%488 = select i1 %486, i32 0, i32 %487
%489 = select i1 %485, i32 %480, i32 %488
%490 = sext i32 %489 to i64
%491 = getelementptr inbounds double, double* %2, i64 %490
%492 = load double, double* %491
%493 = fsub double %484, %492
%494 = getelementptr inbounds double, double* %4, i64 %490
%495 = load double, double* %494
%496 = getelementptr inbounds double, double* %172, i64 %490
%497 = load double, double* %496
%498 = getelementptr inbounds double, double* %360, i64 %490
%499 = load double, double* %498
%500 = getelementptr inbounds double, double* %357, i64 %490
%501 = load double, double* %500
%502 = tail call double @llvm.fmuladd.f64(double %493, double %501, double %499)
%503 = tail call double @llvm.fmuladd.f64(double %493, double %502, double %497)
%504 = tail call double @llvm.fmuladd.f64(double %493, double %503, double %495)
%505 = getelementptr inbounds double, double* %5, i64 %477
store double %504, double* %505
%506 = add nuw nsw i64 %477, 1
%507 = icmp eq i64 %506, %449
br i1 %507, label %508, label %476
508: ; preds = %476, %447
%509 = tail call i32 @free(double* %360)
%510 = tail call i32 @free(double* %357)
%511 = tail call i32 @free(double* %172)
%512 = tail call i32 @free(double* %168)
%513 = tail call i32 @free(double* %165)
br label %514
514: ; preds = %137, %141, %60, %121, %50, %508
ret void
}