#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);
int /*<<< orphan*/ fmax(double, double);
double fmin(double, int /*<<< orphan*/);
double FpCurve1D_s_out(double fpVal, double mEffect) {
  if (mEffect == 0.0)
    return fpVal;
  fpVal = fmin((1.0 - (0.0000000001)), fmax(0.0000000001, fpVal));
  mEffect = fmin((1.0 - (0.0000000001)), fmax(0.0000000001, mEffect));
  fpVal = ((2.0 - mEffect) * fpVal) / ((1.0 - mEffect) + fabs(fpVal));
  return fpVal;
}


x86 assembly (clang, -O0):
<FpCurve1D_s_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1159 <FpCurve1D_s_out+0x39>
jp     1159 <FpCurve1D_s_out+0x39>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11eb <FpCurve1D_s_out+0xcb>
movsd  -0x10(%rbp),%xmm1
movsd  0xec2(%rip),%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movsd  0xeab(%rip),%xmm0
call   1030 <fmin@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xe9c(%rip),%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movsd  0xe85(%rip),%xmm0
call   1030 <fmin@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe6b(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe51(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movaps 0xe30(%rip),%xmm3
pand   %xmm3,%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FpCurve1D_s_out>:
movapd %xmm1,%xmm2
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1139 <FpCurve1D_s_out+0x19>
jp     1139 <FpCurve1D_s_out+0x19>
movapd %xmm1,%xmm0
ret
sub    $0x28,%rsp
movsd  0xebb(%rip),%xmm0
movsd  %xmm2,0x8(%rsp)
call   1040 <fmax@plt>
movsd  0xeb0(%rip),%xmm0
mov    %eax,%edi
call   1030 <fmin@plt>
movaps %xmm0,0x10(%rsp)
movsd  0xe94(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <fmax@plt>
movsd  0xe89(%rip),%xmm0
mov    %eax,%edi
call   1030 <fmin@plt>
movsd  0xe82(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd 0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm1
movsd  0xe74(%rip),%xmm2
subsd  %xmm0,%xmm2
andpd  0xe70(%rip),%xmm3
addsd  %xmm2,%xmm3
divsd  %xmm3,%xmm1
add    $0x28,%rsp
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @FpCurve1D_s_out(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp oeq double %6, 0.000000e+00
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %4
store double %9, double* %3
br label %28
10: ; preds = %2
%11 = load double, double* %4
%12 = call i32 @fmax(double 1.000000e-10, double %11)
%13 = call double @fmin(double 0x3FEFFFFFFFF24190, i32 %12)
store double %13, double* %4
%14 = load double, double* %5
%15 = call i32 @fmax(double 1.000000e-10, double %14)
%16 = call double @fmin(double 0x3FEFFFFFFFF24190, i32 %15)
store double %16, double* %5
%17 = load double, double* %5
%18 = fsub double 2.000000e+00, %17
%19 = load double, double* %4
%20 = fmul double %18, %19
%21 = load double, double* %5
%22 = fsub double 1.000000e+00, %21
%23 = load double, double* %4
%24 = call double @llvm.fabs.f64(double %23)
%25 = fadd double %22, %24
%26 = fdiv double %20, %25
store double %26, double* %4
%27 = load double, double* %4
store double %27, double* %3
br label %28
28: ; preds = %10, %8
%29 = load double, double* %3
ret double %29
}

LLVM IR (-O2):
define double @FpCurve1D_s_out(double %0, double %1) {
%3 = fcmp oeq double %1, 0.000000e+00
br i1 %3, label %15, label %4
4: ; preds = %2
%5 = tail call i32 @fmax(double 1.000000e-10, double %0)
%6 = tail call double @fmin(double 0x3FEFFFFFFFF24190, i32 %5)
%7 = tail call i32 @fmax(double 1.000000e-10, double %1)
%8 = tail call double @fmin(double 0x3FEFFFFFFFF24190, i32 %7)
%9 = fsub double 2.000000e+00, %8
%10 = fmul double %6, %9
%11 = fsub double 1.000000e+00, %8
%12 = tail call double @llvm.fabs.f64(double %6)
%13 = fadd double %12, %11
%14 = fdiv double %10, %13
br label %15
15: ; preds = %2, %4
%16 = phi double [ %14, %4 ], [ %0, %2 ]
ret double %16
}