#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 clamp(float, double, double);
float smootheststep(float edge0, float edge1, float x) {
  x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
  return x * x * x * x * (x * (x * (-20.0 * x + 70.0) - 84.0) + 35.0);
}


x86 assembly (clang, -O0):
<smootheststep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
movsd  0xed6(%rip),%xmm2
call   1030 <clamp@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0xc(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
movsd  0xe81(%rip),%xmm4
mulsd  %xmm4,%xmm3
movsd  0xe7d(%rip),%xmm4
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe5d(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe45(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smootheststep>:
push   %rax
movaps %xmm2,%xmm3
subss  %xmm0,%xmm3
subss  %xmm0,%xmm1
divss  %xmm1,%xmm3
movsd  0xed8(%rip),%xmm2
xorps  %xmm1,%xmm1
movaps %xmm3,%xmm0
call   1030 <clamp@plt>
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
movsd  0xebf(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xebb(%rip),%xmm3
mulss  %xmm0,%xmm1
mulsd  %xmm2,%xmm3
addsd  0xeb3(%rip),%xmm3
mulss  %xmm0,%xmm1
mulsd  %xmm2,%xmm3
addsd  0xeab(%rip),%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mulsd  %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtsd2ss %xmm3,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @smootheststep(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %6
%8 = load float, float* %4
%9 = fsub float %7, %8
%10 = load float, float* %5
%11 = load float, float* %4
%12 = fsub float %10, %11
%13 = fdiv float %9, %12
%14 = call float @clamp(float %13, double 0.000000e+00, double 1.000000e+00)
store float %14, float* %6
%15 = load float, float* %6
%16 = load float, float* %6
%17 = fmul float %15, %16
%18 = load float, float* %6
%19 = fmul float %17, %18
%20 = load float, float* %6
%21 = fmul float %19, %20
%22 = fpext float %21 to double
%23 = load float, float* %6
%24 = fpext float %23 to double
%25 = load float, float* %6
%26 = fpext float %25 to double
%27 = load float, float* %6
%28 = fpext float %27 to double
%29 = call double @llvm.fmuladd.f64(double -2.000000e+01, double %28, double 7.000000e+01)
%30 = call double @llvm.fmuladd.f64(double %26, double %29, double -8.400000e+01)
%31 = call double @llvm.fmuladd.f64(double %24, double %30, double 3.500000e+01)
%32 = fmul double %22, %31
%33 = fptrunc double %32 to float
ret float %33
}

LLVM IR (-O2):
define float @smootheststep(float %0, float %1, float %2) {
%4 = fsub float %2, %0
%5 = fsub float %1, %0
%6 = fdiv float %4, %5
%7 = tail call float @clamp(float %6, double 0.000000e+00, double 1.000000e+00)
%8 = fmul float %7, %7
%9 = fmul float %7, %8
%10 = fmul float %7, %9
%11 = fpext float %10 to double
%12 = fpext float %7 to double
%13 = tail call double @llvm.fmuladd.f64(double %12, double -2.000000e+01, double 7.000000e+01)
%14 = tail call double @llvm.fmuladd.f64(double %12, double %13, double -8.400000e+01)
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double 3.500000e+01)
%16 = fmul double %15, %11
%17 = fptrunc double %16 to float
ret float %17
}