#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 */
int /*<<< orphan*/ __ogg_fdrffti(int, float *, int *);
float cos(float);
void __ogg_fdcosqi(int n, float *wsave, int *ifac) {
  static float pih = 1.57079632679489661923132169163975;
  static int k;
  static float fk, dt;
  dt = pih / n;
  fk = 0.;
  for (k = 0; k < n; k++) {
    fk += 1.;
    wsave[k] = cos(fk * dt);
  }
  __ogg_fdrffti(n, wsave + n, ifac);
}


x86 assembly (clang, -O0):
<__ogg_fdcosqi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movss  0x2ef5(%rip),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,0x2ef4(%rip)
xorps  %xmm0,%xmm0
movss  %xmm0,0x2ee5(%rip)
movl   $0x0,0x2ed7(%rip)
mov    0x2ed1(%rip),%eax
cmp    -0x4(%rbp),%eax
jge    11cd <__ogg_fdcosqi+0xad>
movss  0x2ec4(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe7c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x2ea8(%rip)
movss  0x2ea0(%rip),%xmm0
mulss  0x2e9c(%rip),%xmm0
call   1030 <cos@plt>
mov    -0x10(%rbp),%rax
movslq 0x2e84(%rip),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    0x2e79(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e70(%rip)
jmp    1161 <__ogg_fdcosqi+0x41>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
call   1040 <__ogg_fdrffti@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ogg_fdcosqi>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
cvtsi2ss %edi,%xmm1
mov    %rdx,%r14
mov    %rsi,%rbx
movss  0xec8(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,0x2ef8(%rip)
movl   $0x0,0x2eea(%rip)
movl   $0x0,0x2edc(%rip)
test   %edi,%edi
jle    11b0 <__ogg_fdcosqi+0x90>
movl   $0x3f800000,0x2ed2(%rip)
cs nopw 0x0(%rax,%rax,1)
call   1030 <cos@plt>
movslq 0x2eb8(%rip),%rax
movss  %xmm0,(%rbx,%rax,4)
add    $0x1,%eax
mov    %eax,0x2eaa(%rip)
cmp    %ebp,%eax
jge    11b0 <__ogg_fdcosqi+0x90>
movss  0x2ea2(%rip),%xmm0
addss  0xe66(%rip),%xmm0
movss  %xmm0,0x2e92(%rip)
mulss  0x2e8e(%rip),%xmm0
jmp    1170 <__ogg_fdcosqi+0x50>
movslq %ebp,%rax
lea    (%rbx,%rax,4),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <__ogg_fdrffti@plt>

LLVM IR (-O0):
@__ogg_fdcosqi.pih = internal global float 0x3FF921FB60000000
@__ogg_fdcosqi.k = internal global i32 0
@__ogg_fdcosqi.fk = internal global float 0.000000e+00
@__ogg_fdcosqi.dt = internal global float 0.000000e+00
define void @__ogg_fdcosqi(i32 %0, float* %1, i32* %2) {
%4 = alloca i32
%5 = alloca float*
%6 = alloca i32*
store i32 %0, i32* %4
store float* %1, float** %5
store i32* %2, i32** %6
%7 = load float, float* @__ogg_fdcosqi.pih
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to float
%10 = fdiv float %7, %9
store float %10, float* @__ogg_fdcosqi.dt
store float 0.000000e+00, float* @__ogg_fdcosqi.fk
store i32 0, i32* @__ogg_fdcosqi.k
br label %11
11: ; preds = %28, %3
%12 = load i32, i32* @__ogg_fdcosqi.k
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load float, float* @__ogg_fdcosqi.fk
%17 = fpext float %16 to double
%18 = fadd double %17, 1.000000e+00
%19 = fptrunc double %18 to float
store float %19, float* @__ogg_fdcosqi.fk
%20 = load float, float* @__ogg_fdcosqi.fk
%21 = load float, float* @__ogg_fdcosqi.dt
%22 = fmul float %20, %21
%23 = call float @cos(float %22)
%24 = load float*, float** %5
%25 = load i32, i32* @__ogg_fdcosqi.k
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds float, float* %24, i64 %26
store float %23, float* %27
br label %28
28: ; preds = %15
%29 = load i32, i32* @__ogg_fdcosqi.k
%30 = add nsw i32 %29, 1
store i32 %30, i32* @__ogg_fdcosqi.k
br label %11
31: ; preds = %11
%32 = load i32, i32* %4
%33 = load float*, float** %5
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %33, i64 %35
%37 = load i32*, i32** %6
%38 = call i32 @__ogg_fdrffti(i32 %32, float* %36, i32* %37)
ret void
}

LLVM IR (-O2):
@__ogg_fdcosqi.k = internal unnamed_addr global i32 0
@__ogg_fdcosqi.fk = internal unnamed_addr global float 0.000000e+00
@__ogg_fdcosqi.dt = internal unnamed_addr global float 0.000000e+00
define void @__ogg_fdcosqi(i32 %0, float* %1, i32* %2) {
%4 = sitofp i32 %0 to float
%5 = fdiv float 0x3FF921FB60000000, %4
store float %5, float* @__ogg_fdcosqi.dt
store float 0.000000e+00, float* @__ogg_fdcosqi.fk
store i32 0, i32* @__ogg_fdcosqi.k
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %25
7: ; preds = %3
store float 1.000000e+00, float* @__ogg_fdcosqi.fk
%8 = tail call float @cos(float %5)
%9 = load i32, i32* @__ogg_fdcosqi.k
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds float, float* %1, i64 %10
store float %8, float* %11
%12 = add nsw i32 %9, 1
store i32 %12, i32* @__ogg_fdcosqi.k
%13 = icmp slt i32 %12, %0
br i1 %13, label %14, label %25
14: ; preds = %7, %14
%15 = load float, float* @__ogg_fdcosqi.fk
%16 = load float, float* @__ogg_fdcosqi.dt
%17 = fadd float %15, 1.000000e+00
store float %17, float* @__ogg_fdcosqi.fk
%18 = fmul float %17, %16
%19 = tail call float @cos(float %18)
%20 = load i32, i32* @__ogg_fdcosqi.k
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds float, float* %1, i64 %21
store float %19, float* %22
%23 = add nsw i32 %20, 1
store i32 %23, i32* @__ogg_fdcosqi.k
%24 = icmp slt i32 %23, %0
br i1 %24, label %14, label %25
25: ; preds = %14, %7, %3
%26 = sext i32 %0 to i64
%27 = getelementptr inbounds float, float* %1, i64 %26
%28 = tail call i32 @__ogg_fdrffti(i32 %0, float* %27, i32* %2)
ret void
}