#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*/ dcsqf1(int, double *, double *, double *, int *);
void __ogg_fdcosqf(int n, double *x, double *wsave, int *ifac) {
  static double sqrt2 = 1.4142135623730950488016887242097;
  double tsqx;
  switch (n) {
  case 0:
  case 1:
    return;
  case 2:
    tsqx = sqrt2 * x[1];
    x[1] = x[0] - tsqx;
    x[0] += tsqx;
    return;
  default:
    dcsqf1(n, x, wsave, wsave + n, ifac);
    return;
  }
}


x86 assembly (clang, -O0):
<__ogg_fdcosqf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x2,%eax
jb     114c <__ogg_fdcosqf+0x3c>
jmp    113b <__ogg_fdcosqf+0x2b>
mov    -0x2c(%rbp),%eax
sub    $0x2,%eax
je     1151 <__ogg_fdcosqf+0x41>
jmp    1193 <__ogg_fdcosqf+0x83>
jmp    11b6 <__ogg_fdcosqf+0xa6>
movsd  0x2ecf(%rip),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    11b6 <__ogg_fdcosqf+0xa6>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x18(%rbp),%rcx
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
mov    -0x20(%rbp),%r8
call   1030 <dcsqf1@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ogg_fdcosqf>:
cmp    $0x2,%edi
jb     113d <__ogg_fdcosqf+0x2d>
jne    113e <__ogg_fdcosqf+0x2e>
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
mulsd  0xed8(%rip),%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,0x8(%rsi)
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi)
ret
mov    %rcx,%r8
movslq %edi,%rax
lea    (%rdx,%rax,8),%rcx
jmp    1030 <dcsqf1@plt>

LLVM IR (-O0):
@__ogg_fdcosqf.sqrt2 = internal global double 0x3FF6A09E667F3BCD
define void @__ogg_fdcosqf(i32 %0, double* %1, double* %2, i32* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32*
%9 = alloca double
store i32 %0, i32* %5
store double* %1, double** %6
store double* %2, double** %7
store i32* %3, i32** %8
%10 = load i32, i32* %5
switch i32 %10, label %30 [
i32 0, label %11
i32 1, label %11
i32 2, label %12
]
11: ; preds = %4, %4
br label %40
12: ; preds = %4
%13 = load double, double* @__ogg_fdcosqf.sqrt2
%14 = load double*, double** %6
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fmul double %13, %16
store double %17, double* %9
%18 = load double*, double** %6
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
%21 = load double, double* %9
%22 = fsub double %20, %21
%23 = load double*, double** %6
%24 = getelementptr inbounds double, double* %23, i64 1
store double %22, double* %24
%25 = load double, double* %9
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 0
%28 = load double, double* %27
%29 = fadd double %28, %25
store double %29, double* %27
br label %40
30: ; preds = %4
%31 = load i32, i32* %5
%32 = load double*, double** %6
%33 = load double*, double** %7
%34 = load double*, double** %7
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
%38 = load i32*, i32** %8
%39 = call i32 @dcsqf1(i32 %31, double* %32, double* %33, double* %37, i32* %38)
br label %40
40: ; preds = %30, %12, %11
ret void
}

LLVM IR (-O2):
define void @__ogg_fdcosqf(i32 %0, double* %1, double* %2, i32* %3) {
switch i32 %0, label %12 [
i32 0, label %16
i32 1, label %16
i32 2, label %5
]
5: ; preds = %4
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = fmul double %7, 0x3FF6A09E667F3BCD
%9 = load double, double* %1
%10 = fsub double %9, %8
store double %10, double* %6
%11 = fadd double %9, %8
store double %11, double* %1
br label %16
12: ; preds = %4
%13 = sext i32 %0 to i64
%14 = getelementptr inbounds double, double* %2, i64 %13
%15 = tail call i32 @dcsqf1(i32 %0, double* %1, double* %2, double* %14, i32* %3)
br label %16
16: ; preds = %4, %4, %12, %5
ret void
}