#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 BsplnDWght7(long i, double x) {
  double f, g;
  x -= (double)i;
  f = fabs(x);
  if (f < 1.0) {
    g = f * f;
    f *= g * (g * (f * (7.0 / 144.0) - 1.0 / 6.0) + 4.0 / 9.0) - 2.0 / 3.0;
  } else if (f < 2.0)
    f = f * (f * (f * (f * (f * (0.3 - f * (7.0 / 240.0)) - 7.0 / 6.0) + 2.0) -
                  7.0 / 6.0) -
             0.2) -
        7.0 / 90.0;
  else if (f < 3.0)
    f = f * (f * (f * (f * (f * (f * (7.0 / 720.0) - 1.0 / 6.0) + 7.0 / 6.0) -
                       38.0 / 9.0) +
                  49.0 / 6.0) -
             23.0 / 3.0) +
        217.0 / 90.0;
  else if (f < 4.0) {
    f -= 4.0;
    f *= f;
    f *= f * f * (-1.0 / 720.0);
  } else
    return (0.0);
  return ((x > 0.0) ? (f) : (-f));
}


x86 assembly (clang, -O0):
<BsplnDWght7>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movaps 0xf73(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec2(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11ae <BsplnDWght7+0xae>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  0xf29(%rip),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xedd(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xf05(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeed(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1384 <BsplnDWght7+0x284>
movsd  0xe52(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1268 <BsplnDWght7+0x168>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  -0x20(%rbp),%xmm5
movq   %xmm5,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm5
movsd  0xe7a(%rip),%xmm6
mulsd  %xmm6,%xmm5
movsd  0xe76(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xe56(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xdde(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe36(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe1e(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe06(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    137f <BsplnDWght7+0x27f>
movsd  0xda0(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    130b <BsplnDWght7+0x20b>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  -0x20(%rbp),%xmm5
movsd  0xdaf(%rip),%xmm6
mulsd  %xmm6,%xmm5
movsd  0xdab(%rip),%xmm6
addsd  %xmm6,%xmm5
mulsd  %xmm5,%xmm4
movsd  0xd8b(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xd73(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd5b(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd43(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd2b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    137a <BsplnDWght7+0x27a>
movsd  0xd05(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1368 <BsplnDWght7+0x268>
movsd  -0x20(%rbp),%xmm0
movsd  0xced(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xccb(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1375 <BsplnDWght7+0x275>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13d0 <BsplnDWght7+0x2d0>
jmp    137a <BsplnDWght7+0x27a>
jmp    137f <BsplnDWght7+0x27f>
jmp    1384 <BsplnDWght7+0x284>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13a5 <BsplnDWght7+0x2a5>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    13c6 <BsplnDWght7+0x2c6>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<BsplnDWght7>:
cvtsi2sd %rdi,%xmm1
subsd  %xmm1,%xmm0
movapd 0xeef(%rip),%xmm2
andpd  %xmm0,%xmm2
movsd  0xf03(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    1160 <BsplnDWght7+0x60>
movapd %xmm0,%xmm1
movsd  0xf81(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xf1d(%rip),%xmm3
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm3
addsd  0xf6d(%rip),%xmm3
mulsd  %xmm1,%xmm3
addsd  0xf69(%rip),%xmm3
mulsd  %xmm2,%xmm3
jmp    1259 <BsplnDWght7+0x159>
movsd  0xec0(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    11c3 <BsplnDWght7+0xc3>
movsd  0xf12(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xf0e(%rip),%xmm3
mulsd  %xmm2,%xmm3
movsd  0xf0a(%rip),%xmm1
addsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm3
addsd  0xe8a(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm3
addsd  0xeee(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xeea(%rip),%xmm3
jmp    1259 <BsplnDWght7+0x159>
movsd  0xe65(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    1223 <BsplnDWght7+0x123>
movsd  0xe77(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xe73(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xe6f(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xe6b(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xe67(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xe63(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xe5f(%rip),%xmm3
jmp    1259 <BsplnDWght7+0x159>
xorpd  %xmm1,%xmm1
movsd  0xe09(%rip),%xmm3
ucomisd %xmm2,%xmm3
jbe    127a <BsplnDWght7+0x17a>
movsd  0xe03(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm1
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
mulsd  0xdf3(%rip),%xmm3
mulsd  %xmm1,%xmm3
movapd 0xdaf(%rip),%xmm2
xorpd  %xmm3,%xmm2
xorpd  %xmm1,%xmm1
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm3
andnpd %xmm2,%xmm1
orpd   %xmm3,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @BsplnDWght7(i64 %0, double %1) {
%3 = alloca double
%4 = alloca i64
%5 = alloca double
%6 = alloca double
%7 = alloca double
store i64 %0, i64* %4
store double %1, double* %5
%8 = load i64, i64* %4
%9 = sitofp i64 %8 to double
%10 = load double, double* %5
%11 = fsub double %10, %9
store double %11, double* %5
%12 = load double, double* %5
%13 = call double @llvm.fabs.f64(double %12)
store double %13, double* %6
%14 = load double, double* %6
%15 = fcmp olt double %14, 1.000000e+00
br i1 %15, label %16, label %28
16: ; preds = %2
%17 = load double, double* %6
%18 = load double, double* %6
%19 = fmul double %17, %18
store double %19, double* %7
%20 = load double, double* %7
%21 = load double, double* %7
%22 = load double, double* %6
%23 = call double @llvm.fmuladd.f64(double %22, double 0x3FA8E38E38E38E39, double 0xBFC5555555555555)
%24 = call double @llvm.fmuladd.f64(double %21, double %23, double 0x3FDC71C71C71C71C)
%25 = call double @llvm.fmuladd.f64(double %20, double %24, double 0xBFE5555555555555)
%26 = load double, double* %6
%27 = fmul double %26, %25
store double %27, double* %6
br label %80
28: ; preds = %2
%29 = load double, double* %6
%30 = fcmp olt double %29, 2.000000e+00
br i1 %30, label %31, label %45
31: ; preds = %28
%32 = load double, double* %6
%33 = load double, double* %6
%34 = load double, double* %6
%35 = load double, double* %6
%36 = load double, double* %6
%37 = load double, double* %6
%38 = fneg double %37
%39 = call double @llvm.fmuladd.f64(double %38, double 0x3F9DDDDDDDDDDDDE, double 3.000000e-01)
%40 = call double @llvm.fmuladd.f64(double %36, double %39, double 0xBFF2AAAAAAAAAAAB)
%41 = call double @llvm.fmuladd.f64(double %35, double %40, double 2.000000e+00)
%42 = call double @llvm.fmuladd.f64(double %34, double %41, double 0xBFF2AAAAAAAAAAAB)
%43 = call double @llvm.fmuladd.f64(double %33, double %42, double -2.000000e-01)
%44 = call double @llvm.fmuladd.f64(double %32, double %43, double 0xBFB3E93E93E93E94)
store double %44, double* %6
br label %79
45: ; preds = %28
%46 = load double, double* %6
%47 = fcmp olt double %46, 3.000000e+00
br i1 %47, label %48, label %61
48: ; preds = %45
%49 = load double, double* %6
%50 = load double, double* %6
%51 = load double, double* %6
%52 = load double, double* %6
%53 = load double, double* %6
%54 = load double, double* %6
%55 = call double @llvm.fmuladd.f64(double %54, double 0x3F83E93E93E93E94, double 0xBFC5555555555555)
%56 = call double @llvm.fmuladd.f64(double %53, double %55, double 0x3FF2AAAAAAAAAAAB)
%57 = call double @llvm.fmuladd.f64(double %52, double %56, double 0xC010E38E38E38E39)
%58 = call double @llvm.fmuladd.f64(double %51, double %57, double 0x4020555555555555)
%59 = call double @llvm.fmuladd.f64(double %50, double %58, double 0xC01EAAAAAAAAAAAB)
%60 = call double @llvm.fmuladd.f64(double %49, double %59, double 0x400349F49F49F49F)
store double %60, double* %6
br label %78
61: ; preds = %45
%62 = load double, double* %6
%63 = fcmp olt double %62, 4.000000e+00
br i1 %63, label %64, label %76
64: ; preds = %61
%65 = load double, double* %6
%66 = fsub double %65, 4.000000e+00
store double %66, double* %6
%67 = load double, double* %6
%68 = load double, double* %6
%69 = fmul double %68, %67
store double %69, double* %6
%70 = load double, double* %6
%71 = load double, double* %6
%72 = fmul double %70, %71
%73 = fmul double %72, 0xBF56C16C16C16C17
%74 = load double, double* %6
%75 = fmul double %74, %73
store double %75, double* %6
br label %77
76: ; preds = %61
store double 0.000000e+00, double* %3
br label %90
77: ; preds = %64
br label %78
78: ; preds = %77, %48
br label %79
79: ; preds = %78, %31
br label %80
80: ; preds = %79, %16
%81 = load double, double* %5
%82 = fcmp ogt double %81, 0.000000e+00
br i1 %82, label %83, label %85
83: ; preds = %80
%84 = load double, double* %6
br label %88
85: ; preds = %80
%86 = load double, double* %6
%87 = fneg double %86
br label %88
88: ; preds = %85, %83
%89 = phi double [ %84, %83 ], [ %87, %85 ]
store double %89, double* %3
br label %90
90: ; preds = %88, %76
%91 = load double, double* %3
ret double %91
}

LLVM IR (-O2):
define double @BsplnDWght7(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 0x3FA8E38E38E38E39, double 0xBFC5555555555555)
%10 = tail call double @llvm.fmuladd.f64(double %8, double %9, double 0x3FDC71C71C71C71C)
%11 = tail call double @llvm.fmuladd.f64(double %8, double %10, double 0xBFE5555555555555)
%12 = fmul double %5, %11
br label %40
13: ; preds = %2
%14 = fcmp olt double %5, 2.000000e+00
br i1 %14, label %15, label %23
15: ; preds = %13
%16 = fneg double %5
%17 = tail call double @llvm.fmuladd.f64(double %16, double 0x3F9DDDDDDDDDDDDE, double 3.000000e-01)
%18 = tail call double @llvm.fmuladd.f64(double %5, double %17, double 0xBFF2AAAAAAAAAAAB)
%19 = tail call double @llvm.fmuladd.f64(double %5, double %18, double 2.000000e+00)
%20 = tail call double @llvm.fmuladd.f64(double %5, double %19, double 0xBFF2AAAAAAAAAAAB)
%21 = tail call double @llvm.fmuladd.f64(double %5, double %20, double -2.000000e-01)
%22 = tail call double @llvm.fmuladd.f64(double %5, double %21, double 0xBFB3E93E93E93E94)
br label %40
23: ; preds = %13
%24 = fcmp olt double %5, 3.000000e+00
br i1 %24, label %25, label %32
25: ; preds = %23
%26 = tail call double @llvm.fmuladd.f64(double %5, double 0x3F83E93E93E93E94, double 0xBFC5555555555555)
%27 = tail call double @llvm.fmuladd.f64(double %5, double %26, double 0x3FF2AAAAAAAAAAAB)
%28 = tail call double @llvm.fmuladd.f64(double %5, double %27, double 0xC010E38E38E38E39)
%29 = tail call double @llvm.fmuladd.f64(double %5, double %28, double 0x4020555555555555)
%30 = tail call double @llvm.fmuladd.f64(double %5, double %29, double 0xC01EAAAAAAAAAAAB)
%31 = tail call double @llvm.fmuladd.f64(double %5, double %30, double 0x400349F49F49F49F)
br label %40
32: ; preds = %23
%33 = fcmp olt double %5, 4.000000e+00
br i1 %33, label %34, label %45
34: ; preds = %32
%35 = fadd double %5, -4.000000e+00
%36 = fmul double %35, %35
%37 = fmul double %36, %36
%38 = fmul double %37, 0xBF56C16C16C16C17
%39 = fmul double %36, %38
br label %40
40: ; preds = %15, %34, %25, %7
%41 = phi double [ %12, %7 ], [ %22, %15 ], [ %31, %25 ], [ %39, %34 ]
%42 = fcmp ogt double %4, 0.000000e+00
%43 = fneg double %41
%44 = select i1 %42, double %41, double %43
br label %45
45: ; preds = %32, %40
%46 = phi double [ %44, %40 ], [ 0.000000e+00, %32 ]
ret double %46
}