#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_winBla(long _N, double alpha0, double alpha1, double alpha2) {
  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);
    x++;
  }
  return ret;
}


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

x86 assembly (clang, -O2):
<smileDsp_winBla>:
push   %r14
push   %rbx
sub    $0x58,%rsp
movsd  %xmm2,0x40(%rsp)
movapd %xmm1,0x10(%rsp)
movsd  %xmm0,0x38(%rsp)
mov    %rdi,%rbx
lea    0x0(,%rdi,8),%edi
call   1030 <malloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
jle    120c <smileDsp_winBla+0xec>
xorps  %xmm1,%xmm1
cvtsi2sd %rbx,%xmm1
movsd  0xe9c(%rip),%xmm2
movapd 0x10(%rsp),%xmm0
xorpd  0xeae(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
movsd  %xmm1,0x30(%rsp)
addsd  %xmm1,%xmm2
movsd  %xmm2,0x28(%rsp)
xorpd  %xmm0,%xmm0
mov    %r14,%rbx
nop
movsd  %xmm0,0x8(%rsp)
mulsd  0xe6a(%rip),%xmm0
divsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x48(%rsp)
call   1040 <cos@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x38(%rsp),%xmm0
movsd  %xmm0,0x50(%rsp)
movsd  0x48(%rsp),%xmm0
addsd  %xmm0,%xmm0
call   1040 <cos@plt>
mulsd  0x40(%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
movsd  0x8(%rsp),%xmm0
addsd  0xe1e(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x30(%rsp),%xmm0
ucomisd 0x8(%rsp),%xmm0
movsd  0x8(%rsp),%xmm0
ja     1190 <smileDsp_winBla+0x70>
mov    %r14,%rax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

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

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