#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 M_PI;
double cos(float);
void af_window_blackman(int n, float *w) {
  int i;
  float k1 = 2 * M_PI / ((float)(n - 1));
  float k2 = 2 * k1;
  for (i = 0; i < n; i++)
    *w++ = 0.42 - 0.50 * cos(k1 * (float)i) + 0.08 * cos(k2 * (float)i);
}


x86 assembly (clang, -O0):
<af_window_blackman>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xeb6(%rip),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e4 <af_window_blackman+0xd4>
movss  -0x18(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1030 <cos@plt>
movsd  0xe8e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe8a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
call   1030 <cos@plt>
movsd  -0x28(%rbp),%xmm1
movsd  0xe51(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movss  %xmm0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <af_window_blackman+0x4b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<af_window_blackman>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
jle    12a2 <af_window_blackman+0x192>
mov    %rsi,%r15
mov    %edi,%r14d
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
add    %eax,%eax
cvtsi2ss %eax,%xmm1
lea    -0x1(%r14),%eax
cvtsi2ss %eax,%xmm0
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm2,%xmm2
cmp    $0x1,%edi
movss  %xmm0,0x4(%rsp)
je     124c <af_window_blackman+0x13c>
mov    %r14d,%ebp
and    $0xfffffffe,%ebp
xor    %ebx,%ebx
movss  %xmm1,0x10(%rsp)
nopw   0x0(%rax,%rax,1)
xorps  %xmm2,%xmm2
cvtsi2ss %ebx,%xmm2
movss  %xmm2,(%rsp)
mulss  %xmm2,%xmm1
movaps %xmm1,%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe6d(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe69(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movss  (%rsp),%xmm0
mulss  0x4(%rsp),%xmm0
call   1030 <cos@plt>
movsd  0xe4f(%rip),%xmm1
mulsd  %xmm1,%xmm0
addsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r15)
lea    0x1(%rbx),%eax
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
movss  %xmm1,(%rsp)
movss  0x10(%rsp),%xmm0
mulss  %xmm1,%xmm0
call   1030 <cos@plt>
mulsd  0xe06(%rip),%xmm0
addsd  0xe06(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movss  (%rsp),%xmm0
mulss  0x4(%rsp),%xmm0
call   1030 <cos@plt>
movss  0x10(%rsp),%xmm1
mulsd  0xdea(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x4(%r15)
add    $0x8,%r15
add    $0x2,%ebx
cmp    %ebp,%ebx
jne    1170 <af_window_blackman+0x60>
xorps  %xmm2,%xmm2
cvtsi2ss %ebx,%xmm2
test   $0x1,%r14b
je     12a2 <af_window_blackman+0x192>
mulss  %xmm2,%xmm1
movaps %xmm1,%xmm0
movss  %xmm2,0x8(%rsp)
call   1030 <cos@plt>
mulsd  0xd94(%rip),%xmm0
addsd  0xd94(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movss  0x4(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
call   1030 <cos@plt>
mulsd  0xd7d(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%r15)
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i32 0
define void @af_window_blackman(i32 %0, float* %1) {
%3 = alloca i32
%4 = alloca float*
%5 = alloca i32
%6 = alloca float
%7 = alloca float
store i32 %0, i32* %3
store float* %1, float** %4
%8 = load i32, i32* @M_PI
%9 = mul nsw i32 2, %8
%10 = sitofp i32 %9 to float
%11 = load i32, i32* %3
%12 = sub nsw i32 %11, 1
%13 = sitofp i32 %12 to float
%14 = fdiv float %10, %13
store float %14, float* %6
%15 = load float, float* %6
%16 = fmul float 2.000000e+00, %15
store float %16, float* %7
store i32 0, i32* %5
br label %17
17: ; preds = %37, %2
%18 = load i32, i32* %5
%19 = load i32, i32* %3
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %40
21: ; preds = %17
%22 = load float, float* %6
%23 = load i32, i32* %5
%24 = sitofp i32 %23 to float
%25 = fmul float %22, %24
%26 = call double @cos(float %25)
%27 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %26, double 4.200000e-01)
%28 = load float, float* %7
%29 = load i32, i32* %5
%30 = sitofp i32 %29 to float
%31 = fmul float %28, %30
%32 = call double @cos(float %31)
%33 = call double @llvm.fmuladd.f64(double 8.000000e-02, double %32, double %27)
%34 = fptrunc double %33 to float
%35 = load float*, float** %4
%36 = getelementptr inbounds float, float* %35, i32 1
store float* %36, float** %4
store float %34, float* %35
br label %37
37: ; preds = %21
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %17
40: ; preds = %17
ret void
}

LLVM IR (-O2):
@M_PI = global i32 0
define void @af_window_blackman(i32 %0, float* nocapture writeonly %1) {
%3 = load i32, i32* @M_PI
%4 = shl nsw i32 %3, 1
%5 = sitofp i32 %4 to float
%6 = add nsw i32 %0, -1
%7 = sitofp i32 %6 to float
%8 = fdiv float %5, %7
%9 = fmul float %8, 2.000000e+00
%10 = icmp sgt i32 %0, 0
br i1 %10, label %11, label %56
11: ; preds = %2
%12 = and i32 %0, 1
%13 = icmp eq i32 %0, 1
br i1 %13, label %44, label %14
14: ; preds = %11
%15 = and i32 %0, -2
br label %16
16: ; preds = %16, %14
%17 = phi float* [ %1, %14 ], [ %38, %16 ]
%18 = phi i32 [ 0, %14 ], [ %39, %16 ]
%19 = phi i32 [ 0, %14 ], [ %40, %16 ]
%20 = sitofp i32 %18 to float
%21 = fmul float %8, %20
%22 = tail call double @cos(float %21)
%23 = tail call double @llvm.fmuladd.f64(double %22, double -5.000000e-01, double 4.200000e-01)
%24 = fmul float %9, %20
%25 = tail call double @cos(float %24)
%26 = tail call double @llvm.fmuladd.f64(double %25, double 8.000000e-02, double %23)
%27 = fptrunc double %26 to float
%28 = getelementptr inbounds float, float* %17, i64 1
store float %27, float* %17
%29 = or i32 %18, 1
%30 = sitofp i32 %29 to float
%31 = fmul float %8, %30
%32 = tail call double @cos(float %31)
%33 = tail call double @llvm.fmuladd.f64(double %32, double -5.000000e-01, double 4.200000e-01)
%34 = fmul float %9, %30
%35 = tail call double @cos(float %34)
%36 = tail call double @llvm.fmuladd.f64(double %35, double 8.000000e-02, double %33)
%37 = fptrunc double %36 to float
%38 = getelementptr inbounds float, float* %17, i64 2
store float %37, float* %28
%39 = add nuw nsw i32 %18, 2
%40 = add i32 %19, 2
%41 = icmp eq i32 %40, %15
br i1 %41, label %42, label %16
42: ; preds = %16
%43 = sitofp i32 %39 to float
br label %44
44: ; preds = %42, %11
%45 = phi float* [ %1, %11 ], [ %38, %42 ]
%46 = phi float [ 0.000000e+00, %11 ], [ %43, %42 ]
%47 = icmp eq i32 %12, 0
br i1 %47, label %56, label %48
48: ; preds = %44
%49 = fmul float %8, %46
%50 = tail call double @cos(float %49)
%51 = tail call double @llvm.fmuladd.f64(double %50, double -5.000000e-01, double 4.200000e-01)
%52 = fmul float %9, %46
%53 = tail call double @cos(float %52)
%54 = tail call double @llvm.fmuladd.f64(double %53, double 8.000000e-02, double %51)
%55 = fptrunc double %54 to float
store float %55, float* %45
br label %56
56: ; preds = %48, %44, %2
ret void
}