#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 *);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int nearest_index(double const, double const *, int);
double pow(double, double);
void cubic_spline(int size1, int size2, const double *grid1,
                  const double *grid2, const double *data1, double *data2,
                  double yp1, double ypn) {
  double *y2 = NULL, *u = NULL;
  double p, sig, qn, un, h, a, b;
  int i, k, n, klo, khi;
  for (i = 1; i < size1; i++) {
    if (grid1[i] <= grid1[i - 1])
      error_handler("cubic_spline: 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: grid2 lies outside grid1");
  }
  if (size1 < 2)
    error_handler("cubic_spline: 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;
  }
  y2 = (double *)malloc(size1 * sizeof(double));
  u = (double *)malloc(size1 * sizeof(double));
  if (yp1 > .99e30) {
    y2[0] = 0.;
    u[0] = 0.;
  } else {
    y2[0] = -0.5;
    u[0] = (3. / (grid1[1] - grid1[0])) *
           ((data1[1] - data1[0]) / (grid1[1] - grid1[0]) - yp1);
  }
  for (i = 1; i < size1 - 1; i++) {
    sig = (grid1[i] - grid1[i - 1]) / (grid1[i + 1] - grid1[i - 1]);
    p = sig * y2[i - 1] + 2.;
    y2[i] = (sig - 1.) / p;
    u[i] = (6. *
                ((data1[i + 1] - data1[i]) / (grid1[i + 1] - grid1[i]) -
                 (data1[i] - data1[i - 1]) / (grid1[i] - grid1[i - 1])) /
                (grid1[i + 1] - grid1[i - 1]) -
            sig * u[i - 1]) /
           p;
  }
  if (ypn > .99e30) {
    qn = 0.;
    un = 0.;
  } else {
    qn = 0.5;
    un = (3. / (grid1[size1 - 1] - grid1[size1 - 2])) *
         (ypn - (data1[size1 - 1] - data1[size1 - 2]) /
                    (grid1[size1 - 1] - grid1[size1 - 2]));
  }
  y2[size1 - 1] = (un - qn * u[size1 - 2]) / (qn * y2[size1 - 2] + 1.);
  for (k = size1 - 2; k >= 0; k--)
    y2[k] = y2[k] * y2[k + 1] + u[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;
    h = grid1[khi] - grid1[klo];
    a = (grid1[khi] - grid2[k]) / h;
    b = (grid2[k] - grid1[klo]) / h;
    data2[k] = a * data1[klo] + b * data1[khi] +
               ((pow(a, 3.0) - a) * y2[klo] + (pow(b, 3.0) - b) * y2[khi]) *
                   (pow(h, 2.0)) / 6;
  }
  free(y2);
  free(u);
}


