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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double fmod(int, int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ g2_free(double *);
scalar_t__ g2_malloc(int);
int /*<<< orphan*/ g2_split(int, double const *, double *, double *);
int /*<<< orphan*/ stderr;
void g2_c_b_spline(int n, const double *points, int m, double *sxy) {
  int i, j;
  double *x, *y;
  double t, bl1, bl2, bl3, bl4;
  double interval, xi_3, yi_3, xi, yi;
  if (n < 3) {
    fputs("\nERROR calling function \"g2_c_b_spline\":\n"
          "number of data points input should be at least three\n",
          stderr);
    return;
  }
  x = (double *)g2_malloc(n * 2 * sizeof(double));
  y = x + n;
  g2_split(n, points, x, y);
  m--;
  n--;
  interval = (double)n / m;
  for (m += m, i = 2, j = 0; i <= n + 1; i++) {
    if (i == 2) {
      xi_3 = 2 * x[0] - x[1];
      yi_3 = 2 * y[0] - y[1];
    } else {
      xi_3 = x[i - 3];
      yi_3 = y[i - 3];
    }
    if (i == n + 1) {
      xi = 2 * x[n] - x[n - 1];
      yi = 2 * y[n] - y[n - 1];
    } else {
      xi = x[i];
      yi = y[i];
    }
    t = fmod(j * interval, 1.);
    while (t < 1. && j < m) {
      bl1 = (1. - t);
      bl2 = t * t;
      bl4 = t * bl2;
      bl3 = bl4 - bl2;
      bl1 = bl1 * bl1 * bl1;
      bl2 = 3. * (bl3 - bl2) + 4.;
      bl3 = 3. * (t - bl3) + 1.;
      sxy[j++] = (bl1 * xi_3 + bl2 * x[i - 2] + bl3 * x[i - 1] + bl4 * xi) / 6.;
      sxy[j++] = (bl1 * yi_3 + bl2 * y[i - 2] + bl3 * y[i - 1] + bl4 * yi) / 6.;
      t += interval;
    }
  }
  sxy[m] = x[n];
  sxy[m + 1] = y[n];
  g2_free(x);
}


x86 assembly (clang, -O0):
<g2_c_b_spline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    118d <g2_c_b_spline+0x3d>
mov    0x2e66(%rip),%rax
mov    (%rax),%esi
lea    0xe9d(%rip),%rdi
call   1050 <fputs@plt>
jmp    15e6 <g2_c_b_spline+0x496>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <g2_malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
call   1070 <g2_split@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x14(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x2,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     15a4 <g2_c_b_spline+0x454>
cmpl   $0x2,-0x24(%rbp)
jne    1291 <g2_c_b_spline+0x141>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    12bf <g2_c_b_spline+0x16f>
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    135e <g2_c_b_spline+0x20e>
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    1385 <g2_c_b_spline+0x235>
mov    -0x30(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
cvtsi2sdl -0x28(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
cvttsd2si %xmm0,%edi
mov    $0x1,%esi
call   1040 <fmod@plt>
movsd  %xmm0,-0x40(%rbp)
xor    %eax,%eax
movsd  0xc54(%rip),%xmm0
ucomisd -0x40(%rbp),%xmm0
mov    %al,-0x89(%rbp)
jbe    13cc <g2_c_b_spline+0x27c>
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
setl   %al
mov    %al,-0x89(%rbp)
mov    -0x89(%rbp),%al
test   $0x1,%al
jne    13df <g2_c_b_spline+0x28f>
jmp    1591 <g2_c_b_spline+0x441>
movsd  0xc19(%rip),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x58(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  0xbcc(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xbc8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  0xba5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xb89(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x58(%rbp),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xb26(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mov    -0x38(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x58(%rbp),%xmm1
mov    -0x38(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xaa6(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x28(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x68(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    13a2 <g2_c_b_spline+0x252>
jmp    1596 <g2_c_b_spline+0x446>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1207 <g2_c_b_spline+0xb7>
mov    -0x30(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rdi
call   1060 <g2_free@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g2_c_b_spline>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x2,%edi
jg     1186 <g2_c_b_spline+0x36>
mov    0x2e76(%rip),%rax
mov    (%rax),%esi
lea    0xead(%rip),%rdi
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fputs@plt>
mov    %rcx,%r15
mov    %edx,%r13d
mov    %rsi,%r14
mov    %edi,%ebp
shl    $0x4,%edi
call   1030 <g2_malloc@plt>
mov    %rax,%r12
mov    %ebp,%eax
mov    %rax,0x20(%rsp)
lea    (%r12,%rax,8),%rbx
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
call   1070 <g2_split@plt>
lea    -0x1(%r13),%eax
lea    -0x1(%rbp),%ecx
mov    %rcx,0x10(%rsp)
cvtsi2sd %ecx,%xmm9
cvtsi2sd %eax,%xmm0
divsd  %xmm0,%xmm9
lea    -0x2(%r13,%r13,1),%eax
lea    -0x2(%rbp),%ecx
mov    %rcx,0x18(%rsp)
mov    %eax,0x4(%rsp)
movslq %eax,%r13
add    $0x1,%ebp
mov    %rbp,0x28(%rsp)
xor    %ebp,%ebp
mov    $0x2,%r14d
movsd  %xmm9,0x8(%rsp)
jmp    1216 <g2_c_b_spline+0xc6>
xchg   %ax,%ax
movsd  0x8(%rsp),%xmm9
add    $0x1,%r14
cmp    0x28(%rsp),%r14
je     1412 <g2_c_b_spline+0x2c2>
cmp    $0x2,%r14
jne    1240 <g2_c_b_spline+0xf0>
movsd  (%r12),%xmm1
movsd  0x8(%r12),%xmm0
movhpd 0x8(%rbx),%xmm0
movhpd (%rbx),%xmm1
addpd  %xmm1,%xmm1
subpd  %xmm0,%xmm1
jmp    124e <g2_c_b_spline+0xfe>
nopl   0x0(%rax)
movsd  -0x18(%r12,%r14,8),%xmm1
movhpd -0x18(%rbx,%r14,8),%xmm1
cmp    0x20(%rsp),%r14
movapd %xmm1,0x40(%rsp)
jne    1290 <g2_c_b_spline+0x140>
mov    0x18(%rsp),%rax
movsd  (%r12,%rax,8),%xmm0
movhpd (%rbx,%rax,8),%xmm0
mov    0x10(%rsp),%rax
movsd  (%r12,%rax,8),%xmm1
movhpd (%rbx,%rax,8),%xmm1
addpd  %xmm1,%xmm1
subpd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
jmp    12a2 <g2_c_b_spline+0x152>
nopl   0x0(%rax,%rax,1)
movsd  (%r12,%r14,8),%xmm0
movhpd (%rbx,%r14,8),%xmm0
movapd %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  %xmm9,%xmm0
cvttsd2si %xmm0,%edi
mov    $0x1,%esi
call   1040 <fmod@plt>
movsd  0xd3c(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    1200 <g2_c_b_spline+0xb0>
cmp    0x4(%rsp),%ebp
jge    1200 <g2_c_b_spline+0xb0>
movslq %ebp,%rax
movapd 0x40(%rsp),%xmm14
movapd %xmm14,%xmm8
unpckhpd %xmm14,%xmm8
movapd 0x30(%rsp),%xmm15
movapd %xmm15,%xmm10
unpckhpd %xmm15,%xmm10
add    $0x2,%rax
movsd  0x8(%rsp),%xmm9
movsd  0xcf7(%rip),%xmm11
movsd  0xcf6(%rip),%xmm12
movsd  0xcf5(%rip),%xmm13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd %xmm2,%xmm5
subsd  %xmm0,%xmm5
movapd %xmm0,%xmm7
mulsd  %xmm0,%xmm7
movapd %xmm0,%xmm3
mulsd  %xmm7,%xmm3
movapd %xmm3,%xmm6
subsd  %xmm7,%xmm6
movapd %xmm5,%xmm1
mulsd  %xmm5,%xmm1
mulsd  %xmm5,%xmm1
movapd %xmm0,%xmm5
subsd  %xmm6,%xmm5
subsd  %xmm7,%xmm6
mulsd  %xmm11,%xmm6
addsd  %xmm12,%xmm6
mulsd  %xmm11,%xmm5
addsd  %xmm2,%xmm5
movsd  -0x10(%r12,%r14,8),%xmm7
mulsd  %xmm6,%xmm7
movapd %xmm1,%xmm4
mulsd  %xmm14,%xmm4
addsd  %xmm7,%xmm4
movsd  -0x8(%r12,%r14,8),%xmm7
mulsd  %xmm5,%xmm7
addsd  %xmm4,%xmm7
movapd %xmm3,%xmm4
mulsd  %xmm15,%xmm4
addsd  %xmm7,%xmm4
divsd  %xmm13,%xmm4
movsd  %xmm4,-0x10(%r15,%rax,8)
mulsd  -0x10(%rbx,%r14,8),%xmm6
mulsd  %xmm8,%xmm1
addsd  %xmm6,%xmm1
mulsd  -0x8(%rbx,%r14,8),%xmm5
addsd  %xmm1,%xmm5
mulsd  %xmm10,%xmm3
addsd  %xmm5,%xmm3
divsd  %xmm13,%xmm3
movsd  %xmm3,-0x8(%r15,%rax,8)
addsd  %xmm9,%xmm0
add    $0x2,%ebp
ucomisd %xmm0,%xmm2
jbe    1207 <g2_c_b_spline+0xb7>
lea    0x2(%rax),%rcx
cmp    %r13,%rax
mov    %rcx,%rax
jl     1330 <g2_c_b_spline+0x1e0>
jmp    1207 <g2_c_b_spline+0xb7>
mov    0x10(%rsp),%rax
movsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,(%r15,%r13,8)
movsd  (%rbx,%rax,8),%xmm0
mov    0x4(%rsp),%eax
or     $0x1,%eax
cltq
movsd  %xmm0,(%r15,%rax,8)
mov    %r12,%rdi
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <g2_free@plt>

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

LLVM IR (-O2):
@.str = [95 x i8] c"\0AERROR calling function \22g2_c_b_spline\22:\0Anumber of data points input should be at least three\0A\00"
@stderr = global i32 0
define void @g2_c_b_spline(i32 %0, double* %1, i32 %2, double* nocapture writeonly %3) {
%5 = icmp slt i32 %0, 3
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = load i32, i32* @stderr
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %149
9: ; preds = %4
%10 = shl i32 %0, 4
%11 = tail call i64 @g2_malloc(i32 %10)
%12 = inttoptr i64 %11 to double*
%13 = zext i32 %0 to i64
%14 = getelementptr inbounds double, double* %12, i64 %13
%15 = tail call i32 @g2_split(i32 %0, double* %1, double* %12, double* %14)
%16 = add nsw i32 %2, -1
%17 = add nsw i32 %0, -1
%18 = sitofp i32 %17 to double
%19 = sitofp i32 %16 to double
%20 = fdiv double %18, %19
%21 = shl nsw i32 %16, 1
%22 = getelementptr inbounds double, double* %12, i64 1
%23 = getelementptr inbounds double, double* %14, i64 1
%24 = zext i32 %17 to i64
%25 = getelementptr inbounds double, double* %12, i64 %24
%26 = add nsw i32 %0, -2
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds double, double* %12, i64 %27
%29 = getelementptr inbounds double, double* %14, i64 %24
%30 = getelementptr inbounds double, double* %14, i64 %27
%31 = sext i32 %21 to i64
%32 = add nuw i32 %0, 1
%33 = zext i32 %32 to i64
br label %34
34: ; preds = %9, %136
%35 = phi i64 [ 2, %9 ], [ %138, %136 ]
%36 = phi i32 [ 0, %9 ], [ %137, %136 ]
%37 = icmp eq i64 %35, 2
br i1 %37, label %38, label %49
38: ; preds = %34
%39 = load double, double* %12
%40 = load double, double* %22
%41 = load double, double* %14
%42 = load double, double* %23
%43 = insertelement <2 x double> poison, double %40, i64 0
%44 = insertelement <2 x double> %43, double %42, i64 1
%45 = fneg <2 x double> %44
%46 = insertelement <2 x double> poison, double %39, i64 0
%47 = insertelement <2 x double> %46, double %41, i64 1
%48 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %47, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %45)
br label %57
49: ; preds = %34
%50 = add nsw i64 %35, -3
%51 = getelementptr inbounds double, double* %12, i64 %50
%52 = load double, double* %51
%53 = getelementptr inbounds double, double* %14, i64 %50
%54 = load double, double* %53
%55 = insertelement <2 x double> poison, double %52, i64 0
%56 = insertelement <2 x double> %55, double %54, i64 1
br label %57
57: ; preds = %49, %38
%58 = phi <2 x double> [ %48, %38 ], [ %56, %49 ]
%59 = icmp eq i64 %35, %13
br i1 %59, label %60, label %71
60: ; preds = %57
%61 = load double, double* %25
%62 = load double, double* %28
%63 = load double, double* %29
%64 = load double, double* %30
%65 = insertelement <2 x double> poison, double %62, i64 0
%66 = insertelement <2 x double> %65, double %64, i64 1
%67 = fneg <2 x double> %66
%68 = insertelement <2 x double> poison, double %61, i64 0
%69 = insertelement <2 x double> %68, double %63, i64 1
%70 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %69, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %67)
br label %78
71: ; preds = %57
%72 = getelementptr inbounds double, double* %12, i64 %35
%73 = load double, double* %72
%74 = getelementptr inbounds double, double* %14, i64 %35
%75 = load double, double* %74
%76 = insertelement <2 x double> poison, double %73, i64 0
%77 = insertelement <2 x double> %76, double %75, i64 1
br label %78
78: ; preds = %71, %60
%79 = phi <2 x double> [ %70, %60 ], [ %77, %71 ]
%80 = sitofp i32 %36 to double
%81 = fmul double %20, %80
%82 = fptosi double %81 to i32
%83 = tail call double @fmod(i32 %82, i32 1)
%84 = fcmp olt double %83, 1.000000e+00
%85 = icmp slt i32 %36, %21
%86 = select i1 %84, i1 %85, i1 false
br i1 %86, label %87, label %136
87: ; preds = %78
%88 = add nsw i64 %35, -2
%89 = getelementptr inbounds double, double* %12, i64 %88
%90 = add nsw i64 %35, -1
%91 = getelementptr inbounds double, double* %12, i64 %90
%92 = getelementptr inbounds double, double* %14, i64 %88
%93 = getelementptr inbounds double, double* %14, i64 %90
%94 = sext i32 %36 to i64
%95 = extractelement <2 x double> %58, i64 0
%96 = extractelement <2 x double> %79, i64 0
%97 = extractelement <2 x double> %58, i64 1
%98 = extractelement <2 x double> %79, i64 1
br label %99
99: ; preds = %87, %99
%100 = phi i64 [ %94, %87 ], [ %128, %99 ]
%101 = phi double [ %83, %87 ], [ %130, %99 ]
%102 = fsub double 1.000000e+00, %101
%103 = fmul double %101, %101
%104 = fmul double %101, %103
%105 = fsub double %104, %103
%106 = fmul double %102, %102
%107 = fmul double %102, %106
%108 = fsub double %105, %103
%109 = tail call double @llvm.fmuladd.f64(double %108, double 3.000000e+00, double 4.000000e+00)
%110 = fsub double %101, %105
%111 = tail call double @llvm.fmuladd.f64(double %110, double 3.000000e+00, double 1.000000e+00)
%112 = load double, double* %89
%113 = fmul double %109, %112
%114 = tail call double @llvm.fmuladd.f64(double %107, double %95, double %113)
%115 = load double, double* %91
%116 = tail call double @llvm.fmuladd.f64(double %111, double %115, double %114)
%117 = tail call double @llvm.fmuladd.f64(double %104, double %96, double %116)
%118 = fdiv double %117, 6.000000e+00
%119 = add nsw i64 %100, 1
%120 = getelementptr inbounds double, double* %3, i64 %100
store double %118, double* %120
%121 = load double, double* %92
%122 = fmul double %109, %121
%123 = tail call double @llvm.fmuladd.f64(double %107, double %97, double %122)
%124 = load double, double* %93
%125 = tail call double @llvm.fmuladd.f64(double %111, double %124, double %123)
%126 = tail call double @llvm.fmuladd.f64(double %104, double %98, double %125)
%127 = fdiv double %126, 6.000000e+00
%128 = add nsw i64 %100, 2
%129 = getelementptr inbounds double, double* %3, i64 %119
store double %127, double* %129
%130 = fadd double %20, %101
%131 = fcmp olt double %130, 1.000000e+00
%132 = icmp slt i64 %128, %31
%133 = select i1 %131, i1 %132, i1 false
br i1 %133, label %99, label %134
134: ; preds = %99
%135 = trunc i64 %128 to i32
br label %136
136: ; preds = %134, %78
%137 = phi i32 [ %36, %78 ], [ %135, %134 ]
%138 = add nuw nsw i64 %35, 1
%139 = icmp eq i64 %138, %33
br i1 %139, label %140, label %34
140: ; preds = %136
%141 = load double, double* %25
%142 = getelementptr inbounds double, double* %3, i64 %31
store double %141, double* %142
%143 = getelementptr inbounds double, double* %14, i64 %24
%144 = load double, double* %143
%145 = or i32 %21, 1
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds double, double* %3, i64 %146
store double %144, double* %147
%148 = tail call i32 @g2_free(double* %12)
br label %149
149: ; preds = %140, %6
ret void
}