void cftrec2(int n, double *a, int nw, double *w) {
  void cftrec1(int n, double *a, int nw, double *w);
  void cftrec2(int n, double *a, int nw, double *w);
  void cftmdl2(int n, double *a, double *w);
  void cftexp2(int n, double *a, int nw, double *w);
  int m;
  m = n >> 2;
  cftmdl2(n, a, &w[nw - n]);
  if (n > 512) {
    cftrec1(m, a, nw, w);
    cftrec2(m, &a[m], nw, w);
    cftrec1(m, &a[2 * m], nw, w);
    cftrec2(m, &a[3 * m], nw, w);
  } else {
    cftexp2(n, a, nw, w);
  }
}


x86 assembly (clang, -O0):
<cftrec2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x14(%rbp),%eax
sub    -0x4(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   1030 <cftmdl2@plt>
cmpl   $0x200,-0x4(%rbp)
jle    1203 <cftrec2+0xc3>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1060 <cftrec1@plt>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1040 <cftrec2@plt>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1060 <cftrec1@plt>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
imul   $0x3,-0x24(%rbp),%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1040 <cftrec2@plt>
jmp    1216 <cftrec2+0xd6>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
call   1050 <cftexp2@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cftrec2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r15d
mov    %rsi,%r13
mov    %edi,%r12d
mov    %edx,%eax
sub    %edi,%eax
cltq
lea    (%rcx,%rax,8),%rdx
call   1030 <cftmdl2@plt>
cmp    $0x201,%r12d
jl     11f8 <cftrec2+0xb8>
mov    %r12d,%ebp
cs nopw 0x0(%rax,%rax,1)
sar    $0x2,%ebp
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
call   1060 <cftrec1@plt>
movslq %ebp,%rbx
lea    0x0(,%rbx,8),%rsi
add    %r13,%rsi
mov    %ebx,%edi
mov    %r15d,%edx
mov    %r14,%rcx
call   1040 <cftrec2@plt>
lea    (%rbx,%rbx,1),%eax
cltq
lea    0x0(,%rax,8),%rsi
add    %r13,%rsi
mov    %ebx,%edi
mov    %r15d,%edx
mov    %r14,%rcx
call   1060 <cftrec1@plt>
lea    (%rbx,%rbx,2),%eax
cltq
lea    0x0(%r13,%rax,8),%r13
mov    %r15d,%eax
sub    %ebx,%eax
cltq
lea    (%r14,%rax,8),%rdx
mov    %ebx,%edi
mov    %r13,%rsi
call   1030 <cftmdl2@plt>
cmp    $0x803,%r12d
mov    %ebp,%r12d
jg     1180 <cftrec2+0x40>
jmp    11fb <cftrec2+0xbb>
mov    %r12d,%ebp
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <cftexp2@plt>

LLVM IR (-O0):
define void @cftrec2(i32 %0, double* %1, i32 %2, double* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca i32
%8 = alloca double*
%9 = alloca i32
store i32 %0, i32* %5
store double* %1, double** %6
store i32 %2, i32* %7
store double* %3, double** %8
%10 = load i32, i32* %5
%11 = ashr i32 %10, 2
store i32 %11, i32* %9
%12 = load i32, i32* %5
%13 = load double*, double** %6
%14 = load double*, double** %8
%15 = load i32, i32* %7
%16 = load i32, i32* %5
%17 = sub nsw i32 %15, %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %14, i64 %18
%20 = load i32, i32* %5
%21 = icmp sgt i32 %20, 512
br i1 %21, label %22, label %50
22: ; preds = %4
%23 = load i32, i32* %9
%24 = load double*, double** %6
%25 = load i32, i32* %7
%26 = load double*, double** %8
%27 = load i32, i32* %9
%28 = load double*, double** %6
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load i32, i32* %7
%33 = load double*, double** %8
%34 = load i32, i32* %9
%35 = load double*, double** %6
%36 = load i32, i32* %9
%37 = mul nsw i32 2, %36
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %35, i64 %38
%40 = load i32, i32* %7
%41 = load double*, double** %8
%42 = load i32, i32* %9
%43 = load double*, double** %6
%44 = load i32, i32* %9
%45 = mul nsw i32 3, %44
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %43, i64 %46
%48 = load i32, i32* %7
%49 = load double*, double** %8
br label %55
50: ; preds = %4
%51 = load i32, i32* %5
%52 = load double*, double** %6
%53 = load i32, i32* %7
%54 = load double*, double** %8
br label %55
55: ; preds = %50, %22
ret void
}

LLVM IR (-O2):
define void @cftrec2(i32 %0, double* %1, i32 %2, double* %3) {
%5 = sub nsw i32 %2, %0
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds double, double* %3, i64 %6
tail call void @cftmdl2(i32 %0, double* %1, double* %7)
%8 = icmp sgt i32 %0, 512
br i1 %8, label %9, label %25
9: ; preds = %4, %9
%10 = phi i32 [ %12, %9 ], [ %0, %4 ]
%11 = phi double* [ %20, %9 ], [ %1, %4 ]
%12 = ashr i32 %10, 2
tail call void @cftrec1(i32 %12, double* %11, i32 %2, double* %3)
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %11, i64 %13
tail call void @cftrec2(i32 %12, double* %14, i32 %2, double* %3)
%15 = shl nsw i32 %12, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %11, i64 %16
tail call void @cftrec1(i32 %12, double* %17, i32 %2, double* %3)
%18 = mul nsw i32 %12, 3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %11, i64 %19
%21 = sub nsw i32 %2, %12
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds double, double* %3, i64 %22
tail call void @cftmdl2(i32 %12, double* %20, double* %23)
%24 = icmp sgt i32 %10, 2051
br i1 %24, label %9, label %25
25: ; preds = %9, %4
%26 = phi i32 [ %0, %4 ], [ %12, %9 ]
%27 = phi double* [ %1, %4 ], [ %20, %9 ]
tail call void @cftexp2(i32 %26, double* %27, i32 %2, double* %3)
ret void
}