#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 BesselI_0(double const);
double const sqrt(double);
double Kaiser(const double b, const double k) {
  if (!(k >= -1.0 && k <= 1.0))
    return 0.0;
  return BesselI_0(b * sqrt(1.0 - k * k)) / BesselI_0(b);
}


x86 assembly (clang, -O0):
<Kaiser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xec1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     115c <Kaiser+0x3c>
movsd  0xeb7(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jae    1169 <Kaiser+0x49>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11da <Kaiser+0xba>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe68(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <BesselI_0@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <BesselI_0@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Kaiser>:
sub    $0x18,%rsp
ucomisd 0xed4(%rip),%xmm1
xorpd  %xmm3,%xmm3
jb     1191 <Kaiser+0x71>
movapd %xmm0,%xmm2
movsd  0xeca(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1191 <Kaiser+0x71>
mulsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
movsd  %xmm2,0x8(%rsp)
jb     1162 <Kaiser+0x42>
sqrtsd %xmm0,%xmm0
jmp    116d <Kaiser+0x4d>
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm0
call   1030 <BesselI_0@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <BesselI_0@plt>
movsd  0x10(%rsp),%xmm3
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @Kaiser(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp oge double %6, -1.000000e+00
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load double, double* %5
%10 = fcmp ole double %9, 1.000000e+00
br i1 %10, label %12, label %11
11: ; preds = %8, %2
store double 0.000000e+00, double* %3
br label %24
12: ; preds = %8
%13 = load double, double* %4
%14 = load double, double* %5
%15 = load double, double* %5
%16 = fneg double %14
%17 = call double @llvm.fmuladd.f64(double %16, double %15, double 1.000000e+00)
%18 = call double @sqrt(double %17)
%19 = fmul double %13, %18
%20 = call double @BesselI_0(double %19)
%21 = load double, double* %4
%22 = call double @BesselI_0(double %21)
%23 = fdiv double %20, %22
store double %23, double* %3
br label %24
24: ; preds = %12, %11
%25 = load double, double* %3
ret double %25
}

LLVM IR (-O2):
define double @Kaiser(double %0, double %1) {
%3 = fcmp oge double %1, -1.000000e+00
%4 = fcmp ole double %1, 1.000000e+00
%5 = and i1 %3, %4
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = fneg double %1
%8 = tail call double @llvm.fmuladd.f64(double %7, double %1, double 1.000000e+00)
%9 = tail call double @sqrt(double %8)
%10 = fmul double %9, %0
%11 = tail call double @BesselI_0(double %10)
%12 = tail call double @BesselI_0(double %0)
%13 = fdiv double %11, %12
br label %14
14: ; preds = %2, %6
%15 = phi double [ %13, %6 ], [ 0.000000e+00, %2 ]
ret double %15
}