#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_hamming_window(float alpha, int position, int length) {
  assert(length > 0);
  assert(position >= 0);
  assert(position < length);
  return 0.54f -
         0.46f * cos((2.0f * 3.14159265358979323846f * (float)position) /
                     (float)(length - 1));
}


x86 assembly (clang, -O0):
<ezs_hamming_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%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>
cvtsi2ssl -0x8(%rbp),%xmm1
movss  0xe93(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
call   1040 <cos@plt>
movss  0xe6c(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe64(%rip),%xmm1
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ezs_hamming_window>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
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>
cvtsi2ss %ebp,%xmm0
mulss  0xea7(%rip),%xmm0
add    $0xffffffff,%ebx
cvtsi2ss %ebx,%xmm1
divss  %xmm1,%xmm0
call   1040 <cos@plt>
mulss  0xe93(%rip),%xmm0
addss  0xe8f(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define float @ezs_hamming_window(float %0, i32 %1, i32 %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
store float %0, float* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %5
%12 = icmp sge i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = icmp slt i32 %15, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i32, i32* %5
%21 = sitofp i32 %20 to float
%22 = fmul float 0x401921FB60000000, %21
%23 = load i32, i32* %6
%24 = sub nsw i32 %23, 1
%25 = sitofp i32 %24 to float
%26 = fdiv float %22, %25
%27 = call float @cos(float %26)
%28 = call float @llvm.fmuladd.f32(float 0xBFDD70A3E0000000, float %27, float 0x3FE147AE20000000)
ret float %28
}

LLVM IR (-O2):
define float @ezs_hamming_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 = sitofp i32 %1 to float
%14 = fmul float %13, 0x401921FB60000000
%15 = add nsw i32 %2, -1
%16 = sitofp i32 %15 to float
%17 = fdiv float %14, %16
%18 = tail call float @cos(float %17)
%19 = tail call float @llvm.fmuladd.f32(float %18, float 0xBFDD70A3E0000000, float 0x3FE147AE20000000)
ret float %19
}