void rdft(int n, int isgn, 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) {
      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] = ((double)0.5) * (a[0] - a[1]);
    a[0] -= a[1];
    if (n > 4) {
      rftbsub(n, a);
      cftbsub(n, a);
    } else if (n == 4) {
      cftbsub(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     11dc <rdft+0x9c>
cmpl   $0x4,-0x4(%rbp)
jle    1183 <rdft+0x43>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <cftfsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <rftfsub@plt>
jmp    119e <rdft+0x5e>
cmpl   $0x4,-0x4(%rbp)
jne    1199 <rdft+0x59>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <cftfsub@plt>
jmp    119e <rdft+0x5e>
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    1262 <rdft+0x122>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm1
movsd  0xe0b(%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    1242 <rdft+0x102>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <rftbsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <cftbsub@plt>
jmp    125d <rdft+0x11d>
cmpl   $0x4,-0x4(%rbp)
jne    1258 <rdft+0x118>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <cftbsub@plt>
jmp    125d <rdft+0x11d>
jmp    1262 <rdft+0x122>
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     1167 <rdft+0x27>
cmp    $0x5,%ebp
jl     119c <rdft+0x5c>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1060 <cftfsub@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <rftfsub@plt>
jmp    11ae <rdft+0x6e>
movsd  (%rbx),%xmm0
movapd %xmm0,%xmm1
subsd  0x8(%rbx),%xmm1
mulsd  0xe84(%rip),%xmm1
movsd  %xmm1,0x8(%rbx)
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rbx)
cmp    $0x5,%ebp
jl     11d3 <rdft+0x93>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <rftbsub@plt>
mov    %ebp,%edi
jmp    11dd <rdft+0x9d>
cmp    $0x4,%ebp
jne    11ae <rdft+0x6e>
mov    $0x4,%edi
mov    %rbx,%rsi
call   1060 <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    11cc <rdft+0x8c>
mov    $0x4,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <cftbsub@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 %43
10: ; preds = %3
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 4
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* %4
%15 = load double*, double** %6
%16 = load i32, i32* %4
%17 = load double*, double** %6
br label %25
18: ; preds = %10
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 4
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %4
%23 = load double*, double** %6
br label %24
24: ; preds = %21, %18
br label %25
25: ; preds = %24, %13
%26 = load double*, double** %6
%27 = getelementptr inbounds double, double* %26, i64 0
%28 = load double, double* %27
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 1
%31 = load double, double* %30
%32 = fsub double %28, %31
store double %32, double* %7
%33 = load double*, double** %6
%34 = getelementptr inbounds double, double* %33, i64 1
%35 = load double, double* %34
%36 = load double*, double** %6
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
%39 = fadd double %38, %35
store double %39, double* %37
%40 = load double, double* %7
%41 = load double*, double** %6
%42 = getelementptr inbounds double, double* %41, i64 1
store double %40, double* %42
br label %76
43: ; preds = %3
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 0
%46 = load double, double* %45
%47 = load double*, double** %6
%48 = getelementptr inbounds double, double* %47, i64 1
%49 = load double, double* %48
%50 = fsub double %46, %49
%51 = fmul double 5.000000e-01, %50
%52 = load double*, double** %6
%53 = getelementptr inbounds double, double* %52, i64 1
store double %51, double* %53
%54 = load double*, double** %6
%55 = getelementptr inbounds double, double* %54, i64 1
%56 = load double, double* %55
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 0
%59 = load double, double* %58
%60 = fsub double %59, %56
store double %60, double* %58
%61 = load i32, i32* %4
%62 = icmp sgt i32 %61, 4
br i1 %62, label %63, label %68
63: ; preds = %43
%64 = load i32, i32* %4
%65 = load double*, double** %6
%66 = load i32, i32* %4
%67 = load double*, double** %6
br label %75
68: ; preds = %43
%69 = load i32, i32* %4
%70 = icmp eq i32 %69, 4
br i1 %70, label %71, label %74
71: ; preds = %68
%72 = load i32, i32* %4
%73 = load double*, double** %6
br label %74
74: ; preds = %71, %68
br label %75
75: ; preds = %74, %63
br label %76
76: ; preds = %75, %25
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 @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 @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 @cftbsub(i32 4, double* %2)
br label %29
29: ; preds = %25, %28, %26, %11
ret void
}