#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 */
float abs(float);
float cubicPulse(float c, float w, float x) {
  x = abs(x - c);
  if (x > w)
    return 0.0;
  x /= w;
  return 1.0 - x * x * (3.0 - 2.0 * x);
}


x86 assembly (clang, -O0):
<cubicPulse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
call   1030 <abs@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1157 <cubicPulse+0x47>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11c1 <cubicPulse+0xb1>
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
addsd  %xmm2,%xmm2
movsd  0xe7b(%rip),%xmm1
subsd  %xmm2,%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe4c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cubicPulse>:
push   %rax
movss  %xmm1,0x4(%rsp)
subss  %xmm0,%xmm2
movaps %xmm2,%xmm0
call   1030 <abs@plt>
movss  0x4(%rsp),%xmm2
xorps  %xmm1,%xmm1
ucomiss %xmm2,%xmm0
ja     116b <cubicPulse+0x5b>
divss  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm1,%xmm1
movsd  0xeb0(%rip),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movsd  0xea8(%rip),%xmm0
subsd  %xmm2,%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @cubicPulse(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
%8 = load float, float* %7
%9 = load float, float* %5
%10 = fsub float %8, %9
%11 = call float @abs(float %10)
store float %11, float* %7
%12 = load float, float* %7
%13 = load float, float* %6
%14 = fcmp ogt float %12, %13
br i1 %14, label %15, label %16
15: ; preds = %3
store float 0.000000e+00, float* %4
br label %30
16: ; preds = %3
%17 = load float, float* %6
%18 = load float, float* %7
%19 = fdiv float %18, %17
store float %19, float* %7
%20 = load float, float* %7
%21 = load float, float* %7
%22 = fmul float %20, %21
%23 = fpext float %22 to double
%24 = load float, float* %7
%25 = fpext float %24 to double
%26 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %25, double 3.000000e+00)
%27 = fneg double %23
%28 = call double @llvm.fmuladd.f64(double %27, double %26, double 1.000000e+00)
%29 = fptrunc double %28 to float
store float %29, float* %4
br label %30
30: ; preds = %16, %15
%31 = load float, float* %4
ret float %31
}

LLVM IR (-O2):
define float @cubicPulse(float %0, float %1, float %2) {
%4 = fsub float %2, %0
%5 = tail call float @abs(float %4)
%6 = fcmp ogt float %5, %1
br i1 %6, label %16, label %7
7: ; preds = %3
%8 = fdiv float %5, %1
%9 = fmul float %8, %8
%10 = fpext float %9 to double
%11 = fpext float %8 to double
%12 = tail call double @llvm.fmuladd.f64(double %11, double -2.000000e+00, double 3.000000e+00)
%13 = fneg double %10
%14 = tail call double @llvm.fmuladd.f64(double %13, double %12, double 1.000000e+00)
%15 = fptrunc double %14 to float
br label %16
16: ; preds = %3, %7
%17 = phi float [ %15, %7 ], [ 0.000000e+00, %3 ]
ret float %17
}