#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 */
int exp(float);
float smooth(float n, float strength, float center) {
  float sign = 1;
  float result = 0;
  if (n < 0) {
    sign = -1;
    n = -n;
  }
  if (strength == 0) {
    return sign * n;
  }
  if (n < center) {
    result = center * (exp(strength * n / center) - 1) / (exp(strength) - 1);
  } else {
    result = 1 - ((1 - center) * (exp(strength * (1 - n) / (1 - center)) - 1) /
                  (exp(strength) - 1));
  }
  return sign * result;
}


x86 assembly (clang, -O0):
<smooth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  0xed1(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    116d <smooth+0x5d>
movss  0xeb3(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1198 <smooth+0x88>
jp     1198 <smooth+0x88>
movss  -0x14(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    128f <smooth+0x17f>
movss  -0x8(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1202 <smooth+0xf2>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
movss  -0x20(%rbp),%xmm0
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <exp@plt>
movss  -0x1c(%rbp),%xmm0
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1280 <smooth+0x170>
movss  0xdf6(%rip),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xddf(%rip),%xmm1
subss  -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xdce(%rip),%xmm1
subss  -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1030 <exp@plt>
movss  -0x28(%rbp),%xmm0
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <exp@plt>
movss  -0x24(%rbp),%xmm1
sub    $0x1,%eax
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
movss  0xd89(%rip),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smooth>:
sub    $0x38,%rsp
movaps 0xee5(%rip),%xmm4
xorps  %xmm0,%xmm4
xorps  %xmm6,%xmm6
movaps %xmm0,%xmm3
cmpltss %xmm6,%xmm3
andps  %xmm3,%xmm4
movaps %xmm3,%xmm5
andnps %xmm0,%xmm5
orps   %xmm4,%xmm5
ucomiss %xmm6,%xmm1
jne    1140 <smooth+0x30>
jnp    1207 <smooth+0xf7>
movaps %xmm3,0x20(%rsp)
ucomiss %xmm5,%xmm2
movss  %xmm1,0xc(%rsp)
jbe    119b <smooth+0x8b>
mulss  %xmm1,%xmm5
divss  %xmm2,%xmm5
movaps %xmm5,%xmm0
movss  %xmm2,0x10(%rsp)
call   1030 <exp@plt>
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x10(%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <exp@plt>
movaps 0x10(%rsp),%xmm5
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm5
jmp    1202 <smooth+0xf2>
movss  0xe6d(%rip),%xmm0
movaps %xmm0,%xmm3
subss  %xmm2,%xmm3
movss  %xmm3,0x10(%rsp)
subss  %xmm5,%xmm0
mulss  %xmm1,%xmm0
divss  %xmm3,%xmm0
call   1030 <exp@plt>
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0x10(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1030 <exp@plt>
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x10(%rsp),%xmm1
divss  %xmm0,%xmm1
movss  0xe12(%rip),%xmm5
subss  %xmm1,%xmm5
movaps 0x20(%rsp),%xmm3
movaps 0xdf2(%rip),%xmm0
xorps  %xmm5,%xmm0
andps  %xmm3,%xmm0
andnps %xmm5,%xmm3
orps   %xmm0,%xmm3
movaps %xmm3,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define float @smooth(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float 1.000000e+00, float* %8
store float 0.000000e+00, float* %9
%10 = load float, float* %5
%11 = fcmp olt float %10, 0.000000e+00
br i1 %11, label %12, label %15
12: ; preds = %3
store float -1.000000e+00, float* %8
%13 = load float, float* %5
%14 = fneg float %13
store float %14, float* %5
br label %15
15: ; preds = %12, %3
%16 = load float, float* %6
%17 = fcmp oeq float %16, 0.000000e+00
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load float, float* %8
%20 = load float, float* %5
%21 = fmul float %19, %20
store float %21, float* %4
br label %66
22: ; preds = %15
%23 = load float, float* %5
%24 = load float, float* %7
%25 = fcmp olt float %23, %24
br i1 %25, label %26, label %42
26: ; preds = %22
%27 = load float, float* %7
%28 = load float, float* %6
%29 = load float, float* %5
%30 = fmul float %28, %29
%31 = load float, float* %7
%32 = fdiv float %30, %31
%33 = call i32 @exp(float %32)
%34 = sub nsw i32 %33, 1
%35 = sitofp i32 %34 to float
%36 = fmul float %27, %35
%37 = load float, float* %6
%38 = call i32 @exp(float %37)
%39 = sub nsw i32 %38, 1
%40 = sitofp i32 %39 to float
%41 = fdiv float %36, %40
store float %41, float* %9
br label %62
42: ; preds = %22
%43 = load float, float* %7
%44 = fsub float 1.000000e+00, %43
%45 = load float, float* %6
%46 = load float, float* %5
%47 = fsub float 1.000000e+00, %46
%48 = fmul float %45, %47
%49 = load float, float* %7
%50 = fsub float 1.000000e+00, %49
%51 = fdiv float %48, %50
%52 = call i32 @exp(float %51)
%53 = sub nsw i32 %52, 1
%54 = sitofp i32 %53 to float
%55 = fmul float %44, %54
%56 = load float, float* %6
%57 = call i32 @exp(float %56)
%58 = sub nsw i32 %57, 1
%59 = sitofp i32 %58 to float
%60 = fdiv float %55, %59
%61 = fsub float 1.000000e+00, %60
store float %61, float* %9
br label %62
62: ; preds = %42, %26
%63 = load float, float* %8
%64 = load float, float* %9
%65 = fmul float %63, %64
store float %65, float* %4
br label %66
66: ; preds = %62, %18
%67 = load float, float* %4
ret float %67
}

LLVM IR (-O2):
define float @smooth(float %0, float %1, float %2) {
%4 = fcmp olt float %0, 0.000000e+00
%5 = fneg float %0
%6 = select i1 %4, float %5, float %0
%7 = fcmp oeq float %1, 0.000000e+00
br i1 %7, label %35, label %8
8: ; preds = %3
%9 = fcmp olt float %6, %2
br i1 %9, label %10, label %21
10: ; preds = %8
%11 = fmul float %6, %1
%12 = fdiv float %11, %2
%13 = tail call i32 @exp(float %12)
%14 = add nsw i32 %13, -1
%15 = sitofp i32 %14 to float
%16 = fmul float %15, %2
%17 = tail call i32 @exp(float %1)
%18 = add nsw i32 %17, -1
%19 = sitofp i32 %18 to float
%20 = fdiv float %16, %19
br label %35
21: ; preds = %8
%22 = fsub float 1.000000e+00, %2
%23 = fsub float 1.000000e+00, %6
%24 = fmul float %23, %1
%25 = fdiv float %24, %22
%26 = tail call i32 @exp(float %25)
%27 = add nsw i32 %26, -1
%28 = sitofp i32 %27 to float
%29 = fmul float %22, %28
%30 = tail call i32 @exp(float %1)
%31 = add nsw i32 %30, -1
%32 = sitofp i32 %31 to float
%33 = fdiv float %29, %32
%34 = fsub float 1.000000e+00, %33
br label %35
35: ; preds = %10, %21, %3
%36 = phi float [ %6, %3 ], [ %20, %10 ], [ %34, %21 ]
%37 = fneg float %36
%38 = select i1 %4, float %37, float %36
ret float %38
}