void cftfsub(int n, double *a, int *ip, int nw, double *w) {
  void bitrv2(int n, int *ip, double *a);
  void bitrv216(double *a);
  void bitrv208(double *a);
  void cftf1st(int n, double *a, double *w);
  void cftrec1(int n, double *a, int nw, double *w);
  void cftrec2(int n, double *a, int nw, double *w);
  void cftexp1(int n, double *a, int nw, double *w);
  void cftfx41(int n, double *a, int nw, double *w);
  void cftf161(double *a, double *w);
  void cftf081(double *a, double *w);
  void cftf040(double *a);
  void cftx020(double *a);
  int m;
  if (n > 32) {
    m = n >> 2;
    cftf1st(n, a, &w[nw - m]);
    if (n > 512) {
      cftrec1(m, a, nw, w);
      cftrec2(m, &a[m], nw, w);
      cftrec1(m, &a[2 * m], nw, w);
      cftrec1(m, &a[3 * m], nw, w);
    } else if (m > 32) {
      cftexp1(n, a, nw, w);
    } else {
      cftfx41(n, a, nw, w);
    }
    bitrv2(n, ip, a);
  } else if (n > 8) {
    if (n == 32) {
      cftf161(a, &w[nw - 8]);
      bitrv216(a);
    } else {
      cftf081(a, w);
      bitrv208(a);
    }
  } else if (n == 8) {
    cftf040(a);
  } else if (n == 4) {
    cftx020(a);
  }
}


