#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 */
double exp(double);
double pow(float, double);
float ATH_dB(float f, float value) {
  float ath;
  float valueold = 0.0;
  if (f < -.3)
    f = 3410;
  f /= 1000;
  f = ((0.01) > (f) ? (0.01) : (f));
  f = ((18.0) < (f) ? (18.0) : (f));
  ath = 3.640 * pow(f, -0.8) - 6.800 * exp(-0.6 * pow(f - 3.4, 2.0)) +
        6.000 * exp(-0.15 * pow(f - 8.7, 2.0)) +
        (0.6 + 0.04 * valueold) * 0.001 * pow(f, 4.0);
  return (ath + value);
}


x86 assembly (clang, -O0):
<ATH_dB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb5(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1162 <ATH_dB+0x42>
movss  0xf23(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xf15(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe7f(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a5 <ATH_dB+0x85>
movsd  0xe6d(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11b3 <ATH_dB+0x93>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11ee <ATH_dB+0xce>
movsd  0xe2c(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11fc <ATH_dB+0xdc>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xe61(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x40(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3e(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xe06(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe16(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
movsd  0xdf5(%rip),%xmm1
mulsd  %xmm2,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xdca(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda4(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xd8c(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xd74(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0x38(%rbp),%xmm1
movsd  0xd56(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd28(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd24(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd08(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
movsd  0xcea(%rip),%xmm1
call   1040 <pow@plt>
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ATH_dB>:
sub    $0x18,%rsp
movss  %xmm1,0xc(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
divss  0xec7(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
cmpltsd 0xec2(%rip),%xmm1
movsd  0xec2(%rip),%xmm2
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
cmpltsd 0xeb1(%rip),%xmm0
movsd  0xeb1(%rip),%xmm2
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm0,%xmm2
movsd  0xea5(%rip),%xmm0
minsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
movsd  0xe97(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,(%rsp)
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0xe7a(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xe72(%rip),%xmm1
call   1040 <pow@plt>
mulsd  0xe6d(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xe68(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  0xe63(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  0xe54(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xe28(%rip),%xmm1
call   1040 <pow@plt>
mulsd  0xe43(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xe3e(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe34(%rip),%xmm1
movss  0x8(%rsp),%xmm0
call   1040 <pow@plt>
mulsd  0xe29(%rip),%xmm0
addsd  (%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
addss  0xc(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @ATH_dB(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float %1, float* %4
store float 0.000000e+00, float* %6
%7 = load float, float* %3
%8 = fpext float %7 to double
%9 = fcmp olt double %8, -3.000000e-01
br i1 %9, label %10, label %11
10: ; preds = %2
store float 3.410000e+03, float* %3
br label %11
11: ; preds = %10, %2
%12 = load float, float* %3
%13 = fdiv float %12, 1.000000e+03
store float %13, float* %3
%14 = load float, float* %3
%15 = fpext float %14 to double
%16 = fcmp ogt double 1.000000e-02, %15
br i1 %16, label %17, label %18
17: ; preds = %11
br label %21
18: ; preds = %11
%19 = load float, float* %3
%20 = fpext float %19 to double
br label %21
21: ; preds = %18, %17
%22 = phi double [ 1.000000e-02, %17 ], [ %20, %18 ]
%23 = fptrunc double %22 to float
store float %23, float* %3
%24 = load float, float* %3
%25 = fpext float %24 to double
%26 = fcmp olt double 1.800000e+01, %25
br i1 %26, label %27, label %28
27: ; preds = %21
br label %31
28: ; preds = %21
%29 = load float, float* %3
%30 = fpext float %29 to double
br label %31
31: ; preds = %28, %27
%32 = phi double [ 1.800000e+01, %27 ], [ %30, %28 ]
%33 = fptrunc double %32 to float
store float %33, float* %3
%34 = load float, float* %3
%35 = call double @pow(float %34, double -8.000000e-01)
%36 = load float, float* %3
%37 = fpext float %36 to double
%38 = fsub double %37, 3.400000e+00
%39 = fptrunc double %38 to float
%40 = call double @pow(float %39, double 2.000000e+00)
%41 = fmul double -6.000000e-01, %40
%42 = call double @exp(double %41)
%43 = fmul double 6.800000e+00, %42
%44 = fneg double %43
%45 = call double @llvm.fmuladd.f64(double 3.640000e+00, double %35, double %44)
%46 = load float, float* %3
%47 = fpext float %46 to double
%48 = fsub double %47, 0x4021666666666666
%49 = fptrunc double %48 to float
%50 = call double @pow(float %49, double 2.000000e+00)
%51 = fmul double -1.500000e-01, %50
%52 = call double @exp(double %51)
%53 = call double @llvm.fmuladd.f64(double 6.000000e+00, double %52, double %45)
%54 = load float, float* %6
%55 = fpext float %54 to double
%56 = call double @llvm.fmuladd.f64(double 4.000000e-02, double %55, double 6.000000e-01)
%57 = fmul double %56, 1.000000e-03
%58 = load float, float* %3
%59 = call double @pow(float %58, double 4.000000e+00)
%60 = call double @llvm.fmuladd.f64(double %57, double %59, double %53)
%61 = fptrunc double %60 to float
store float %61, float* %5
%62 = load float, float* %5
%63 = load float, float* %4
%64 = fadd float %62, %63
ret float %64
}

LLVM IR (-O2):
define float @ATH_dB(float %0, float %1) {
%3 = fpext float %0 to double
%4 = fcmp olt double %3, -3.000000e-01
%5 = fdiv float %0, 1.000000e+03
%6 = fpext float %5 to double
%7 = select i1 %4, double 0x400B47AE20000000, double %6
%8 = fcmp olt double %7, 1.000000e-02
%9 = select i1 %8, double 0x3F847AE140000000, double %7
%10 = fcmp ogt double %9, 1.800000e+01
%11 = select i1 %10, double 1.800000e+01, double %9
%12 = fptrunc double %11 to float
%13 = tail call double @pow(float %12, double -8.000000e-01)
%14 = fpext float %12 to double
%15 = fadd double %14, -3.400000e+00
%16 = fptrunc double %15 to float
%17 = tail call double @pow(float %16, double 2.000000e+00)
%18 = fmul double %17, -6.000000e-01
%19 = tail call double @exp(double %18)
%20 = fmul double %19, -6.800000e+00
%21 = tail call double @llvm.fmuladd.f64(double %13, double 3.640000e+00, double %20)
%22 = fadd double %14, 0xC021666666666666
%23 = fptrunc double %22 to float
%24 = tail call double @pow(float %23, double 2.000000e+00)
%25 = fmul double %24, -1.500000e-01
%26 = tail call double @exp(double %25)
%27 = tail call double @llvm.fmuladd.f64(double %26, double 6.000000e+00, double %21)
%28 = tail call double @pow(float %12, double 4.000000e+00)
%29 = tail call double @llvm.fmuladd.f64(double %28, double 6.000000e-04, double %27)
%30 = fptrunc double %29 to float
%31 = fadd float %30, %1
ret float %31
}