#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 frexpf_fast(float, int *);
float linear_to_decibels(float linear) {
  if (linear <= 0)
    return -1000;
  int e = 0;
  float x = frexpf_fast(linear, &e);
  float exp = e;
  if (x > 0.707106781186548f) {
    x *= 0.707106781186548f;
    exp += 0.5f;
  }
  const float A5 = 1.131880283355712890625f;
  const float A4 = -4.258677959442138671875f;
  const float A3 = 6.81631565093994140625f;
  const float A2 = -6.1185703277587890625f;
  const float A1 = 3.6505267620086669921875f;
  const float A0 = -1.217894077301025390625f;
  float x2 = x * x;
  float x4 = x2 * x2;
  return ((A5 * x + A4) * x4 + (A3 * x + A2) * x2 + (A1 * x + A0)) * 20.0f +
         exp * 6.0205999132796239f;
}


x86 assembly (clang, -O0):
<linear_to_decibels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     113c <linear_to_decibels+0x2c>
movss  0xef6(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1295 <linear_to_decibels+0x185>
movl   $0x0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
lea    -0xc(%rbp),%rdi
call   1030 <frexpf_fast@plt>
movss  %xmm0,-0x10(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe93(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    119a <linear_to_decibels+0x8a>
movss  0xe82(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe74(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe7e(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe75(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  0xe5c(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xe53(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xe3a(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  0xe31(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x10(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x30(%rbp),%xmm0
mulss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe0d(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe05(%rip),%xmm1
addss  %xmm1,%xmm0
movss  -0x34(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
movss  0xde3(%rip),%xmm3
mulss  %xmm3,%xmm1
movss  0xddb(%rip),%xmm3
addss  %xmm3,%xmm1
mulss  -0x30(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xdb1(%rip),%xmm2
mulss  %xmm2,%xmm1
movss  0xda9(%rip),%xmm2
addss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  0xd91(%rip),%xmm1
mulss  -0x14(%rbp),%xmm1
movss  0xd80(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear_to_decibels>:
push   %rax
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jae    11cb <linear_to_decibels+0xbb>
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <frexpf_fast@plt>
movaps %xmm0,%xmm1
cvtsi2ssl 0x4(%rsp),%xmm2
movss  0xec4(%rip),%xmm0
ucomiss %xmm0,%xmm1
movaps %xmm1,%xmm3
mulss  %xmm0,%xmm3
jbe    1154 <linear_to_decibels+0x44>
addss  0xeb4(%rip),%xmm2
cmpltss %xmm1,%xmm0
andps  %xmm0,%xmm3
andnps %xmm1,%xmm0
orps   %xmm3,%xmm0
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
movss  0xea3(%rip),%xmm3
mulss  %xmm0,%xmm3
addss  0xe9b(%rip),%xmm3
mulss  %xmm1,%xmm3
mulss  %xmm1,%xmm1
movss  0xe7f(%rip),%xmm4
mulss  %xmm0,%xmm4
addss  0xe77(%rip),%xmm4
mulss  %xmm1,%xmm4
addss  %xmm4,%xmm3
mulss  0xe73(%rip),%xmm0
addss  0xe6f(%rip),%xmm0
mulss  0xe6b(%rip),%xmm2
addss  %xmm3,%xmm0
mulss  0xe63(%rip),%xmm0
addss  %xmm2,%xmm0
pop    %rax
ret
movss  0xe2d(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @linear_to_decibels(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
store float %0, float* %3
%15 = load float, float* %3
%16 = fcmp ole float %15, 0.000000e+00
br i1 %16, label %17, label %18
17: ; preds = %1
store float -1.000000e+03, float* %2
br label %51
18: ; preds = %1
store i32 0, i32* %4
%19 = load float, float* %3
%20 = call float @frexpf_fast(float %19, i32* %4)
store float %20, float* %5
%21 = load i32, i32* %4
%22 = sitofp i32 %21 to float
store float %22, float* %6
%23 = load float, float* %5
%24 = fcmp ogt float %23, 0x3FE6A09E60000000
br i1 %24, label %25, label %30
25: ; preds = %18
%26 = load float, float* %5
%27 = fmul float %26, 0x3FE6A09E60000000
store float %27, float* %5
%28 = load float, float* %6
%29 = fadd float %28, 5.000000e-01
store float %29, float* %6
br label %30
30: ; preds = %25, %18
store float 0x3FF21C2E80000000, float* %7
store float 0xC01108E2E0000000, float* %8
store float 0x401B43E840000000, float* %9
store float 0xC018796A80000000, float* %10
store float 0x400D344760000000, float* %11
store float 0xBFF37C7E80000000, float* %12
%31 = load float, float* %5
%32 = load float, float* %5
%33 = fmul float %31, %32
store float %33, float* %13
%34 = load float, float* %13
%35 = load float, float* %13
%36 = fmul float %34, %35
store float %36, float* %14
%37 = load float, float* %5
%38 = call float @llvm.fmuladd.f32(float 0x3FF21C2E80000000, float %37, float 0xC01108E2E0000000)
%39 = load float, float* %14
%40 = load float, float* %5
%41 = call float @llvm.fmuladd.f32(float 0x401B43E840000000, float %40, float 0xC018796A80000000)
%42 = load float, float* %13
%43 = fmul float %41, %42
%44 = call float @llvm.fmuladd.f32(float %38, float %39, float %43)
%45 = load float, float* %5
%46 = call float @llvm.fmuladd.f32(float 0x400D344760000000, float %45, float 0xBFF37C7E80000000)
%47 = fadd float %44, %46
%48 = load float, float* %6
%49 = fmul float %48, 0x4018151820000000
%50 = call float @llvm.fmuladd.f32(float %47, float 2.000000e+01, float %49)
store float %50, float* %2
br label %51
51: ; preds = %30, %17
%52 = load float, float* %2
ret float %52
}

LLVM IR (-O2):
define float @linear_to_decibels(float %0) {
%2 = alloca i32
%3 = fcmp ugt float %0, 0.000000e+00
br i1 %3, label %4, label %24
4: ; preds = %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = call float @frexpf_fast(float %0, i32* %2)
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to float
%9 = fcmp ogt float %6, 0x3FE6A09E60000000
%10 = fmul float %6, 0x3FE6A09E60000000
%11 = fadd float %8, 5.000000e-01
%12 = select i1 %9, float %11, float %8
%13 = select i1 %9, float %10, float %6
%14 = fmul float %13, %13
%15 = fmul float %14, %14
%16 = call float @llvm.fmuladd.f32(float %13, float 0x3FF21C2E80000000, float 0xC01108E2E0000000)
%17 = call float @llvm.fmuladd.f32(float %13, float 0x401B43E840000000, float 0xC018796A80000000)
%18 = fmul float %17, %14
%19 = call float @llvm.fmuladd.f32(float %16, float %15, float %18)
%20 = call float @llvm.fmuladd.f32(float %13, float 0x400D344760000000, float 0xBFF37C7E80000000)
%21 = fadd float %20, %19
%22 = fmul float %12, 0x4018151820000000
%23 = call float @llvm.fmuladd.f32(float %21, float 2.000000e+01, float %22)
br label %24
24: ; preds = %1, %4
%25 = phi float [ %23, %4 ], [ -1.000000e+03, %1 ]
ret float %25
}