#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ myWarn_Loc(int, char *, int, char *);
int mySplineSnd(const double *x, const double *y, size_t n, double A, double B,
                double *y2) {
  size_t i;
  double *gam;
  double dx2;
  double dx3;
  double bet;
  double r_i;
  if (n < 1) {
    return 0;
  }
  y2[0] = A;
  if (n == 1) {
    return 0;
  }
  if (n == 2) {
    y2[1] = B;
    return 0;
  }
  n -= 2;
  if ((gam = (double *)malloc(n * sizeof(double))) == NULL) {
    myWarn_Loc(3,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/brianmckenna/rex2nc/refs/"
               "heads/master/src/libaat/spline.c",
               92, "Ran out of memory\n");
    return -1;
  }
  dx2 = x[1] - x[0];
  dx3 = x[2] - x[1];
  r_i = 6 * ((y[2] - y[1]) / dx3 - (y[1] - y[0]) / dx2) - dx2 * A;
  if (n == 1) {
    r_i += -dx3 * B;
  }
  bet = 2 * (x[2] - x[0]);
  if (bet == 0.0) {
    myWarn_Loc(3,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/brianmckenna/rex2nc/refs/"
               "heads/master/src/libaat/spline.c",
               104, "x is not monitonic increasing\n");
    free(gam);
    return -2;
  }
  y2[1] = r_i / bet;
  for (i = 1; i < n; ++i) {
    dx2 = x[i + 1] - x[i];
    dx3 = x[i + 2] - x[i + 1];
    r_i = 6 * ((y[i + 2] - y[i + 1]) / dx3 - (y[i + 1] - y[i]) / dx2);
    if (i == n - 1) {
      r_i += -dx3 * B;
    }
    gam[i] = dx2 / bet;
    bet = 2 * (x[i + 2] - x[i]) - dx2 * gam[i];
    if (bet == 0) {
      myWarn_Loc(3,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/brianmckenna/rex2nc/refs/"
                 "heads/master/src/libaat/spline.c",
                 123, "x is not monitonic increasing?\n");
      free(gam);
      return -2;
    }
    y2[i + 1] = (r_i - dx2 * y2[i]) / bet;
  }
  for (i = (n - 1); i >= 1; --i) {
    y2[i] -= gam[i] * y2[i + 1];
  }
  free(gam);
  y2[n + 1] = B;
  return 0;
}


