#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 sin(double);
void Hanning(int sizeWindow, double *pWindow) {
  int i;
  for (i = 0; i < sizeWindow; i++)
    pWindow[i] = (sin(3.141592653589793238462643 * i / (sizeWindow - 1))) *
                 (sin(3.141592653589793238462643 * i / (sizeWindow - 1)));
}


x86 assembly (clang, -O0):
<Hanning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11a6 <Hanning+0x96>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xec1(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe98(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <Hanning+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hanning>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
jle    121e <Hanning+0x10e>
mov    %rsi,%r14
lea    -0x1(%rdi),%eax
cvtsi2sd %eax,%xmm2
mov    %edi,%r15d
cmp    $0x1,%edi
jne    113c <Hanning+0x2c>
xor    %ebx,%ebx
jmp    11df <Hanning+0xcf>
mov    %r15d,%r12d
and    $0xfffffffe,%r12d
xor    %ebx,%ebx
movsd  %xmm2,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0xea1(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,0x10(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
lea    0x1(%rbx),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe61(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%r14,%rbx,8)
movsd  0x8(%rsp),%xmm2
add    $0x2,%rbx
cmp    %r12,%rbx
jne    1150 <Hanning+0x40>
test   $0x1,%r15b
je     121e <Hanning+0x10e>
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
mulsd  0xe0c(%rip),%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @Hanning(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %4
store i32 0, i32* %5
br label %6
6: ; preds = %32, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %35
10: ; preds = %6
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to double
%13 = fmul double 0x400921FB54442D18, %12
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 1
%16 = sitofp i32 %15 to double
%17 = fdiv double %13, %16
%18 = call double @sin(double %17)
%19 = load i32, i32* %5
%20 = sitofp i32 %19 to double
%21 = fmul double 0x400921FB54442D18, %20
%22 = load i32, i32* %3
%23 = sub nsw i32 %22, 1
%24 = sitofp i32 %23 to double
%25 = fdiv double %21, %24
%26 = call double @sin(double %25)
%27 = fmul double %18, %26
%28 = load double*, double** %4
%29 = load i32, i32* %5
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
store double %27, double* %31
br label %32
32: ; preds = %10
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %6
35: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @Hanning(i32 %0, double* nocapture writeonly %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %47
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 %35, label %10
10: ; preds = %4
%11 = and i64 %7, 4294967294
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %32, %12 ]
%14 = phi i64 [ 0, %10 ], [ %33, %12 ]
%15 = trunc i64 %13 to i32
%16 = sitofp i32 %15 to double
%17 = fmul double %16, 0x400921FB54442D18
%18 = fdiv double %17, %6
%19 = tail call double @sin(double %18)
%20 = tail call double @sin(double %18)
%21 = fmul double %19, %20
%22 = getelementptr inbounds double, double* %1, i64 %13
store double %21, double* %22
%23 = or i64 %13, 1
%24 = trunc i64 %23 to i32
%25 = sitofp i32 %24 to double
%26 = fmul double %25, 0x400921FB54442D18
%27 = fdiv double %26, %6
%28 = tail call double @sin(double %27)
%29 = tail call double @sin(double %27)
%30 = fmul double %28, %29
%31 = getelementptr inbounds double, double* %1, i64 %23
store double %30, double* %31
%32 = add nuw nsw i64 %13, 2
%33 = add i64 %14, 2
%34 = icmp eq i64 %33, %11
br i1 %34, label %35, label %12
35: ; preds = %12, %4
%36 = phi i64 [ 0, %4 ], [ %32, %12 ]
%37 = icmp eq i64 %8, 0
br i1 %37, label %47, label %38
38: ; preds = %35
%39 = trunc i64 %36 to i32
%40 = sitofp i32 %39 to double
%41 = fmul double %40, 0x400921FB54442D18
%42 = fdiv double %41, %6
%43 = tail call double @sin(double %42)
%44 = tail call double @sin(double %42)
%45 = fmul double %43, %44
%46 = getelementptr inbounds double, double* %1, i64 %36
store double %45, double* %46
br label %47
47: ; preds = %38, %35, %2
ret void
}