#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 fabs(double);
double BsplnWght7(long i, double x) {
  double f;
  x = fabs(x - (double)i);
  if (x < 1.0) {
    f = x * x;
    return (f * (f * (f * (x * (1.0 / 144.0) - 1.0 / 36.0) + 1.0 / 9.0) -
                 1.0 / 3.0) +
            151.0 / 315.0);
  }
  if (x < 2.0)
    return (
        x * (x * (x * (x * (x * (x * (0.05 - x * (1.0 / 240.0)) - 7.0 / 30.0) +
                            0.5) -
                       7.0 / 18.0) -
                  0.1) -
             7.0 / 90.0) +
        103.0 / 210.0);
  if (x < 3.0)
    return (x * (x * (x * (x * (x * (x * (x * (1.0 / 720.0) - 1.0 / 36.0) +
                                     7.0 / 30.0) -
                                19.0 / 18.0) +
                           49.0 / 18.0) -
                      23.0 / 6.0) +
                 217.0 / 90.0) -
            139.0 / 630.0);
  if (x < 4.0) {
    f = 4.0 - x;
    x = f * f * f;
    return (x * x * f * (1.0 / 5040.0));
  }
  return (0.0);
}


x86 assembly (clang, -O0):
<BsplnWght7>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
movaps 0xfad(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xecc(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11b4 <BsplnWght7+0xb4>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  0xf56(%rip),%xmm4
mulsd  %xmm4,%xmm3
movsd  0xeea(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xf32(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xf1a(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xf02(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13a1 <BsplnWght7+0x2a1>
movsd  0xe4c(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1283 <BsplnWght7+0x183>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x18(%rbp),%xmm5
movsd  -0x18(%rbp),%xmm6
movq   %xmm6,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm6
movsd  0xe8f(%rip),%xmm7
mulsd  %xmm7,%xmm6
movsd  0xe8b(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xe6b(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xe53(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe3b(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe23(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe0b(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13a1 <BsplnWght7+0x2a1>
movsd  0xd85(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    133b <BsplnWght7+0x23b>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm4
movsd  -0x18(%rbp),%xmm5
movsd  -0x18(%rbp),%xmm6
movsd  0xd97(%rip),%xmm7
mulsd  %xmm7,%xmm6
movsd  0xd93(%rip),%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm6,%xmm5
movsd  0xd73(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xd5b(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xd43(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd2b(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd13(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcfb(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13a1 <BsplnWght7+0x2a1>
movsd  0xcd5(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1399 <BsplnWght7+0x299>
movsd  0xcc2(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xc95(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13a1 <BsplnWght7+0x2a1>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<BsplnWght7>:
cvtsi2sd %rdi,%xmm1
subsd  %xmm1,%xmm0
movapd 0xeef(%rip),%xmm2
andpd  %xmm0,%xmm2
movsd  0xef3(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    1164 <BsplnWght7+0x64>
movsd  0xf8d(%rip),%xmm1
mulsd  %xmm2,%xmm1
addsd  0xf09(%rip),%xmm1
mulsd  %xmm0,%xmm0
mulsd  %xmm0,%xmm1
addsd  0xf79(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf75(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf71(%rip),%xmm1
movapd %xmm1,%xmm0
ret
movsd  0xeac(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    11cf <BsplnWght7+0xcf>
movsd  0xefe(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xefa(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xef6(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xef2(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xeee(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xeea(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xee6(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xee2(%rip),%xmm0
ret
movsd  0xe49(%rip),%xmm0
ucomisd %xmm2,%xmm0
jbe    123a <BsplnWght7+0x13a>
movsd  0xe53(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe4f(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe4b(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe47(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe43(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe3f(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe3b(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  0xe37(%rip),%xmm0
ret
xorpd  %xmm0,%xmm0
movsd  0xde2(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    126c <BsplnWght7+0x16c>
subsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
mulsd  0xdc4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @BsplnWght7(i64 %0, double %1) {
%3 = alloca double
%4 = alloca i64
%5 = alloca double
%6 = alloca double
store i64 %0, i64* %4
store double %1, double* %5
%7 = load double, double* %5
%8 = load i64, i64* %4
%9 = sitofp i64 %8 to double
%10 = fsub double %7, %9
%11 = call double @llvm.fabs.f64(double %10)
store double %11, double* %5
%12 = load double, double* %5
%13 = fcmp olt double %12, 1.000000e+00
br i1 %13, label %14, label %26
14: ; preds = %2
%15 = load double, double* %5
%16 = load double, double* %5
%17 = fmul double %15, %16
store double %17, double* %6
%18 = load double, double* %6
%19 = load double, double* %6
%20 = load double, double* %6
%21 = load double, double* %5
%22 = call double @llvm.fmuladd.f64(double %21, double 0x3F7C71C71C71C71C, double 0xBF9C71C71C71C71C)
%23 = call double @llvm.fmuladd.f64(double %20, double %22, double 0x3FBC71C71C71C71C)
%24 = call double @llvm.fmuladd.f64(double %19, double %23, double 0xBFD5555555555555)
%25 = call double @llvm.fmuladd.f64(double %18, double %24, double 0x3FDEADEADEADEADF)
store double %25, double* %3
br label %81
26: ; preds = %2
%27 = load double, double* %5
%28 = fcmp olt double %27, 2.000000e+00
br i1 %28, label %29, label %45
29: ; preds = %26
%30 = load double, double* %5
%31 = load double, double* %5
%32 = load double, double* %5
%33 = load double, double* %5
%34 = load double, double* %5
%35 = load double, double* %5
%36 = load double, double* %5
%37 = fneg double %36
%38 = call double @llvm.fmuladd.f64(double %37, double 0x3F71111111111111, double 5.000000e-02)
%39 = call double @llvm.fmuladd.f64(double %35, double %38, double 0xBFCDDDDDDDDDDDDE)
%40 = call double @llvm.fmuladd.f64(double %34, double %39, double 5.000000e-01)
%41 = call double @llvm.fmuladd.f64(double %33, double %40, double 0xBFD8E38E38E38E39)
%42 = call double @llvm.fmuladd.f64(double %32, double %41, double -1.000000e-01)
%43 = call double @llvm.fmuladd.f64(double %31, double %42, double 0xBFB3E93E93E93E94)
%44 = call double @llvm.fmuladd.f64(double %30, double %43, double 0x3FDF63F63F63F63F)
store double %44, double* %3
br label %81
45: ; preds = %26
%46 = load double, double* %5
%47 = fcmp olt double %46, 3.000000e+00
br i1 %47, label %48, label %63
48: ; preds = %45
%49 = load double, double* %5
%50 = load double, double* %5
%51 = load double, double* %5
%52 = load double, double* %5
%53 = load double, double* %5
%54 = load double, double* %5
%55 = load double, double* %5
%56 = call double @llvm.fmuladd.f64(double %55, double 0x3F56C16C16C16C17, double 0xBF9C71C71C71C71C)
%57 = call double @llvm.fmuladd.f64(double %54, double %56, double 0x3FCDDDDDDDDDDDDE)
%58 = call double @llvm.fmuladd.f64(double %53, double %57, double 0xBFF0E38E38E38E39)
%59 = call double @llvm.fmuladd.f64(double %52, double %58, double 0x4005C71C71C71C72)
%60 = call double @llvm.fmuladd.f64(double %51, double %59, double 0xC00EAAAAAAAAAAAB)
%61 = call double @llvm.fmuladd.f64(double %50, double %60, double 0x400349F49F49F49F)
%62 = call double @llvm.fmuladd.f64(double %49, double %61, double 0xBFCC3DC3DC3DC3DC)
store double %62, double* %3
br label %81
63: ; preds = %45
%64 = load double, double* %5
%65 = fcmp olt double %64, 4.000000e+00
br i1 %65, label %66, label %80
66: ; preds = %63
%67 = load double, double* %5
%68 = fsub double 4.000000e+00, %67
store double %68, double* %6
%69 = load double, double* %6
%70 = load double, double* %6
%71 = fmul double %69, %70
%72 = load double, double* %6
%73 = fmul double %71, %72
store double %73, double* %5
%74 = load double, double* %5
%75 = load double, double* %5
%76 = fmul double %74, %75
%77 = load double, double* %6
%78 = fmul double %76, %77
%79 = fmul double %78, 0x3F2A01A01A01A01A
store double %79, double* %3
br label %81
80: ; preds = %63
store double 0.000000e+00, double* %3
br label %81
81: ; preds = %80, %66, %48, %29, %14
%82 = load double, double* %3
ret double %82
}

LLVM IR (-O2):
define double @BsplnWght7(i64 %0, double %1) {
%3 = sitofp i64 %0 to double
%4 = fsub double %1, %3
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = fcmp olt double %5, 1.000000e+00
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = fmul double %4, %4
%9 = tail call double @llvm.fmuladd.f64(double %5, double 0x3F7C71C71C71C71C, double 0xBF9C71C71C71C71C)
%10 = tail call double @llvm.fmuladd.f64(double %8, double %9, double 0x3FBC71C71C71C71C)
%11 = tail call double @llvm.fmuladd.f64(double %8, double %10, double 0xBFD5555555555555)
%12 = tail call double @llvm.fmuladd.f64(double %8, double %11, double 0x3FDEADEADEADEADF)
br label %43
13: ; preds = %2
%14 = fcmp olt double %5, 2.000000e+00
br i1 %14, label %15, label %24
15: ; preds = %13
%16 = fneg double %5
%17 = tail call double @llvm.fmuladd.f64(double %16, double 0x3F71111111111111, double 5.000000e-02)
%18 = tail call double @llvm.fmuladd.f64(double %5, double %17, double 0xBFCDDDDDDDDDDDDE)
%19 = tail call double @llvm.fmuladd.f64(double %5, double %18, double 5.000000e-01)
%20 = tail call double @llvm.fmuladd.f64(double %5, double %19, double 0xBFD8E38E38E38E39)
%21 = tail call double @llvm.fmuladd.f64(double %5, double %20, double -1.000000e-01)
%22 = tail call double @llvm.fmuladd.f64(double %5, double %21, double 0xBFB3E93E93E93E94)
%23 = tail call double @llvm.fmuladd.f64(double %5, double %22, double 0x3FDF63F63F63F63F)
br label %43
24: ; preds = %13
%25 = fcmp olt double %5, 3.000000e+00
br i1 %25, label %26, label %34
26: ; preds = %24
%27 = tail call double @llvm.fmuladd.f64(double %5, double 0x3F56C16C16C16C17, double 0xBF9C71C71C71C71C)
%28 = tail call double @llvm.fmuladd.f64(double %5, double %27, double 0x3FCDDDDDDDDDDDDE)
%29 = tail call double @llvm.fmuladd.f64(double %5, double %28, double 0xBFF0E38E38E38E39)
%30 = tail call double @llvm.fmuladd.f64(double %5, double %29, double 0x4005C71C71C71C72)
%31 = tail call double @llvm.fmuladd.f64(double %5, double %30, double 0xC00EAAAAAAAAAAAB)
%32 = tail call double @llvm.fmuladd.f64(double %5, double %31, double 0x400349F49F49F49F)
%33 = tail call double @llvm.fmuladd.f64(double %5, double %32, double 0xBFCC3DC3DC3DC3DC)
br label %43
34: ; preds = %24
%35 = fcmp olt double %5, 4.000000e+00
br i1 %35, label %36, label %43
36: ; preds = %34
%37 = fsub double 4.000000e+00, %5
%38 = fmul double %37, %37
%39 = fmul double %37, %38
%40 = fmul double %39, %39
%41 = fmul double %37, %40
%42 = fmul double %41, 0x3F2A01A01A01A01A
br label %43
43: ; preds = %34, %36, %26, %15, %7
%44 = phi double [ %12, %7 ], [ %23, %15 ], [ %33, %26 ], [ %42, %36 ], [ 0.000000e+00, %34 ]
ret double %44
}