void rdft(int n, int isgn, double *a, int *ip, double *w) {
  void makewt(int nw, int *ip, double *w);
  void makect(int nc, int *ip, double *c);
  void cftfsub(int n, double *a, int *ip, int nw, double *w);
  void cftbsub(int n, double *a, int *ip, int nw, double *w);
  void rftfsub(int n, double *a, int nc, double *c);
  void rftbsub(int n, double *a, int nc, double *c);
  int nw, nc;
  double xi;
  nw = ip[0];
  if (n > (nw << 2)) {
    nw = n >> 2;
    makewt(nw, ip, w);
  }
  nc = ip[1];
  if (n > (nc << 2)) {
    nc = n >> 2;
    makect(nc, ip, w + nw);
  }
  if (isgn >= 0) {
    if (n > 4) {
      cftfsub(n, a, ip + 2, nw, w);
      rftfsub(n, a, nc, w + nw);
    } else if (n == 4) {
      cftfsub(n, a, ip + 2, nw, w);
    }
    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, nc, w + nw);
      cftbsub(n, a, ip + 2, nw, w);
    } else if (n == 4) {
      cftbsub(n, a, ip + 2, nw, w);
    }
  }
}


x86 assembly (clang, -O0):
<rdft>:
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    11ad <rdft+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>
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x28(%rbp),%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jle    11ec <rdft+0x8c>
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdx
call   1070 <makect@plt>
cmpl   $0x0,-0x8(%rbp)
jl     12a6 <rdft+0x146>
cmpl   $0x4,-0x4(%rbp)
jle    123e <rdft+0xde>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1080 <cftfsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    -0x20(%rbp),%rcx
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
call   1040 <rftfsub@plt>
jmp    1268 <rdft+0x108>
cmpl   $0x4,-0x4(%rbp)
jne    1263 <rdft+0x103>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1080 <cftfsub@plt>
jmp    1268 <rdft+0x108>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    135c <rdft+0x1fc>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm1
movsd  0xd41(%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    132d <rdft+0x1cd>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%edx
mov    -0x20(%rbp),%rcx
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
call   1060 <rftbsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1050 <cftbsub@plt>
jmp    1357 <rdft+0x1f7>
cmpl   $0x4,-0x4(%rbp)
jne    1352 <rdft+0x1f2>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x8,%rdx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
call   1050 <cftbsub@plt>
jmp    1357 <rdft+0x1f7>
jmp    135c <rdft+0x1fc>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdft>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r13
mov    %rdx,%r15
mov    %esi,%r14d
mov    %edi,%ebp
mov    (%rcx),%r12d
lea    0x0(,%r12,4),%eax
cmp    %edi,%eax
jge    11a0 <rdft+0x40>
mov    %ebp,%r12d
sar    $0x2,%r12d
mov    %r12d,%edi
mov    %r13,%rsi
mov    %r8,%rdx
mov    %r8,%rbx
call   1030 <makewt@plt>
mov    %rbx,%r8
mov    0x4(%r13),%ebx
lea    0x0(,%rbx,4),%eax
cmp    %ebp,%eax
jge    11d5 <rdft+0x75>
mov    %ebp,%ebx
sar    $0x2,%ebx
movslq %r12d,%rax
lea    (%r8,%rax,8),%rdx
mov    %ebx,%edi
mov    %r13,%rsi
mov    %r14d,0x4(%rsp)
mov    %r8,%r14
call   1070 <makect@plt>
mov    %r14,%r8
mov    0x4(%rsp),%r14d
test   %r14d,%r14d
js     120f <rdft+0xaf>
cmp    $0x5,%ebp
jl     1264 <rdft+0x104>
add    $0x8,%r13
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    %r8,%r14
call   1080 <cftfsub@plt>
movslq %r12d,%rax
lea    (%r14,%rax,8),%rcx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %ebx,%edx
call   1040 <rftfsub@plt>
jmp    1280 <rdft+0x120>
movsd  (%r15),%xmm0
movapd %xmm0,%xmm1
subsd  0x8(%r15),%xmm1
mulsd  0xdda(%rip),%xmm1
movsd  %xmm1,0x8(%r15)
subsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
cmp    $0x5,%ebp
jl     12b1 <rdft+0x151>
movslq %r12d,%rax
lea    (%r8,%rax,8),%rcx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %ebx,%edx
mov    %r8,%rbx
call   1060 <rftbsub@plt>
add    $0x8,%r13
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12d,%ecx
mov    %rbx,%r8
jmp    12c8 <rdft+0x168>
cmp    $0x4,%ebp
jne    1280 <rdft+0x120>
add    $0x8,%r13
mov    $0x4,%edi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12d,%ecx
call   1080 <cftfsub@plt>
movsd  (%r15),%xmm0
movsd  0x8(%r15),%xmm1
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
movsd  %xmm2,0x8(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x4,%ebp
jne    12a2 <rdft+0x142>
add    $0x8,%r13
mov    $0x4,%edi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <cftbsub@plt>

LLVM IR (-O0):
define void @rdft(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
%12 = alloca i32
%13 = alloca double
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
%14 = load i32*, i32** %9
%15 = getelementptr inbounds i32, i32* %14, i64 0
%16 = load i32, i32* %15
store i32 %16, i32* %11
%17 = load i32, i32* %6
%18 = load i32, i32* %11
%19 = shl i32 %18, 2
%20 = icmp sgt i32 %17, %19
br i1 %20, label %21, label %27
21: ; preds = %5
%22 = load i32, i32* %6
%23 = ashr i32 %22, 2
store i32 %23, i32* %11
%24 = load i32, i32* %11
%25 = load i32*, i32** %9
%26 = load double*, double** %10
br label %27
27: ; preds = %21, %5
%28 = load i32*, i32** %9
%29 = getelementptr inbounds i32, i32* %28, i64 1
%30 = load i32, i32* %29
store i32 %30, i32* %12
%31 = load i32, i32* %6
%32 = load i32, i32* %12
%33 = shl i32 %32, 2
%34 = icmp sgt i32 %31, %33
br i1 %34, label %35, label %44
35: ; preds = %27
%36 = load i32, i32* %6
%37 = ashr i32 %36, 2
store i32 %37, i32* %12
%38 = load i32, i32* %12
%39 = load i32*, i32** %9
%40 = load double*, double** %10
%41 = load i32, i32* %11
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
br label %44
44: ; preds = %35, %27
%45 = load i32, i32* %7
%46 = icmp sge i32 %45, 0
br i1 %46, label %47, label %93
47: ; preds = %44
%48 = load i32, i32* %6
%49 = icmp sgt i32 %48, 4
br i1 %49, label %50, label %64
50: ; preds = %47
%51 = load i32, i32* %6
%52 = load double*, double** %8
%53 = load i32*, i32** %9
%54 = getelementptr inbounds i32, i32* %53, i64 2
%55 = load i32, i32* %11
%56 = load double*, double** %10
%57 = load i32, i32* %6
%58 = load double*, double** %8
%59 = load i32, i32* %12
%60 = load double*, double** %10
%61 = load i32, i32* %11
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
br label %75
64: ; preds = %47
%65 = load i32, i32* %6
%66 = icmp eq i32 %65, 4
br i1 %66, label %67, label %74
67: ; preds = %64
%68 = load i32, i32* %6
%69 = load double*, double** %8
%70 = load i32*, i32** %9
%71 = getelementptr inbounds i32, i32* %70, i64 2
%72 = load i32, i32* %11
%73 = load double*, double** %10
br label %74
74: ; preds = %67, %64
br label %75
75: ; preds = %74, %50
%76 = load double*, double** %8
%77 = getelementptr inbounds double, double* %76, i64 0
%78 = load double, double* %77
%79 = load double*, double** %8
%80 = getelementptr inbounds double, double* %79, i64 1
%81 = load double, double* %80
%82 = fsub double %78, %81
store double %82, double* %13
%83 = load double*, double** %8
%84 = getelementptr inbounds double, double* %83, i64 1
%85 = load double, double* %84
%86 = load double*, double** %8
%87 = getelementptr inbounds double, double* %86, i64 0
%88 = load double, double* %87
%89 = fadd double %88, %85
store double %89, double* %87
%90 = load double, double* %13
%91 = load double*, double** %8
%92 = getelementptr inbounds double, double* %91, i64 1
store double %90, double* %92
br label %139
93: ; preds = %44
%94 = load double*, double** %8
%95 = getelementptr inbounds double, double* %94, i64 0
%96 = load double, double* %95
%97 = load double*, double** %8
%98 = getelementptr inbounds double, double* %97, i64 1
%99 = load double, double* %98
%100 = fsub double %96, %99
%101 = fmul double 5.000000e-01, %100
%102 = load double*, double** %8
%103 = getelementptr inbounds double, double* %102, i64 1
store double %101, double* %103
%104 = load double*, double** %8
%105 = getelementptr inbounds double, double* %104, i64 1
%106 = load double, double* %105
%107 = load double*, double** %8
%108 = getelementptr inbounds double, double* %107, i64 0
%109 = load double, double* %108
%110 = fsub double %109, %106
store double %110, double* %108
%111 = load i32, i32* %6
%112 = icmp sgt i32 %111, 4
br i1 %112, label %113, label %127
113: ; preds = %93
%114 = load i32, i32* %6
%115 = load double*, double** %8
%116 = load i32, i32* %12
%117 = load double*, double** %10
%118 = load i32, i32* %11
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %117, i64 %119
%121 = load i32, i32* %6
%122 = load double*, double** %8
%123 = load i32*, i32** %9
%124 = getelementptr inbounds i32, i32* %123, i64 2
%125 = load i32, i32* %11
%126 = load double*, double** %10
br label %138
127: ; preds = %93
%128 = load i32, i32* %6
%129 = icmp eq i32 %128, 4
br i1 %129, label %130, label %137
130: ; preds = %127
%131 = load i32, i32* %6
%132 = load double*, double** %8
%133 = load i32*, i32** %9
%134 = getelementptr inbounds i32, i32* %133, i64 2
%135 = load i32, i32* %11
%136 = load double*, double** %10
br label %137
137: ; preds = %130, %127
br label %138
138: ; preds = %137, %113
br label %139
139: ; preds = %138, %75
ret void
}

LLVM IR (-O2):
define void @rdft(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 = getelementptr inbounds i32, i32* %3, i64 1
%14 = load i32, i32* %13
%15 = shl i32 %14, 2
%16 = icmp slt i32 %15, %0
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = ashr i32 %0, 2
%19 = sext i32 %12 to i64
%20 = getelementptr inbounds double, double* %4, i64 %19
tail call void @makect(i32 %18, i32* %3, double* %20)
br label %21
21: ; preds = %17, %11
%22 = phi i32 [ %18, %17 ], [ %14, %11 ]
%23 = icmp sgt i32 %1, -1
br i1 %23, label %24, label %40
24: ; preds = %21
%25 = icmp sgt i32 %0, 4
br i1 %25, label %26, label %30
26: ; preds = %24
%27 = getelementptr inbounds i32, i32* %3, i64 2
tail call void @cftfsub(i32 %0, double* %2, i32* %27, i32 %12, double* %4)
%28 = sext i32 %12 to i64
%29 = getelementptr inbounds double, double* %4, i64 %28
tail call void @rftfsub(i32 %0, double* %2, i32 %22, double* %29)
br label %34
30: ; preds = %24
%31 = icmp eq i32 %0, 4
br i1 %31, label %32, label %34
32: ; preds = %30
%33 = getelementptr inbounds i32, i32* %3, i64 2
tail call void @cftfsub(i32 4, double* %2, i32* %33, i32 %12, double* %4)
br label %34
34: ; preds = %30, %32, %26
%35 = load double, double* %2
%36 = getelementptr inbounds double, double* %2, i64 1
%37 = load double, double* %36
%38 = fsub double %35, %37
%39 = fadd double %35, %37
store double %39, double* %2
store double %38, double* %36
br label %56
40: ; preds = %21
%41 = load double, double* %2
%42 = getelementptr inbounds double, double* %2, i64 1
%43 = load double, double* %42
%44 = fsub double %41, %43
%45 = fmul double %44, 5.000000e-01
store double %45, double* %42
%46 = fsub double %41, %45
store double %46, double* %2
%47 = icmp sgt i32 %0, 4
br i1 %47, label %48, label %52
48: ; preds = %40
%49 = sext i32 %12 to i64
%50 = getelementptr inbounds double, double* %4, i64 %49
tail call void @rftbsub(i32 %0, double* %2, i32 %22, double* %50)
%51 = getelementptr inbounds i32, i32* %3, i64 2
tail call void @cftbsub(i32 %0, double* %2, i32* %51, i32 %12, double* %4)
br label %56
52: ; preds = %40
%53 = icmp eq i32 %0, 4
br i1 %53, label %54, label %56
54: ; preds = %52
%55 = getelementptr inbounds i32, i32* %3, i64 2
tail call void @cftbsub(i32 4, double* %2, i32* %55, i32 %12, double* %4)
br label %56
56: ; preds = %48, %54, %52, %34
ret void
}