#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 sqrtf(float);
float meter_deflect_din(float db) {
  float rv = dB_to_coefficient(db);
  rv = sqrtf(sqrtf(2.3676f * rv)) - 0.1803f;
  if (rv >= 1.0) {
    return 1.0;
  } else {
    return (rv > 0 ? rv : 0.0);
  }
}


x86 assembly (clang, -O0):
<meter_deflect_din>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <dB_to_coefficient@plt>
movss  %xmm0,-0xc(%rbp)
movss  0xec8(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
call   1040 <sqrtf@plt>
call   1040 <sqrtf@plt>
movss  0xead(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe8b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1191 <meter_deflect_din+0x71>
movss  0xe89(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11d0 <meter_deflect_din+0xb0>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    11b5 <meter_deflect_din+0x95>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11c2 <meter_deflect_din+0xa2>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11c2 <meter_deflect_din+0xa2>
movsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<meter_deflect_din>:
push   %rax
call   1030 <dB_to_coefficient@plt>
mulss  0xed2(%rip),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1146 <meter_deflect_din+0x26>
sqrtss %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jae    1153 <meter_deflect_din+0x33>
call   1040 <sqrtf@plt>
jmp    1157 <meter_deflect_din+0x37>
call   1040 <sqrtf@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     113f <meter_deflect_din+0x1f>
sqrtss %xmm0,%xmm0
addss  0xea5(%rip),%xmm0
xorps  %xmm2,%xmm2
movss  0xe9e(%rip),%xmm3
movaps %xmm3,%xmm1
cmpnless %xmm0,%xmm1
maxss  %xmm2,%xmm0
andps  %xmm1,%xmm0
andnps %xmm3,%xmm1
orps   %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @meter_deflect_din(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %3
%5 = load float, float* %3
%6 = call float @dB_to_coefficient(float %5)
store float %6, float* %4
%7 = load float, float* %4
%8 = fmul float 0x4002F0D840000000, %7
%9 = call float @sqrtf(float %8)
%10 = call float @sqrtf(float %9)
%11 = fsub float %10, 0x3FC7141200000000
store float %11, float* %4
%12 = load float, float* %4
%13 = fpext float %12 to double
%14 = fcmp oge double %13, 1.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %1
store float 1.000000e+00, float* %2
br label %26
16: ; preds = %1
%17 = load float, float* %4
%18 = fcmp ogt float %17, 0.000000e+00
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load float, float* %4
%21 = fpext float %20 to double
br label %23
22: ; preds = %16
br label %23
23: ; preds = %22, %19
%24 = phi double [ %21, %19 ], [ 0.000000e+00, %22 ]
%25 = fptrunc double %24 to float
store float %25, float* %2
br label %26
26: ; preds = %23, %15
%27 = load float, float* %2
ret float %27
}

LLVM IR (-O2):
define float @meter_deflect_din(float %0) {
%2 = tail call float @dB_to_coefficient(float %0)
%3 = fmul float %2, 0x4002F0D840000000
%4 = tail call float @sqrtf(float %3)
%5 = tail call float @sqrtf(float %4)
%6 = fadd float %5, 0xBFC7141200000000
%7 = fcmp ult float %6, 1.000000e+00
%8 = fcmp ogt float %6, 0.000000e+00
%9 = select i1 %8, float %6, float 0.000000e+00
%10 = select i1 %7, float %9, float 1.000000e+00
ret float %10
}