#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 */
scalar_t__ malloc(int);
double sin(double);
double *smileDsp_winSin(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 = sin((1.0 * 3.14159265358979323846264338327950288 * i) / (NN - 1.0));
    x++;
  }
  return ret;
}


x86 assembly (clang, -O0):
<smileDsp_winSin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <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    11c0 <smileDsp_winSin+0xa0>
movsd  0xe92(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xe78(%rip),%xmm2
subsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
movsd  0xe4f(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    115a <smileDsp_winSin+0x3a>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smileDsp_winSin>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0x0(,%rdi,8),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
jle    11b9 <smileDsp_winSin+0x99>
cvtsi2sd %rbx,%xmm0
movsd  0xeb5(%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)
nopl   0x0(%rax)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
mulsd  0xe86(%rip),%xmm0
divsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
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_winSin+0x50>
mov    %r14,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double* @smileDsp_winSin(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 = %29, %1
%16 = load double, double* %3
%17 = load double, double* %6
%18 = fcmp olt double %16, %17
br i1 %18, label %19, label %32
19: ; preds = %15
%20 = load double, double* %3
%21 = fmul double 0x400921FB54442D18, %20
%22 = load double, double* %6
%23 = fsub double %22, 1.000000e+00
%24 = fdiv double %21, %23
%25 = call double @sin(double %24)
%26 = load double*, double** %5
store double %25, double* %26
%27 = load double*, double** %5
%28 = getelementptr inbounds double, double* %27, i32 1
store double* %28, double** %5
br label %29
29: ; preds = %19
%30 = load double, double* %3
%31 = fadd double %30, 1.000000e+00
store double %31, double* %3
br label %15
32: ; preds = %15
%33 = load double*, double** %4
ret double* %33
}

LLVM IR (-O2):
define double* @smileDsp_winSin(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 %19
8: ; preds = %1
%9 = fadd double %6, -1.000000e+00
br label %10
10: ; preds = %8, %10
%11 = phi double [ 0.000000e+00, %8 ], [ %17, %10 ]
%12 = phi double* [ %5, %8 ], [ %16, %10 ]
%13 = fmul double %11, 0x400921FB54442D18
%14 = fdiv double %13, %9
%15 = tail call double @sin(double %14)
store double %15, double* %12
%16 = getelementptr inbounds double, double* %12, i64 1
%17 = fadd double %11, 1.000000e+00
%18 = fcmp olt double %17, %6
br i1 %18, label %10, label %19
19: ; preds = %10, %1
ret double* %5
}