#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 */
int /*<<< orphan*/ assert(int);
double i_zero(double);
double sqrt(double);
double kaiser(double x, double beta, double inv_izbeta) {
  if (x < -1.0) {
    assert(x > -1.00001);
    x = -1.0;
  }
  if (x > 1.0) {
    assert(x < +1.00001);
    x = 1.0;
  }
  return i_zero(beta * sqrt(1.0 - x * x)) * inv_izbeta;
}


x86 assembly (clang, -O0):
<kaiser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xeb1(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1185 <kaiser+0x55>
movsd  -0x8(%rbp),%xmm0
movsd  0xea1(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  0xe80(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe7e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11c3 <kaiser+0x93>
movsd  0xe74(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  0xe52(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe16(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <i_zero@plt>
mulsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kaiser>:
sub    $0x18,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  0xeb8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1160 <kaiser+0x30>
movsd  %xmm1,(%rsp)
ucomisd 0xebd(%rip),%xmm0
seta   %al
jmp    1186 <kaiser+0x56>
ucomisd 0xea0(%rip),%xmm0
jbe    1193 <kaiser+0x63>
movsd  0xe9e(%rip),%xmm1
ucomisd %xmm0,%xmm1
seta   %al
movsd  0xe87(%rip),%xmm0
movsd  %xmm0,(%rsp)
movzbl %al,%edi
call   1030 <assert@plt>
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xe69(%rip),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     11b6 <kaiser+0x86>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    11bf <kaiser+0x8f>
movapd %xmm1,%xmm0
call   1050 <sqrt@plt>
mulsd  0x8(%rsp),%xmm0
call   1040 <i_zero@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define double @kaiser(double %0, double %1, double %2) {
%4 = fcmp olt double %0, -1.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = fcmp ogt double %0, -1.000010e+00
br label %11
7: ; preds = %3
%8 = fcmp ogt double %0, 1.000000e+00
br i1 %8, label %9, label %16
9: ; preds = %7
%10 = fcmp olt double %0, 1.000010e+00
br label %11
11: ; preds = %9, %5
%12 = phi i1 [ %6, %5 ], [ %10, %9 ]
%13 = phi double [ -1.000000e+00, %5 ], [ 1.000000e+00, %9 ]
%14 = zext i1 %12 to i32
%15 = tail call i32 @assert(i32 %14)
br label %16
16: ; preds = %11, %7
%17 = phi double [ %0, %7 ], [ %13, %11 ]
%18 = fneg double %17
%19 = tail call double @llvm.fmuladd.f64(double %18, double %17, double 1.000000e+00)
%20 = tail call double @sqrt(double %19)
%21 = fmul double %20, %1
%22 = tail call double @i_zero(double %21)
%23 = fmul double %22, %2
ret double %23
}