#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 */
float ino(float);
float sqrt(double);
void kaiser(float *w, int n, float beta) {
  float xind, xi;
  int i;
  xind = (float)((2 * n - 1) * (2 * n - 1));
  for (i = 0; i < n; i++) {
    xi = (float)(i + 0.5);
    w[i] = ino((float)(beta * sqrt((double)(1. - 4 * xi * xi / xind)))) /
           ino((float)beta);
  }
}


x86 assembly (clang, -O0):
<kaiser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  %xmm0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fc <kaiser+0xdc>
cvtsi2sdl -0x1c(%rbp),%xmm0
movsd  0xe96(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xe7f(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe54(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x24(%rbp),%xmm0
mulss  %xmm1,%xmm0
call   1030 <ino@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <ino@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
divss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1159 <kaiser+0x39>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kaiser>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0x4(%rsp)
test   %esi,%esi
jle    11d1 <kaiser+0xb1>
mov    %rdi,%r14
lea    (%rsi,%rsi,1),%eax
add    $0xffffffff,%eax
imul   %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x8(%rsp)
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  0xe91(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movaps %xmm0,%xmm1
mulss  0xe92(%rip),%xmm1
mulss  %xmm0,%xmm1
divss  0x8(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
addsd  0xe71(%rip),%xmm0
call   1040 <sqrt@plt>
mulss  0x4(%rsp),%xmm0
call   1030 <ino@plt>
movss  %xmm0,0xc(%rsp)
movss  0x4(%rsp),%xmm0
call   1030 <ino@plt>
movss  0xc(%rsp),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <kaiser+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @kaiser(float* %0, i32 %1, float %2) {
%4 = alloca float*
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
store float* %0, float** %4
store i32 %1, i32* %5
store float %2, float* %6
%10 = load i32, i32* %5
%11 = mul nsw i32 2, %10
%12 = sub nsw i32 %11, 1
%13 = load i32, i32* %5
%14 = mul nsw i32 2, %13
%15 = sub nsw i32 %14, 1
%16 = mul nsw i32 %12, %15
%17 = sitofp i32 %16 to float
store float %17, float* %7
store i32 0, i32* %9
br label %18
18: ; preds = %46, %3
%19 = load i32, i32* %9
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %49
22: ; preds = %18
%23 = load i32, i32* %9
%24 = sitofp i32 %23 to double
%25 = fadd double %24, 5.000000e-01
%26 = fptrunc double %25 to float
store float %26, float* %8
%27 = load float, float* %6
%28 = load float, float* %8
%29 = fmul float 4.000000e+00, %28
%30 = load float, float* %8
%31 = fmul float %29, %30
%32 = load float, float* %7
%33 = fdiv float %31, %32
%34 = fpext float %33 to double
%35 = fsub double 1.000000e+00, %34
%36 = call float @sqrt(double %35)
%37 = fmul float %27, %36
%38 = call float @ino(float %37)
%39 = load float, float* %6
%40 = call float @ino(float %39)
%41 = fdiv float %38, %40
%42 = load float*, float** %4
%43 = load i32, i32* %9
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds float, float* %42, i64 %44
store float %41, float* %45
br label %46
46: ; preds = %22
%47 = load i32, i32* %9
%48 = add nsw i32 %47, 1
store i32 %48, i32* %9
br label %18
49: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @kaiser(float* nocapture writeonly %0, i32 %1, float %2) {
%4 = shl nsw i32 %1, 1
%5 = add nsw i32 %4, -1
%6 = mul nsw i32 %5, %5
%7 = sitofp i32 %6 to float
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %30
9: ; preds = %3
%10 = zext i32 %1 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 0, %9 ], [ %28, %11 ]
%13 = trunc i64 %12 to i32
%14 = sitofp i32 %13 to double
%15 = fadd double %14, 5.000000e-01
%16 = fptrunc double %15 to float
%17 = fmul float %16, 4.000000e+00
%18 = fmul float %17, %16
%19 = fdiv float %18, %7
%20 = fpext float %19 to double
%21 = fsub double 1.000000e+00, %20
%22 = tail call float @sqrt(double %21)
%23 = fmul float %22, %2
%24 = tail call float @ino(float %23)
%25 = tail call float @ino(float %2)
%26 = fdiv float %24, %25
%27 = getelementptr inbounds float, float* %0, i64 %12
store float %26, float* %27
%28 = add nuw nsw i64 %12, 1
%29 = icmp eq i64 %28, %10
br i1 %29, label %30, label %11
30: ; preds = %11, %3
ret void
}