#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 */
double cos(double);
void BlackmanHarris92(int sizeWindow, double *pFWindow) {
  int i;
  double fSum = 0;
  double a0 = .35875, a1 = .48829, a2 = .14128, a3 = .01168;
  double fConst = 6.28318530717958647692 / sizeWindow;
  for (i = 0; i < sizeWindow; i++) {
    fSum += pFWindow[i] = a0 - a1 * cos(fConst * i) + a2 * cos(fConst * 2 * i) +
                          a3 * cos(fConst * 3 * i);
  }
}


x86 assembly (clang, -O0):
<BlackmanHarris92>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeee(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xec4(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xeaf(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xe95(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    127d <BlackmanHarris92+0x16d>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <cos@plt>
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe3f(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <cos@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xdf8(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <cos@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117b <BlackmanHarris92+0x6b>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BlackmanHarris92>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
test   %edi,%edi
jle    11e9 <BlackmanHarris92+0xd9>
mov    %rsi,%r14
cvtsi2sd %edi,%xmm0
movsd  0xed0(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0xebe(%rip),%xmm0
movsd  %xmm1,0x28(%rsp)
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    %edi,%r15d
xor    %ebx,%ebx
nop
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x28(%rsp),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <cos@plt>
mulsd  0xe8c(%rip),%xmm0
addsd  0xe8c(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1030 <cos@plt>
mulsd  0xe75(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
call   1030 <cos@plt>
mulsd  0xe58(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <BlackmanHarris92+0x50>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @BlackmanHarris92(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 %0, i32* %3
store double* %1, double** %4
store double 0.000000e+00, double* %6
store double 3.587500e-01, double* %7
store double 4.882900e-01, double* %8
store double 1.412800e-01, double* %9
store double 1.168000e-02, double* %10
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to double
%14 = fdiv double 0x401921FB54442D18, %13
store double %14, double* %11
store i32 0, i32* %5
br label %15
15: ; preds = %51, %2
%16 = load i32, i32* %5
%17 = load i32, i32* %3
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %54
19: ; preds = %15
%20 = load double, double* %7
%21 = load double, double* %8
%22 = load double, double* %11
%23 = load i32, i32* %5
%24 = sitofp i32 %23 to double
%25 = fmul double %22, %24
%26 = call double @cos(double %25)
%27 = fneg double %21
%28 = call double @llvm.fmuladd.f64(double %27, double %26, double %20)
%29 = load double, double* %9
%30 = load double, double* %11
%31 = fmul double %30, 2.000000e+00
%32 = load i32, i32* %5
%33 = sitofp i32 %32 to double
%34 = fmul double %31, %33
%35 = call double @cos(double %34)
%36 = call double @llvm.fmuladd.f64(double %29, double %35, double %28)
%37 = load double, double* %10
%38 = load double, double* %11
%39 = fmul double %38, 3.000000e+00
%40 = load i32, i32* %5
%41 = sitofp i32 %40 to double
%42 = fmul double %39, %41
%43 = call double @cos(double %42)
%44 = call double @llvm.fmuladd.f64(double %37, double %43, double %36)
%45 = load double*, double** %4
%46 = load i32, i32* %5
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %45, i64 %47
store double %44, double* %48
%49 = load double, double* %6
%50 = fadd double %49, %44
store double %50, double* %6
br label %51
51: ; preds = %19
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %15
54: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @BlackmanHarris92(i32 %0, double* nocapture writeonly %1) {
%3 = sitofp i32 %0 to double
%4 = fdiv double 0x401921FB54442D18, %3
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %26
6: ; preds = %2
%7 = fmul double %4, 2.000000e+00
%8 = fmul double %4, 3.000000e+00
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %6, %10
%11 = phi i64 [ 0, %6 ], [ %24, %10 ]
%12 = trunc i64 %11 to i32
%13 = sitofp i32 %12 to double
%14 = fmul double %4, %13
%15 = tail call double @cos(double %14)
%16 = tail call double @llvm.fmuladd.f64(double %15, double -4.882900e-01, double 3.587500e-01)
%17 = fmul double %7, %13
%18 = tail call double @cos(double %17)
%19 = tail call double @llvm.fmuladd.f64(double %18, double 1.412800e-01, double %16)
%20 = fmul double %8, %13
%21 = tail call double @cos(double %20)
%22 = tail call double @llvm.fmuladd.f64(double %21, double 1.168000e-02, double %19)
%23 = getelementptr inbounds double, double* %1, i64 %11
store double %22, double* %23
%24 = add nuw nsw i64 %11, 1
%25 = icmp eq i64 %24, %9
br i1 %25, label %26, label %10
26: ; preds = %10, %2
ret void
}