void cdft(int n, int isgn, double *a, int *ip, double *w) {
  void makewt(int nw, int *ip, double *w);
  void bitrv2(int n, int *ip, double *a);
  void bitrv2conj(int n, int *ip, double *a);
  void cftfsub(int n, double *a, double *w);
  void cftbsub(int n, double *a, 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 %22
17: ; preds = %5
%18 = load i32, i32* %6
%19 = ashr i32 %18, 2
%20 = load i32*, i32** %9
%21 = load double*, double** %10
br label %22
22: ; preds = %17, %5
%23 = load i32, i32* %6
%24 = icmp sgt i32 %23, 4
br i1 %24, label %25, label %45
25: ; preds = %22
%26 = load i32, i32* %7
%27 = icmp sge i32 %26, 0
br i1 %27, label %28, label %36
28: ; preds = %25
%29 = load i32, i32* %6
%30 = load i32*, i32** %9
%31 = getelementptr inbounds i32, i32* %30, i64 2
%32 = load double*, double** %8
%33 = load i32, i32* %6
%34 = load double*, double** %8
%35 = load double*, double** %10
br label %44
36: ; preds = %25
%37 = load i32, i32* %6
%38 = load i32*, i32** %9
%39 = getelementptr inbounds i32, i32* %38, i64 2
%40 = load double*, double** %8
%41 = load i32, i32* %6
%42 = load double*, double** %8
%43 = load double*, double** %10
br label %44
44: ; preds = %36, %28
br label %53
45: ; preds = %22
%46 = load i32, i32* %6
%47 = icmp eq i32 %46, 4
br i1 %47, label %48, label %52
48: ; preds = %45
%49 = load i32, i32* %6
%50 = load double*, double** %8
%51 = load double*, double** %10
br label %52
52: ; preds = %48, %45
br label %53
53: ; preds = %52, %44
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 %11
9: ; preds = %5
%10 = ashr i32 %0, 2
tail call void @makewt(i32 %10, i32* %3, double* %4)
br label %11
11: ; preds = %9, %5
%12 = icmp sgt i32 %0, 4
br i1 %12, label %13, label %18
13: ; preds = %11
%14 = icmp sgt i32 %1, -1
%15 = getelementptr inbounds i32, i32* %3, i64 2
br i1 %14, label %16, label %17
16: ; preds = %13
tail call void @bitrv2(i32 %0, i32* %15, double* %2)
tail call void @cftfsub(i32 %0, double* %2, double* %4)
br label %21
17: ; preds = %13
tail call void @bitrv2conj(i32 %0, i32* %15, double* %2)
tail call void @cftbsub(i32 %0, double* %2, double* %4)
br label %21
18: ; preds = %11
%19 = icmp eq i32 %0, 4
br i1 %19, label %20, label %21
20: ; preds = %18
tail call void @cftfsub(i32 4, double* %2, double* %4)
br label %21
21: ; preds = %18, %20, %16, %17
ret void
}