#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 /*<<< orphan*/ fmax(double, double);
double fmin(double, int /*<<< orphan*/);
double FpCurveUp(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) + fpVal);
  return fpVal;
}


x86 assembly (clang, -O0):
<FpCurveUp>:
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 <FpCurveUp+0x39>
jp     1159 <FpCurveUp+0x39>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11dc <FpCurveUp+0xbc>
movsd  -0x10(%rbp),%xmm1
movsd  0xeb2(%rip),%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movsd  0xe9b(%rip),%xmm0
call   1030 <fmin@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xe8c(%rip),%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movsd  0xe75(%rip),%xmm0
call   1030 <fmin@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe5b(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe41(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
addsd  -0x10(%rbp),%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):
<FpCurveUp>:
movapd %xmm1,%xmm2
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1139 <FpCurveUp+0x19>
jp     1139 <FpCurveUp+0x19>
movapd %xmm1,%xmm0
ret
sub    $0x18,%rsp
movsd  0xebb(%rip),%xmm0
movsd  %xmm2,0x8(%rsp)
call   1040 <fmax@plt>
movsd  0xeb0(%rip),%xmm0
mov    %eax,%edi
call   1030 <fmin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe93(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <fmax@plt>
movsd  0xe88(%rip),%xmm0
mov    %eax,%edi
call   1030 <fmin@plt>
movsd  0xe81(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm1
movsd  0xe73(%rip),%xmm2
subsd  %xmm0,%xmm2
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
add    $0x18,%rsp
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @FpCurveUp(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 %27
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 = fadd double %22, %23
%25 = fdiv double %20, %24
store double %25, double* %4
%26 = load double, double* %4
store double %26, double* %3
br label %27
27: ; preds = %10, %8
%28 = load double, double* %3
ret double %28
}

LLVM IR (-O2):
define double @FpCurveUp(double %0, double %1) {
%3 = fcmp oeq double %1, 0.000000e+00
br i1 %3, label %14, 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 = fadd double %6, %11
%13 = fdiv double %10, %12
br label %14
14: ; preds = %2, %4
%15 = phi double [ %13, %4 ], [ %0, %2 ]
ret double %15
}