#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 BsplnDDWght6(long i, double x) {
  x = fabs(x - (double)i);
  if (x < 0.5) {
    x *= x;
    return (x * (7.0 / 4.0 - x * (5.0 / 6.0)) - 77.0 / 96.0);
  }
  if (x < 1.5)
    return (x * (x * (x * (x * 0.625 - 35.0 / 12.0) + 3.9375) - 35.0 / 48.0) -
            0.7109375);
  if (x < 2.5)
    return (x * (x * (x * (7.0 / 3.0 - x * 0.25) - 7.875) + 133.0 / 12.0) -
            5.140625);
  if (x < 3.5) {
    x -= 3.5;
    x *= x;
    return (x * x * (1.0 / 24.0));
  }
  return (0.0);
}


x86 assembly (clang, -O0):
<BsplnDDWght6>:
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 0xf6d(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xecc(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11a1 <BsplnDDWght6+0xa1>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xf09(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xf05(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee5(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130a <BsplnDDWght6+0x20a>
movsd  0xe5f(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    121a <BsplnDDWght6+0x11a>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  0xe98(%rip),%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe94(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe74(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe5c(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe44(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130a <BsplnDDWght6+0x20a>
movsd  0xdee(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    12aa <BsplnDDWght6+0x1aa>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
movsd  0xde0(%rip),%xmm4
mulsd  %xmm4,%xmm3
movsd  0xddc(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xdbc(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xda4(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd8c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130a <BsplnDDWght6+0x20a>
movsd  0xd66(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1302 <BsplnDDWght6+0x202>
movsd  -0x18(%rbp),%xmm0
movsd  0xd4e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xd2c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    130a <BsplnDDWght6+0x20a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<BsplnDDWght6>:
cvtsi2sd %rdi,%xmm1
subsd  %xmm1,%xmm0
movapd 0xeef(%rip),%xmm1
andpd  %xmm0,%xmm1
movsd  0xef3(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    114c <BsplnDDWght6+0x4c>
mulsd  %xmm0,%xmm0
movsd  0xf61(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf5d(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xf59(%rip),%xmm1
movapd %xmm1,%xmm0
ret
movsd  0xec4(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1193 <BsplnDDWght6+0x93>
movsd  0xf06(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xf02(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xefe(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xefa(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xef6(%rip),%xmm0
ret
movsd  0xe85(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11da <BsplnDDWght6+0xda>
movsd  0xe97(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe93(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe8f(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe8b(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe87(%rip),%xmm0
ret
xorpd  %xmm0,%xmm0
movsd  0xe42(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    1208 <BsplnDDWght6+0x108>
addsd  0xe3c(%rip),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm1,%xmm1
mulsd  0xe34(%rip),%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @BsplnDDWght6(i64 %0, double %1) {
%3 = alloca double
%4 = alloca i64
%5 = alloca double
store i64 %0, i64* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = load i64, i64* %4
%8 = sitofp i64 %7 to double
%9 = fsub double %6, %8
%10 = call double @llvm.fabs.f64(double %9)
store double %10, double* %5
%11 = load double, double* %5
%12 = fcmp olt double %11, 5.000000e-01
br i1 %12, label %13, label %22
13: ; preds = %2
%14 = load double, double* %5
%15 = load double, double* %5
%16 = fmul double %15, %14
store double %16, double* %5
%17 = load double, double* %5
%18 = load double, double* %5
%19 = fneg double %18
%20 = call double @llvm.fmuladd.f64(double %19, double 0x3FEAAAAAAAAAAAAB, double 1.750000e+00)
%21 = call double @llvm.fmuladd.f64(double %17, double %20, double 0xBFE9AAAAAAAAAAAB)
store double %21, double* %3
br label %61
22: ; preds = %2
%23 = load double, double* %5
%24 = fcmp olt double %23, 1.500000e+00
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load double, double* %5
%27 = load double, double* %5
%28 = load double, double* %5
%29 = load double, double* %5
%30 = call double @llvm.fmuladd.f64(double %29, double 6.250000e-01, double 0xC007555555555555)
%31 = call double @llvm.fmuladd.f64(double %28, double %30, double 3.937500e+00)
%32 = call double @llvm.fmuladd.f64(double %27, double %31, double 0xBFE7555555555555)
%33 = call double @llvm.fmuladd.f64(double %26, double %32, double 0xBFE6C00000000000)
store double %33, double* %3
br label %61
34: ; preds = %22
%35 = load double, double* %5
%36 = fcmp olt double %35, 2.500000e+00
br i1 %36, label %37, label %47
37: ; preds = %34
%38 = load double, double* %5
%39 = load double, double* %5
%40 = load double, double* %5
%41 = load double, double* %5
%42 = fneg double %41
%43 = call double @llvm.fmuladd.f64(double %42, double 2.500000e-01, double 0x4002AAAAAAAAAAAB)
%44 = call double @llvm.fmuladd.f64(double %40, double %43, double -7.875000e+00)
%45 = call double @llvm.fmuladd.f64(double %39, double %44, double 0x40262AAAAAAAAAAB)
%46 = call double @llvm.fmuladd.f64(double %38, double %45, double 0xC014900000000000)
store double %46, double* %3
br label %61
47: ; preds = %34
%48 = load double, double* %5
%49 = fcmp olt double %48, 3.500000e+00
br i1 %49, label %50, label %60
50: ; preds = %47
%51 = load double, double* %5
%52 = fsub double %51, 3.500000e+00
store double %52, double* %5
%53 = load double, double* %5
%54 = load double, double* %5
%55 = fmul double %54, %53
store double %55, double* %5
%56 = load double, double* %5
%57 = load double, double* %5
%58 = fmul double %56, %57
%59 = fmul double %58, 0x3FA5555555555555
store double %59, double* %3
br label %61
60: ; preds = %47
store double 0.000000e+00, double* %3
br label %61
61: ; preds = %60, %50, %37, %25, %13
%62 = load double, double* %3
ret double %62
}

LLVM IR (-O2):
define double @BsplnDDWght6(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 %12
7: ; preds = %2
%8 = fmul double %4, %4
%9 = fneg double %8
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3FEAAAAAAAAAAAAB, double 1.750000e+00)
%11 = tail call double @llvm.fmuladd.f64(double %8, double %10, double 0xBFE9AAAAAAAAAAAB)
br label %34
12: ; preds = %2
%13 = fcmp olt double %5, 1.500000e+00
br i1 %13, label %14, label %19
14: ; preds = %12
%15 = tail call double @llvm.fmuladd.f64(double %5, double 6.250000e-01, double 0xC007555555555555)
%16 = tail call double @llvm.fmuladd.f64(double %5, double %15, double 3.937500e+00)
%17 = tail call double @llvm.fmuladd.f64(double %5, double %16, double 0xBFE7555555555555)
%18 = tail call double @llvm.fmuladd.f64(double %5, double %17, double 0xBFE6C00000000000)
br label %34
19: ; preds = %12
%20 = fcmp olt double %5, 2.500000e+00
br i1 %20, label %21, label %27
21: ; preds = %19
%22 = fneg double %5
%23 = tail call double @llvm.fmuladd.f64(double %22, double 2.500000e-01, double 0x4002AAAAAAAAAAAB)
%24 = tail call double @llvm.fmuladd.f64(double %5, double %23, double -7.875000e+00)
%25 = tail call double @llvm.fmuladd.f64(double %5, double %24, double 0x40262AAAAAAAAAAB)
%26 = tail call double @llvm.fmuladd.f64(double %5, double %25, double 0xC014900000000000)
br label %34
27: ; preds = %19
%28 = fcmp olt double %5, 3.500000e+00
br i1 %28, label %29, label %34
29: ; preds = %27
%30 = fadd double %5, -3.500000e+00
%31 = fmul double %30, %30
%32 = fmul double %31, %31
%33 = fmul double %32, 0x3FA5555555555555
br label %34
34: ; preds = %27, %29, %21, %14, %7
%35 = phi double [ %11, %7 ], [ %18, %14 ], [ %26, %21 ], [ %33, %29 ], [ 0.000000e+00, %27 ]
ret double %35
}