#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 BsplnDWght6(long i, double x) {
  double f, g;
  x -= (double)i;
  f = fabs(x);
  if (f < 0.5) {
    g = f * f;
    f *= g * (7.0 / 12.0 - g * (1.0 / 6.0)) - 77.0 / 96.0;
  } else if (f < 1.5)
    f = f * (f * (f * (f * (f * 0.125 - 35.0 / 48.0) + 1.3125) - 35.0 / 96.0) -
             0.7109375) -
        7.0 / 768.0;
  else if (f < 2.5)
    f = f * (f * (f * (f * (7.0 / 12.0 - f * 0.05) - 2.625) + 133.0 / 24.0) -
             5.140625) +
        1267.0 / 960.0;
  else if (f < 3.5) {
    f -= 3.5;
    g = f * f;
    f *= g * g * (1.0 / 120.0);
  } else
    return (0.0);
  return ((x > 0.0) ? (f) : (-f));
}


x86 assembly (clang, -O0):
<BsplnDWght6>:
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    11b0 <BsplnDWght6+0xb0>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xf0f(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xec3(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeeb(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    135c <BsplnDWght6+0x25c>
movsd  0xe50(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    123e <BsplnDWght6+0x13e>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  0xe94(%rip),%xmm5
mulsd  %xmm5,%xmm4
movsd  0xe90(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe70(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe58(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe40(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe28(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1357 <BsplnDWght6+0x257>
movsd  0xdca(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    12e3 <BsplnDWght6+0x1e3>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movq   %xmm4,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm4
movsd  0xdbf(%rip),%xmm5
mulsd  %xmm5,%xmm4
movsd  0xdbb(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm3
movsd  0xd9b(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd83(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd6b(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd53(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1352 <BsplnDWght6+0x252>
movsd  0xd2d(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1340 <BsplnDWght6+0x240>
movsd  -0x20(%rbp),%xmm0
movsd  0xd15(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xcf3(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    134d <BsplnDWght6+0x24d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13a8 <BsplnDWght6+0x2a8>
jmp    1352 <BsplnDWght6+0x252>
jmp    1357 <BsplnDWght6+0x257>
jmp    135c <BsplnDWght6+0x25c>
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    137d <BsplnDWght6+0x27d>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    139e <BsplnDWght6+0x29e>
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):
<BsplnDWght6>:
cvtsi2sd %rdi,%xmm1
subsd  %xmm1,%xmm0
movapd 0xeef(%rip),%xmm3
andpd  %xmm0,%xmm3
movsd  0xf03(%rip),%xmm1
ucomisd %xmm3,%xmm1
jbe    1154 <BsplnDWght6+0x54>
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xf7d(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xf19(%rip),%xmm2
mulsd  %xmm1,%xmm2
addsd  0xf6d(%rip),%xmm2
mulsd  %xmm3,%xmm2
jmp    1235 <BsplnDWght6+0x135>
movsd  0xecc(%rip),%xmm1
ucomisd %xmm3,%xmm1
jbe    11ab <BsplnDWght6+0xab>
movsd  0xf16(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xf12(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xf0e(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xf0a(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xf06(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xf02(%rip),%xmm2
jmp    1235 <BsplnDWght6+0x135>
movsd  0xe7d(%rip),%xmm1
ucomisd %xmm3,%xmm1
jbe    11ff <BsplnDWght6+0xff>
movsd  0xe8f(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe8b(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe87(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe83(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe7f(%rip),%xmm2
mulsd  %xmm3,%xmm2
addsd  0xe7b(%rip),%xmm2
jmp    1235 <BsplnDWght6+0x135>
xorpd  %xmm1,%xmm1
movsd  0xe2d(%rip),%xmm2
ucomisd %xmm3,%xmm2
jbe    1256 <BsplnDWght6+0x156>
movsd  0xe27(%rip),%xmm1
addsd  %xmm3,%xmm1
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm2
mulsd  0xe17(%rip),%xmm2
mulsd  %xmm1,%xmm2
movapd 0xdd3(%rip),%xmm3
xorpd  %xmm2,%xmm3
xorpd  %xmm1,%xmm1
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm3,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @BsplnDWght6(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, 5.000000e-01
br i1 %15, label %16, label %27
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 = fneg double %21
%23 = call double @llvm.fmuladd.f64(double %22, double 0x3FC5555555555555, double 0x3FE2AAAAAAAAAAAB)
%24 = call double @llvm.fmuladd.f64(double %20, double %23, double 0xBFE9AAAAAAAAAAAB)
%25 = load double, double* %6
%26 = fmul double %25, %24
store double %26, double* %6
br label %75
27: ; preds = %2
%28 = load double, double* %6
%29 = fcmp olt double %28, 1.500000e+00
br i1 %29, label %30, label %41
30: ; preds = %27
%31 = load double, double* %6
%32 = load double, double* %6
%33 = load double, double* %6
%34 = load double, double* %6
%35 = load double, double* %6
%36 = call double @llvm.fmuladd.f64(double %35, double 1.250000e-01, double 0xBFE7555555555555)
%37 = call double @llvm.fmuladd.f64(double %34, double %36, double 1.312500e+00)
%38 = call double @llvm.fmuladd.f64(double %33, double %37, double 0xBFD7555555555555)
%39 = call double @llvm.fmuladd.f64(double %32, double %38, double 0xBFE6C00000000000)
%40 = call double @llvm.fmuladd.f64(double %31, double %39, double 0xBF82AAAAAAAAAAAB)
store double %40, double* %6
br label %74
41: ; preds = %27
%42 = load double, double* %6
%43 = fcmp olt double %42, 2.500000e+00
br i1 %43, label %44, label %56
44: ; preds = %41
%45 = load double, double* %6
%46 = load double, double* %6
%47 = load double, double* %6
%48 = load double, double* %6
%49 = load double, double* %6
%50 = fneg double %49
%51 = call double @llvm.fmuladd.f64(double %50, double 5.000000e-02, double 0x3FE2AAAAAAAAAAAB)
%52 = call double @llvm.fmuladd.f64(double %48, double %51, double -2.625000e+00)
%53 = call double @llvm.fmuladd.f64(double %47, double %52, double 0x40162AAAAAAAAAAB)
%54 = call double @llvm.fmuladd.f64(double %46, double %53, double 0xC014900000000000)
%55 = call double @llvm.fmuladd.f64(double %45, double %54, double 0x3FF51DDDDDDDDDDE)
store double %55, double* %6
br label %73
56: ; preds = %41
%57 = load double, double* %6
%58 = fcmp olt double %57, 3.500000e+00
br i1 %58, label %59, label %71
59: ; preds = %56
%60 = load double, double* %6
%61 = fsub double %60, 3.500000e+00
store double %61, double* %6
%62 = load double, double* %6
%63 = load double, double* %6
%64 = fmul double %62, %63
store double %64, double* %7
%65 = load double, double* %7
%66 = load double, double* %7
%67 = fmul double %65, %66
%68 = fmul double %67, 0x3F81111111111111
%69 = load double, double* %6
%70 = fmul double %69, %68
store double %70, double* %6
br label %72
71: ; preds = %56
store double 0.000000e+00, double* %3
br label %85
72: ; preds = %59
br label %73
73: ; preds = %72, %44
br label %74
74: ; preds = %73, %30
br label %75
75: ; preds = %74, %16
%76 = load double, double* %5
%77 = fcmp ogt double %76, 0.000000e+00
br i1 %77, label %78, label %80
78: ; preds = %75
%79 = load double, double* %6
br label %83
80: ; preds = %75
%81 = load double, double* %6
%82 = fneg double %81
br label %83
83: ; preds = %80, %78
%84 = phi double [ %79, %78 ], [ %82, %80 ]
store double %84, double* %3
br label %85
85: ; preds = %83, %71
%86 = load double, double* %3
ret double %86
}

LLVM IR (-O2):
define double @BsplnDWght6(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, 5.000000e-01
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = fmul double %4, %4
%9 = fneg double %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3FC5555555555555, double 0x3FE2AAAAAAAAAAAB)
%11 = tail call double @llvm.fmuladd.f64(double %8, double %10, double 0xBFE9AAAAAAAAAAAB)
%12 = fmul double %5, %11
br label %38
13: ; preds = %2
%14 = fcmp olt double %5, 1.500000e+00
br i1 %14, label %15, label %21
15: ; preds = %13
%16 = tail call double @llvm.fmuladd.f64(double %5, double 1.250000e-01, double 0xBFE7555555555555)
%17 = tail call double @llvm.fmuladd.f64(double %5, double %16, double 1.312500e+00)
%18 = tail call double @llvm.fmuladd.f64(double %5, double %17, double 0xBFD7555555555555)
%19 = tail call double @llvm.fmuladd.f64(double %5, double %18, double 0xBFE6C00000000000)
%20 = tail call double @llvm.fmuladd.f64(double %5, double %19, double 0xBF82AAAAAAAAAAAB)
br label %38
21: ; preds = %13
%22 = fcmp olt double %5, 2.500000e+00
br i1 %22, label %23, label %30
23: ; preds = %21
%24 = fneg double %5
%25 = tail call double @llvm.fmuladd.f64(double %24, double 5.000000e-02, double 0x3FE2AAAAAAAAAAAB)
%26 = tail call double @llvm.fmuladd.f64(double %5, double %25, double -2.625000e+00)
%27 = tail call double @llvm.fmuladd.f64(double %5, double %26, double 0x40162AAAAAAAAAAB)
%28 = tail call double @llvm.fmuladd.f64(double %5, double %27, double 0xC014900000000000)
%29 = tail call double @llvm.fmuladd.f64(double %5, double %28, double 0x3FF51DDDDDDDDDDE)
br label %38
30: ; preds = %21
%31 = fcmp olt double %5, 3.500000e+00
br i1 %31, label %32, label %43
32: ; preds = %30
%33 = fadd double %5, -3.500000e+00
%34 = fmul double %33, %33
%35 = fmul double %34, %34
%36 = fmul double %35, 0x3F81111111111111
%37 = fmul double %33, %36
br label %38
38: ; preds = %15, %32, %23, %7
%39 = phi double [ %12, %7 ], [ %20, %15 ], [ %29, %23 ], [ %37, %32 ]
%40 = fcmp ogt double %4, 0.000000e+00
%41 = fneg double %39
%42 = select i1 %40, double %39, double %41
br label %43
43: ; preds = %30, %38
%44 = phi double [ %42, %38 ], [ 0.000000e+00, %30 ]
ret double %44
}