#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 BesselI0(double);
int DBL_EPSILON;
double sqrt(double);
double KaiserWindow(double x, double kaiser_beta) {
  if (x > 1.0 + 100 * DBL_EPSILON) {
    return 0.0;
  }
  double y = 1.0 - x * x;
  if (y < 0.0) {
    y = 0.0;
  }
  return BesselI0(kaiser_beta * sqrt(y));
}


x86 assembly (clang, -O0):
<KaiserWindow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    0x2eaa(%rip),%rax
imul   $0x64,(%rax),%eax
cvtsi2sd %eax,%xmm2
movsd  0xeb3(%rip),%xmm1
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    1168 <KaiserWindow+0x48>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11de <KaiserWindow+0xbe>
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe6b(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11b4 <KaiserWindow+0x94>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <BesselI0@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KaiserWindow>:
push   %rax
mov    0x2ec0(%rip),%rax
imul   $0x64,(%rax),%eax
or     $0x1,%eax
cvtsi2sd %eax,%xmm2
ucomisd %xmm2,%xmm0
jbe    113e <KaiserWindow+0x1e>
xorpd  %xmm0,%xmm0
pop    %rax
ret
mulsd  %xmm0,%xmm0
movsd  0xeb6(%rip),%xmm3
subsd  %xmm0,%xmm3
xorpd  %xmm2,%xmm2
xorpd  %xmm0,%xmm0
maxsd  %xmm3,%xmm0
ucomisd %xmm2,%xmm0
jb     1166 <KaiserWindow+0x46>
sqrtsd %xmm0,%xmm0
jmp    1175 <KaiserWindow+0x55>
movsd  %xmm1,(%rsp)
call   1030 <sqrt@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rax
jmp    1040 <BesselI0@plt>

LLVM IR (-O0):
@DBL_EPSILON = global i32 0
define double @KaiserWindow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
%7 = load double, double* %4
%8 = load i32, i32* @DBL_EPSILON
%9 = mul nsw i32 100, %8
%10 = sitofp i32 %9 to double
%11 = fadd double 1.000000e+00, %10
%12 = fcmp ogt double %7, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store double 0.000000e+00, double* %3
br label %28
14: ; preds = %2
%15 = load double, double* %4
%16 = load double, double* %4
%17 = fneg double %15
%18 = call double @llvm.fmuladd.f64(double %17, double %16, double 1.000000e+00)
store double %18, double* %6
%19 = load double, double* %6
%20 = fcmp olt double %19, 0.000000e+00
br i1 %20, label %21, label %22
21: ; preds = %14
store double 0.000000e+00, double* %6
br label %22
22: ; preds = %21, %14
%23 = load double, double* %5
%24 = load double, double* %6
%25 = call double @sqrt(double %24)
%26 = fmul double %23, %25
%27 = call double @BesselI0(double %26)
store double %27, double* %3
br label %28
28: ; preds = %22, %13
%29 = load double, double* %3
ret double %29
}

LLVM IR (-O2):
@DBL_EPSILON = global i32 0
define double @KaiserWindow(double %0, double %1) {
%3 = load i32, i32* @DBL_EPSILON
%4 = mul nsw i32 %3, 100
%5 = or i32 %4, 1
%6 = sitofp i32 %5 to double
%7 = fcmp olt double %6, %0
br i1 %7, label %16, label %8
8: ; preds = %2
%9 = fneg double %0
%10 = tail call double @llvm.fmuladd.f64(double %9, double %0, double 1.000000e+00)
%11 = fcmp olt double %10, 0.000000e+00
%12 = select i1 %11, double 0.000000e+00, double %10
%13 = tail call double @sqrt(double %12)
%14 = fmul double %13, %1
%15 = tail call double @BesselI0(double %14)
br label %16
16: ; preds = %2, %8
%17 = phi double [ %15, %8 ], [ 0.000000e+00, %2 ]
ret double %17
}