#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);
float cos(float);
float ezs_blackman_window(float alpha, int position, int length) {
  assert(length > 0);
  assert(position >= 0);
  assert(position < length);
  assert(alpha >= 0.0f);
  assert(1.0f >= alpha);
  float a[3] = {(1.0f - alpha) / 2.0f, 0.5f, alpha / 2.0f};
  return a[0] -
         a[1] * cos((2.0f * 3.14159265358979323846f * ((float)position)) /
                    ((float)(length - 1))) +
         a[2] * cos((4.0f * 3.14159265358979323846f * ((float)position)) /
                    ((float)(length - 1)));
}


x86 assembly (clang, -O0):
<ezs_blackman_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpl   $0x0,-0x8(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movss  0xe88(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movss  0xe6f(%rip),%xmm0
subss  -0x4(%rbp),%xmm0
movss  0xe5a(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe4d(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xe37(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm1
movss  0xe09(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
call   1040 <cos@plt>
movss  -0x28(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x24(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm1
movss  0xdb0(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
call   1040 <cos@plt>
movss  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movss  -0x1c(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ezs_blackman_window>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
movss  %xmm0,0x8(%rsp)
xor    %edi,%edi
test   %esi,%esi
setg   %dil
call   1030 <assert@plt>
mov    %ebp,%edi
not    %edi
shr    $0x1f,%edi
call   1030 <assert@plt>
xor    %edi,%edi
cmp    %ebx,%ebp
setl   %dil
call   1030 <assert@plt>
xorps  %xmm0,%xmm0
xor    %edi,%edi
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
setae  %dil
call   1030 <assert@plt>
movss  0xe8b(%rip),%xmm0
xor    %edi,%edi
ucomiss 0x8(%rsp),%xmm0
setae  %dil
call   1030 <assert@plt>
movss  0x8(%rsp),%xmm1
movss  0xe6d(%rip),%xmm2
subss  %xmm1,%xmm2
movss  0xe65(%rip),%xmm0
mulss  %xmm0,%xmm2
movss  %xmm2,0xc(%rsp)
xorps  %xmm2,%xmm2
cvtsi2ss %ebp,%xmm2
movss  %xmm2,0x14(%rsp)
mulss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movss  0xe40(%rip),%xmm0
mulss  %xmm2,%xmm0
add    $0xffffffff,%ebx
xorps  %xmm1,%xmm1
cvtsi2ss %ebx,%xmm1
movss  %xmm1,0x10(%rsp)
divss  %xmm1,%xmm0
call   1040 <cos@plt>
mulss  0xe1f(%rip),%xmm0
addss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x14(%rsp),%xmm0
mulss  0xe09(%rip),%xmm0
divss  0x10(%rsp),%xmm0
call   1040 <cos@plt>
mulss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @ezs_blackman_window(float %0, i32 %1, i32 %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = alloca [3 x float]
store float %0, float* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp sgt i32 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %5
%13 = icmp sge i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load float, float* %4
%22 = fcmp oge float %21, 0.000000e+00
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load float, float* %4
%26 = fcmp oge float 1.000000e+00, %25
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
%30 = load float, float* %4
%31 = fsub float 1.000000e+00, %30
%32 = fdiv float %31, 2.000000e+00
store float %32, float* %29
%33 = getelementptr inbounds float, float* %29, i64 1
store float 5.000000e-01, float* %33
%34 = getelementptr inbounds float, float* %33, i64 1
%35 = load float, float* %4
%36 = fdiv float %35, 2.000000e+00
store float %36, float* %34
%37 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 0
%38 = load float, float* %37
%39 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 1
%40 = load float, float* %39
%41 = load i32, i32* %5
%42 = sitofp i32 %41 to float
%43 = fmul float 0x401921FB60000000, %42
%44 = load i32, i32* %6
%45 = sub nsw i32 %44, 1
%46 = sitofp i32 %45 to float
%47 = fdiv float %43, %46
%48 = call float @cos(float %47)
%49 = fneg float %40
%50 = call float @llvm.fmuladd.f32(float %49, float %48, float %38)
%51 = getelementptr inbounds [3 x float], [3 x float]* %7, i64 0, i64 2
%52 = load float, float* %51
%53 = load i32, i32* %5
%54 = sitofp i32 %53 to float
%55 = fmul float 0x402921FB60000000, %54
%56 = load i32, i32* %6
%57 = sub nsw i32 %56, 1
%58 = sitofp i32 %57 to float
%59 = fdiv float %55, %58
%60 = call float @cos(float %59)
%61 = call float @llvm.fmuladd.f32(float %52, float %60, float %50)
ret float %61
}

LLVM IR (-O2):
define float @ezs_blackman_window(float %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = xor i32 %1, -1
%8 = lshr i32 %7, 31
%9 = tail call i32 @assert(i32 %8)
%10 = icmp slt i32 %1, %2
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = fcmp oge float %0, 0.000000e+00
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = fcmp ole float %0, 1.000000e+00
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = fsub float 1.000000e+00, %0
%20 = fmul float %19, 5.000000e-01
%21 = fmul float %0, 5.000000e-01
%22 = sitofp i32 %1 to float
%23 = fmul float %22, 0x401921FB60000000
%24 = add nsw i32 %2, -1
%25 = sitofp i32 %24 to float
%26 = fdiv float %23, %25
%27 = tail call float @cos(float %26)
%28 = tail call float @llvm.fmuladd.f32(float %27, float -5.000000e-01, float %20)
%29 = fmul float %22, 0x402921FB60000000
%30 = fdiv float %29, %25
%31 = tail call float @cos(float %30)
%32 = tail call float @llvm.fmuladd.f32(float %21, float %31, float %28)
ret float %32
}