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 bitrv2(int n, int *ip, double *a);
  void cftfsub(int n, double *a, double *w);
  void cftbsub(int n, double *a, 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) {
      bitrv2(n, ip + 2, a);
      cftfsub(n, a, w);
      rftfsub(n, a, nc, w + nw);
    } else if (n == 4) {
      cftfsub(n, a, 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);
      bitrv2(n, ip + 2, a);
      cftbsub(n, a, w);
    } else if (n == 4) {
      cftfsub(n, a, 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    11bd <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    11fc <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   1080 <makect@plt>
cmpl   $0x0,-0x8(%rbp)
jl     12b4 <rdft+0x144>
cmpl   $0x4,-0x4(%rbp)
jle    1257 <rdft+0xe7>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x10(%rbp),%rdx
call   1050 <bitrv2@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <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    1276 <rdft+0x106>
cmpl   $0x4,-0x4(%rbp)
jne    1271 <rdft+0x101>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <cftfsub@plt>
jmp    1276 <rdft+0x106>
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    1368 <rdft+0x1f8>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm1
movsd  0xd33(%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    1344 <rdft+0x1d4>
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   1070 <rftbsub@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
mov    -0x10(%rbp),%rdx
call   1050 <bitrv2@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <cftbsub@plt>
jmp    1363 <rdft+0x1f3>
cmpl   $0x4,-0x4(%rbp)
jne    135e <rdft+0x1ee>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <cftfsub@plt>
jmp    1363 <rdft+0x1f3>
jmp    1368 <rdft+0x1f8>
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    %r8,(%rsp)
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %esi,%r14d
mov    %edi,%ebp
mov    (%rcx),%r12d
lea    0x0(,%r12,4),%eax
cmp    %edi,%eax
jge    11af <rdft+0x3f>
mov    %ebp,%r12d
sar    $0x2,%r12d
mov    %r12d,%edi
mov    %rbx,%rsi
mov    (%rsp),%rdx
call   1030 <makewt@plt>
mov    0x4(%rbx),%r13d
lea    0x0(,%r13,4),%eax
cmp    %ebp,%eax
jge    11dc <rdft+0x6c>
mov    %ebp,%r13d
sar    $0x2,%r13d
movslq %r12d,%rax
mov    (%rsp),%rcx
lea    (%rcx,%rax,8),%rdx
mov    %r13d,%edi
mov    %rbx,%rsi
call   1080 <makect@plt>
test   %r14d,%r14d
js     1225 <rdft+0xb5>
cmp    $0x5,%ebp
jl     1298 <rdft+0x128>
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <bitrv2@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    (%rsp),%rbx
mov    %rbx,%rdx
call   1090 <cftfsub@plt>
movslq %r12d,%rax
lea    (%rbx,%rax,8),%rcx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r13d,%edx
call   1040 <rftfsub@plt>
jmp    12ae <rdft+0x13e>
movsd  (%r15),%xmm0
movapd %xmm0,%xmm1
subsd  0x8(%r15),%xmm1
mulsd  0xdc4(%rip),%xmm1
movsd  %xmm1,0x8(%r15)
subsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
cmp    $0x5,%ebp
jl     12df <rdft+0x16f>
movslq %r12d,%rax
mov    (%rsp),%r14
lea    (%r14,%rax,8),%rcx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r13d,%edx
call   1070 <rftbsub@plt>
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <bitrv2@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <cftbsub@plt>
cmp    $0x4,%ebp
jne    12ae <rdft+0x13e>
mov    $0x4,%edi
mov    %r15,%rsi
mov    (%rsp),%rdx
call   1090 <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    12d0 <rdft+0x160>
mov    $0x4,%edi
mov    %r15,%rsi
mov    (%rsp),%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <cftfsub@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 %91
47: ; preds = %44
%48 = load i32, i32* %6
%49 = icmp sgt i32 %48, 4
br i1 %49, label %50, label %65
50: ; preds = %47
%51 = load i32, i32* %6
%52 = load i32*, i32** %9
%53 = getelementptr inbounds i32, i32* %52, i64 2
%54 = load double*, double** %8
%55 = load i32, i32* %6
%56 = load double*, double** %8
%57 = load double*, double** %10
%58 = load i32, i32* %6
%59 = load double*, double** %8
%60 = load i32, i32* %12
%61 = load double*, double** %10
%62 = load i32, i32* %11
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
br label %73
65: ; preds = %47
%66 = load i32, i32* %6
%67 = icmp eq i32 %66, 4
br i1 %67, label %68, label %72
68: ; preds = %65
%69 = load i32, i32* %6
%70 = load double*, double** %8
%71 = load double*, double** %10
br label %72
72: ; preds = %68, %65
br label %73
73: ; preds = %72, %50
%74 = load double*, double** %8
%75 = getelementptr inbounds double, double* %74, i64 0
%76 = load double, double* %75
%77 = load double*, double** %8
%78 = getelementptr inbounds double, double* %77, i64 1
%79 = load double, double* %78
%80 = fsub double %76, %79
store double %80, double* %13
%81 = load double*, double** %8
%82 = getelementptr inbounds double, double* %81, i64 1
%83 = load double, double* %82
%84 = load double*, double** %8
%85 = getelementptr inbounds double, double* %84, i64 0
%86 = load double, double* %85
%87 = fadd double %86, %83
store double %87, double* %85
%88 = load double, double* %13
%89 = load double*, double** %8
%90 = getelementptr inbounds double, double* %89, i64 1
store double %88, double* %90
br label %135
91: ; preds = %44
%92 = load double*, double** %8
%93 = getelementptr inbounds double, double* %92, i64 0
%94 = load double, double* %93
%95 = load double*, double** %8
%96 = getelementptr inbounds double, double* %95, i64 1
%97 = load double, double* %96
%98 = fsub double %94, %97
%99 = fmul double 5.000000e-01, %98
%100 = load double*, double** %8
%101 = getelementptr inbounds double, double* %100, i64 1
store double %99, double* %101
%102 = load double*, double** %8
%103 = getelementptr inbounds double, double* %102, i64 1
%104 = load double, double* %103
%105 = load double*, double** %8
%106 = getelementptr inbounds double, double* %105, i64 0
%107 = load double, double* %106
%108 = fsub double %107, %104
store double %108, double* %106
%109 = load i32, i32* %6
%110 = icmp sgt i32 %109, 4
br i1 %110, label %111, label %126
111: ; preds = %91
%112 = load i32, i32* %6
%113 = load double*, double** %8
%114 = load i32, i32* %12
%115 = load double*, double** %10
%116 = load i32, i32* %11
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %115, i64 %117
%119 = load i32, i32* %6
%120 = load i32*, i32** %9
%121 = getelementptr inbounds i32, i32* %120, i64 2
%122 = load double*, double** %8
%123 = load i32, i32* %6
%124 = load double*, double** %8
%125 = load double*, double** %10
br label %134
126: ; preds = %91
%127 = load i32, i32* %6
%128 = icmp eq i32 %127, 4
br i1 %128, label %129, label %133
129: ; preds = %126
%130 = load i32, i32* %6
%131 = load double*, double** %8
%132 = load double*, double** %10
br label %133
133: ; preds = %129, %126
br label %134
134: ; preds = %133, %111
br label %135
135: ; preds = %134, %73
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 %39
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 @bitrv2(i32 %0, i32* %27, double* %2)
tail call void @cftfsub(i32 %0, double* %2, 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 %33
30: ; preds = %24
%31 = icmp eq i32 %0, 4
br i1 %31, label %32, label %33
32: ; preds = %30
tail call void @cftfsub(i32 4, double* %2, double* %4)
br label %33
33: ; preds = %30, %32, %26
%34 = load double, double* %2
%35 = getelementptr inbounds double, double* %2, i64 1
%36 = load double, double* %35
%37 = fsub double %34, %36
%38 = fadd double %34, %36
store double %38, double* %2
store double %37, double* %35
br label %54
39: ; preds = %21
%40 = load double, double* %2
%41 = getelementptr inbounds double, double* %2, i64 1
%42 = load double, double* %41
%43 = fsub double %40, %42
%44 = fmul double %43, 5.000000e-01
store double %44, double* %41
%45 = fsub double %40, %44
store double %45, double* %2
%46 = icmp sgt i32 %0, 4
br i1 %46, label %47, label %51
47: ; preds = %39
%48 = sext i32 %12 to i64
%49 = getelementptr inbounds double, double* %4, i64 %48
tail call void @rftbsub(i32 %0, double* %2, i32 %22, double* %49)
%50 = getelementptr inbounds i32, i32* %3, i64 2
tail call void @bitrv2(i32 %0, i32* %50, double* %2)
tail call void @cftbsub(i32 %0, double* %2, double* %4)
br label %54
51: ; preds = %39
%52 = icmp eq i32 %0, 4
br i1 %52, label %53, label %54
53: ; preds = %51
tail call void @cftfsub(i32 4, double* %2, double* %4)
br label %54
54: ; preds = %47, %53, %51, %33
ret void
}