double FpUcurveSc_d(const double inpVal, const double hard,
                    const double scale) {
  return (double)(inpVal >= 0.0
                      ? (inpVal * (hard + inpVal) /
                         (scale + (hard * inpVal) + (inpVal * inpVal)))
                      : (inpVal * (hard - inpVal) /
                         (scale - (hard * inpVal) + (inpVal * inpVal))));
}


x86 assembly (clang, -O0):
<FpUcurveSc_d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     116f <FpUcurveSc_d+0x6f>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
addsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11cb <FpUcurveSc_d+0xcb>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FpUcurveSc_d>:
movapd %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm3
movapd 0xeec(%rip),%xmm5
movapd %xmm1,%xmm4
jae    111e <FpUcurveSc_d+0x1e>
xorpd  %xmm5,%xmm4
xorpd  %xmm3,%xmm5
cmpnlesd %xmm3,%xmm0
andpd  %xmm0,%xmm5
andnpd %xmm3,%xmm0
orpd   %xmm5,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
mulsd  %xmm3,%xmm4
addsd  %xmm2,%xmm4
mulsd  %xmm3,%xmm3
addsd  %xmm4,%xmm3
divsd  %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @FpUcurveSc_d(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = fcmp oge double %7, 0.000000e+00
br i1 %8, label %9, label %23
9: ; preds = %3
%10 = load double, double* %4
%11 = load double, double* %5
%12 = load double, double* %4
%13 = fadd double %11, %12
%14 = fmul double %10, %13
%15 = load double, double* %6
%16 = load double, double* %5
%17 = load double, double* %4
%18 = call double @llvm.fmuladd.f64(double %16, double %17, double %15)
%19 = load double, double* %4
%20 = load double, double* %4
%21 = call double @llvm.fmuladd.f64(double %19, double %20, double %18)
%22 = fdiv double %14, %21
br label %38
23: ; preds = %3
%24 = load double, double* %4
%25 = load double, double* %5
%26 = load double, double* %4
%27 = fsub double %25, %26
%28 = fmul double %24, %27
%29 = load double, double* %6
%30 = load double, double* %5
%31 = load double, double* %4
%32 = fneg double %30
%33 = call double @llvm.fmuladd.f64(double %32, double %31, double %29)
%34 = load double, double* %4
%35 = load double, double* %4
%36 = call double @llvm.fmuladd.f64(double %34, double %35, double %33)
%37 = fdiv double %28, %36
br label %38
38: ; preds = %23, %9
%39 = phi double [ %22, %9 ], [ %37, %23 ]
ret double %39
}

LLVM IR (-O2):
define double @FpUcurveSc_d(double %0, double %1, double %2) {
%4 = fcmp ult double %0, 0.000000e+00
%5 = fneg double %1
%6 = select i1 %4, double %5, double %1
%7 = fneg double %0
%8 = select i1 %4, double %7, double %0
%9 = fadd double %8, %1
%10 = fmul double %9, %0
%11 = tail call double @llvm.fmuladd.f64(double %6, double %0, double %2)
%12 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %11)
%13 = fdiv double %10, %12
ret double %13
}