#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 */
float pow(float, float);
float meter_deflect_k(float db, float krange) {
  db += krange;
  if (db < -40.0f) {
    return (db > -90.0f ? pow(10.0f, db * 0.05f) : 0.0f) * 500.0f /
           (krange + 45.0f);
  } else {
    const float rv = (db + 45.0f) / (krange + 45.0f);
    if (rv < 1.0) {
      return rv;
    } else {
      return 1.0;
    }
  }
}


x86 assembly (clang, -O0):
<meter_deflect_k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xec7(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    11b6 <meter_deflect_k+0xa6>
movss  -0x8(%rbp),%xmm0
movss  0xebc(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    117d <meter_deflect_k+0x6d>
movss  0xeb3(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
movss  0xea2(%rip),%xmm0
call   1030 <pow@plt>
movss  %xmm0,-0x14(%rbp)
jmp    118a <meter_deflect_k+0x7a>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    118a <meter_deflect_k+0x7a>
movss  -0x14(%rbp),%xmm0
movss  0xe81(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe61(%rip),%xmm1
addss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1210 <meter_deflect_k+0x100>
movss  0xe46(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  0xe39(%rip),%xmm1
addss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe36(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1203 <meter_deflect_k+0xf3>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1210 <meter_deflect_k+0x100>
movss  0xdfd(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<meter_deflect_k>:
push   %rax
movaps %xmm1,%xmm2
movaps %xmm0,%xmm1
addss  %xmm2,%xmm1
movss  0xedd(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    116b <meter_deflect_k+0x5b>
xorps  %xmm0,%xmm0
ucomiss 0xeda(%rip),%xmm1
jbe    115d <meter_deflect_k+0x4d>
mulss  0xed4(%rip),%xmm1
movss  0xed0(%rip),%xmm0
movss  %xmm2,0x4(%rsp)
call   1030 <pow@plt>
movss  0x4(%rsp),%xmm2
mulss  0xebb(%rip),%xmm0
addss  0xe9f(%rip),%xmm2
divss  %xmm2,%xmm0
pop    %rax
ret
movss  0xe91(%rip),%xmm0
addss  %xmm0,%xmm1
addss  %xmm0,%xmm2
divss  %xmm2,%xmm1
minss  0xe81(%rip),%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @meter_deflect_k(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
%7 = load float, float* %5
%8 = load float, float* %4
%9 = fadd float %8, %7
store float %9, float* %4
%10 = load float, float* %4
%11 = fcmp olt float %10, -4.000000e+01
br i1 %11, label %12, label %26
12: ; preds = %2
%13 = load float, float* %4
%14 = fcmp ogt float %13, -9.000000e+01
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load float, float* %4
%17 = fmul float %16, 0x3FA99999A0000000
%18 = call float @pow(float 1.000000e+01, float %17)
br label %20
19: ; preds = %12
br label %20
20: ; preds = %19, %15
%21 = phi float [ %18, %15 ], [ 0.000000e+00, %19 ]
%22 = fmul float %21, 5.000000e+02
%23 = load float, float* %5
%24 = fadd float %23, 4.500000e+01
%25 = fdiv float %22, %24
store float %25, float* %3
br label %38
26: ; preds = %2
%27 = load float, float* %4
%28 = fadd float %27, 4.500000e+01
%29 = load float, float* %5
%30 = fadd float %29, 4.500000e+01
%31 = fdiv float %28, %30
store float %31, float* %6
%32 = load float, float* %6
%33 = fpext float %32 to double
%34 = fcmp olt double %33, 1.000000e+00
br i1 %34, label %35, label %37
35: ; preds = %26
%36 = load float, float* %6
store float %36, float* %3
br label %38
37: ; preds = %26
store float 1.000000e+00, float* %3
br label %38
38: ; preds = %37, %35, %20
%39 = load float, float* %3
ret float %39
}

LLVM IR (-O2):
define float @meter_deflect_k(float %0, float %1) {
%3 = fadd float %0, %1
%4 = fcmp olt float %3, -4.000000e+01
br i1 %4, label %5, label %15
5: ; preds = %2
%6 = fcmp ogt float %3, -9.000000e+01
br i1 %6, label %7, label %11
7: ; preds = %5
%8 = fmul float %3, 0x3FA99999A0000000
%9 = tail call float @pow(float 1.000000e+01, float %8)
%10 = fmul float %9, 5.000000e+02
br label %11
11: ; preds = %5, %7
%12 = phi float [ %10, %7 ], [ 0.000000e+00, %5 ]
%13 = fadd float %1, 4.500000e+01
%14 = fdiv float %12, %13
br label %21
15: ; preds = %2
%16 = fadd float %3, 4.500000e+01
%17 = fadd float %1, 4.500000e+01
%18 = fdiv float %16, %17
%19 = fcmp olt float %18, 1.000000e+00
%20 = select i1 %19, float %18, float 1.000000e+00
br label %21
21: ; preds = %15, %11
%22 = phi float [ %14, %11 ], [ %20, %15 ]
ret float %22
}