#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*/ bitrv2(int, int *, double *);
int /*<<< orphan*/ bitrv2conj(int, int *, double *);
int /*<<< orphan*/ cftbsub(int, double *, double *);
int /*<<< orphan*/ cftfsub(int, double *, double *);
int /*<<< orphan*/ makewt(int, int *, double *);
void lsx_cdft(int n, int isgn, double *a, int *ip, double *w) {
  if (n > 262144)
    return;
  if (n > (ip[0] << 2)) {
    makewt(n >> 2, ip, w);
  }
  if (n > 4) {
    if (isgn >= 0) {
      bitrv2(n, ip + 2, a);
      cftfsub(n, a, w);
    } else {
      bitrv2conj(n, ip + 2, a);
      cftbsub(n, a, w);
    }
  } else if (n == 4) {
    cftfsub(n, a, w);
  }
}


x86 assembly (clang, -O0):
<lsx_cdft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
cmpl   $0x40000,-0x4(%rbp)
jle    117c <lsx_cdft+0x2c>
jmp    1228 <lsx_cdft+0xd8>
mov    -0x4(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jle    11a3 <lsx_cdft+0x53>
mov    -0x4(%rbp),%edi
sar    $0x2,%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <makewt@plt>
cmpl   $0x4,-0x4(%rbp)
jle    1209 <lsx_cdft+0xb9>
cmpl   $0x0,-0x8(%rbp)
jl     11e0 <lsx_cdft+0x90>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x10(%rbp),%rdx
call   1050 <bitrv2@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <cftfsub@plt>
jmp    1204 <lsx_cdft+0xb4>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x10(%rbp),%rdx
call   1030 <bitrv2conj@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <cftbsub@plt>
jmp    1228 <lsx_cdft+0xd8>
cmpl   $0x4,-0x4(%rbp)
jne    1223 <lsx_cdft+0xd3>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <cftfsub@plt>
jmp    1228 <lsx_cdft+0xd8>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsx_cdft>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x40000,%edi
jle    1169 <lsx_cdft+0x19>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %esi,%r12d
mov    %edi,%ebp
mov    (%rcx),%eax
shl    $0x2,%eax
cmp    %edi,%eax
jge    1190 <lsx_cdft+0x40>
mov    %ebp,%edi
sar    $0x2,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <makewt@plt>
cmp    $0x5,%ebp
jl     11af <lsx_cdft+0x5f>
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
test   %r12d,%r12d
js     11cc <lsx_cdft+0x7c>
call   1050 <bitrv2@plt>
mov    %ebp,%edi
jmp    11b9 <lsx_cdft+0x69>
cmp    $0x4,%ebp
jne    1160 <lsx_cdft+0x10>
mov    $0x4,%edi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <cftfsub@plt>
call   1030 <bitrv2conj@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <cftbsub@plt>

LLVM IR (-O0):
define void @lsx_cdft(i32 %0, i32 %1, double* %2, i32* %3, double* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca double*
%9 = alloca i32*
%10 = alloca double*
store i32 %0, i32* %6
store i32 %1, i32* %7
store double* %2, double** %8
store i32* %3, i32** %9
store double* %4, double** %10
%11 = load i32, i32* %6
%12 = icmp sgt i32 %11, 262144
br i1 %12, label %13, label %14
13: ; preds = %5
br label %63
14: ; preds = %5
%15 = load i32, i32* %6
%16 = load i32*, i32** %9
%17 = getelementptr inbounds i32, i32* %16, i64 0
%18 = load i32, i32* %17
%19 = shl i32 %18, 2
%20 = icmp sgt i32 %15, %19
br i1 %20, label %21, label %27
21: ; preds = %14
%22 = load i32, i32* %6
%23 = ashr i32 %22, 2
%24 = load i32*, i32** %9
%25 = load double*, double** %10
%26 = call i32 @makewt(i32 %23, i32* %24, double* %25)
br label %27
27: ; preds = %21, %14
%28 = load i32, i32* %6
%29 = icmp sgt i32 %28, 4
br i1 %29, label %30, label %54
30: ; preds = %27
%31 = load i32, i32* %7
%32 = icmp sge i32 %31, 0
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = load i32, i32* %6
%35 = load i32*, i32** %9
%36 = getelementptr inbounds i32, i32* %35, i64 2
%37 = load double*, double** %8
%38 = call i32 @bitrv2(i32 %34, i32* %36, double* %37)
%39 = load i32, i32* %6
%40 = load double*, double** %8
%41 = load double*, double** %10
%42 = call i32 @cftfsub(i32 %39, double* %40, double* %41)
br label %53
43: ; preds = %30
%44 = load i32, i32* %6
%45 = load i32*, i32** %9
%46 = getelementptr inbounds i32, i32* %45, i64 2
%47 = load double*, double** %8
%48 = call i32 @bitrv2conj(i32 %44, i32* %46, double* %47)
%49 = load i32, i32* %6
%50 = load double*, double** %8
%51 = load double*, double** %10
%52 = call i32 @cftbsub(i32 %49, double* %50, double* %51)
br label %53
53: ; preds = %43, %33
br label %63
54: ; preds = %27
%55 = load i32, i32* %6
%56 = icmp eq i32 %55, 4
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i32, i32* %6
%59 = load double*, double** %8
%60 = load double*, double** %10
%61 = call i32 @cftfsub(i32 %58, double* %59, double* %60)
br label %62
62: ; preds = %57, %54
br label %63
63: ; preds = %13, %62, %53
ret void
}

LLVM IR (-O2):
define void @lsx_cdft(i32 %0, i32 %1, double* %2, i32* %3, double* %4) {
%6 = icmp sgt i32 %0, 262144
br i1 %6, label %29, label %7
7: ; preds = %5
%8 = load i32, i32* %3
%9 = shl i32 %8, 2
%10 = icmp slt i32 %9, %0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = ashr i32 %0, 2
%13 = tail call i32 @makewt(i32 %12, i32* %3, double* %4)
br label %14
14: ; preds = %11, %7
%15 = icmp sgt i32 %0, 4
br i1 %15, label %16, label %25
16: ; preds = %14
%17 = icmp sgt i32 %1, -1
%18 = getelementptr inbounds i32, i32* %3, i64 2
br i1 %17, label %19, label %22
19: ; preds = %16
%20 = tail call i32 @bitrv2(i32 %0, i32* %18, double* %2)
%21 = tail call i32 @cftfsub(i32 %0, double* %2, double* %4)
br label %29
22: ; preds = %16
%23 = tail call i32 @bitrv2conj(i32 %0, i32* %18, double* %2)
%24 = tail call i32 @cftbsub(i32 %0, double* %2, double* %4)
br label %29
25: ; preds = %14
%26 = icmp eq i32 %0, 4
br i1 %26, label %27, label %29
27: ; preds = %25
%28 = tail call i32 @cftfsub(i32 4, double* %2, double* %4)
br label %29
29: ; preds = %25, %27, %19, %22, %5
ret void
}