void cdft(int n, int isgn, double *a, int *ip, double *w) {
  void makewt(int nw, int *ip, double *w);
  void cftfsub(int n, double *a, int *ip, int nw, double *w);
  void cftbsub(int n, double *a, int *ip, int nw, double *w);
  int nw;
  nw = ip[0];
  if (n > (nw << 2)) {
    nw = n >> 2;
    makewt(nw, ip, w);
  }
  if (isgn >= 0) {
    cftfsub(n, a, ip + 2, nw, w);
  } else {
    cftbsub(n, a, ip + 2, nw, w);
  }
}


x86 assembly (clang, -O0):
<cdft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x24(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jle    117d <cdft+0x4d>
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <makewt@plt>
cmpl   $0x0,-0x8(%rbp)
jl     11a7 <cdft+0x77>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1050 <cftfsub@plt>
jmp    11c2 <cdft+0x92>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1040 <cftbsub@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdft>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %esi,%r13d
mov    %edi,%ebp
mov    (%rcx),%r12d
lea    0x0(,%r12,4),%eax
cmp    %edi,%eax
jge    116d <cdft+0x3d>
mov    %ebp,%r12d
sar    $0x2,%r12d
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <makewt@plt>
add    $0x8,%rbx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r12d,%ecx
mov    %r14,%r8
add    $0x8,%rsp
test   %r13d,%r13d
js     1197 <cdft+0x67>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <cftfsub@plt>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <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*
%11 = alloca i32
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
%12 = load i32*, i32** %9
%13 = getelementptr inbounds i32, i32* %12, i64 0
%14 = load i32, i32* %13
store i32 %14, i32* %11
%15 = load i32, i32* %6
%16 = load i32, i32* %11
%17 = shl i32 %16, 2
%18 = icmp sgt i32 %15, %17
br i1 %18, label %19, label %25
19: ; preds = %5
%20 = load i32, i32* %6
%21 = ashr i32 %20, 2
store i32 %21, i32* %11
%22 = load i32, i32* %11
%23 = load i32*, i32** %9
%24 = load double*, double** %10
br label %25
25: ; preds = %19, %5
%26 = load i32, i32* %7
%27 = icmp sge i32 %26, 0
br i1 %27, label %28, label %35
28: ; preds = %25
%29 = load i32, i32* %6
%30 = load double*, double** %8
%31 = load i32*, i32** %9
%32 = getelementptr inbounds i32, i32* %31, i64 2
%33 = load i32, i32* %11
%34 = load double*, double** %10
br label %42
35: ; preds = %25
%36 = load i32, i32* %6
%37 = load double*, double** %8
%38 = load i32*, i32** %9
%39 = getelementptr inbounds i32, i32* %38, i64 2
%40 = load i32, i32* %11
%41 = load double*, double** %10
br label %42
42: ; preds = %35, %28
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 = phi i32 [ %10, %9 ], [ %6, %5 ]
%13 = icmp sgt i32 %1, -1
%14 = getelementptr inbounds i32, i32* %3, i64 2
br i1 %13, label %15, label %16
15: ; preds = %11
tail call void @cftfsub(i32 %0, double* %2, i32* %14, i32 %12, double* %4)
br label %17
16: ; preds = %11
tail call void @cftbsub(i32 %0, double* %2, i32* %14, i32 %12, double* %4)
br label %17
17: ; preds = %16, %15
ret void
}