x86 assembly (clang, -O0):
<cubic_spline>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%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)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x1,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f8 <cubic_spline+0xa8>
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jb     11df <cubic_spline+0x8f>
lea    0xe5e(%rip),%rdi
call   1040 <error_handler@plt>
jmp    11e4 <cubic_spline+0x94>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1195 <cubic_spline+0x45>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1280 <cubic_spline+0x130>
mov    -0x18(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
ja     125b <cubic_spline+0x10b>
mov    -0x18(%rbp),%rax
movslq -0x84(%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    1267 <cubic_spline+0x117>
lea    0xe06(%rip),%rdi
call   1040 <error_handler@plt>
jmp    126c <cubic_spline+0x11c>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1202 <cubic_spline+0xb2>
cmpl   $0x2,-0x4(%rbp)
jge    1296 <cubic_spline+0x146>
lea    0xdfe(%rip),%rdi
call   1040 <error_handler@plt>
cmpl   $0x2,-0x4(%rbp)
jne    133a <cubic_spline+0x1ea>
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,-0x50(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1335 <cubic_spline+0x1e5>
movsd  -0x50(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x84(%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 -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    12d5 <cubic_spline+0x185>
jmp    1a10 <cubic_spline+0x8c0>
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xc93(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1392 <cubic_spline+0x242>
mov    -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    13f6 <cubic_spline+0x2a6>
mov    -0x40(%rbp),%rax
movsd  0xc72(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
movsd  0xc4d(%rip),%xmm0
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm2
divsd  %xmm2,%xmm1
subsd  -0x30(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    15fd <cubic_spline+0x4ad>
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xb9e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  0xb78(%rip),%xmm1
subsd  %xmm1,%xmm0
divsd  -0x50(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x84(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  0xabf(%rip),%xmm1
mulsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
mov    -0x84(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x84(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x50(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1400 <cubic_spline+0x2b0>
movsd  -0x38(%rbp),%xmm0
movsd  0x9f6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1629 <cubic_spline+0x4d9>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    16c4 <cubic_spline+0x574>
movsd  0x9e7(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
movsd  0x9a6(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  -0x38(%rbp),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm3
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x60(%rbp),%xmm1
mov    -0x40(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
movsd  0x8fe(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x88(%rbp)
cmpl   $0x0,-0x88(%rbp)
jl     17b6 <cubic_spline+0x666>
mov    -0x40(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x88(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x48(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x88(%rbp)
jmp    1748 <cubic_spline+0x5f8>
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    19fe <cubic_spline+0x8ae>
mov    -0x18(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1060 <nearest_index@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    182c <cubic_spline+0x6dc>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x90(%rbp)
jmp    185e <cubic_spline+0x70e>
cmpl   $0x0,-0x8c(%rbp)
jne    184a <cubic_spline+0x6fa>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x90(%rbp)
jmp    1859 <cubic_spline+0x709>
mov    -0x8c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x90(%rbp)
jmp    185e <cubic_spline+0x70e>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x90(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x94(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x88(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x90(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x78(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x90(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x80(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movslq -0x94(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
movsd  0x6db(%rip),%xmm1
call   1070 <pow@plt>
subsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
mov    -0x40(%rbp),%rax
movslq -0x90(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  0x6a4(%rip),%xmm1
call   1070 <pow@plt>
movsd  -0xb8(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movsd  -0xb0(%rbp),%xmm0
ff
subsd  -0x80(%rbp),%xmm1
mov    -0x40(%rbp),%rax
movslq -0x94(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movsd  0x682(%rip),%xmm1
call   1070 <pow@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
movsd  0x656(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x88(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    17c0 <cubic_spline+0x670>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cubic_spline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x28(%rsp)
mov    %r9,(%rsp)
mov    %r8,0x10(%rsp)
mov    %rcx,0x18(%rsp)
mov    %rdx,%r12
mov    %esi,0x8(%rsp)
mov    %edi,%r13d
cmp    $0x2,%edi
jl     11c2 <cubic_spline+0x72>
mov    %r13d,%ebx
mov    $0x1,%ebp
lea    0xeba(%rip),%r14
jmp    11a9 <cubic_spline+0x59>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     11c2 <cubic_spline+0x72>
movsd  -0x8(%r12,%rbp,8),%xmm0
ucomisd (%r12,%rbp,8),%xmm0
jb     11a0 <cubic_spline+0x50>
mov    %r14,%rdi
call   1040 <error_handler@plt>
jmp    11a0 <cubic_spline+0x50>
cmpl   $0x0,0x8(%rsp)
jle    1211 <cubic_spline+0xc1>
lea    -0x1(%r13),%eax
movslq %eax,%r15
mov    0x8(%rsp),%ebp
xor    %ebx,%ebx
lea    0xea3(%rip),%r14
jmp    11f1 <cubic_spline+0xa1>
nop
mov    %r14,%rdi
call   1040 <error_handler@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1211 <cubic_spline+0xc1>
mov    0x18(%rsp),%rax
movsd  (%rax,%rbx,8),%xmm0
movsd  (%r12),%xmm1
ucomisd %xmm0,%xmm1
ja     11e0 <cubic_spline+0x90>
ucomisd (%r12,%r15,8),%xmm0
ja     11e0 <cubic_spline+0x90>
jmp    11e8 <cubic_spline+0x98>
mov    %r13,%r15
cmp    $0x1,%r15d
jg     122f <cubic_spline+0xdf>
lea    0xe86(%rip),%rdi
call   1040 <error_handler@plt>
mov    (%rsp),%rbx
jmp    1387 <cubic_spline+0x237>
cmp    $0x2,%r15d
mov    (%rsp),%rbx
jne    1387 <cubic_spline+0x237>
mov    0x8(%rsp),%eax
test   %eax,%eax
mov    0x10(%rsp),%r13
mov    0x18(%rsp),%rbp
jle    1900 <cubic_spline+0x7b0>
movsd  0x0(%r13),%xmm1
movsd  0x8(%r13),%xmm0
subsd  %xmm1,%xmm0
movsd  (%r12),%xmm2
movsd  0x8(%r12),%xmm3
subsd  %xmm2,%xmm3
divsd  %xmm3,%xmm0
movsd  0x0(%rbp),%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,(%rbx)
cmp    $0x1,%eax
je     1900 <cubic_spline+0x7b0>
mov    %eax,%eax
lea    -0x1(%rax),%r8
mov    $0x1,%ecx
cmp    $0x4,%r8
jb     1891 <cubic_spline+0x741>
lea    0x8(%rbx),%r9
lea    (%rbx,%rax,8),%rdi
lea    0x8(%rbp),%r14
lea    0x0(,%rax,8),%rdx
add    %rbp,%rdx
cmp    %r12,%rbx
setb   %r10b
cmp    %r12,%rdi
seta   %r11b
cmp    %r13,%rbx
setb   %bl
cmp    %r13,%rdi
seta   %sil
cmp    %rdx,%r9
setb   %dl
cmp    %rdi,%r14
setb   %dil
test   %r11b,%r10b
jne    188d <cubic_spline+0x73d>
and    %sil,%bl
jne    188d <cubic_spline+0x73d>
and    %dil,%dl
mov    (%rsp),%rbx
jne    1891 <cubic_spline+0x741>
mov    %r8,%rsi
and    $0xfffffffffffffffc,%rsi
lea    0x1(%rsi),%rcx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
movsd  (%r12),%xmm2
unpcklpd %xmm2,%xmm2
movsd  0x0(%r13),%xmm3
unpcklpd %xmm3,%xmm3
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movupd 0x8(%rbp,%rdi,8),%xmm4
movupd 0x18(%rbp,%rdi,8),%xmm5
subpd  %xmm2,%xmm4
subpd  %xmm2,%xmm5
mulpd  %xmm1,%xmm4
addpd  %xmm3,%xmm4
mulpd  %xmm1,%xmm5
addpd  %xmm3,%xmm5
movupd %xmm4,0x8(%rbx,%rdi,8)
movupd %xmm5,0x18(%rbx,%rdi,8)
add    $0x4,%rdi
cmp    %rdi,%rsi
jne    1340 <cubic_spline+0x1f0>
cmp    %rsi,%r8
jne    1891 <cubic_spline+0x741>
jmp    1900 <cubic_spline+0x7b0>
lea    0x0(,%r15,8),%r14d
mov    %r14d,%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
mov    %r14d,%edi
call   1050 <malloc@plt>
movsd  0x28(%rsp),%xmm0
ucomisd 0xc50(%rip),%xmm0
jbe    13c5 <cubic_spline+0x275>
movq   $0x0,0x0(%rbp)
xorpd  %xmm0,%xmm0
mov    0x10(%rsp),%r13
jmp    1419 <cubic_spline+0x2c9>
movabs $0xbfe0000000000000,%rcx
mov    %rcx,0x0(%rbp)
movapd %xmm0,%xmm3
movsd  0x8(%r12),%xmm0
subsd  (%r12),%xmm0
mov    0x10(%rsp),%r13
movsd  0x8(%r13),%xmm1
subsd  0x0(%r13),%xmm1
movapd 0xc43(%rip),%xmm2
unpcklpd %xmm1,%xmm2
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
subsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,(%rax)
lea    -0x1(%r15),%edi
cmp    $0x3,%r15d
mov    0x8(%rsp),%r8d
jl     1630 <cubic_spline+0x4e0>
mov    %edi,%ecx
lea    (%rax,%rcx,8),%rdx
cmp    %rdx,%rbp
jae    153c <cubic_spline+0x3ec>
lea    0x0(,%rcx,8),%rdx
add    %rbp,%rdx
cmp    %rdx,%rax
jae    153c <cubic_spline+0x3ec>
mov    $0x1,%edx
movsd  0xba7(%rip),%xmm8
movsd  0xba6(%rip),%xmm9
movsd  0xba5(%rip),%xmm10
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  -0x8(%r12,%rdx,8),%xmm4
movsd  (%r12,%rdx,8),%xmm3
subsd  %xmm4,%xmm3
movsd  0x8(%r12,%rdx,8),%xmm5
subsd  %xmm4,%xmm5
divsd  %xmm5,%xmm3
movsd  -0x8(%rbp,%rdx,8),%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm8,%xmm4
movapd %xmm3,%xmm5
addsd  %xmm9,%xmm5
divsd  %xmm4,%xmm5
movsd  %xmm5,0x0(%rbp,%rdx,8)
movsd  0x0(%r13,%rdx,8),%xmm5
movsd  0x8(%r13,%rdx,8),%xmm6
subsd  %xmm5,%xmm6
movsd  0x8(%r12,%rdx,8),%xmm2
movsd  -0x8(%r12,%rdx,8),%xmm0
movsd  (%r12,%rdx,8),%xmm1
movapd %xmm2,%xmm7
subsd  %xmm1,%xmm7
divsd  %xmm7,%xmm6
subsd  -0x8(%r13,%rdx,8),%xmm5
subsd  %xmm0,%xmm1
divsd  %xmm1,%xmm5
subsd  %xmm5,%xmm6
mulsd  %xmm10,%xmm6
subsd  %xmm0,%xmm2
divsd  %xmm2,%xmm6
mulsd  -0x8(%rax,%rdx,8),%xmm3
subsd  %xmm3,%xmm6
divsd  %xmm4,%xmm6
movsd  %xmm6,(%rax,%rdx,8)
lea    0x1(%rdx),%rsi
mov    %rsi,%rdx
cmp    %rsi,%rcx
jne    1480 <cubic_spline+0x330>
jmp    1630 <cubic_spline+0x4e0>
movsd  0x0(%rbp),%xmm0
movsd  (%rax),%xmm4
mov    $0x1,%edx
movsd  0xab5(%rip),%xmm8
movsd  0xab4(%rip),%xmm9
movsd  0xab3(%rip),%xmm10
cs nopw 0x0(%rax,%rax,1)
nop
movupd (%r12,%rdx,8),%xmm5
movsd  -0x8(%r12,%rdx,8),%xmm6
unpcklpd %xmm6,%xmm6
subpd  %xmm6,%xmm5
movapd %xmm5,%xmm6
unpckhpd %xmm5,%xmm6
divsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm0
addsd  %xmm8,%xmm0
movapd %xmm5,%xmm6
addsd  %xmm9,%xmm6
divsd  %xmm0,%xmm6
movsd  %xmm6,0x0(%rbp,%rdx,8)
movupd 0x0(%r13,%rdx,8),%xmm7
mulsd  %xmm4,%xmm5
movapd %xmm7,%xmm4
shufpd $0x1,%xmm7,%xmm4
movupd (%r12,%rdx,8),%xmm2
movapd %xmm2,%xmm3
shufpd $0x1,%xmm2,%xmm3
movhpd -0x8(%r13,%rdx,8),%xmm7
subpd  %xmm7,%xmm4
movsd  -0x8(%r12,%rdx,8),%xmm7
movapd %xmm2,%xmm1
unpcklpd %xmm7,%xmm1
subpd  %xmm1,%xmm3
divpd  %xmm3,%xmm4
movapd %xmm4,%xmm1
unpckhpd %xmm4,%xmm1
subsd  %xmm1,%xmm4
mulsd  %xmm10,%xmm4
unpckhpd %xmm2,%xmm2
subsd  %xmm7,%xmm2
divsd  %xmm2,%xmm4
subsd  %xmm5,%xmm4
divsd  %xmm0,%xmm4
movsd  %xmm4,(%rax,%rdx,8)
lea    0x1(%rdx),%rsi
movapd %xmm6,%xmm0
mov    %rsi,%rdx
cmp    %rsi,%rcx
jne    1570 <cubic_spline+0x420>
movsd  0x30(%rsp),%xmm3
ucomisd 0x9c2(%rip),%xmm3
jbe    1654 <cubic_spline+0x504>
lea    -0x2(%r15),%ecx
movslq %ecx,%rdx
movslq %edi,%rdi
xorpd  %xmm3,%xmm3
xorpd  %xmm0,%xmm0
jmp    16a9 <cubic_spline+0x559>
movslq %edi,%rdi
movsd  (%r12,%rdi,8),%xmm0
lea    -0x2(%r15),%ecx
movslq %r15d,%rsi
subsd  -0x10(%r12,%rsi,8),%xmm0
lea    -0x2(%rsi),%rdx
movsd  0x0(%r13,%rdi,8),%xmm1
subsd  -0x10(%r13,%rsi,8),%xmm1
movapd 0x9bb(%rip),%xmm2
unpcklpd %xmm1,%xmm2
unpcklpd %xmm0,%xmm0
divpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
subsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm3
movsd  0x977(%rip),%xmm0
mov    %rbx,%rsi
movsd  (%rax,%rdx,8),%xmm1
mulsd  %xmm0,%xmm1
mulsd  0x0(%rbp,%rdx,8),%xmm0
addsd  0x965(%rip),%xmm0
subsd  %xmm1,%xmm3
divsd  %xmm0,%xmm3
movsd  %xmm3,0x0(%rbp,%rdi,8)
cmp    $0x2,%r15d
jl     1733 <cubic_spline+0x5e3>
mov    %ecx,%edx
test   $0x1,%cl
jne    16f9 <cubic_spline+0x5a9>
movsd  0x0(%rbp,%rdx,8),%xmm0
mulsd  0x8(%rbp,%rdx,8),%xmm0
addsd  (%rax,%rdx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rdx,8)
add    $0xffffffffffffffff,%rdx
test   %ecx,%ecx
je     1733 <cubic_spline+0x5e3>
nopl   (%rax)
movsd  0x0(%rbp,%rdx,8),%xmm0
mulsd  0x8(%rbp,%rdx,8),%xmm0
addsd  (%rax,%rdx,8),%xmm0
movsd  %xmm0,0x0(%rbp,%rdx,8)
mulsd  -0x8(%rbp,%rdx,8),%xmm0
addsd  -0x8(%rax,%rdx,8),%xmm0
movsd  %xmm0,-0x8(%rbp,%rdx,8)
add    $0xfffffffffffffffe,%rdx
cmp    $0xffffffffffffffff,%rdx
jne    1700 <cubic_spline+0x5b0>
mov    %rax,0x38(%rsp)
test   %r8d,%r8d
mov    %rbp,%rdi
mov    0x18(%rsp),%rbx
jle    1870 <cubic_spline+0x720>
mov    %rsi,%rbp
mov    %r15,%r13
mov    %r8d,%ecx
mov    %rcx,0x40(%rsp)
xor    %r15d,%r15d
mov    %rdi,(%rsp)
xchg   %ax,%ax
movsd  (%rbx,%r15,8),%xmm0
mov    %r12,%rdi
mov    %r13d,%esi
call   1060 <nearest_index@plt>
cltq
mov    %eax,%ecx
sub    $0x1,%ecx
mov    $0x0,%edx
cmovb  %edx,%ecx
movsd  (%rbx,%r15,8),%xmm1
ucomisd (%r12,%rax,8),%xmm1
cmova  %eax,%ecx
movslq %ecx,%r14
movsd  (%r12,%r14,8),%xmm0
movsd  0x8(%r12,%r14,8),%xmm3
movapd %xmm3,%xmm2
subsd  %xmm0,%xmm2
movsd  %xmm2,0x30(%rsp)
subsd  %xmm1,%xmm3
divsd  %xmm2,%xmm3
subsd  %xmm0,%xmm1
divsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    0x10(%rsp),%rax
movsd  0x8(%rax,%r14,8),%xmm2
mulsd  %xmm1,%xmm2
movsd  (%rax,%r14,8),%xmm1
movapd %xmm3,%xmm0
movsd  %xmm3,0x20(%rsp)
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0x837(%rip),%xmm1
call   1070 <pow@plt>
subsd  0x20(%rsp),%xmm0
mov    (%rsp),%rax
mulsd  (%rax,%r14,8),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  0x80e(%rip),%xmm1
call   1070 <pow@plt>
mov    (%rsp),%rdi
subsd  0x8(%rsp),%xmm0
mulsd  0x8(%rdi,%r14,8),%xmm0
addsd  0x20(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
divsd  0x7c4(%rip),%xmm1
addsd  0x28(%rsp),%xmm1
movsd  %xmm1,0x0(%rbp,%r15,8)
add    $0x1,%r15
cmp    %r15,0x40(%rsp)
jne    1760 <cubic_spline+0x610>
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    (%rsp),%rbx
mov    %rcx,%rdx
not    %rdx
test   $0x1,%al
jne    18ba <cubic_spline+0x76a>
movsd  0x0(%rbp,%rcx,8),%xmm1
subsd  (%r12),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x0(%r13),%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
add    $0x1,%rcx
add    %rax,%rdx
je     1900 <cubic_spline+0x7b0>
nop
movsd  0x0(%rbp,%rcx,8),%xmm1
subsd  (%r12),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x0(%r13),%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
movsd  0x8(%rbp,%rcx,8),%xmm1
subsd  (%r12),%xmm1
mulsd  %xmm0,%xmm1
addsd  0x0(%r13),%xmm1
movsd  %xmm1,0x8(%rbx,%rcx,8)
add    $0x2,%rcx
cmp    %rcx,%rax
jne    18c0 <cubic_spline+0x770>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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