#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 */
float sinf(int);
__attribute__((cold)) void ff_sine_window_init(float *window, int n) {
  int i;
  for (i = 0; i < n; i++)
    window[i] = sinf((i + 0.5) * (3.14159265358979323846 / (2.0 * n)));
}


x86 assembly (clang, -O0):
<ff_sine_window_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1188 <ff_sine_window_init+0x78>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xeb8(%rip),%xmm2
mulsd  %xmm1,%xmm2
movsd  0xea4(%rip),%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sinf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <ff_sine_window_init+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ff_sine_window_init>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
test   %esi,%esi
jle    10ab <ff_sine_window_init+0x5b>
mov    %rdi,%r14
cvtsi2sd %esi,%xmm0
addsd  %xmm0,%xmm0
movsd  0xf90(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %esi,%r15d
xor    %ebx,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
addsd  0xf7a(%rip),%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sinf@plt>
movss  %xmm0,(%r14,%rbx,4)
inc    %rbx
cmp    %rbx,%r15
jne    107f <ff_sine_window_init+0x2f>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
cs nopw 0x0(%rax,%rax,1)
nop

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

LLVM IR (-O2):
define void @ff_sine_window_init(float* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = sitofp i32 %1 to double
%6 = fmul double %5, 2.000000e+00
%7 = fdiv double 0x400921FB54442D18, %6
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %4, %9
%10 = phi i64 [ 0, %4 ], [ %18, %9 ]
%11 = trunc i64 %10 to i32
%12 = sitofp i32 %11 to double
%13 = fadd double %12, 5.000000e-01
%14 = fmul double %7, %13
%15 = fptosi double %14 to i32
%16 = tail call float @sinf(i32 %15)
%17 = getelementptr inbounds float, float* %0, i64 %10
store float %16, float* %17
%18 = add nuw nsw i64 %10, 1
%19 = icmp eq i64 %18, %8
br i1 %19, label %20, label %9
20: ; preds = %9, %2
ret void
}