#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_winHam(long _N) {
  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 = 0.54 - 0.46 * cos((2.0 * 3.14159265358979323846264338327950288 * i) /
                           (NN - 1.0));
    x++;
  }
  return ret;
}


x86 assembly (clang, -O0):
<smileDsp_winHam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d8 <smileDsp_winHam+0xb8>
movsd  0xea2(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe88(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1040 <cos@plt>
movsd  0xe63(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5f(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
movsd  0xe47(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    115a <smileDsp_winHam+0x3a>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smileDsp_winHam>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0x0(,%rdi,8),%edi
call   1030 <malloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
jle    11c9 <smileDsp_winHam+0xa9>
cvtsi2sd %rbx,%xmm0
movsd  0xeb1(%rip),%xmm1
movsd  %xmm0,0x10(%rsp)
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xorpd  %xmm0,%xmm0
mov    %r14,%rbx
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xe86(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
mulsd  0xe7b(%rip),%xmm0
addsd  0xe7b(%rip),%xmm0
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
movsd  (%rsp),%xmm0
addsd  0xe6e(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
ucomisd (%rsp),%xmm0
movsd  (%rsp),%xmm0
ja     1170 <smileDsp_winHam+0x50>
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double* @smileDsp_winHam(i64 %0) {
%2 = alloca i64
%3 = alloca double
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
store i64 %0, i64* %2
%7 = load i64, i64* %2
%8 = mul i64 8, %7
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to double*
store double* %11, double** %4
%12 = load double*, double** %4
store double* %12, double** %5
%13 = load i64, i64* %2
%14 = sitofp i64 %13 to double
store double %14, double* %6
store double 0.000000e+00, double* %3
br label %15
15: ; preds = %30, %1
%16 = load double, double* %3
%17 = load double, double* %6
%18 = fcmp olt double %16, %17
br i1 %18, label %19, label %33
19: ; preds = %15
%20 = load double, double* %3
%21 = fmul double 0x401921FB54442D18, %20
%22 = load double, double* %6
%23 = fsub double %22, 1.000000e+00
%24 = fdiv double %21, %23
%25 = call double @cos(double %24)
%26 = call double @llvm.fmuladd.f64(double -4.600000e-01, double %25, double 5.400000e-01)
%27 = load double*, double** %5
store double %26, double* %27
%28 = load double*, double** %5
%29 = getelementptr inbounds double, double* %28, i32 1
store double* %29, double** %5
br label %30
30: ; preds = %19
%31 = load double, double* %3
%32 = fadd double %31, 1.000000e+00
store double %32, double* %3
br label %15
33: ; preds = %15
%34 = load double*, double** %4
ret double* %34
}

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