double iw_filter_quadratic(struct iw_rr_ctx *rrctx, double x) {
  if (x < 0.5)
    return 0.75 - x * x;
  if (x < 1.5)
    return 0.50 * (x - 1.5) * (x - 1.5);
  return 0.0;
}


x86 assembly (clang, -O0):
<iw_filter_quadratic>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  0xeeb(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    115b <iw_filter_quadratic+0x5b>
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xec3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b2 <iw_filter_quadratic+0xb2>
movsd  0xea5(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11aa <iw_filter_quadratic+0xaa>
movsd  -0x18(%rbp),%xmm1
movsd  0xe8d(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe79(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe70(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b2 <iw_filter_quadratic+0xb2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<iw_filter_quadratic>:
movsd  0xef8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1123 <iw_filter_quadratic+0x23>
mulsd  %xmm0,%xmm0
movsd  0xefe(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret
xorpd  %xmm1,%xmm1
movsd  0xed9(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    114d <iw_filter_quadratic+0x4d>
addsd  0xed3(%rip),%xmm0
movsd  0xebb(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

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

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