#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 FpCurveUpRs(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)) + fpVal;
  fpVal *= 0.50;
  return fpVal;
}


x86 assembly (clang, -O0):
<FpCurveUpRs>:
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 <FpCurveUpRs+0x39>
jp     1159 <FpCurveUpRs+0x39>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11f3 <FpCurveUpRs+0xd3>
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  0xe63(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xe49(%rip),%xmm1
subsd  -0x18(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe21(%rip),%xmm0
mulsd  -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):
<FpCurveUpRs>:
movapd %xmm1,%xmm2
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jne    1139 <FpCurveUpRs+0x19>
jp     1139 <FpCurveUpRs+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
addsd  %xmm3,%xmm1
mulsd  0xe63(%rip),%xmm1
add    $0x18,%rsp
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @FpCurveUpRs(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* %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
%26 = load double, double* %4
%27 = fadd double %25, %26
store double %27, double* %4
%28 = load double, double* %4
%29 = fmul double %28, 5.000000e-01
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 @FpCurveUpRs(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 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
%14 = fadd double %6, %13
%15 = fmul double %14, 5.000000e-01
br label %16
16: ; preds = %2, %4
%17 = phi double [ %15, %4 ], [ %0, %2 ]
ret double %17
}