#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 cdft(int n, int isgn, double *a, int *ip, double *w) {
  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):
<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)
mov    -0x4(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jle    1191 <cdft+0x41>
mov    -0x4(%rbp),%edi
sar    $0x2,%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <makewt@plt>
cmpl   $0x4,-0x4(%rbp)
jle    11f7 <cdft+0xa7>
cmpl   $0x0,-0x8(%rbp)
jl     11ce <cdft+0x7e>
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    11f2 <cdft+0xa2>
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    1216 <cdft+0xc6>
cmpl   $0x4,-0x4(%rbp)
jne    1211 <cdft+0xc1>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1070 <cftfsub@plt>
jmp    1216 <cdft+0xc6>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdft>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %esi,%r12d
mov    %edi,%ebp
mov    (%rcx),%eax
shl    $0x2,%eax
cmp    %edi,%eax
jl     118e <cdft+0x3e>
cmp    $0x5,%ebp
jl     11a3 <cdft+0x53>
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
test   %r12d,%r12d
js     11c9 <cdft+0x79>
call   1050 <bitrv2@plt>
mov    %ebp,%edi
jmp    11ad <cdft+0x5d>
mov    %ebp,%edi
sar    $0x2,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <makewt@plt>
cmp    $0x5,%ebp
jge    1174 <cdft+0x24>
cmp    $0x4,%ebp
jne    11c0 <cdft+0x70>
mov    $0x4,%edi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <cftfsub@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
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 @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 = load i32*, i32** %9
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
%15 = shl i32 %14, 2
%16 = icmp sgt i32 %11, %15
br i1 %16, label %17, label %23
17: ; preds = %5
%18 = load i32, i32* %6
%19 = ashr i32 %18, 2
%20 = load i32*, i32** %9
%21 = load double*, double** %10
%22 = call i32 @makewt(i32 %19, i32* %20, double* %21)
br label %23
23: ; preds = %17, %5
%24 = load i32, i32* %6
%25 = icmp sgt i32 %24, 4
br i1 %25, label %26, label %50
26: ; preds = %23
%27 = load i32, i32* %7
%28 = icmp sge i32 %27, 0
br i1 %28, label %29, label %39
29: ; preds = %26
%30 = load i32, i32* %6
%31 = load i32*, i32** %9
%32 = getelementptr inbounds i32, i32* %31, i64 2
%33 = load double*, double** %8
%34 = call i32 @bitrv2(i32 %30, i32* %32, double* %33)
%35 = load i32, i32* %6
%36 = load double*, double** %8
%37 = load double*, double** %10
%38 = call i32 @cftfsub(i32 %35, double* %36, double* %37)
br label %49
39: ; preds = %26
%40 = load i32, i32* %6
%41 = load i32*, i32** %9
%42 = getelementptr inbounds i32, i32* %41, i64 2
%43 = load double*, double** %8
%44 = call i32 @bitrv2conj(i32 %40, i32* %42, double* %43)
%45 = load i32, i32* %6
%46 = load double*, double** %8
%47 = load double*, double** %10
%48 = call i32 @cftbsub(i32 %45, double* %46, double* %47)
br label %49
49: ; preds = %39, %29
br label %59
50: ; preds = %23
%51 = load i32, i32* %6
%52 = icmp eq i32 %51, 4
br i1 %52, label %53, label %58
53: ; preds = %50
%54 = load i32, i32* %6
%55 = load double*, double** %8
%56 = load double*, double** %10
%57 = call i32 @cftfsub(i32 %54, double* %55, double* %56)
br label %58
58: ; preds = %53, %50
br label %59
59: ; preds = %58, %49
ret void
}

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