double bell_filter(double t) {
  if (t < 0)
    t = -t;
  if (t < .5)
    return (.75 - (t * t));
  if (t < 1.5) {
    t = (t - 1.5);
    return (.5 * (t * t));
  }
  return (0.0);
}


x86 assembly (clang, -O0):
<bell_filter>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1138 <bell_filter+0x38>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xec0(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1186 <bell_filter+0x86>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe98(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d7 <bell_filter+0xd7>
movsd  0xe7a(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11cf <bell_filter+0xcf>
movsd  -0x10(%rbp),%xmm0
movsd  0xe62(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xe3f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d7 <bell_filter+0xd7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bell_filter>:
movapd %xmm0,%xmm1
movapd 0xef4(%rip),%xmm3
xorpd  %xmm0,%xmm3
xorpd  %xmm0,%xmm0
movapd %xmm1,%xmm2
cmpltsd %xmm0,%xmm2
andpd  %xmm2,%xmm3
andnpd %xmm1,%xmm2
orpd   %xmm3,%xmm2
movsd  0xedf(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    1148 <bell_filter+0x48>
mulsd  %xmm2,%xmm2
movsd  0xee5(%rip),%xmm0
subsd  %xmm2,%xmm0
ret
movsd  0xec8(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    116e <bell_filter+0x6e>
movsd  0xec2(%rip),%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm0
mulsd  0xea2(%rip),%xmm0
ret

LLVM IR (-O0):
define double @bell_filter(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = fneg double %7
store double %8, double* %3
br label %9
9: ; preds = %6, %1
%10 = load double, double* %3
%11 = fcmp olt double %10, 5.000000e-01
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load double, double* %3
%14 = load double, double* %3
%15 = fneg double %13
%16 = call double @llvm.fmuladd.f64(double %15, double %14, double 7.500000e-01)
store double %16, double* %2
br label %28
17: ; preds = %9
%18 = load double, double* %3
%19 = fcmp olt double %18, 1.500000e+00
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load double, double* %3
%22 = fsub double %21, 1.500000e+00
store double %22, double* %3
%23 = load double, double* %3
%24 = load double, double* %3
%25 = fmul double %23, %24
%26 = fmul double 5.000000e-01, %25
store double %26, double* %2
br label %28
27: ; preds = %17
store double 0.000000e+00, double* %2
br label %28
28: ; preds = %27, %20, %12
%29 = load double, double* %2
ret double %29
}

LLVM IR (-O2):
define double @bell_filter(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
%5 = fcmp olt double %4, 5.000000e-01
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = fneg double %4
%8 = tail call double @llvm.fmuladd.f64(double %7, double %4, double 7.500000e-01)
br label %15
9: ; preds = %1
%10 = fcmp olt double %4, 1.500000e+00
br i1 %10, label %11, label %15
11: ; preds = %9
%12 = fadd double %4, -1.500000e+00
%13 = fmul double %12, %12
%14 = fmul double %13, 5.000000e-01
br label %15
15: ; preds = %9, %11, %6
%16 = phi double [ %8, %6 ], [ %14, %11 ], [ 0.000000e+00, %9 ]
ret double %16
}