#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);
scalar_t__ malloc(int);
double *smileDsp_winBlH(long _N, double alpha0, double alpha1, double alpha2,
                        double alpha3) {
  double i;
  double *ret = (double *)malloc(sizeof(double) * _N);
  double *x = ret;
  double NN = (double)_N;
  double tmp;
  for (i = 0.0; i < NN; i += 1.0) {
    tmp = (2.0 * 3.14159265358979323846264338327950288 * i) / (NN - 1.0);
    *x = alpha0 - alpha1 * cos(tmp) + alpha2 * cos(2.0 * tmp) -
         alpha3 * cos(3.0 * tmp);
    x++;
  }
  return ret;
}


x86 assembly (clang, -O0):
<smileDsp_winBlH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12a4 <smileDsp_winBlH+0x184>
movsd  0xe8b(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  0xe71(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x80(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x78(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xdfb(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x70(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xdbd(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
call   1040 <cos@plt>
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x40(%rbp)
movsd  0xd7b(%rip),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1171 <smileDsp_winBlH+0x51>
mov    -0x38(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smileDsp_winBlH>:
push   %r14
push   %rbx
sub    $0x68,%rsp
movaps %xmm3,0x30(%rsp)
movsd  %xmm2,0x60(%rsp)
movapd %xmm1,0x20(%rsp)
movsd  %xmm0,0x58(%rsp)
mov    %rdi,%rbx
lea    0x0(,%rdi,8),%edi
call   1030 <malloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
jle    1255 <smileDsp_winBlH+0x135>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0xe97(%rip),%xmm1
movsd  %xmm0,0x50(%rsp)
addsd  %xmm0,%xmm1
movsd  %xmm1,0x48(%rsp)
movapd 0xe9f(%rip),%xmm0
movapd 0x20(%rsp),%xmm1
xorpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
movapd 0x30(%rsp),%xmm1
xorpd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
xorpd  %xmm0,%xmm0
mov    %r14,%rbx
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%rsp)
mulsd  0xe4a(%rip),%xmm0
divsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
call   1040 <cos@plt>
mulsd  0x20(%rsp),%xmm0
addsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
addsd  %xmm0,%xmm0
call   1040 <cos@plt>
mulsd  0x60(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  0xe00(%rip),%xmm0
call   1040 <cos@plt>
mulsd  0x30(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
movsd  0x8(%rsp),%xmm0
addsd  0xde1(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x50(%rsp),%xmm0
ucomisd 0x8(%rsp),%xmm0
movsd  0x8(%rsp),%xmm0
ja     11b0 <smileDsp_winBlH+0x90>
mov    %r14,%rax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double* @smileDsp_winBlH(i64 %0, double %1, double %2, double %3, double %4) {
%6 = alloca i64
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double*
%13 = alloca double*
%14 = alloca double
%15 = alloca double
store i64 %0, i64* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%16 = load i64, i64* %6
%17 = mul i64 8, %16
%18 = trunc i64 %17 to i32
%19 = call i64 @malloc(i32 %18)
%20 = inttoptr i64 %19 to double*
store double* %20, double** %12
%21 = load double*, double** %12
store double* %21, double** %13
%22 = load i64, i64* %6
%23 = sitofp i64 %22 to double
store double %23, double* %14
store double 0.000000e+00, double* %11
br label %24
24: ; preds = %54, %5
%25 = load double, double* %11
%26 = load double, double* %14
%27 = fcmp olt double %25, %26
br i1 %27, label %28, label %57
28: ; preds = %24
%29 = load double, double* %11
%30 = fmul double 0x401921FB54442D18, %29
%31 = load double, double* %14
%32 = fsub double %31, 1.000000e+00
%33 = fdiv double %30, %32
store double %33, double* %15
%34 = load double, double* %7
%35 = load double, double* %8
%36 = load double, double* %15
%37 = call double @cos(double %36)
%38 = fneg double %35
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double %34)
%40 = load double, double* %9
%41 = load double, double* %15
%42 = fmul double 2.000000e+00, %41
%43 = call double @cos(double %42)
%44 = call double @llvm.fmuladd.f64(double %40, double %43, double %39)
%45 = load double, double* %10
%46 = load double, double* %15
%47 = fmul double 3.000000e+00, %46
%48 = call double @cos(double %47)
%49 = fneg double %45
%50 = call double @llvm.fmuladd.f64(double %49, double %48, double %44)
%51 = load double*, double** %13
store double %50, double* %51
%52 = load double*, double** %13
%53 = getelementptr inbounds double, double* %52, i32 1
store double* %53, double** %13
br label %54
54: ; preds = %28
%55 = load double, double* %11
%56 = fadd double %55, 1.000000e+00
store double %56, double* %11
br label %24
57: ; preds = %24
%58 = load double*, double** %12
ret double* %58
}

LLVM IR (-O2):
define double* @smileDsp_winBlH(i64 %0, double %1, double %2, double %3, double %4) {
%6 = trunc i64 %0 to i32
%7 = shl i32 %6, 3
%8 = tail call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to double*
%10 = sitofp i64 %0 to double
%11 = icmp sgt i64 %0, 0
br i1 %11, label %12, label %32
12: ; preds = %5
%13 = fadd double %10, -1.000000e+00
%14 = fneg double %2
%15 = fneg double %4
br label %16
16: ; preds = %12, %16
%17 = phi double [ 0.000000e+00, %12 ], [ %30, %16 ]
%18 = phi double* [ %9, %12 ], [ %29, %16 ]
%19 = fmul double %17, 0x401921FB54442D18
%20 = fdiv double %19, %13
%21 = tail call double @cos(double %20)
%22 = tail call double @llvm.fmuladd.f64(double %14, double %21, double %1)
%23 = fmul double %20, 2.000000e+00
%24 = tail call double @cos(double %23)
%25 = tail call double @llvm.fmuladd.f64(double %3, double %24, double %22)
%26 = fmul double %20, 3.000000e+00
%27 = tail call double @cos(double %26)
%28 = tail call double @llvm.fmuladd.f64(double %15, double %27, double %25)
store double %28, double* %18
%29 = getelementptr inbounds double, double* %18, i64 1
%30 = fadd double %17, 1.000000e+00
%31 = fcmp olt double %30, %10
br i1 %31, label %16, label %32
32: ; preds = %16, %5
ret double* %9
}