#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 Hamming(int sizeWindow, double *pWindow) {
  int i;
  double fSum = 0;
  for (i = 0; i < sizeWindow; i++) {
    fSum += pWindow[i] =
        0.53836 - 0.46164 * cos(6.28318530717958647692 * i / (sizeWindow - 1));
  }
}


x86 assembly (clang, -O0):
<Hamming>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    119b <Hamming+0x8b>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xec9(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
movsd  0xe9a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe96(%rip),%xmm1
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    112e <Hamming+0x1e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hamming>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1214 <Hamming+0x104>
mov    %rsi,%r14
lea    -0x1(%rdi),%eax
cvtsi2sd %eax,%xmm0
mov    %edi,%r15d
cmp    $0x1,%edi
jne    1143 <Hamming+0x33>
xor    %ebx,%ebx
test   $0x1,%r15b
jne    11e2 <Hamming+0xd2>
jmp    1214 <Hamming+0x104>
mov    %r15d,%r12d
and    $0xfffffffe,%r12d
xor    %ebx,%ebx
movsd  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0xe91(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  (%rsp),%xmm0
call   1030 <cos@plt>
movsd  0xe83(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe7f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14,%rbx,8)
lea    0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe53(%rip),%xmm0
divsd  (%rsp),%xmm0
call   1030 <cos@plt>
mulsd  0xe49(%rip),%xmm0
addsd  0xe49(%rip),%xmm0
movsd  %xmm0,0x8(%r14,%rbx,8)
add    $0x2,%rbx
cmp    %r12,%rbx
jne    1160 <Hamming+0x50>
movsd  (%rsp),%xmm0
test   $0x1,%r15b
je     1214 <Hamming+0x104>
movapd %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xe0b(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1030 <cos@plt>
mulsd  0xe02(%rip),%xmm0
addsd  0xe02(%rip),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @Hamming(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
store i32 %0, i32* %3
store double* %1, double** %4
store double 0.000000e+00, double* %6
store i32 0, i32* %5
br label %7
7: ; preds = %27, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %30
11: ; preds = %7
%12 = load i32, i32* %5
%13 = sitofp i32 %12 to double
%14 = fmul double 0x401921FB54442D18, %13
%15 = load i32, i32* %3
%16 = sub nsw i32 %15, 1
%17 = sitofp i32 %16 to double
%18 = fdiv double %14, %17
%19 = call double @cos(double %18)
%20 = call double @llvm.fmuladd.f64(double -4.616400e-01, double %19, double 5.383600e-01)
%21 = load double*, double** %4
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
store double %20, double* %24
%25 = load double, double* %6
%26 = fadd double %25, %20
store double %26, double* %6
br label %27
27: ; preds = %11
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %7
30: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @Hamming(i32 %0, double* nocapture writeonly %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %44
4: ; preds = %2
%5 = add nsw i32 %0, -1
%6 = sitofp i32 %5 to double
%7 = zext i32 %0 to i64
%8 = and i64 %7, 1
%9 = icmp eq i32 %0, 1
br i1 %9, label %33, label %10
10: ; preds = %4
%11 = and i64 %7, 4294967294
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %30, %12 ]
%14 = phi i64 [ 0, %10 ], [ %31, %12 ]
%15 = trunc i64 %13 to i32
%16 = sitofp i32 %15 to double
%17 = fmul double %16, 0x401921FB54442D18
%18 = fdiv double %17, %6
%19 = tail call double @cos(double %18)
%20 = tail call double @llvm.fmuladd.f64(double %19, double -4.616400e-01, double 5.383600e-01)
%21 = getelementptr inbounds double, double* %1, i64 %13
store double %20, double* %21
%22 = or i64 %13, 1
%23 = trunc i64 %22 to i32
%24 = sitofp i32 %23 to double
%25 = fmul double %24, 0x401921FB54442D18
%26 = fdiv double %25, %6
%27 = tail call double @cos(double %26)
%28 = tail call double @llvm.fmuladd.f64(double %27, double -4.616400e-01, double 5.383600e-01)
%29 = getelementptr inbounds double, double* %1, i64 %22
store double %28, double* %29
%30 = add nuw nsw i64 %13, 2
%31 = add i64 %14, 2
%32 = icmp eq i64 %31, %11
br i1 %32, label %33, label %12
33: ; preds = %12, %4
%34 = phi i64 [ 0, %4 ], [ %30, %12 ]
%35 = icmp eq i64 %8, 0
br i1 %35, label %44, label %36
36: ; preds = %33
%37 = trunc i64 %34 to i32
%38 = sitofp i32 %37 to double
%39 = fmul double %38, 0x401921FB54442D18
%40 = fdiv double %39, %6
%41 = tail call double @cos(double %40)
%42 = tail call double @llvm.fmuladd.f64(double %41, double -4.616400e-01, double 5.383600e-01)
%43 = getelementptr inbounds double, double* %1, i64 %34
store double %42, double* %43
br label %44
44: ; preds = %36, %33, %2
ret void
}