#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 FpCurveDnRs(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;
  fpVal *= 0.50;
  fpVal = 1.0 - fpVal;
  return fpVal;
}


x86 assembly (clang, -O0):
<FpCurveDnRs>:
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 <FpCurveDnRs+0x39>
jp     1159 <FpCurveDnRs+0x39>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1217 <FpCurveDnRs+0xf7>
movsd  -0x10(%rbp),%xmm1
movsd  0xeba(%rip),%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movsd  0xea3(%rip),%xmm0
call   1030 <fmin@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xe94(%rip),%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movsd  0xe7d(%rip),%xmm0
call   1030 <fmin@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe53(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe51(%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
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe17(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xdfd(%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):
<FpCurveDnRs>:
movapd %xmm1,%xmm2
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1139 <FpCurveDnRs+0x19>
jp     1139 <FpCurveDnRs+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),%xmm2
movapd %xmm2,%xmm3
subsd  0x10(%rsp),%xmm3
movsd  0xe77(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm2,%xmm4
subsd  %xmm0,%xmm4
addsd  %xmm3,%xmm4
divsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
mulsd  0xe5b(%rip),%xmm1
addsd  %xmm2,%xmm1
add    $0x18,%rsp
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @FpCurveDnRs(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 %35
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
%28 = load double, double* %4
%29 = fadd double %27, %28
store double %29, double* %4
%30 = load double, double* %4
%31 = fmul double %30, 5.000000e-01
store double %31, double* %4
%32 = load double, double* %4
%33 = fsub double 1.000000e+00, %32
store double %33, double* %4
%34 = load double, double* %4
store double %34, double* %3
br label %35
35: ; preds = %10, %8
%36 = load double, double* %3
ret double %36
}

LLVM IR (-O2):
define double @FpCurveDnRs(double %0, double %1) {
%3 = fcmp oeq double %1, 0.000000e+00
br i1 %3, label %18, 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 = fadd double %9, %14
%16 = fmul double %15, 5.000000e-01
%17 = fsub double 1.000000e+00, %16
br label %18
18: ; preds = %2, %4
%19 = phi double [ %17, %4 ], [ %0, %2 ]
ret double %19
}