double IEC_Scale(double dB) {
  double fScale = 1.0f;
  if (dB < -70.0f)
    fScale = 0.0f;
  else if (dB < -60.0f)
    fScale = (dB + 70.0f) * 0.0025f;
  else if (dB < -50.0f)
    fScale = (dB + 60.0f) * 0.005f + 0.025f;
  else if (dB < -40.0)
    fScale = (dB + 50.0f) * 0.0075f + 0.075f;
  else if (dB < -30.0f)
    fScale = (dB + 40.0f) * 0.015f + 0.15f;
  else if (dB < -20.0f)
    fScale = (dB + 30.0f) * 0.02f + 0.3f;
  else if (dB < -0.001f || dB > 0.001f)
    fScale = (dB + 20.0f) * 0.025f + 0.5f;
  return fScale;
}


x86 assembly (clang, -O0):
<IEC_Scale>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xee2(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1136 <IEC_Scale+0x36>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12e6 <IEC_Scale+0x1e6>
movsd  0xed2(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    116c <IEC_Scale+0x6c>
movsd  0xf6f(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xf5a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12e1 <IEC_Scale+0x1e1>
movsd  0xea4(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11ae <IEC_Scale+0xae>
movsd  0xf29(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xf14(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12dc <IEC_Scale+0x1dc>
movsd  0xe6a(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11f0 <IEC_Scale+0xf0>
movsd  0xed7(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xeba(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb6(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12d7 <IEC_Scale+0x1d7>
movsd  0xe30(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1232 <IEC_Scale+0x132>
movsd  0xe7d(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xe60(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12d2 <IEC_Scale+0x1d2>
movsd  0xdf6(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1274 <IEC_Scale+0x174>
movsd  0xe23(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xe06(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe02(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12cd <IEC_Scale+0x1cd>
movsd  0xdbc(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
ja     129e <IEC_Scale+0x19e>
movsd  -0x8(%rbp),%xmm0
movsd  0xdac(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12c8 <IEC_Scale+0x1c8>
movsd  0xdb2(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xd95(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd91(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    12cd <IEC_Scale+0x1cd>
jmp    12d2 <IEC_Scale+0x1d2>
jmp    12d7 <IEC_Scale+0x1d7>
jmp    12dc <IEC_Scale+0x1dc>
jmp    12e1 <IEC_Scale+0x1e1>
jmp    12e6 <IEC_Scale+0x1e6>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<IEC_Scale>:
xorps  %xmm1,%xmm1
movsd  0xef5(%rip),%xmm2
ucomisd %xmm0,%xmm2
jbe    1115 <IEC_Scale+0x15>
movaps %xmm1,%xmm0
ret
movsd  0xeeb(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1134 <IEC_Scale+0x34>
addsd  0xf8d(%rip),%xmm0
mulsd  0xf8d(%rip),%xmm0
ret
movsd  0xed4(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    115b <IEC_Scale+0x5b>
addsd  0xf5e(%rip),%xmm0
mulsd  0xf5e(%rip),%xmm0
addsd  0xef6(%rip),%xmm0
ret
movsd  0xeb5(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1182 <IEC_Scale+0x82>
addsd  0xf1f(%rip),%xmm0
mulsd  0xf1f(%rip),%xmm0
addsd  0xf1f(%rip),%xmm0
ret
movsd  0xe96(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a9 <IEC_Scale+0xa9>
addsd  0xee0(%rip),%xmm0
mulsd  0xee0(%rip),%xmm0
addsd  0xee0(%rip),%xmm0
ret
movsd  0xe77(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11d0 <IEC_Scale+0xd0>
addsd  0xea1(%rip),%xmm0
mulsd  0xea1(%rip),%xmm0
addsd  0xea1(%rip),%xmm0
ret
movsd  0xe58(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     11f4 <IEC_Scale+0xf4>
ucomisd 0xe5a(%rip),%xmm0
ja     11f4 <IEC_Scale+0xf4>
movsd  0xe48(%rip),%xmm1
movaps %xmm1,%xmm0
ret
addsd  0xe4c(%rip),%xmm0
mulsd  0xe4c(%rip),%xmm0
addsd  0xe4c(%rip),%xmm0
ret

LLVM IR (-O0):
define double @IEC_Scale(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 1.000000e+00, double* %3
%4 = load double, double* %2
%5 = fcmp olt double %4, -7.000000e+01
br i1 %5, label %6, label %7
6: ; preds = %1
store double 0.000000e+00, double* %3
br label %58
7: ; preds = %1
%8 = load double, double* %2
%9 = fcmp olt double %8, -6.000000e+01
br i1 %9, label %10, label %14
10: ; preds = %7
%11 = load double, double* %2
%12 = fadd double %11, 7.000000e+01
%13 = fmul double %12, 0x3F647AE140000000
store double %13, double* %3
br label %57
14: ; preds = %7
%15 = load double, double* %2
%16 = fcmp olt double %15, -5.000000e+01
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load double, double* %2
%19 = fadd double %18, 6.000000e+01
%20 = call double @llvm.fmuladd.f64(double %19, double 0x3F747AE140000000, double 0x3F999999A0000000)
store double %20, double* %3
br label %56
21: ; preds = %14
%22 = load double, double* %2
%23 = fcmp olt double %22, -4.000000e+01
br i1 %23, label %24, label %28
24: ; preds = %21
%25 = load double, double* %2
%26 = fadd double %25, 5.000000e+01
%27 = call double @llvm.fmuladd.f64(double %26, double 0x3F7EB851E0000000, double 0x3FB3333340000000)
store double %27, double* %3
br label %55
28: ; preds = %21
%29 = load double, double* %2
%30 = fcmp olt double %29, -3.000000e+01
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = load double, double* %2
%33 = fadd double %32, 4.000000e+01
%34 = call double @llvm.fmuladd.f64(double %33, double 0x3F8EB851E0000000, double 0x3FC3333340000000)
store double %34, double* %3
br label %54
35: ; preds = %28
%36 = load double, double* %2
%37 = fcmp olt double %36, -2.000000e+01
br i1 %37, label %38, label %42
38: ; preds = %35
%39 = load double, double* %2
%40 = fadd double %39, 3.000000e+01
%41 = call double @llvm.fmuladd.f64(double %40, double 0x3F947AE140000000, double 0x3FD3333340000000)
store double %41, double* %3
br label %53
42: ; preds = %35
%43 = load double, double* %2
%44 = fcmp olt double %43, 0xBF50624DE0000000
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = load double, double* %2
%47 = fcmp ogt double %46, 0x3F50624DE0000000
br i1 %47, label %48, label %52
48: ; preds = %45, %42
%49 = load double, double* %2
%50 = fadd double %49, 2.000000e+01
%51 = call double @llvm.fmuladd.f64(double %50, double 0x3F999999A0000000, double 5.000000e-01)
store double %51, double* %3
br label %52
52: ; preds = %48, %45
br label %53
53: ; preds = %52, %38
br label %54
54: ; preds = %53, %31
br label %55
55: ; preds = %54, %24
br label %56
56: ; preds = %55, %17
br label %57
57: ; preds = %56, %10
br label %58
58: ; preds = %57, %6
%59 = load double, double* %3
ret double %59
}

LLVM IR (-O2):
define double @IEC_Scale(double %0) {
%2 = fcmp olt double %0, -7.000000e+01
br i1 %2, label %35, label %3
3: ; preds = %1
%4 = fcmp olt double %0, -6.000000e+01
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = fadd double %0, 7.000000e+01
%7 = fmul double %6, 0x3F647AE140000000
br label %35
8: ; preds = %3
%9 = fcmp olt double %0, -5.000000e+01
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = fadd double %0, 6.000000e+01
%12 = tail call double @llvm.fmuladd.f64(double %11, double 0x3F747AE140000000, double 0x3F999999A0000000)
br label %35
13: ; preds = %8
%14 = fcmp olt double %0, -4.000000e+01
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = fadd double %0, 5.000000e+01
%17 = tail call double @llvm.fmuladd.f64(double %16, double 0x3F7EB851E0000000, double 0x3FB3333340000000)
br label %35
18: ; preds = %13
%19 = fcmp olt double %0, -3.000000e+01
br i1 %19, label %20, label %23
20: ; preds = %18
%21 = fadd double %0, 4.000000e+01
%22 = tail call double @llvm.fmuladd.f64(double %21, double 0x3F8EB851E0000000, double 0x3FC3333340000000)
br label %35
23: ; preds = %18
%24 = fcmp olt double %0, -2.000000e+01
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = fadd double %0, 3.000000e+01
%27 = tail call double @llvm.fmuladd.f64(double %26, double 0x3F947AE140000000, double 0x3FD3333340000000)
br label %35
28: ; preds = %23
%29 = fcmp olt double %0, 0xBF50624DE0000000
%30 = fcmp ogt double %0, 0x3F50624DE0000000
%31 = or i1 %29, %30
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = fadd double %0, 2.000000e+01
%34 = tail call double @llvm.fmuladd.f64(double %33, double 0x3F999999A0000000, double 5.000000e-01)
br label %35
35: ; preds = %1, %5, %15, %25, %28, %32, %20, %10
%36 = phi double [ %7, %5 ], [ %12, %10 ], [ %17, %15 ], [ %22, %20 ], [ %27, %25 ], [ %34, %32 ], [ 1.000000e+00, %28 ], [ 0.000000e+00, %1 ]
ret double %36
}