#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 sin(double);
int llz_mdct_sine(double *w, int N) {
  double tmp;
  int n;
  for (n = 0; n < N; n++) {
    tmp = (3.14159265358979323846 / N) * (n + 0.5);
    w[n] = sin(tmp);
  }
  return N;
}


x86 assembly (clang, -O0):
<llz_mdct_sine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1182 <llz_mdct_sine+0x72>
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xec9(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  0xeb0(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1126 <llz_mdct_sine+0x16>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<llz_mdct_sine>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
test   %esi,%esi
jle    11e8 <llz_mdct_sine+0xd8>
mov    %rdi,%rbx
cvtsi2sd %r14d,%xmm0
movsd  0xec9(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
mov    %r14d,%r15d
cmp    $0x1,%r14d
jne    1155 <llz_mdct_sine+0x45>
xor    %ebp,%ebp
test   $0x1,%r15b
jne    11cb <llz_mdct_sine+0xbb>
jmp    11e8 <llz_mdct_sine+0xd8>
mov    %r15d,%r12d
and    $0xfffffffe,%r12d
xor    %ebp,%ebp
movsd  %xmm0,0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  0xe89(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rbx,%rbp,8)
lea    0x1(%rbp),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xe63(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,0x8(%rbx,%rbp,8)
add    $0x2,%rbp
cmp    %r12,%rbp
jne    1170 <llz_mdct_sine+0x60>
movsd  0x8(%rsp),%xmm0
test   $0x1,%r15b
je     11e8 <llz_mdct_sine+0xd8>
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
addsd  0xe2e(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sin@plt>
movsd  %xmm0,(%rbx,%rbp,8)
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @llz_mdct_sine(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca double
%6 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
store i32 0, i32* %6
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %28
11: ; preds = %7
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to double
%14 = fdiv double 0x400921FB54442D18, %13
%15 = load i32, i32* %6
%16 = sitofp i32 %15 to double
%17 = fadd double %16, 5.000000e-01
%18 = fmul double %14, %17
store double %18, double* %5
%19 = load double, double* %5
%20 = call double @sin(double %19)
%21 = load double*, double** %3
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
store double %20, double* %24
br label %25
25: ; preds = %11
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
store i32 %27, i32* %6
br label %7
28: ; preds = %7
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
define i32 @llz_mdct_sine(double* nocapture writeonly %0, i32 returned %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %41
4: ; preds = %2
%5 = sitofp i32 %1 to double
%6 = fdiv double 0x400921FB54442D18, %5
%7 = zext i32 %1 to i64
%8 = and i64 %7, 1
%9 = icmp eq i32 %1, 1
br i1 %9, label %31, label %10
10: ; preds = %4
%11 = and i64 %7, 4294967294
br label %12
12: ; preds = %12, %10
%13 = phi i64 [ 0, %10 ], [ %28, %12 ]
%14 = phi i64 [ 0, %10 ], [ %29, %12 ]
%15 = trunc i64 %13 to i32
%16 = sitofp i32 %15 to double
%17 = fadd double %16, 5.000000e-01
%18 = fmul double %6, %17
%19 = tail call double @sin(double %18)
%20 = getelementptr inbounds double, double* %0, i64 %13
store double %19, double* %20
%21 = or i64 %13, 1
%22 = trunc i64 %21 to i32
%23 = sitofp i32 %22 to double
%24 = fadd double %23, 5.000000e-01
%25 = fmul double %6, %24
%26 = tail call double @sin(double %25)
%27 = getelementptr inbounds double, double* %0, i64 %21
store double %26, double* %27
%28 = add nuw nsw i64 %13, 2
%29 = add i64 %14, 2
%30 = icmp eq i64 %29, %11
br i1 %30, label %31, label %12
31: ; preds = %12, %4
%32 = phi i64 [ 0, %4 ], [ %28, %12 ]
%33 = icmp eq i64 %8, 0
br i1 %33, label %41, label %34
34: ; preds = %31
%35 = trunc i64 %32 to i32
%36 = sitofp i32 %35 to double
%37 = fadd double %36, 5.000000e-01
%38 = fmul double %6, %37
%39 = tail call double @sin(double %38)
%40 = getelementptr inbounds double, double* %0, i64 %32
store double %39, double* %40
br label %41
41: ; preds = %34, %31, %2
ret i32 %1
}