#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);
int llz_blackman(double *w, const int N) {
  int i, j;
  for (i = 0, j = N - 1; i <= j; i++, j--) {
    w[i] = (double)(0.42 - 0.5 * cos(2 * 3.14159265358979323846 * i / (N - 1)) +
                    0.08 * cos(4 * 3.14159265358979323846 * i / (N - 1)));
    w[j] = w[i];
  }
  return N;
}


x86 assembly (clang, -O0):
<llz_blackman>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11fb <llz_blackman+0xeb>
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xed8(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movsd  0xea5(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xe7b(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movsd  -0x20(%rbp),%xmm1
movsd  0xe4b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    112f <llz_blackman+0x1f>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llz_blackman>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r14d
test   %esi,%esi
jle    11c8 <llz_blackman+0xb8>
mov    %rdi,%r15
lea    -0x1(%r14),%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%rsp)
mov    %r14d,%r12d
add    $0xfffffffffffffffe,%r12
xor    %ebx,%ebx
nop
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  0xeab(%rip),%xmm0
divsd  (%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
mulsd  0xe9d(%rip),%xmm0
addsd  0xe9d(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xe91(%rip),%xmm0
divsd  (%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
mulsd  0xe83(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r15,%rbx,8)
movsd  %xmm0,0x8(%r15,%r12,8)
lea    0x1(%rbx),%rax
lea    -0x1(%r12),%rcx
cmp    %r12,%rbx
mov    %rcx,%r12
mov    %rax,%rbx
jl     1140 <llz_blackman+0x30>
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @llz_blackman(double* nocapture writeonly %0, i32 returned %1) {
%3 = icmp slt i32 %1, 1
br i1 %3, label %29, label %4
4: ; preds = %2
%5 = add nsw i32 %1, -1
%6 = sitofp i32 %5 to double
%7 = zext i32 %1 to i64
%8 = add nsw i64 %7, -1
br label %9
9: ; preds = %4, %9
%10 = phi i64 [ 0, %4 ], [ %26, %9 ]
%11 = phi i64 [ %8, %4 ], [ %27, %9 ]
%12 = trunc i64 %10 to i32
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 0x401921FB54442D18
%15 = fdiv double %14, %6
%16 = fptosi double %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 = fmul double %13, 0x402921FB54442D18
%20 = fdiv double %19, %6
%21 = fptosi double %20 to i32
%22 = tail call double @cos(i32 %21)
%23 = tail call double @llvm.fmuladd.f64(double %22, double 8.000000e-02, double %18)
%24 = getelementptr inbounds double, double* %0, i64 %10
store double %23, double* %24
%25 = getelementptr inbounds double, double* %0, i64 %11
store double %23, double* %25
%26 = add nuw nsw i64 %10, 1
%27 = add nsw i64 %11, -1
%28 = icmp slt i64 %10, %27
br i1 %28, label %9, label %29
29: ; preds = %9, %2
ret i32 %1
}