#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 FpCurveUp(double, double);
int /*<<< orphan*/ fmax(double, double);
double fmin(double, int /*<<< orphan*/);
double FpCurve1D_u_out(double fpVal, double mEffect, double cntPnt) {
  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));
  cntPnt = fmin((1.0 - (0.0000000001)), fmax(0.0000000001, cntPnt));
  if (fpVal > cntPnt) {
    double fpVal_mod = (fpVal - cntPnt) / (1.0 - cntPnt);
    fpVal_mod = FpCurveUp(fpVal_mod, mEffect);
    fpVal_mod *= 1.0 - cntPnt;
    fpVal_mod += cntPnt;
    return fpVal_mod;
  }
  if (fpVal < cntPnt) {
    double fpVal_mod = (cntPnt - fpVal) / cntPnt;
    fpVal_mod = FpCurveUp(fpVal_mod, mEffect);
    fpVal_mod *= cntPnt;
    fpVal_mod = cntPnt - fpVal_mod;
    return fpVal_mod;
  }
  return fpVal;
}


x86 assembly (clang, -O0):
<FpCurve1D_u_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    116e <FpCurve1D_u_out+0x3e>
jp     116e <FpCurve1D_u_out+0x3e>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12cc <FpCurve1D_u_out+0x19c>
movsd  -0x10(%rbp),%xmm1
movsd  0xe8d(%rip),%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movsd  0xe76(%rip),%xmm0
call   1030 <fmin@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xe67(%rip),%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movsd  0xe50(%rip),%xmm0
call   1030 <fmin@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  0xe41(%rip),%xmm0
call   1040 <fmax@plt>
mov    %eax,%edi
movsd  0xe2a(%rip),%xmm0
call   1030 <fmin@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1259 <FpCurve1D_u_out+0x129>
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  0xe0e(%rip),%xmm1
subsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1050 <FpCurveUp@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xde4(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12cc <FpCurve1D_u_out+0x19c>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12c2 <FpCurve1D_u_out+0x192>
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1050 <FpCurveUp@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12cc <FpCurve1D_u_out+0x19c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FpCurve1D_u_out>:
sub    $0x18,%rsp
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    1148 <FpCurve1D_u_out+0x18>
jnp    123c <FpCurve1D_u_out+0x10c>
movsd  0xeb0(%rip),%xmm0
movsd  %xmm1,0x8(%rsp)
movapd %xmm3,%xmm1
movsd  %xmm2,(%rsp)
call   1040 <fmax@plt>
movsd  0xe9c(%rip),%xmm0
mov    %eax,%edi
call   1030 <fmin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe7f(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <fmax@plt>
movsd  0xe74(%rip),%xmm0
mov    %eax,%edi
call   1030 <fmin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe57(%rip),%xmm0
movsd  (%rsp),%xmm1
call   1040 <fmax@plt>
movsd  0xe4d(%rip),%xmm0
mov    %eax,%edi
call   1030 <fmin@plt>
movsd  0x10(%rsp),%xmm3
ucomisd %xmm0,%xmm3
jbe    120d <FpCurve1D_u_out+0xdd>
subsd  %xmm0,%xmm3
movsd  0xe36(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
divsd  %xmm1,%xmm3
movsd  %xmm0,(%rsp)
movapd %xmm3,%xmm0
movsd  0x8(%rsp),%xmm1
call   1050 <FpCurveUp@plt>
movapd %xmm0,%xmm3
mulsd  0x10(%rsp),%xmm3
addsd  (%rsp),%xmm3
jmp    123c <FpCurve1D_u_out+0x10c>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm3,%xmm0
jbe    123c <FpCurve1D_u_out+0x10c>
movapd %xmm0,%xmm2
movsd  %xmm0,(%rsp)
subsd  %xmm3,%xmm0
divsd  %xmm2,%xmm0
call   1050 <FpCurveUp@plt>
movsd  (%rsp),%xmm3
mulsd  %xmm3,%xmm0
subsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @FpCurve1D_u_out(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%10 = load double, double* %6
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = load double, double* %5
store double %13, double* %4
br label %67
14: ; preds = %3
%15 = load double, double* %5
%16 = call i32 @fmax(double 1.000000e-10, double %15)
%17 = call double @fmin(double 0x3FEFFFFFFFF24190, i32 %16)
store double %17, double* %5
%18 = load double, double* %6
%19 = call i32 @fmax(double 1.000000e-10, double %18)
%20 = call double @fmin(double 0x3FEFFFFFFFF24190, i32 %19)
store double %20, double* %6
%21 = load double, double* %7
%22 = call i32 @fmax(double 1.000000e-10, double %21)
%23 = call double @fmin(double 0x3FEFFFFFFFF24190, i32 %22)
store double %23, double* %7
%24 = load double, double* %5
%25 = load double, double* %7
%26 = fcmp ogt double %24, %25
br i1 %26, label %27, label %45
27: ; preds = %14
%28 = load double, double* %5
%29 = load double, double* %7
%30 = fsub double %28, %29
%31 = load double, double* %7
%32 = fsub double 1.000000e+00, %31
%33 = fdiv double %30, %32
store double %33, double* %8
%34 = load double, double* %8
%35 = load double, double* %6
%36 = call double @FpCurveUp(double %34, double %35)
store double %36, double* %8
%37 = load double, double* %7
%38 = fsub double 1.000000e+00, %37
%39 = load double, double* %8
%40 = fmul double %39, %38
store double %40, double* %8
%41 = load double, double* %7
%42 = load double, double* %8
%43 = fadd double %42, %41
store double %43, double* %8
%44 = load double, double* %8
store double %44, double* %4
br label %67
45: ; preds = %14
%46 = load double, double* %5
%47 = load double, double* %7
%48 = fcmp olt double %46, %47
br i1 %48, label %49, label %65
49: ; preds = %45
%50 = load double, double* %7
%51 = load double, double* %5
%52 = fsub double %50, %51
%53 = load double, double* %7
%54 = fdiv double %52, %53
store double %54, double* %9
%55 = load double, double* %9
%56 = load double, double* %6
%57 = call double @FpCurveUp(double %55, double %56)
store double %57, double* %9
%58 = load double, double* %7
%59 = load double, double* %9
%60 = fmul double %59, %58
store double %60, double* %9
%61 = load double, double* %7
%62 = load double, double* %9
%63 = fsub double %61, %62
store double %63, double* %9
%64 = load double, double* %9
store double %64, double* %4
br label %67
65: ; preds = %45
%66 = load double, double* %5
store double %66, double* %4
br label %67
67: ; preds = %65, %49, %27, %12
%68 = load double, double* %4
ret double %68
}

LLVM IR (-O2):
define double @FpCurve1D_u_out(double %0, double %1, double %2) {
%4 = fcmp oeq double %1, 0.000000e+00
br i1 %4, label %28, label %5
5: ; preds = %3
%6 = tail call i32 @fmax(double 1.000000e-10, double %0)
%7 = tail call double @fmin(double 0x3FEFFFFFFFF24190, i32 %6)
%8 = tail call i32 @fmax(double 1.000000e-10, double %1)
%9 = tail call double @fmin(double 0x3FEFFFFFFFF24190, i32 %8)
%10 = tail call i32 @fmax(double 1.000000e-10, double %2)
%11 = tail call double @fmin(double 0x3FEFFFFFFFF24190, i32 %10)
%12 = fcmp ogt double %7, %11
br i1 %12, label %13, label %20
13: ; preds = %5
%14 = fsub double %7, %11
%15 = fsub double 1.000000e+00, %11
%16 = fdiv double %14, %15
%17 = tail call double @FpCurveUp(double %16, double %9)
%18 = fmul double %15, %17
%19 = fadd double %11, %18
br label %28
20: ; preds = %5
%21 = fcmp olt double %7, %11
br i1 %21, label %22, label %28
22: ; preds = %20
%23 = fsub double %11, %7
%24 = fdiv double %23, %11
%25 = tail call double @FpCurveUp(double %24, double %9)
%26 = fmul double %11, %25
%27 = fsub double %11, %26
br label %28
28: ; preds = %20, %3, %22, %13
%29 = phi double [ %19, %13 ], [ %27, %22 ], [ %0, %3 ], [ %7, %20 ]
ret double %29
}