#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 FpCurveDn(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 = 1.0 - fpVal;
  fpVal = ((2.0 - mEffect) * fpVal) / ((1.0 - mEffect) + fpVal);
  fpVal = 1.0 - fpVal;
  return fpVal;
}


x86 assembly (clang, -O0):
<FpCurveDn>:
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 <FpCurveDn+0x39>
jp     1159 <FpCurveDn+0x39>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1200 <FpCurveDn+0xe0>
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  0xe53(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe49(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe2f(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe14(%rip),%xmm0
subsd  -0x10(%rbp),%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):
<FpCurveDn>:
movapd %xmm1,%xmm2
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1139 <FpCurveDn+0x19>
jp     1139 <FpCurveDn+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
movapd %xmm1,%xmm2
subsd  0x10(%rsp),%xmm2
movsd  0xe77(%rip),%xmm3
subsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm3
movapd %xmm1,%xmm4
subsd  %xmm0,%xmm4
addsd  %xmm2,%xmm4
divsd  %xmm4,%xmm3
subsd  %xmm3,%xmm1
add    $0x18,%rsp
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @FpCurveDn(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 %31
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* %4
%18 = fsub double 1.000000e+00, %17
store double %18, double* %4
%19 = load double, double* %5
%20 = fsub double 2.000000e+00, %19
%21 = load double, double* %4
%22 = fmul double %20, %21
%23 = load double, double* %5
%24 = fsub double 1.000000e+00, %23
%25 = load double, double* %4
%26 = fadd double %24, %25
%27 = fdiv double %22, %26
store double %27, double* %4
%28 = load double, double* %4
%29 = fsub double 1.000000e+00, %28
store double %29, double* %4
%30 = load double, double* %4
store double %30, double* %3
br label %31
31: ; preds = %10, %8
%32 = load double, double* %3
ret double %32
}

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