#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(int);
void blackman3(int size, float *array) {
  int i;
  float w, win_frq;
  win_frq = 6.283185309564 / size;
  for (i = 0; i < size / 2; i++) {
    w = (0.42 - 0.5 * cos(i * win_frq) + 0.08 * cos(2 * i * win_frq));
    array[size - i] *= w;
    array[i] *= w;
  }
}


x86 assembly (clang, -O0):
<blackman3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xed4(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    1205 <blackman3+0xf5>
cvtsi2ssl -0x14(%rbp),%xmm0
mulss  -0x1c(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <cos@plt>
movsd  0xe97(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe93(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
mulss  -0x1c(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <cos@plt>
movsd  -0x28(%rbp),%xmm1
movsd  0xe55(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mulss  (%rax,%rcx,4),%xmm0
movss  %xmm0,(%rax,%rcx,4)
movss  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mulss  (%rax,%rcx,4),%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <blackman3+0x30>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blackman3>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jl     11e6 <blackman3+0xd6>
mov    %rsi,%r15
mov    %edi,%r14d
cvtsi2sd %edi,%xmm0
movsd  0xec8(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
mov    %edi,%eax
shr    %r14d
lea    (%rsi,%rax,4),%r13
xor    %r12d,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
mulss  0x4(%rsp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <cos@plt>
mulsd  0xe8a(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %r12d,%xmm1
addsd  0xe82(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mulss  0x4(%rsp),%xmm1
cvttss2si %xmm1,%edi
call   1030 <cos@plt>
mulsd  0xe6d(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0x0(%r13),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,0x0(%r13)
mulss  (%r15,%rbx,4),%xmm0
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
add    $0x2,%r12d
add    $0xfffffffffffffffc,%r13
cmp    %rbx,%r14
jne    1160 <blackman3+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @blackman3(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* %3
%9 = sitofp i32 %8 to double
%10 = fdiv double 0x401921FB546D23DB, %9
%11 = fptrunc double %10 to float
store float %11, float* %7
store i32 0, i32* %5
br label %12
12: ; preds = %50, %2
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = sdiv i32 %14, 2
%16 = icmp slt i32 %13, %15
br i1 %16, label %17, label %53
17: ; preds = %12
%18 = load i32, i32* %5
%19 = sitofp i32 %18 to float
%20 = load float, float* %7
%21 = fmul float %19, %20
%22 = fptosi float %21 to i32
%23 = call double @cos(i32 %22)
%24 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %23, double 4.200000e-01)
%25 = load i32, i32* %5
%26 = mul nsw i32 2, %25
%27 = sitofp i32 %26 to float
%28 = load float, float* %7
%29 = fmul float %27, %28
%30 = fptosi float %29 to i32
%31 = call double @cos(i32 %30)
%32 = call double @llvm.fmuladd.f64(double 8.000000e-02, double %31, double %24)
%33 = fptrunc double %32 to float
store float %33, float* %6
%34 = load float, float* %6
%35 = load float*, float** %4
%36 = load i32, i32* %3
%37 = load i32, i32* %5
%38 = sub nsw i32 %36, %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds float, float* %35, i64 %39
%41 = load float, float* %40
%42 = fmul float %41, %34
store float %42, float* %40
%43 = load float, float* %6
%44 = load float*, float** %4
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds float, float* %44, i64 %46
%48 = load float, float* %47
%49 = fmul float %48, %43
store float %49, float* %47
br label %50
50: ; preds = %17
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 1
store i32 %52, i32* %5
br label %12
53: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @blackman3(i32 %0, float* nocapture %1) {
%3 = sitofp i32 %0 to double
%4 = fdiv double 0x401921FB546D23DB, %3
%5 = fptrunc double %4 to float
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %36
7: ; preds = %2
%8 = lshr i32 %0, 1
%9 = zext i32 %0 to i64
%10 = zext i32 %8 to i64
br label %11
11: ; preds = %7, %11
%12 = phi i64 [ 0, %7 ], [ %34, %11 ]
%13 = trunc i64 %12 to i32
%14 = sitofp i32 %13 to float
%15 = fmul float %5, %14
%16 = fptosi float %15 to i32
%17 = tail call double @cos(i32 %16)
%18 = tail call double @llvm.fmuladd.f64(double %17, double -5.000000e-01, double 4.200000e-01)
%19 = trunc i64 %12 to i32
%20 = shl i32 %19, 1
%21 = sitofp i32 %20 to float
%22 = fmul float %5, %21
%23 = fptosi float %22 to i32
%24 = tail call double @cos(i32 %23)
%25 = tail call double @llvm.fmuladd.f64(double %24, double 8.000000e-02, double %18)
%26 = fptrunc double %25 to float
%27 = sub nsw i64 %9, %12
%28 = getelementptr inbounds float, float* %1, i64 %27
%29 = load float, float* %28
%30 = fmul float %29, %26
store float %30, float* %28
%31 = getelementptr inbounds float, float* %1, i64 %12
%32 = load float, float* %31
%33 = fmul float %32, %26
store float %33, float* %31
%34 = add nuw nsw i64 %12, 1
%35 = icmp eq i64 %34, %10
br i1 %35, label %36, label %11
36: ; preds = %11, %2
ret void
}