#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 f_B_3(double X) {
  double absV = fabs(X);
  if (absV < 2) {
    if (absV >= 1) {
      return 0.25 * (2.0 - absV) * (2.0 - absV) * (2.0 - absV);
    } else
      return 1.0 - 1.5 * absV * absV * (1.0 - 0.5 * absV);
  }
  return 0.0;
}


x86 assembly (clang, -O0):
<f_B_3>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xf1b(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeda(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11ed <f_B_3+0xed>
movsd  -0x18(%rbp),%xmm0
movsd  0xeca(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     118d <f_B_3+0x8d>
movsd  0xeb0(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  0xec3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe97(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe86(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f5 <f_B_3+0xf5>
movsd  0xe83(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe64(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe50(%rip),%xmm2
addsd  %xmm2,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe29(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f5 <f_B_3+0xf5>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_B_3>:
andpd  0xef8(%rip),%xmm0
xorpd  %xmm1,%xmm1
movsd  0xefc(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    1154 <f_B_3+0x54>
ucomisd 0xef6(%rip),%xmm0
jae    1159 <f_B_3+0x59>
movsd  0xefc(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  0xee0(%rip),%xmm3
addsd  %xmm3,%xmm2
movsd  0xeec(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
movapd %xmm1,%xmm0
ret
subsd  %xmm0,%xmm2
movsd  0xebb(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

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

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