x86 assembly (clang, -O0):
<cftfsub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x20,-0x4(%rbp)
jle    12e0 <cftfsub+0x120>
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x1c(%rbp),%eax
sub    -0x2c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   10a0 <cftf1st@plt>
cmpl   $0x200,-0x4(%rbp)
jle    1291 <cftfsub+0xd1>
mov    -0x2c(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   10b0 <cftrec1@plt>
mov    -0x2c(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1040 <cftrec2@plt>
mov    -0x2c(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   10b0 <cftrec1@plt>
mov    -0x2c(%rbp),%edi
mov    -0x10(%rbp),%rsi
imul   $0x3,-0x2c(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   10b0 <cftrec1@plt>
jmp    12cb <cftfsub+0x10b>
cmpl   $0x20,-0x2c(%rbp)
jle    12b3 <cftfsub+0xf3>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   10e0 <cftexp1@plt>
jmp    12c6 <cftfsub+0x106>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1080 <cftfx41@plt>
jmp    12cb <cftfsub+0x10b>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1090 <bitrv2@plt>
jmp    1373 <cftfsub+0x1b3>
cmpl   $0x8,-0x4(%rbp)
jle    1339 <cftfsub+0x179>
cmpl   $0x20,-0x4(%rbp)
jne    131e <cftfsub+0x15e>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x1c(%rbp),%eax
sub    $0x8,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
call   1030 <cftf161@plt>
mov    -0x10(%rbp),%rdi
call   1070 <bitrv216@plt>
jmp    1334 <cftfsub+0x174>
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <cftf081@plt>
mov    -0x10(%rbp),%rdi
call   10d0 <bitrv208@plt>
jmp    136e <cftfsub+0x1ae>
cmpl   $0x8,-0x4(%rbp)
jne    1351 <cftfsub+0x191>
mov    -0x10(%rbp),%rdi
call   1060 <cftf040@plt>
jmp    1369 <cftfsub+0x1a9>
cmpl   $0x4,-0x4(%rbp)
jne    1364 <cftfsub+0x1a4>
mov    -0x10(%rbp),%rdi
call   10c0 <cftx020@plt>
jmp    1369 <cftfsub+0x1a9>
jmp    136e <cftfsub+0x1ae>
jmp    1373 <cftfsub+0x1b3>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cftfsub>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %ecx,%r12d
mov    %rsi,%r13
mov    %edi,%ebp
cmp    $0x21,%edi
jl     126d <cftfsub+0xad>
mov    %rdx,%r15
mov    %ebp,%ebx
shr    $0x2,%ebx
mov    %r12d,%eax
sub    %ebx,%eax
cltq
lea    (%r14,%rax,8),%rdx
mov    %ebp,%edi
mov    %r13,%rsi
call   10a0 <cftf1st@plt>
cmp    $0x201,%ebp
jb     12a0 <cftfsub+0xe0>
mov    %ebx,%edi
mov    %r13,%rsi
mov    %r12d,%edx
mov    %r14,%rcx
call   10b0 <cftrec1@plt>
mov    %ebx,%eax
lea    0x0(,%rax,8),%rsi
add    %r13,%rsi
mov    %ebx,%edi
mov    %r12d,%edx
mov    %r14,%rcx
call   1040 <cftrec2@plt>
lea    (%rbx,%rbx,1),%eax
lea    0x0(,%rax,8),%rsi
add    %r13,%rsi
mov    %ebx,%edi
mov    %r12d,%edx
mov    %r14,%rcx
call   10b0 <cftrec1@plt>
lea    (%rbx,%rbx,2),%eax
lea    0x0(,%rax,8),%rsi
add    %r13,%rsi
mov    %ebx,%edi
mov    %r12d,%edx
mov    %r14,%rcx
call   10b0 <cftrec1@plt>
jmp    1300 <cftfsub+0x140>
cmp    $0x9,%ebp
jl     12ba <cftfsub+0xfa>
cmp    $0x20,%ebp
jne    12da <cftfsub+0x11a>
movslq %r12d,%rax
lea    (%r14,%rax,8),%rsi
add    $0xffffffffffffffc0,%rsi
mov    %r13,%rdi
call   1030 <cftf161@plt>
mov    %r13,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <bitrv216@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r12d,%edx
mov    %r14,%rcx
cmp    $0x84,%ebp
jb     12fb <cftfsub+0x13b>
call   10e0 <cftexp1@plt>
jmp    1300 <cftfsub+0x140>
cmp    $0x4,%ebp
je     131b <cftfsub+0x15b>
cmp    $0x8,%ebp
jne    1331 <cftfsub+0x171>
mov    %r13,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <cftf040@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1050 <cftf081@plt>
mov    %r13,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10d0 <bitrv208@plt>
call   1080 <cftfx41@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r13,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <bitrv2@plt>
mov    %r13,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10c0 <cftx020@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @cftfsub(i32 %0, double* %1, i32* %2, i32 %3, double* %4) {
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca double*
%11 = alloca i32
store i32 %0, i32* %6
store double* %1, double** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store double* %4, double** %10
%12 = load i32, i32* %6
%13 = icmp sgt i32 %12, 32
br i1 %13, label %14, label %73
14: ; preds = %5
%15 = load i32, i32* %6
%16 = ashr i32 %15, 2
store i32 %16, i32* %11
%17 = load i32, i32* %6
%18 = load double*, double** %7
%19 = load double*, double** %10
%20 = load i32, i32* %9
%21 = load i32, i32* %11
%22 = sub nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %19, i64 %23
%25 = load i32, i32* %6
%26 = icmp sgt i32 %25, 512
br i1 %26, label %27, label %55
27: ; preds = %14
%28 = load i32, i32* %11
%29 = load double*, double** %7
%30 = load i32, i32* %9
%31 = load double*, double** %10
%32 = load i32, i32* %11
%33 = load double*, double** %7
%34 = load i32, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load i32, i32* %9
%38 = load double*, double** %10
%39 = load i32, i32* %11
%40 = load double*, double** %7
%41 = load i32, i32* %11
%42 = mul nsw i32 2, %41
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %40, i64 %43
%45 = load i32, i32* %9
%46 = load double*, double** %10
%47 = load i32, i32* %11
%48 = load double*, double** %7
%49 = load i32, i32* %11
%50 = mul nsw i32 3, %49
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds double, double* %48, i64 %51
%53 = load i32, i32* %9
%54 = load double*, double** %10
br label %69
55: ; preds = %14
%56 = load i32, i32* %11
%57 = icmp sgt i32 %56, 32
br i1 %57, label %58, label %63
58: ; preds = %55
%59 = load i32, i32* %6
%60 = load double*, double** %7
%61 = load i32, i32* %9
%62 = load double*, double** %10
br label %68
63: ; preds = %55
%64 = load i32, i32* %6
%65 = load double*, double** %7
%66 = load i32, i32* %9
%67 = load double*, double** %10
br label %68
68: ; preds = %63, %58
br label %69
69: ; preds = %68, %27
%70 = load i32, i32* %6
%71 = load i32*, i32** %8
%72 = load double*, double** %7
br label %105
73: ; preds = %5
%74 = load i32, i32* %6
%75 = icmp sgt i32 %74, 8
br i1 %75, label %76, label %92
76: ; preds = %73
%77 = load i32, i32* %6
%78 = icmp eq i32 %77, 32
br i1 %78, label %79, label %87
79: ; preds = %76
%80 = load double*, double** %7
%81 = load double*, double** %10
%82 = load i32, i32* %9
%83 = sub nsw i32 %82, 8
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %81, i64 %84
%86 = load double*, double** %7
br label %91
87: ; preds = %76
%88 = load double*, double** %7
%89 = load double*, double** %10
%90 = load double*, double** %7
br label %91
91: ; preds = %87, %79
br label %104
92: ; preds = %73
%93 = load i32, i32* %6
%94 = icmp eq i32 %93, 8
br i1 %94, label %95, label %97
95: ; preds = %92
%96 = load double*, double** %7
br label %103
97: ; preds = %92
%98 = load i32, i32* %6
%99 = icmp eq i32 %98, 4
br i1 %99, label %100, label %102
100: ; preds = %97
%101 = load double*, double** %7
br label %102
102: ; preds = %100, %97
br label %103
103: ; preds = %102, %95
br label %104
104: ; preds = %103, %91
br label %105
105: ; preds = %104, %69
ret void
}

LLVM IR (-O2):
define void @cftfsub(i32 %0, double* %1, i32* %2, i32 %3, double* %4) {
%6 = icmp sgt i32 %0, 32
br i1 %6, label %7, label %27
7: ; preds = %5
%8 = lshr i32 %0, 2
%9 = sub nsw i32 %3, %8
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %4, i64 %10
tail call void @cftf1st(i32 %0, double* %1, double* %11)
%12 = icmp ugt i32 %0, 512
br i1 %12, label %13, label %22
13: ; preds = %7
tail call void @cftrec1(i32 %8, double* %1, i32 %3, double* %4)
%14 = zext i32 %8 to i64
%15 = getelementptr inbounds double, double* %1, i64 %14
tail call void @cftrec2(i32 %8, double* %15, i32 %3, double* %4)
%16 = shl nuw nsw i32 %8, 1
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds double, double* %1, i64 %17
tail call void @cftrec1(i32 %8, double* %18, i32 %3, double* %4)
%19 = mul nuw nsw i32 %8, 3
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds double, double* %1, i64 %20
tail call void @cftrec1(i32 %8, double* %21, i32 %3, double* %4)
br label %26
22: ; preds = %7
%23 = icmp ugt i32 %0, 131
br i1 %23, label %24, label %25
24: ; preds = %22
tail call void @cftexp1(i32 %0, double* %1, i32 %3, double* %4)
br label %26
25: ; preds = %22
tail call void @cftfx41(i32 %0, double* %1, i32 %3, double* %4)
br label %26
26: ; preds = %24, %25, %13
tail call void @bitrv2(i32 %0, i32* %2, double* %1)
br label %39
27: ; preds = %5
%28 = icmp sgt i32 %0, 8
br i1 %28, label %29, label %36
29: ; preds = %27
%30 = icmp eq i32 %0, 32
br i1 %30, label %31, label %35
31: ; preds = %29
%32 = add nsw i32 %3, -8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %4, i64 %33
tail call void @cftf161(double* %1, double* %34)
tail call void @bitrv216(double* %1)
br label %39
35: ; preds = %29
tail call void @cftf081(double* %1, double* %4)
tail call void @bitrv208(double* %1)
br label %39
36: ; preds = %27
switch i32 %0, label %39 [
i32 8, label %37
i32 4, label %38
]
37: ; preds = %36
tail call void @cftf040(double* %1)
br label %39
38: ; preds = %36
tail call void @cftx020(double* %1)
br label %39
39: ; preds = %36, %35, %31, %38, %37, %26
ret void
}