#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(double, double);
double ath_db(double f, double value) {
  double ath;
  double 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    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xebe(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    115a <ath_db+0x3a>
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeb1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe98(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1195 <ath_db+0x75>
movsd  0xe85(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    119f <ath_db+0x7f>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe6a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11d2 <ath_db+0xb2>
movsd  0xe58(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11dc <ath_db+0xbc>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe95(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe76(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe42(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe52(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movsd  0xe31(%rip),%xmm1
mulsd  %xmm2,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe06(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xde4(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xdd0(%rip),%xmm1
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xdb8(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0x48(%rbp),%xmm1
movsd  0xd9a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xd70(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd6c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd50(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd32(%rip),%xmm1
call   1040 <pow@plt>
movsd  -0x40(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ath_db>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  0xed6(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1142 <ath_db+0x22>
movsd  0xec0(%rip),%xmm0
jmp    114a <ath_db+0x2a>
divsd  0xec6(%rip),%xmm0
movsd  0xec6(%rip),%xmm1
maxsd  %xmm0,%xmm1
movsd  0xec2(%rip),%xmm0
minsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xeb8(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,(%rsp)
movsd  0xeae(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
mulsd  0xea4(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xe9f(%rip),%xmm0
movsd  (%rsp),%xmm1
mulsd  0xe9a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe91(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
mulsd  0xe87(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xe82(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xe78(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1040 <pow@plt>
mulsd  0xe6d(%rip),%xmm0
addsd  (%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

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

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