float IEC_Scale(float dB) {
  float 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
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xee2(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1135 <IEC_Scale+0x35>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12e7 <IEC_Scale+0x1e7>
movss  0xecb(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    116a <IEC_Scale+0x6a>
movss  0xf0d(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xefc(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12e2 <IEC_Scale+0x1e2>
movss  0xe9a(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    11ab <IEC_Scale+0xab>
movss  0xed0(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xebf(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe83(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12dd <IEC_Scale+0x1dd>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea4(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f5 <IEC_Scale+0xf5>
movss  0xe7e(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xe69(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe61(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12d8 <IEC_Scale+0x1d8>
movss  0xe13(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1236 <IEC_Scale+0x136>
movss  0xe31(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xe1c(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe14(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12d3 <IEC_Scale+0x1d3>
movss  0xdd6(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1277 <IEC_Scale+0x177>
movss  0xde4(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xdcf(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdc7(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12ce <IEC_Scale+0x1ce>
movss  0xd99(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
ja     129f <IEC_Scale+0x19f>
movss  -0x4(%rbp),%xmm0
movss  0xd86(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    12c9 <IEC_Scale+0x1c9>
movss  0xd81(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  0xd6c(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xd64(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12ce <IEC_Scale+0x1ce>
jmp    12d3 <IEC_Scale+0x1d3>
jmp    12d8 <IEC_Scale+0x1d8>
jmp    12dd <IEC_Scale+0x1dd>
jmp    12e2 <IEC_Scale+0x1e2>
jmp    12e7 <IEC_Scale+0x1e7>
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<IEC_Scale>:
xorps  %xmm1,%xmm1
movss  0xef5(%rip),%xmm2
ucomiss %xmm0,%xmm2
jbe    1114 <IEC_Scale+0x14>
movaps %xmm1,%xmm0
ret
movss  0xee8(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1132 <IEC_Scale+0x32>
addss  0xf33(%rip),%xmm0
mulss  0xf2f(%rip),%xmm0
ret
movss  0xece(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1158 <IEC_Scale+0x58>
addss  0xf0d(%rip),%xmm0
mulss  0xf09(%rip),%xmm0
addss  0xed1(%rip),%xmm0
ret
movss  0xeac(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    117e <IEC_Scale+0x7e>
addss  0xedb(%rip),%xmm0
mulss  0xed7(%rip),%xmm0
addss  0xed3(%rip),%xmm0
ret
movss  0xe8a(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11a4 <IEC_Scale+0xa4>
addss  0xea9(%rip),%xmm0
mulss  0xea5(%rip),%xmm0
addss  0xea1(%rip),%xmm0
ret
movss  0xe68(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11ca <IEC_Scale+0xca>
addss  0xe77(%rip),%xmm0
mulss  0xe73(%rip),%xmm0
addss  0xe6f(%rip),%xmm0
ret
movss  0xe46(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     11ec <IEC_Scale+0xec>
ucomiss 0xe42(%rip),%xmm0
ja     11ec <IEC_Scale+0xec>
movss  0xe34(%rip),%xmm1
movaps %xmm1,%xmm0
ret
addss  0xe30(%rip),%xmm0
mulss  0xe2c(%rip),%xmm0
addss  0xe28(%rip),%xmm0
ret

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

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