#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 bessel(float);
scalar_t__ sqrt(int);
int fa_kaiser(float *w, const int N) {
  int i;
  float Ia, Ib;
  float beta = 8.96;
  for (i = 0; i < N; i++) {
    float x;
    Ib = bessel(beta);
    x = (float)((2. * i / (N - 1)) - 1);
    Ia = bessel(beta * (float)sqrt(1. - x * x));
    w[i] = (float)(Ia / Ib);
  }
  return N;
}


x86 assembly (clang, -O0):
<fa_kaiser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fc <fa_kaiser+0xdc>
movss  -0x1c(%rbp),%xmm0
call   1030 <bessel@plt>
movss  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xea5(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe83(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe56(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movss  -0x24(%rbp),%xmm0
cvtsi2ss %rax,%xmm1
mulss  %xmm1,%xmm0
call   1030 <bessel@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1143 <fa_kaiser+0x23>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fa_kaiser>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r14d
test   %esi,%esi
jle    11c7 <fa_kaiser+0xa7>
mov    %rdi,%r15
lea    -0x1(%r14),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r14d,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax)
movss  0xea8(%rip),%xmm0
call   1030 <bessel@plt>
movss  %xmm0,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  %xmm0,%xmm0
divsd  0x10(%rsp),%xmm0
addsd  0xe8c(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mulss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe80(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0xe53(%rip),%xmm0
call   1030 <bessel@plt>
divss  0xc(%rsp),%xmm0
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1150 <fa_kaiser+0x30>
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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