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


x86 assembly (clang, -O0):
<f_d_B_3>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xeeb(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11df <f_d_B_3+0xdf>
movsd  0xed8(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11da <f_d_B_3+0xda>
movsd  -0x18(%rbp),%xmm0
movsd  0xec8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     118e <f_d_B_3+0x8e>
movsd  0xeae(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  0xec9(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe95(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1296 <f_d_B_3+0x196>
movsd  -0x18(%rbp),%xmm1
movsd  0xe85(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe64(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1296 <f_d_B_3+0x196>
jmp    128e <f_d_B_3+0x18e>
movsd  0xe29(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1289 <f_d_B_3+0x189>
movsd  -0x18(%rbp),%xmm0
movsd  0xe19(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     123d <f_d_B_3+0x13d>
movsd  0xdff(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  0xe0a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xde6(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1296 <f_d_B_3+0x196>
movsd  -0x18(%rbp),%xmm1
movsd  0xdd6(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0xda5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1296 <f_d_B_3+0x196>
jmp    128e <f_d_B_3+0x18e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_d_B_3>:
movapd %xmm0,%xmm1
movapd 0xef4(%rip),%xmm2
andpd  %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jae    1154 <f_d_B_3+0x54>
movsd  0xeee(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    1190 <f_d_B_3+0x90>
ucomisd 0xee8(%rip),%xmm2
jae    1191 <f_d_B_3+0x91>
movsd  0xeee(%rip),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
mulsd  0xee6(%rip),%xmm2
jmp    118c <f_d_B_3+0x8c>
movsd  0xeb4(%rip),%xmm1
ucomisd %xmm2,%xmm1
jbe    1190 <f_d_B_3+0x90>
ucomisd 0xeae(%rip),%xmm2
jae    119f <f_d_B_3+0x9f>
movsd  0xeb4(%rip),%xmm0
movapd %xmm2,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
ret
subsd  %xmm2,%xmm1
movsd  0xe93(%rip),%xmm0
jmp    11ab <f_d_B_3+0xab>
subsd  %xmm2,%xmm1
movsd  0xe75(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f_d_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* %3
%8 = fcmp oge double %7, 0.000000e+00
br i1 %8, label %9, label %32
9: ; preds = %1
%10 = load double, double* %4
%11 = fcmp olt double %10, 2.000000e+00
br i1 %11, label %12, label %31
12: ; preds = %9
%13 = load double, double* %4
%14 = fcmp oge double %13, 1.000000e+00
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load double, double* %4
%17 = fsub double 2.000000e+00, %16
%18 = fmul double -7.500000e-01, %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 %56
22: ; preds = %12
%23 = load double, double* %4
%24 = load double, double* %4
%25 = fmul double 1.500000e+00, %24
%26 = load double, double* %4
%27 = fmul double %25, %26
%28 = fneg double %27
%29 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %23, double %28)
%30 = fmul double -1.500000e+00, %29
store double %30, double* %2
br label %56
31: ; preds = %9
br label %55
32: ; preds = %1
%33 = load double, double* %4
%34 = fcmp olt double %33, 2.000000e+00
br i1 %34, label %35, label %54
35: ; preds = %32
%36 = load double, double* %4
%37 = fcmp oge double %36, 1.000000e+00
br i1 %37, label %38, label %45
38: ; preds = %35
%39 = load double, double* %4
%40 = fsub double 2.000000e+00, %39
%41 = fmul double 7.500000e-01, %40
%42 = load double, double* %4
%43 = fsub double 2.000000e+00, %42
%44 = fmul double %41, %43
store double %44, double* %2
br label %56
45: ; preds = %35
%46 = load double, double* %4
%47 = load double, double* %4
%48 = fmul double 1.500000e+00, %47
%49 = load double, double* %4
%50 = fmul double %48, %49
%51 = fneg double %50
%52 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %46, double %51)
%53 = fmul double 1.500000e+00, %52
store double %53, double* %2
br label %56
54: ; preds = %32
br label %55
55: ; preds = %54, %31
store double 0.000000e+00, double* %2
br label %56
56: ; preds = %55, %45, %38, %22, %15
%57 = load double, double* %2
ret double %57
}

LLVM IR (-O2):
define double @f_d_B_3(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
%3 = fcmp ult double %0, 0.000000e+00
%4 = fcmp olt double %2, 2.000000e+00
br i1 %3, label %17, label %5
5: ; preds = %1
br i1 %4, label %6, label %29
6: ; preds = %5
%7 = fcmp ult double %2, 1.000000e+00
br i1 %7, label %12, label %8
8: ; preds = %6
%9 = fsub double 2.000000e+00, %2
%10 = fmul double %9, -7.500000e-01
%11 = fmul double %9, %10
br label %29
12: ; preds = %6
%13 = fmul double %2, -1.500000e+00
%14 = fmul double %2, %13
%15 = tail call double @llvm.fmuladd.f64(double %2, double 2.000000e+00, double %14)
%16 = fmul double %15, -1.500000e+00
br label %29
17: ; preds = %1
br i1 %4, label %18, label %29
18: ; preds = %17
%19 = fcmp ult double %2, 1.000000e+00
br i1 %19, label %24, label %20
20: ; preds = %18
%21 = fsub double 2.000000e+00, %2
%22 = fmul double %21, 7.500000e-01
%23 = fmul double %21, %22
br label %29
24: ; preds = %18
%25 = fmul double %2, -1.500000e+00
%26 = fmul double %2, %25
%27 = tail call double @llvm.fmuladd.f64(double %2, double 2.000000e+00, double %26)
%28 = fmul double %27, 1.500000e+00
br label %29
29: ; preds = %5, %17, %24, %20, %12, %8
%30 = phi double [ %11, %8 ], [ %16, %12 ], [ %23, %20 ], [ %28, %24 ], [ 0.000000e+00, %17 ], [ 0.000000e+00, %5 ]
ret double %30
}