#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*/ dcsqb1(int, float *, float *, float *, int *);
void __ogg_fdcosqb(int n, float *x, float *wsave, int *ifac) {
  static float tsqrt2 = 2.8284271247461900976033774484194;
  float x1;
  if (n < 2) {
    x[0] *= 4;
    return;
  }
  if (n == 2) {
    x1 = (x[0] + x[1]) * 4;
    x[1] = tsqrt2 * (x[0] - x[1]);
    x[0] = x1;
    return;
  }
  dcsqb1(n, x, wsave, wsave + n, ifac);
}


x86 assembly (clang, -O0):
<__ogg_fdcosqb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    114a <__ogg_fdcosqb+0x3a>
mov    -0x10(%rbp),%rax
movss  0xec3(%rip),%xmm0
mulss  (%rax),%xmm0
movss  %xmm0,(%rax)
jmp    11d1 <__ogg_fdcosqb+0xc1>
cmpl   $0x2,-0x4(%rbp)
jne    11ae <__ogg_fdcosqb+0x9e>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
addss  0x4(%rax),%xmm0
movss  0xe93(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0x2eaa(%rip),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm1
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x24(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
jmp    11d1 <__ogg_fdcosqb+0xc1>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rcx
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rcx
mov    -0x20(%rbp),%r8
call   1030 <dcsqb1@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ogg_fdcosqb>:
cmp    $0x1,%edi
jg     1126 <__ogg_fdcosqb+0x16>
movss  (%rsi),%xmm0
mulss  0xedf(%rip),%xmm0
movss  %xmm0,(%rsi)
ret
cmp    $0x2,%edi
jne    1159 <__ogg_fdcosqb+0x49>
movss  (%rsi),%xmm0
movss  0x4(%rsi),%xmm1
movaps %xmm0,%xmm2
addss  %xmm1,%xmm2
mulss  0xebd(%rip),%xmm2
subss  %xmm1,%xmm0
mulss  0xeb5(%rip),%xmm0
movss  %xmm0,0x4(%rsi)
movss  %xmm2,(%rsi)
ret
mov    %rcx,%r8
mov    %edi,%eax
lea    (%rdx,%rax,4),%rcx
jmp    1030 <dcsqb1@plt>

LLVM IR (-O0):
@__ogg_fdcosqb.tsqrt2 = internal global float 0x4006A09E60000000
define void @__ogg_fdcosqb(i32 %0, float* %1, float* %2, i32* %3) {
%5 = alloca i32
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32*
%9 = alloca float
store i32 %0, i32* %5
store float* %1, float** %6
store float* %2, float** %7
store i32* %3, i32** %8
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = load float*, float** %6
%14 = getelementptr inbounds float, float* %13, i64 0
%15 = load float, float* %14
%16 = fmul float %15, 4.000000e+00
store float %16, float* %14
br label %53
17: ; preds = %4
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 2
br i1 %19, label %20, label %43
20: ; preds = %17
%21 = load float*, float** %6
%22 = getelementptr inbounds float, float* %21, i64 0
%23 = load float, float* %22
%24 = load float*, float** %6
%25 = getelementptr inbounds float, float* %24, i64 1
%26 = load float, float* %25
%27 = fadd float %23, %26
%28 = fmul float %27, 4.000000e+00
store float %28, float* %9
%29 = load float, float* @__ogg_fdcosqb.tsqrt2
%30 = load float*, float** %6
%31 = getelementptr inbounds float, float* %30, i64 0
%32 = load float, float* %31
%33 = load float*, float** %6
%34 = getelementptr inbounds float, float* %33, i64 1
%35 = load float, float* %34
%36 = fsub float %32, %35
%37 = fmul float %29, %36
%38 = load float*, float** %6
%39 = getelementptr inbounds float, float* %38, i64 1
store float %37, float* %39
%40 = load float, float* %9
%41 = load float*, float** %6
%42 = getelementptr inbounds float, float* %41, i64 0
store float %40, float* %42
br label %53
43: ; preds = %17
%44 = load i32, i32* %5
%45 = load float*, float** %6
%46 = load float*, float** %7
%47 = load float*, float** %7
%48 = load i32, i32* %5
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds float, float* %47, i64 %49
%51 = load i32*, i32** %8
%52 = call i32 @dcsqb1(i32 %44, float* %45, float* %46, float* %50, i32* %51)
br label %53
53: ; preds = %43, %20, %12
ret void
}

LLVM IR (-O2):
define void @__ogg_fdcosqb(i32 %0, float* %1, float* %2, i32* %3) {
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = load float, float* %1
%8 = fmul float %7, 4.000000e+00
store float %8, float* %1
br label %23
9: ; preds = %4
%10 = icmp eq i32 %0, 2
br i1 %10, label %11, label %19
11: ; preds = %9
%12 = load float, float* %1
%13 = getelementptr inbounds float, float* %1, i64 1
%14 = load float, float* %13
%15 = fadd float %12, %14
%16 = fmul float %15, 4.000000e+00
%17 = fsub float %12, %14
%18 = fmul float %17, 0x4006A09E60000000
store float %18, float* %13
store float %16, float* %1
br label %23
19: ; preds = %9
%20 = zext i32 %0 to i64
%21 = getelementptr inbounds float, float* %2, i64 %20
%22 = tail call i32 @dcsqb1(i32 %0, float* %1, float* %2, float* %21, i32* %3)
br label %23
23: ; preds = %19, %11, %6
ret void
}