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


x86 assembly (clang, -O0):
<smileDsp_winBaH>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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    1264 <smileDsp_winBaH+0x144>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
movsd  0xe67(%rip),%xmm4
subsd  %xmm4,%xmm3
divsd  %xmm3,%xmm2
movsd  0xe67(%rip),%xmm3
subsd  %xmm3,%xmm2
movaps 0xe6c(%rip),%xmm3
pand   %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe1a(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  0xe00(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%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  0xdab(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1169 <smileDsp_winBaH+0x49>
mov    -0x30(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smileDsp_winBaH>:
push   %r14
push   %rbx
sub    $0x68,%rsp
movaps %xmm2,0x20(%rsp)
movapd %xmm1,0x10(%rsp)
movsd  %xmm0,0x48(%rsp)
mov    %rdi,%rbx
lea    0x0(,%rdi,8),%edi
call   1030 <malloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
jle    1239 <smileDsp_winBaH+0x119>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
movsd  0xe9d(%rip),%xmm1
movsd  %xmm0,0x40(%rsp)
addsd  %xmm0,%xmm1
movsd  %xmm1,0x38(%rsp)
movapd 0xea5(%rip),%xmm0
movapd 0x10(%rsp),%xmm1
xorpd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movapd 0x20(%rsp),%xmm1
xorpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
xorpd  %xmm0,%xmm0
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
movsd  0x38(%rsp),%xmm1
divsd  %xmm1,%xmm0
addsd  0xe40(%rip),%xmm0
andpd  0xe60(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  0x48(%rsp),%xmm0
movapd %xmm0,0x50(%rsp)
movsd  0x8(%rsp),%xmm0
mulsd  0xe20(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
mulsd  0x20(%rsp),%xmm0
addsd  0x50(%rsp),%xmm0
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
movsd  0x8(%rsp),%xmm0
addsd  0xdfd(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x40(%rsp),%xmm0
ucomisd 0x8(%rsp),%xmm0
movsd  0x8(%rsp),%xmm0
ja     11b0 <smileDsp_winBaH+0x90>
mov    %r14,%rax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define double* @smileDsp_winBaH(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 %29
11: ; preds = %4
%12 = fadd double %9, -1.000000e+00
%13 = fneg double %2
%14 = fneg double %3
br label %15
15: ; preds = %11, %15
%16 = phi double [ 0.000000e+00, %11 ], [ %27, %15 ]
%17 = phi double* [ %8, %11 ], [ %26, %15 ]
%18 = fdiv double %16, %12
%19 = fadd double %18, -5.000000e-01
%20 = tail call double @llvm.fabs.f64(double %19)
%21 = tail call double @llvm.fmuladd.f64(double %13, double %20, double %1)
%22 = fmul double %16, 0x401921FB54442D18
%23 = fdiv double %22, %12
%24 = tail call double @cos(double %23)
%25 = tail call double @llvm.fmuladd.f64(double %14, double %24, double %21)
store double %25, double* %17
%26 = getelementptr inbounds double, double* %17, i64 1
%27 = fadd double %16, 1.000000e+00
%28 = fcmp olt double %27, %9
br i1 %28, label %15, label %29
29: ; preds = %15, %4
ret double* %8
}