void rdft(int n, int isgn, double *a) {
  void bitrv2(int n, double *a);
  void cftfsub(int n, double *a);
  void cftbsub(int n, double *a);
  void rftfsub(int n, double *a);
  void rftbsub(int n, double *a);
  double xi;
  if (isgn >= 0) {
    if (n > 4) {
      bitrv2(n, a);
      cftfsub(n, a);
      rftfsub(n, a);
    } else if (n == 4) {
      cftfsub(n, a);
    }
    xi = a[0] - a[1];
    a[0] += a[1];
    a[1] = xi;
  } else {
    a[1] = 0.5 * (a[0] - a[1]);
    a[0] -= a[1];
    if (n > 4) {
      rftbsub(n, a);
      bitrv2(n, a);
      cftbsub(n, a);
    } else if (n == 4) {
      cftfsub(n, a);
    }
  }
}


x86 assembly (clang, -O0):
<rdft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11f8 <rdft+0xa8>
cmpl   $0x4,-0x4(%rbp)
jle    119f <rdft+0x4f>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <bitrv2@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <cftfsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <rftfsub@plt>
jmp    11ba <rdft+0x6a>
cmpl   $0x4,-0x4(%rbp)
jne    11b5 <rdft+0x65>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <cftfsub@plt>
jmp    11ba <rdft+0x6a>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    128a <rdft+0x13a>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm1
movsd  0xdef(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
cmpl   $0x4,-0x4(%rbp)
jle    126a <rdft+0x11a>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <rftbsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <bitrv2@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <cftbsub@plt>
jmp    1285 <rdft+0x135>
cmpl   $0x4,-0x4(%rbp)
jne    1280 <rdft+0x130>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <cftfsub@plt>
jmp    1285 <rdft+0x135>
jmp    128a <rdft+0x13a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdft>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %edi,%ebp
test   %esi,%esi
js     1181 <rdft+0x31>
cmp    $0x5,%ebp
jl     11cc <rdft+0x7c>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <bitrv2@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <cftfsub@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <rftfsub@plt>
jmp    11de <rdft+0x8e>
movsd  (%rbx),%xmm0
movapd %xmm0,%xmm1
subsd  0x8(%rbx),%xmm1
mulsd  0xe6a(%rip),%xmm1
movsd  %xmm1,0x8(%rbx)
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
cmp    $0x5,%ebp
jl     1203 <rdft+0xb3>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <rftbsub@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <bitrv2@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <cftbsub@plt>
cmp    $0x4,%ebp
jne    11de <rdft+0x8e>
mov    $0x4,%edi
mov    %rbx,%rsi
call   1070 <cftfsub@plt>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
movsd  %xmm2,0x8(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
cmp    $0x4,%ebp
jne    11fc <rdft+0xac>
mov    $0x4,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <cftfsub@plt>

LLVM IR (-O0):
define void @rdft(i32 %0, i32 %1, double* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double*
%7 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store double* %2, double** %6
%8 = load i32, i32* %5
%9 = icmp sge i32 %8, 0
br i1 %9, label %10, label %45
10: ; preds = %3
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 4
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %4
%15 = load double*, double** %6
%16 = load i32, i32* %4
%17 = load double*, double** %6
%18 = load i32, i32* %4
%19 = load double*, double** %6
br label %27
20: ; preds = %10
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 4
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* %4
%25 = load double*, double** %6
br label %26
26: ; preds = %23, %20
br label %27
27: ; preds = %26, %13
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 0
%30 = load double, double* %29
%31 = load double*, double** %6
%32 = getelementptr inbounds double, double* %31, i64 1
%33 = load double, double* %32
%34 = fsub double %30, %33
store double %34, double* %7
%35 = load double*, double** %6
%36 = getelementptr inbounds double, double* %35, i64 1
%37 = load double, double* %36
%38 = load double*, double** %6
%39 = getelementptr inbounds double, double* %38, i64 0
%40 = load double, double* %39
%41 = fadd double %40, %37
store double %41, double* %39
%42 = load double, double* %7
%43 = load double*, double** %6
%44 = getelementptr inbounds double, double* %43, i64 1
store double %42, double* %44
br label %80
45: ; preds = %3
%46 = load double*, double** %6
%47 = getelementptr inbounds double, double* %46, i64 0
%48 = load double, double* %47
%49 = load double*, double** %6
%50 = getelementptr inbounds double, double* %49, i64 1
%51 = load double, double* %50
%52 = fsub double %48, %51
%53 = fmul double 5.000000e-01, %52
%54 = load double*, double** %6
%55 = getelementptr inbounds double, double* %54, i64 1
store double %53, double* %55
%56 = load double*, double** %6
%57 = getelementptr inbounds double, double* %56, i64 1
%58 = load double, double* %57
%59 = load double*, double** %6
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = fsub double %61, %58
store double %62, double* %60
%63 = load i32, i32* %4
%64 = icmp sgt i32 %63, 4
br i1 %64, label %65, label %72
65: ; preds = %45
%66 = load i32, i32* %4
%67 = load double*, double** %6
%68 = load i32, i32* %4
%69 = load double*, double** %6
%70 = load i32, i32* %4
%71 = load double*, double** %6
br label %79
72: ; preds = %45
%73 = load i32, i32* %4
%74 = icmp eq i32 %73, 4
br i1 %74, label %75, label %78
75: ; preds = %72
%76 = load i32, i32* %4
%77 = load double*, double** %6
br label %78
78: ; preds = %75, %72
br label %79
79: ; preds = %78, %65
br label %80
80: ; preds = %79, %27
ret void
}

LLVM IR (-O2):
define void @rdft(i32 %0, i32 %1, double* %2) {
%4 = icmp sgt i32 %1, -1
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = icmp sgt i32 %0, 4
br i1 %6, label %7, label %8
7: ; preds = %5
tail call void @bitrv2(i32 %0, double* %2)
tail call void @cftfsub(i32 %0, double* %2)
tail call void @rftfsub(i32 %0, double* %2)
br label %11
8: ; preds = %5
%9 = icmp eq i32 %0, 4
br i1 %9, label %10, label %11
10: ; preds = %8
tail call void @cftfsub(i32 4, double* %2)
br label %11
11: ; preds = %8, %10, %7
%12 = load double, double* %2
%13 = getelementptr inbounds double, double* %2, i64 1
%14 = load double, double* %13
%15 = fsub double %12, %14
%16 = fadd double %12, %14
store double %16, double* %2
store double %15, double* %13
br label %29
17: ; preds = %3
%18 = load double, double* %2
%19 = getelementptr inbounds double, double* %2, i64 1
%20 = load double, double* %19
%21 = fsub double %18, %20
%22 = fmul double %21, 5.000000e-01
store double %22, double* %19
%23 = fsub double %18, %22
store double %23, double* %2
%24 = icmp sgt i32 %0, 4
br i1 %24, label %25, label %26
25: ; preds = %17
tail call void @rftbsub(i32 %0, double* %2)
tail call void @bitrv2(i32 %0, double* %2)
tail call void @cftbsub(i32 %0, double* %2)
br label %29
26: ; preds = %17
%27 = icmp eq i32 %0, 4
br i1 %27, label %28, label %29
28: ; preds = %26
tail call void @cftfsub(i32 4, double* %2)
br label %29
29: ; preds = %25, %28, %26, %11
ret void
}