x86 assembly (clang, -O0):
<mySplineSnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
cmpq   $0x1,-0x20(%rbp)
jae    1169 <mySplineSnd+0x39>
movl   $0x0,-0x4(%rbp)
jmp    15eb <mySplineSnd+0x4bb>
movsd  -0x28(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
cmpq   $0x1,-0x20(%rbp)
jne    118d <mySplineSnd+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    15eb <mySplineSnd+0x4bb>
cmpq   $0x2,-0x20(%rbp)
jne    11b2 <mySplineSnd+0x82>
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movl   $0x0,-0x4(%rbp)
jmp    15eb <mySplineSnd+0x4bb>
mov    -0x20(%rbp),%rax
sub    $0x2,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1202 <mySplineSnd+0xd2>
mov    $0x3,%edi
lea    0xe2b(%rip),%rsi
mov    $0x5c,%edx
lea    0xeb3(%rip),%rcx
call   1050 <myWarn_Loc@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15eb <mySplineSnd+0x4bb>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  0x8(%rax),%xmm0
divsd  -0x58(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm1
divsd  -0x50(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xd77(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
cmpq   $0x1,-0x20(%rbp)
jne    12d4 <mySplineSnd+0x1a4>
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm1
movsd  0xd1b(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1340 <mySplineSnd+0x210>
jp     1340 <mySplineSnd+0x210>
mov    $0x3,%edi
lea    0xcf6(%rip),%rsi
mov    $0x68,%edx
lea    0xd91(%rip),%rcx
call   1050 <myWarn_Loc@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    15eb <mySplineSnd+0x4bb>
movsd  -0x68(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movq   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1554 <mySplineSnd+0x424>
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  0x8(%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  0x10(%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
subsd  0x8(%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  0x10(%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
subsd  0x8(%rax,%rcx,8),%xmm1
divsd  -0x58(%rbp),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  0x8(%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x50(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  0xc09(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x40(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jne    1448 <mySplineSnd+0x318>
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x30(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
divsd  -0x60(%rbp),%xmm0
mov    -0x48(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  0x10(%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  -0x50(%rbp),%xmm1
mov    -0x48(%rbp),%rax
mov    -0x40(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    14fa <mySplineSnd+0x3ca>
jp     14fa <mySplineSnd+0x3ca>
mov    $0x3,%edi
lea    0xb3c(%rip),%rsi
mov    $0x7b,%edx
lea    0xbf6(%rip),%rcx
call   1050 <myWarn_Loc@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    15eb <mySplineSnd+0x4bb>
movsd  -0x68(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%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  -0x60(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  %xmm0,0x8(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    135b <mySplineSnd+0x22b>
mov    -0x20(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x1,-0x40(%rbp)
jb     15c8 <mySplineSnd+0x498>
mov    -0x48(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  0x8(%rax,%rcx,8),%xmm2
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
jmp    1560 <mySplineSnd+0x430>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  %xmm0,0x8(%rax,%rcx,8)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mySplineSnd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %r15d,%r15d
test   %rdx,%rdx
je     1406 <mySplineSnd+0x2d6>
mov    %rcx,%r13
mov    %rdx,%rbp
movsd  %xmm0,(%rcx)
cmp    $0x1,%rdx
je     1406 <mySplineSnd+0x2d6>
cmp    $0x2,%rbp
jne    116f <mySplineSnd+0x3f>
movsd  %xmm1,0x8(%r13)
jmp    1406 <mySplineSnd+0x2d6>
mov    %rsi,%r12
mov    %rdi,%rbx
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
lea    -0x10(,%rbp,8),%rdi
ff
call   1040 <malloc@plt>
test   %rax,%rax
je     11e7 <mySplineSnd+0xb7>
mov    %rax,%r14
movsd  (%rbx),%xmm2
movsd  0x10(%rbx),%xmm1
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm0
addsd  %xmm0,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jne    120f <mySplineSnd+0xdf>
jp     120f <mySplineSnd+0xdf>
lea    0xe62(%rip),%rsi
lea    0xf02(%rip),%rcx
mov    $0x3,%edi
mov    $0x68,%edx
call   1050 <myWarn_Loc@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    $0xfffffffe,%r15d
jmp    1406 <mySplineSnd+0x2d6>
lea    0xe32(%rip),%rsi
lea    0xebf(%rip),%rcx
mov    $0x3,%edi
mov    $0x5c,%edx
call   1050 <myWarn_Loc@plt>
mov    $0xffffffff,%r15d
jmp    1406 <mySplineSnd+0x2d6>
lea    -0x2(%rbp),%rax
movsd  0x8(%rbx),%xmm3
subsd  %xmm3,%xmm1
subsd  %xmm2,%xmm3
movsd  0x8(%r12),%xmm4
movsd  0x10(%r12),%xmm2
subsd  %xmm4,%xmm2
subsd  (%r12),%xmm4
divsd  %xmm1,%xmm2
divsd  %xmm3,%xmm4
subsd  %xmm4,%xmm2
mulsd  0x10(%rsp),%xmm3
mulsd  0xdae(%rip),%xmm2
subsd  %xmm3,%xmm2
cmp    $0x1,%rax
je     1265 <mySplineSnd+0x135>
movsd  0x8(%rsp),%xmm8
jmp    1275 <mySplineSnd+0x145>
movsd  0x8(%rsp),%xmm8
mulsd  %xmm8,%xmm1
subsd  %xmm1,%xmm2
divsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%r13)
cmp    $0x2,%rax
jb     13f1 <mySplineSnd+0x2c1>
lea    -0x3(%rbp),%rcx
lea    -0x4(%rbp),%rax
xor    %edx,%edx
movsd  0xd65(%rip),%xmm1
movapd 0xd6d(%rip),%xmm2
xorpd  %xmm3,%xmm3
jmp    12d7 <mySplineSnd+0x1a7>
nopl   0x0(%rax)
xorpd  %xmm2,%xmm4
mulsd  0x8(%r13,%rdx,8),%xmm4
addsd  %xmm5,%xmm4
divsd  %xmm0,%xmm4
movsd  %xmm4,0x10(%r13,%rdx,8)
add    $0x1,%rdx
cmp    %rdx,%rcx
je     137d <mySplineSnd+0x24d>
movsd  0x10(%rbx,%rdx,8),%xmm5
movsd  0x18(%rbx,%rdx,8),%xmm6
movapd %xmm5,%xmm4
subsd  0x8(%rbx,%rdx,8),%xmm4
subsd  %xmm5,%xmm6
movsd  0x10(%r12,%rdx,8),%xmm7
movsd  0x18(%r12,%rdx,8),%xmm5
subsd  %xmm7,%xmm5
divsd  %xmm6,%xmm5
subsd  0x8(%r12,%rdx,8),%xmm7
divsd  %xmm4,%xmm7
subsd  %xmm7,%xmm5
mulsd  %xmm1,%xmm5
movapd %xmm4,%xmm7
divsd  %xmm0,%xmm7
movsd  %xmm7,0x8(%r14,%rdx,8)
movsd  0x18(%rbx,%rdx,8),%xmm0
subsd  0x8(%rbx,%rdx,8),%xmm0
mulsd  %xmm4,%xmm7
addsd  %xmm0,%xmm0
subsd  %xmm7,%xmm0
ucomisd %xmm3,%xmm0
jne    1349 <mySplineSnd+0x219>
jnp    1360 <mySplineSnd+0x230>
cmp    %rdx,%rax
jne    12b0 <mySplineSnd+0x180>
mulsd  %xmm8,%xmm6
subsd  %xmm6,%xmm5
jmp    12b0 <mySplineSnd+0x180>
lea    0xcb9(%rip),%rsi
lea    0xd78(%rip),%rcx
mov    $0x3,%edi
mov    $0x7b,%edx
jmp    11cf <mySplineSnd+0x9f>
test   %rcx,%rcx
je     13f1 <mySplineSnd+0x2c1>
movsd  -0x10(%r13,%rbp,8),%xmm0
test   $0x1,%cl
jne    1393 <mySplineSnd+0x263>
mov    %rcx,%rax
jmp    13b0 <mySplineSnd+0x280>
movsd  -0x18(%r13,%rbp,8),%xmm1
mulsd  -0x18(%r14,%rbp,8),%xmm0
subsd  %xmm0,%xmm1
movsd  %xmm1,-0x18(%r13,%rbp,8)
movapd %xmm1,%xmm0
cmp    $0x4,%rbp
je     13f1 <mySplineSnd+0x2c1>
movsd  -0x8(%r13,%rax,8),%xmm1
movsd  0x0(%r13,%rax,8),%xmm2
mulsd  (%r14,%rax,8),%xmm0
subsd  %xmm0,%xmm2
movsd  %xmm2,0x0(%r13,%rax,8)
mulsd  -0x8(%r14,%rax,8),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,-0x8(%r13,%rax,8)
movapd %xmm1,%xmm0
add    $0xfffffffffffffffe,%rax
jne    13b6 <mySplineSnd+0x286>
mov    %r14,%rdi
call   1030 <free@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,-0x8(%r13,%rbp,8)
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/brianmckenna/rex2nc/refs/heads/master/src/libaat/spline.c\00"
@.str.1 = [19 x i8] c"Ran out of memory\0A\00"
@.str.2 = [31 x i8] c"x is not monitonic increasing\0A\00"
@.str.3 = [32 x i8] c"x is not monitonic increasing?\0A\00"
define i32 @mySplineSnd(double* %0, double* %1, i64 %2, double %3, double %4, double* %5) {
%7 = alloca i32
%8 = alloca double*
%9 = alloca double*
%10 = alloca i64
%11 = alloca double
%12 = alloca double
%13 = alloca double*
%14 = alloca i64
%15 = alloca double*
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store double* %0, double** %8
store double* %1, double** %9
store i64 %2, i64* %10
store double %3, double* %11
store double %4, double* %12
store double* %5, double** %13
%20 = load i64, i64* %10
%21 = icmp ult i64 %20, 1
br i1 %21, label %22, label %23
22: ; preds = %6
store i32 0, i32* %7
br label %260
23: ; preds = %6
%24 = load double, double* %11
%25 = load double*, double** %13
%26 = getelementptr inbounds double, double* %25, i64 0
store double %24, double* %26
%27 = load i64, i64* %10
%28 = icmp eq i64 %27, 1
br i1 %28, label %29, label %30
29: ; preds = %23
store i32 0, i32* %7
br label %260
30: ; preds = %23
%31 = load i64, i64* %10
%32 = icmp eq i64 %31, 2
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load double, double* %12
%35 = load double*, double** %13
%36 = getelementptr inbounds double, double* %35, i64 1
store double %34, double* %36
store i32 0, i32* %7
br label %260
37: ; preds = %30
%38 = load i64, i64* %10
%39 = sub i64 %38, 2
store i64 %39, i64* %10
%40 = load i64, i64* %10
%41 = mul i64 %40, 8
%42 = call i64 @malloc(i64 %41)
%43 = inttoptr i64 %42 to double*
store double* %43, double** %15
%44 = icmp eq double* %43, null
br i1 %44, label %45, label %47
45: ; preds = %37
%46 = call i32 @myWarn_Loc(i32 3, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 92, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %7
br label %260
47: ; preds = %37
%48 = load double*, double** %8
%49 = getelementptr inbounds double, double* %48, i64 1
%50 = load double, double* %49
%51 = load double*, double** %8
%52 = getelementptr inbounds double, double* %51, i64 0
%53 = load double, double* %52
%54 = fsub double %50, %53
store double %54, double* %16
%55 = load double*, double** %8
%56 = getelementptr inbounds double, double* %55, i64 2
%57 = load double, double* %56
%58 = load double*, double** %8
%59 = getelementptr inbounds double, double* %58, i64 1
%60 = load double, double* %59
%61 = fsub double %57, %60
store double %61, double* %17
%62 = load double*, double** %9
%63 = getelementptr inbounds double, double* %62, i64 2
%64 = load double, double* %63
%65 = load double*, double** %9
%66 = getelementptr inbounds double, double* %65, i64 1
%67 = load double, double* %66
%68 = fsub double %64, %67
%69 = load double, double* %17
%70 = fdiv double %68, %69
%71 = load double*, double** %9
%72 = getelementptr inbounds double, double* %71, i64 1
%73 = load double, double* %72
%74 = load double*, double** %9
%75 = getelementptr inbounds double, double* %74, i64 0
%76 = load double, double* %75
%77 = fsub double %73, %76
%78 = load double, double* %16
%79 = fdiv double %77, %78
%80 = fsub double %70, %79
%81 = load double, double* %16
%82 = load double, double* %11
%83 = fmul double %81, %82
%84 = fneg double %83
%85 = call double @llvm.fmuladd.f64(double 6.000000e+00, double %80, double %84)
store double %85, double* %19
%86 = load i64, i64* %10
%87 = icmp eq i64 %86, 1
br i1 %87, label %88, label %94
88: ; preds = %47
%89 = load double, double* %17
%90 = fneg double %89
%91 = load double, double* %12
%92 = load double, double* %19
%93 = call double @llvm.fmuladd.f64(double %90, double %91, double %92)
store double %93, double* %19
br label %94
94: ; preds = %88, %47
%95 = load double*, double** %8
%96 = getelementptr inbounds double, double* %95, i64 2
%97 = load double, double* %96
%98 = load double*, double** %8
%99 = getelementptr inbounds double, double* %98, i64 0
%100 = load double, double* %99
%101 = fsub double %97, %100
%102 = fmul double 2.000000e+00, %101
store double %102, double* %18
%103 = load double, double* %18
%104 = fcmp oeq double %103, 0.000000e+00
br i1 %104, label %105, label %109
105: ; preds = %94
%106 = call i32 @myWarn_Loc(i32 3, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 104, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%107 = load double*, double** %15
%108 = call i32 @free(double* %107)
store i32 -2, i32* %7
br label %260
109: ; preds = %94
%110 = load double, double* %19
%111 = load double, double* %18
%112 = fdiv double %110, %111
%113 = load double*, double** %13
%114 = getelementptr inbounds double, double* %113, i64 1
store double %112, double* %114
store i64 1, i64* %14
br label %115
115: ; preds = %224, %109
%116 = load i64, i64* %14
%117 = load i64, i64* %10
%118 = icmp ult i64 %116, %117
br i1 %118, label %119, label %227
119: ; preds = %115
%120 = load double*, double** %8
%121 = load i64, i64* %14
%122 = add i64 %121, 1
%123 = getelementptr inbounds double, double* %120, i64 %122
%124 = load double, double* %123
%125 = load double*, double** %8
%126 = load i64, i64* %14
%127 = getelementptr inbounds double, double* %125, i64 %126
%128 = load double, double* %127
%129 = fsub double %124, %128
store double %129, double* %16
%130 = load double*, double** %8
%131 = load i64, i64* %14
%132 = add i64 %131, 2
%133 = getelementptr inbounds double, double* %130, i64 %132
%134 = load double, double* %133
%135 = load double*, double** %8
%136 = load i64, i64* %14
%137 = add i64 %136, 1
%138 = getelementptr inbounds double, double* %135, i64 %137
%139 = load double, double* %138
%140 = fsub double %134, %139
store double %140, double* %17
%141 = load double*, double** %9
%142 = load i64, i64* %14
%143 = add i64 %142, 2
%144 = getelementptr inbounds double, double* %141, i64 %143
%145 = load double, double* %144
%146 = load double*, double** %9
%147 = load i64, i64* %14
%148 = add i64 %147, 1
%149 = getelementptr inbounds double, double* %146, i64 %148
%150 = load double, double* %149
%151 = fsub double %145, %150
%152 = load double, double* %17
%153 = fdiv double %151, %152
%154 = load double*, double** %9
%155 = load i64, i64* %14
%156 = add i64 %155, 1
%157 = getelementptr inbounds double, double* %154, i64 %156
%158 = load double, double* %157
%159 = load double*, double** %9
%160 = load i64, i64* %14
%161 = getelementptr inbounds double, double* %159, i64 %160
%162 = load double, double* %161
%163 = fsub double %158, %162
%164 = load double, double* %16
%165 = fdiv double %163, %164
%166 = fsub double %153, %165
%167 = fmul double 6.000000e+00, %166
store double %167, double* %19
%168 = load i64, i64* %14
%169 = load i64, i64* %10
%170 = sub i64 %169, 1
%171 = icmp eq i64 %168, %170
br i1 %171, label %172, label %178
172: ; preds = %119
%173 = load double, double* %17
%174 = fneg double %173
%175 = load double, double* %12
%176 = load double, double* %19
%177 = call double @llvm.fmuladd.f64(double %174, double %175, double %176)
store double %177, double* %19
br label %178
178: ; preds = %172, %119
%179 = load double, double* %16
%180 = load double, double* %18
%181 = fdiv double %179, %180
%182 = load double*, double** %15
%183 = load i64, i64* %14
%184 = getelementptr inbounds double, double* %182, i64 %183
store double %181, double* %184
%185 = load double*, double** %8
%186 = load i64, i64* %14
%187 = add i64 %186, 2
%188 = getelementptr inbounds double, double* %185, i64 %187
%189 = load double, double* %188
%190 = load double*, double** %8
%191 = load i64, i64* %14
%192 = getelementptr inbounds double, double* %190, i64 %191
%193 = load double, double* %192
%194 = fsub double %189, %193
%195 = load double, double* %16
%196 = load double*, double** %15
%197 = load i64, i64* %14
%198 = getelementptr inbounds double, double* %196, i64 %197
%199 = load double, double* %198
%200 = fmul double %195, %199
%201 = fneg double %200
%202 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %194, double %201)
store double %202, double* %18
%203 = load double, double* %18
%204 = fcmp oeq double %203, 0.000000e+00
br i1 %204, label %205, label %209
205: ; preds = %178
%206 = call i32 @myWarn_Loc(i32 3, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 123, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%207 = load double*, double** %15
%208 = call i32 @free(double* %207)
store i32 -2, i32* %7
br label %260
209: ; preds = %178
%210 = load double, double* %19
%211 = load double, double* %16
%212 = load double*, double** %13
%213 = load i64, i64* %14
%214 = getelementptr inbounds double, double* %212, i64 %213
%215 = load double, double* %214
%216 = fneg double %211
%217 = call double @llvm.fmuladd.f64(double %216, double %215, double %210)
%218 = load double, double* %18
%219 = fdiv double %217, %218
%220 = load double*, double** %13
%221 = load i64, i64* %14
%222 = add i64 %221, 1
%223 = getelementptr inbounds double, double* %220, i64 %222
store double %219, double* %223
br label %224
224: ; preds = %209
%225 = load i64, i64* %14
%226 = add i64 %225, 1
store i64 %226, i64* %14
br label %115
227: ; preds = %115
%228 = load i64, i64* %10
%229 = sub i64 %228, 1
store i64 %229, i64* %14
br label %230
230: ; preds = %249, %227
%231 = load i64, i64* %14
%232 = icmp uge i64 %231, 1
br i1 %232, label %233, label %252
233: ; preds = %230
%234 = load double*, double** %15
%235 = load i64, i64* %14
%236 = getelementptr inbounds double, double* %234, i64 %235
%237 = load double, double* %236
%238 = load double*, double** %13
%239 = load i64, i64* %14
%240 = add i64 %239, 1
%241 = getelementptr inbounds double, double* %238, i64 %240
%242 = load double, double* %241
%243 = load double*, double** %13
%244 = load i64, i64* %14
%245 = getelementptr inbounds double, double* %243, i64 %244
%246 = load double, double* %245
%247 = fneg double %237
%248 = call double @llvm.fmuladd.f64(double %247, double %242, double %246)
store double %248, double* %245
br label %249
249: ; preds = %233
%250 = load i64, i64* %14
%251 = add i64 %250, -1
store i64 %251, i64* %14
br label %230
252: ; preds = %230
%253 = load double*, double** %15
%254 = call i32 @free(double* %253)
%255 = load double, double* %12
%256 = load double*, double** %13
%257 = load i64, i64* %10
%258 = add i64 %257, 1
%259 = getelementptr inbounds double, double* %256, i64 %258
store double %255, double* %259
store i32 0, i32* %7
br label %260
260: ; preds = %252, %205, %105, %45, %33, %29, %22
%261 = load i32, i32* %7
ret i32 %261
}

LLVM IR (-O2):
@.str = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/brianmckenna/rex2nc/refs/heads/master/src/libaat/spline.c\00"
@.str.1 = [19 x i8] c"Ran out of memory\0A\00"
@.str.2 = [31 x i8] c"x is not monitonic increasing\0A\00"
@.str.3 = [32 x i8] c"x is not monitonic increasing?\0A\00"
define i32 @mySplineSnd(double* nocapture %0, double* nocapture %1, i64 %2, double %3, double %4, double* nocapture %5) {
%7 = icmp eq i64 %2, 0
br i1 %7, label %145, label %8
8: ; preds = %6
store double %3, double* %5
switch i64 %2, label %11 [
i64 1, label %145
i64 2, label %9
]
9: ; preds = %8
%10 = getelementptr inbounds double, double* %5, i64 1
store double %4, double* %10
br label %145
11: ; preds = %8
%12 = add i64 %2, -2
%13 = shl i64 %12, 3
%14 = tail call i64 @malloc(i64 %13)
%15 = inttoptr i64 %14 to double*
%16 = icmp eq i64 %14, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = tail call i32 @myWarn_Loc(i32 3, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 92, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %145
19: ; preds = %11
%20 = getelementptr inbounds double, double* %0, i64 1
%21 = load double, double* %20
%22 = load double, double* %0
%23 = fsub double %21, %22
%24 = getelementptr inbounds double, double* %0, i64 2
%25 = load double, double* %24
%26 = fsub double %25, %21
%27 = getelementptr inbounds double, double* %1, i64 2
%28 = load double, double* %27
%29 = getelementptr inbounds double, double* %1, i64 1
%30 = load double, double* %29
%31 = fsub double %28, %30
%32 = fdiv double %31, %26
%33 = load double, double* %1
%34 = fsub double %30, %33
%35 = fdiv double %34, %23
%36 = fsub double %32, %35
%37 = fneg double %23
%38 = fmul double %37, %3
%39 = tail call double @llvm.fmuladd.f64(double %36, double 6.000000e+00, double %38)
%40 = fsub double %25, %22
%41 = fmul double %40, 2.000000e+00
%42 = fcmp oeq double %41, 0.000000e+00
br i1 %42, label %43, label %46
43: ; preds = %19
%44 = tail call i32 @myWarn_Loc(i32 3, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 104, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%45 = tail call i32 @free(double* %15)
br label %145
46: ; preds = %19
%47 = icmp eq i64 %12, 1
%48 = fneg double %26
%49 = tail call double @llvm.fmuladd.f64(double %48, double %4, double %39)
%50 = select i1 %47, double %49, double %39
%51 = fdiv double %50, %41
%52 = getelementptr inbounds double, double* %5, i64 1
store double %51, double* %52
%53 = icmp ugt i64 %12, 1
br i1 %53, label %54, label %141
54: ; preds = %46
%55 = add i64 %2, -3
br label %56
56: ; preds = %54, %93
%57 = phi double [ %41, %54 ], [ %88, %93 ]
%58 = phi i64 [ 1, %54 ], [ %59, %93 ]
%59 = add nuw i64 %58, 1
%60 = getelementptr inbounds double, double* %0, i64 %59
%61 = load double, double* %60
%62 = getelementptr inbounds double, double* %0, i64 %58
%63 = load double, double* %62
%64 = fsub double %61, %63
%65 = add i64 %58, 2
%66 = getelementptr inbounds double, double* %0, i64 %65
%67 = load double, double* %66
%68 = fsub double %67, %61
%69 = getelementptr inbounds double, double* %1, i64 %65
%70 = load double, double* %69
%71 = getelementptr inbounds double, double* %1, i64 %59
%72 = load double, double* %71
%73 = fsub double %70, %72
%74 = fdiv double %73, %68
%75 = getelementptr inbounds double, double* %1, i64 %58
%76 = load double, double* %75
%77 = fsub double %72, %76
%78 = fdiv double %77, %64
%79 = fsub double %74, %78
%80 = fmul double %79, 6.000000e+00
%81 = fdiv double %64, %57
%82 = getelementptr inbounds double, double* %15, i64 %58
store double %81, double* %82
%83 = load double, double* %66
%84 = load double, double* %62
%85 = fsub double %83, %84
%86 = fneg double %64
%87 = fmul double %81, %86
%88 = tail call double @llvm.fmuladd.f64(double %85, double 2.000000e+00, double %87)
%89 = fcmp oeq double %88, 0.000000e+00
br i1 %89, label %90, label %93
90: ; preds = %56
%91 = tail call i32 @myWarn_Loc(i32 3, i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 123, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%92 = tail call i32 @free(double* %15)
br label %145
93: ; preds = %56
%94 = icmp eq i64 %58, %55
%95 = fneg double %68
%96 = tail call double @llvm.fmuladd.f64(double %95, double %4, double %80)
%97 = select i1 %94, double %96, double %80
%98 = getelementptr inbounds double, double* %5, i64 %58
%99 = load double, double* %98
%100 = tail call double @llvm.fmuladd.f64(double %86, double %99, double %97)
%101 = fdiv double %100, %88
%102 = getelementptr inbounds double, double* %5, i64 %59
store double %101, double* %102
%103 = icmp eq i64 %59, %12
br i1 %103, label %104, label %56
104: ; preds = %93
%105 = icmp eq i64 %55, 0
br i1 %105, label %141, label %106
106: ; preds = %104
%107 = getelementptr inbounds double, double* %5, i64 %12
%108 = load double, double* %107
%109 = and i64 %55, 1
%110 = icmp eq i64 %109, 0
br i1 %110, label %119, label %111
111: ; preds = %106
%112 = getelementptr inbounds double, double* %15, i64 %55
%113 = load double, double* %112
%114 = getelementptr inbounds double, double* %5, i64 %55
%115 = load double, double* %114
%116 = fneg double %113
%117 = tail call double @llvm.fmuladd.f64(double %116, double %108, double %115)
store double %117, double* %114
%118 = add i64 %2, -4
br label %119
119: ; preds = %111, %106
%120 = phi double [ %108, %106 ], [ %117, %111 ]
%121 = phi i64 [ %55, %106 ], [ %118, %111 ]
%122 = icmp eq i64 %2, 4
br i1 %122, label %141, label %123
123: ; preds = %119, %123
%124 = phi double [ %138, %123 ], [ %120, %119 ]
%125 = phi i64 [ %139, %123 ], [ %121, %119 ]
%126 = getelementptr inbounds double, double* %15, i64 %125
%127 = load double, double* %126
%128 = getelementptr inbounds double, double* %5, i64 %125
%129 = load double, double* %128
%130 = fneg double %127
%131 = tail call double @llvm.fmuladd.f64(double %130, double %124, double %129)
store double %131, double* %128
%132 = add i64 %125, -1
%133 = getelementptr inbounds double, double* %15, i64 %132
%134 = load double, double* %133
%135 = getelementptr inbounds double, double* %5, i64 %132
%136 = load double, double* %135
%137 = fneg double %134
%138 = tail call double @llvm.fmuladd.f64(double %137, double %131, double %136)
store double %138, double* %135
%139 = add i64 %125, -2
%140 = icmp eq i64 %139, 0
br i1 %140, label %141, label %123
141: ; preds = %119, %123, %46, %104
%142 = tail call i32 @free(double* %15)
%143 = add i64 %2, -1
%144 = getelementptr inbounds double, double* %5, i64 %143
store double %4, double* %144
br label %145
145: ; preds = %8, %6, %141, %90, %43, %17, %9
%146 = phi i32 [ 0, %9 ], [ -1, %17 ], [ -2, %43 ], [ -2, %90 ], [ 0, %141 ], [ 0, %6 ], [ 0, %8 ]
ret i32 %146
}