#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) {
  float tmp = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
  return tmp * tmp * tmp * tmp *
         (tmp * (tmp * (-20.0 * tmp + 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,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x10(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x10(%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
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%8 = load float, float* %6
%9 = load float, float* %4
%10 = fsub float %8, %9
%11 = load float, float* %5
%12 = load float, float* %4
%13 = fsub float %11, %12
%14 = fdiv float %10, %13
%15 = call float @clamp(float %14, double 0.000000e+00, double 1.000000e+00)
store float %15, float* %7
%16 = load float, float* %7
%17 = load float, float* %7
%18 = fmul float %16, %17
%19 = load float, float* %7
%20 = fmul float %18, %19
%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 = load float, float* %7
%27 = fpext float %26 to double
%28 = load float, float* %7
%29 = fpext float %28 to double
%30 = call double @llvm.fmuladd.f64(double -2.000000e+01, double %29, double 7.000000e+01)
%31 = call double @llvm.fmuladd.f64(double %27, double %30, double -8.400000e+01)
%32 = call double @llvm.fmuladd.f64(double %25, double %31, double 3.500000e+01)
%33 = fmul double %23, %32
%34 = fptrunc double %33 to float
ret float %34
}

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
}