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, nw, w);
  } else {
    cftbsub(n, a, ip, 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     11a3 <cdft+0x73>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1050 <cftfsub@plt>
jmp    11ba <cdft+0x8a>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%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,%r12
mov    %rdx,%r15
mov    %esi,%r13d
mov    %edi,%ebp
mov    (%rcx),%ebx
lea    0x0(,%rbx,4),%eax
cmp    %edi,%eax
jge    1168 <cdft+0x38>
mov    %ebp,%ebx
sar    $0x2,%ebx
mov    %ebx,%edi
mov    %r12,%rsi
mov    %r14,%rdx
call   1030 <makewt@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %ebx,%ecx
mov    %r14,%r8
add    $0x8,%rsp
test   %r13d,%r13d
js     118d <cdft+0x5d>
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 %34
28: ; preds = %25
%29 = load i32, i32* %6
%30 = load double*, double** %8
%31 = load i32*, i32** %9
%32 = load i32, i32* %11
%33 = load double*, double** %10
br label %40
34: ; preds = %25
%35 = load i32, i32* %6
%36 = load double*, double** %8
%37 = load i32*, i32** %9
%38 = load i32, i32* %11
%39 = load double*, double** %10
br label %40
40: ; preds = %34, %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
br i1 %13, label %14, label %15
14: ; preds = %11
tail call void @cftfsub(i32 %0, double* %2, i32* %3, i32 %12, double* %4)
br label %16
15: ; preds = %11
tail call void @cftbsub(i32 %0, double* %2, i32* %3, i32 %12, double* %4)
br label %16
16: ; preds = %15, %14
ret void
}