#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 floor(double);
double BGBMID_SplinePolateF(float *samp, int len, double t) {
  double f, g, u, v;
  double a, b, c, d;
  double p;
  int i;
  i = floor(t);
  f = t - i;
  g = 1.0 - f;
  a = samp[i - 1];
  b = samp[i + 0];
  c = samp[i + 1];
  d = samp[i + 2];
  u = b + f * (b - a);
  v = c + g * (c - d);
  p = (u * g) + (v * f);
  return (p);
}


x86 assembly (clang, -O0):
<BGBMID_SplinePolateF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <floor@plt>
mov    %eax,-0x64(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x64(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb4(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x64(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x64(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
subsd  -0x40(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
subsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BGBMID_SplinePolateF>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
call   1030 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  0xec4(%rip),%xmm1
subsd  %xmm2,%xmm1
movapd %xmm2,%xmm6
cltq
movss  -0x4(%rbx,%rax,4),%xmm0
movss  (%rbx,%rax,4),%xmm2
cvtss2sd %xmm0,%xmm3
cvtss2sd %xmm2,%xmm2
movss  0x4(%rbx,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm4
movss  0x8(%rbx,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm5
movaps %xmm2,%xmm0
subsd  %xmm3,%xmm0
mulsd  %xmm6,%xmm0
addsd  %xmm2,%xmm0
movaps %xmm4,%xmm2
subsd  %xmm5,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm4,%xmm2
mulsd  %xmm6,%xmm2
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @BGBMID_SplinePolateF(float* %0, i32 %1, double %2) {
%4 = alloca float*
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca i32
store float* %0, float** %4
store i32 %1, i32* %5
store double %2, double* %6
%17 = load double, double* %6
%18 = call i32 @floor(double %17)
store i32 %18, i32* %16
%19 = load double, double* %6
%20 = load i32, i32* %16
%21 = sitofp i32 %20 to double
%22 = fsub double %19, %21
store double %22, double* %7
%23 = load double, double* %7
%24 = fsub double 1.000000e+00, %23
store double %24, double* %8
%25 = load float*, float** %4
%26 = load i32, i32* %16
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds float, float* %25, i64 %28
%30 = load float, float* %29
%31 = fpext float %30 to double
store double %31, double* %11
%32 = load float*, float** %4
%33 = load i32, i32* %16
%34 = add nsw i32 %33, 0
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %32, i64 %35
%37 = load float, float* %36
%38 = fpext float %37 to double
store double %38, double* %12
%39 = load float*, float** %4
%40 = load i32, i32* %16
%41 = add nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds float, float* %39, i64 %42
%44 = load float, float* %43
%45 = fpext float %44 to double
store double %45, double* %13
%46 = load float*, float** %4
%47 = load i32, i32* %16
%48 = add nsw i32 %47, 2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds float, float* %46, i64 %49
%51 = load float, float* %50
%52 = fpext float %51 to double
store double %52, double* %14
%53 = load double, double* %12
%54 = load double, double* %7
%55 = load double, double* %12
%56 = load double, double* %11
%57 = fsub double %55, %56
%58 = call double @llvm.fmuladd.f64(double %54, double %57, double %53)
store double %58, double* %9
%59 = load double, double* %13
%60 = load double, double* %8
%61 = load double, double* %13
%62 = load double, double* %14
%63 = fsub double %61, %62
%64 = call double @llvm.fmuladd.f64(double %60, double %63, double %59)
store double %64, double* %10
%65 = load double, double* %9
%66 = load double, double* %8
%67 = load double, double* %10
%68 = load double, double* %7
%69 = fmul double %67, %68
%70 = call double @llvm.fmuladd.f64(double %65, double %66, double %69)
store double %70, double* %15
%71 = load double, double* %15
ret double %71
}

LLVM IR (-O2):
define double @BGBMID_SplinePolateF(float* nocapture %0, i32 %1, double %2) {
%4 = tail call i32 @floor(double %2)
%5 = sitofp i32 %4 to double
%6 = fsub double %2, %5
%7 = fsub double 1.000000e+00, %6
%8 = add nsw i32 %4, -1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds float, float* %0, i64 %9
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = sext i32 %4 to i64
%14 = getelementptr inbounds float, float* %0, i64 %13
%15 = load float, float* %14
%16 = fpext float %15 to double
%17 = add nsw i32 %4, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds float, float* %0, i64 %18
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = add nsw i32 %4, 2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds float, float* %0, i64 %23
%25 = load float, float* %24
%26 = fpext float %25 to double
%27 = fsub double %16, %12
%28 = tail call double @llvm.fmuladd.f64(double %6, double %27, double %16)
%29 = fsub double %21, %26
%30 = tail call double @llvm.fmuladd.f64(double %7, double %29, double %21)
%31 = fmul double %6, %30
%32 = tail call double @llvm.fmuladd.f64(double %28, double %7, double %31)
ret double %32
}