#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 pow(double const, double);
double CalcKaiserBeta(const double rejection) {
  if (rejection > 50.0)
    return 0.1102 * (rejection - 8.7);
  else if (rejection >= 21.0)
    return (0.5842 * pow(rejection - 21.0, 0.4)) +
           (0.07886 * (rejection - 21.0));
  return 0.0;
}


x86 assembly (clang, -O0):
<CalcKaiserBeta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    115b <CalcKaiserBeta+0x4b>
movsd  -0x10(%rbp),%xmm1
movsd  0xeef(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xedb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d4 <CalcKaiserBeta+0xc4>
movsd  -0x10(%rbp),%xmm0
movsd  0xea0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11c7 <CalcKaiserBeta+0xb7>
movsd  -0x10(%rbp),%xmm0
movsd  0xe89(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe95(%rip),%xmm1
call   1030 <pow@plt>
movsd  -0x10(%rbp),%xmm2
movsd  0xe6b(%rip),%xmm1
subsd  %xmm1,%xmm2
movsd  0xe6f(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe5b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11d4 <CalcKaiserBeta+0xc4>
jmp    11cc <CalcKaiserBeta+0xbc>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalcKaiserBeta>:
push   %rax
movapd %xmm0,%xmm1
ucomisd 0xee3(%rip),%xmm0
jbe    1135 <CalcKaiserBeta+0x25>
addsd  0xf09(%rip),%xmm1
mulsd  0xf09(%rip),%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret
xorpd  %xmm0,%xmm0
ucomisd 0xec7(%rip),%xmm1
jb     117a <CalcKaiserBeta+0x6a>
addsd  0xec5(%rip),%xmm1
movapd %xmm1,%xmm0
movsd  %xmm1,(%rsp)
movsd  0xebc(%rip),%xmm1
call   1030 <pow@plt>
movsd  (%rsp),%xmm1
mulsd  0xeb2(%rip),%xmm1
mulsd  0xeb2(%rip),%xmm0
addsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @CalcKaiserBeta(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ogt double %4, 5.000000e+01
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fsub double %7, 0x4021666666666666
%9 = fmul double 1.102000e-01, %8
store double %9, double* %2
br label %23
10: ; preds = %1
%11 = load double, double* %3
%12 = fcmp oge double %11, 2.100000e+01
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load double, double* %3
%15 = fsub double %14, 2.100000e+01
%16 = call double @pow(double %15, double 4.000000e-01)
%17 = load double, double* %3
%18 = fsub double %17, 2.100000e+01
%19 = fmul double 0x3FB4302B40F66A55, %18
%20 = call double @llvm.fmuladd.f64(double 5.842000e-01, double %16, double %19)
store double %20, double* %2
br label %23
21: ; preds = %10
br label %22
22: ; preds = %21
store double 0.000000e+00, double* %2
br label %23
23: ; preds = %22, %13, %6
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
define double @CalcKaiserBeta(double %0) {
%2 = fcmp ogt double %0, 5.000000e+01
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = fadd double %0, 0xC021666666666666
%5 = fmul double %4, 1.102000e-01
br label %13
6: ; preds = %1
%7 = fcmp ult double %0, 2.100000e+01
br i1 %7, label %13, label %8
8: ; preds = %6
%9 = fadd double %0, -2.100000e+01
%10 = tail call double @pow(double %9, double 4.000000e-01)
%11 = fmul double %9, 0x3FB4302B40F66A55
%12 = tail call double @llvm.fmuladd.f64(double %10, double 5.842000e-01, double %11)
br label %13
13: ; preds = %6, %8, %3
%14 = phi double [ %5, %3 ], [ %12, %8 ], [ 0.000000e+00, %6 ]
ret double %14
}