#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 dB_to_coefficient(float);
float meter_deflect_k(float db, float krange) {
  db += krange;
  if (db < -40.0f) {
    return (dB_to_coefficient(db) * 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    $0x10,%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    1174 <meter_deflect_k+0x64>
movss  -0x8(%rbp),%xmm0
call   1030 <dB_to_coefficient@plt>
movss  0xeb7(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xea3(%rip),%xmm1
addss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ce <meter_deflect_k+0xbe>
movss  0xe88(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  0xe7b(%rip),%xmm1
addss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe68(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c1 <meter_deflect_k+0xb1>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ce <meter_deflect_k+0xbe>
movss  0xe3f(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<meter_deflect_k>:
push   %rax
addss  %xmm1,%xmm0
movss  0xee3(%rip),%xmm2
ucomiss %xmm0,%xmm2
jbe    1149 <meter_deflect_k+0x39>
movss  %xmm1,0x4(%rsp)
call   1030 <dB_to_coefficient@plt>
mulss  0xed7(%rip),%xmm0
movss  0x4(%rsp),%xmm1
addss  0xec1(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rax
ret
movss  0xeb3(%rip),%xmm2
addss  %xmm2,%xmm0
addss  %xmm2,%xmm1
divss  %xmm1,%xmm0
minss  0xea3(%rip),%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 %19
12: ; preds = %2
%13 = load float, float* %4
%14 = call float @dB_to_coefficient(float %13)
%15 = fmul float %14, 5.000000e+02
%16 = load float, float* %5
%17 = fadd float %16, 4.500000e+01
%18 = fdiv float %15, %17
store float %18, float* %3
br label %31
19: ; preds = %2
%20 = load float, float* %4
%21 = fadd float %20, 4.500000e+01
%22 = load float, float* %5
%23 = fadd float %22, 4.500000e+01
%24 = fdiv float %21, %23
store float %24, float* %6
%25 = load float, float* %6
%26 = fpext float %25 to double
%27 = fcmp olt double %26, 1.000000e+00
br i1 %27, label %28, label %30
28: ; preds = %19
%29 = load float, float* %6
store float %29, float* %3
br label %31
30: ; preds = %19
store float 1.000000e+00, float* %3
br label %31
31: ; preds = %30, %28, %12
%32 = load float, float* %3
ret float %32
}

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 %10
5: ; preds = %2
%6 = tail call float @dB_to_coefficient(float %3)
%7 = fmul float %6, 5.000000e+02
%8 = fadd float %1, 4.500000e+01
%9 = fdiv float %7, %8
br label %16
10: ; preds = %2
%11 = fadd float %3, 4.500000e+01
%12 = fadd float %1, 4.500000e+01
%13 = fdiv float %11, %12
%14 = fcmp olt float %13, 1.000000e+00
%15 = select i1 %14, float %13, float 1.000000e+00
br label %16
16: ; preds = %10, %5
%17 = phi float [ %9, %5 ], [ %15, %10 ]
ret float %17
}