#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ permute(int, int, int *, int *, double *, double *, double *,
                           double *);
int /*<<< orphan*/ transTableSetup(int *, int *, int *, int *, int *);
int /*<<< orphan*/ transf(int, int, int, double *, double *);
int /*<<< orphan*/ twiddleTransf(int, int, int, double *, double *);
void fft(int n, double xRe[], double xIm[], double yRe[], double yIm[]) {
  int sofarRadix[20], actualRadix[20], remainRadix[20];
  int nFactor;
  int count;
  transTableSetup(sofarRadix, actualRadix, remainRadix, &nFactor, &n);
  permute(n, nFactor, actualRadix, remainRadix, xRe, xIm, yRe, yIm);
  transf(sofarRadix[1], actualRadix[1], remainRadix[1], yRe, yIm);
  if (nFactor > 1)
    for (count = 2; count <= nFactor; count++)
      twiddleTransf(sofarRadix[count], actualRadix[count], remainRadix[count],
                    yRe, yIm);
}


x86 assembly (clang, -O0):
<fft>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0x80(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
lea    -0x120(%rbp),%rdx
lea    -0x124(%rbp),%rcx
lea    -0x4(%rbp),%r8
call   1060 <transTableSetup@plt>
mov    -0x4(%rbp),%edi
mov    -0x124(%rbp),%esi
lea    -0xd0(%rbp),%rdx
lea    -0x120(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
mov    -0x28(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <permute@plt>
mov    -0x7c(%rbp),%edi
mov    -0xcc(%rbp),%esi
mov    -0x11c(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1050 <transf@plt>
cmpl   $0x1,-0x124(%rbp)
jle    1247 <fft+0x107>
movl   $0x2,-0x128(%rbp)
mov    -0x128(%rbp),%eax
cmp    -0x124(%rbp),%eax
jg     1242 <fft+0x102>
movslq -0x128(%rbp),%rax
mov    -0x80(%rbp,%rax,4),%edi
movslq -0x128(%rbp),%rax
mov    -0xd0(%rbp,%rax,4),%esi
movslq -0x128(%rbp),%rax
mov    -0x120(%rbp,%rax,4),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <twiddleTransf@plt>
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    11e8 <fft+0xa8>
jmp    1247 <fft+0x107>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fft>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %rsi,%r12
mov    %edi,0xc(%rsp)
lea    0xb0(%rsp),%rdi
lea    0x60(%rsp),%r13
lea    0x10(%rsp),%rbp
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %r13,%rsi
mov    %rbp,%rdx
call   1060 <transTableSetup@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %r13,%rdx
mov    %rbp,%rcx
mov    %r12,%r8
mov    %r15,%r9
push   %r14
push   %rbx
call   1040 <permute@plt>
add    $0x10,%rsp
mov    0xb4(%rsp),%edi
mov    0x64(%rsp),%esi
mov    0x14(%rsp),%edx
mov    %rbx,%rcx
mov    %r14,%r8
call   1050 <transf@plt>
cmpl   $0x2,0x8(%rsp)
jl     11f8 <fft+0xb8>
mov    $0x1,%ebp
xchg   %ax,%ax
mov    0xb4(%rsp,%rbp,4),%edi
mov    0x64(%rsp,%rbp,4),%esi
mov    0x14(%rsp,%rbp,4),%edx
mov    %rbx,%rcx
mov    %r14,%r8
call   1030 <twiddleTransf@plt>
movslq 0x8(%rsp),%rax
add    $0x1,%rbp
cmp    %rax,%rbp
jl     11d0 <fft+0x90>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fft(i32 %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca [20 x i32]
%12 = alloca [20 x i32]
%13 = alloca [20 x i32]
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %11, i64 0, i64 0
%17 = getelementptr inbounds [20 x i32], [20 x i32]* %12, i64 0, i64 0
%18 = getelementptr inbounds [20 x i32], [20 x i32]* %13, i64 0, i64 0
%19 = call i32 @transTableSetup(i32* %16, i32* %17, i32* %18, i32* %14, i32* %6)
%20 = load i32, i32* %6
%21 = load i32, i32* %14
%22 = getelementptr inbounds [20 x i32], [20 x i32]* %12, i64 0, i64 0
%23 = getelementptr inbounds [20 x i32], [20 x i32]* %13, i64 0, i64 0
%24 = load double*, double** %7
%25 = load double*, double** %8
%26 = load double*, double** %9
%27 = load double*, double** %10
%28 = call i32 @permute(i32 %20, i32 %21, i32* %22, i32* %23, double* %24, double* %25, double* %26, double* %27)
%29 = getelementptr inbounds [20 x i32], [20 x i32]* %11, i64 0, i64 1
%30 = load i32, i32* %29
%31 = getelementptr inbounds [20 x i32], [20 x i32]* %12, i64 0, i64 1
%32 = load i32, i32* %31
%33 = getelementptr inbounds [20 x i32], [20 x i32]* %13, i64 0, i64 1
%34 = load i32, i32* %33
%35 = load double*, double** %9
%36 = load double*, double** %10
%37 = call i32 @transf(i32 %30, i32 %32, i32 %34, double* %35, double* %36)
%38 = load i32, i32* %14
%39 = icmp sgt i32 %38, 1
br i1 %39, label %40, label %65
40: ; preds = %5
store i32 2, i32* %15
br label %41
41: ; preds = %61, %40
%42 = load i32, i32* %15
%43 = load i32, i32* %14
%44 = icmp sle i32 %42, %43
br i1 %44, label %45, label %64
45: ; preds = %41
%46 = load i32, i32* %15
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [20 x i32], [20 x i32]* %11, i64 0, i64 %47
%49 = load i32, i32* %48
%50 = load i32, i32* %15
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [20 x i32], [20 x i32]* %12, i64 0, i64 %51
%53 = load i32, i32* %52
%54 = load i32, i32* %15
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [20 x i32], [20 x i32]* %13, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = load double*, double** %9
%59 = load double*, double** %10
%60 = call i32 @twiddleTransf(i32 %49, i32 %53, i32 %57, double* %58, double* %59)
br label %61
61: ; preds = %45
%62 = load i32, i32* %15
%63 = add nsw i32 %62, 1
store i32 %63, i32* %15
br label %41
64: ; preds = %41
br label %65
65: ; preds = %64, %5
ret void
}

LLVM IR (-O2):
define void @fft(i32 %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca [20 x i32]
%8 = alloca [20 x i32]
%9 = alloca [20 x i32]
%10 = alloca i32
store i32 %0, i32* %6
%11 = bitcast [20 x i32]* %7 to i8*
%12 = bitcast [20 x i32]* %8 to i8*
%13 = bitcast [20 x i32]* %9 to i8*
%14 = bitcast i32* %10 to i8*
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 0
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 0
%17 = getelementptr inbounds [20 x i32], [20 x i32]* %9, i64 0, i64 0
%18 = call i32 @transTableSetup(i32* %15, i32* %16, i32* %17, i32* %10, i32* %6)
%19 = load i32, i32* %6
%20 = load i32, i32* %10
%21 = call i32 @permute(i32 %19, i32 %20, i32* %16, i32* %17, double* %1, double* %2, double* %3, double* %4)
%22 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 1
%23 = load i32, i32* %22
%24 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 1
%25 = load i32, i32* %24
%26 = getelementptr inbounds [20 x i32], [20 x i32]* %9, i64 0, i64 1
%27 = load i32, i32* %26
%28 = call i32 @transf(i32 %23, i32 %25, i32 %27, double* %3, double* %4)
%29 = load i32, i32* %10
%30 = icmp slt i32 %29, 2
br i1 %30, label %44, label %31
31: ; preds = %5, %31
%32 = phi i64 [ %40, %31 ], [ 2, %5 ]
%33 = getelementptr inbounds [20 x i32], [20 x i32]* %7, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = getelementptr inbounds [20 x i32], [20 x i32]* %8, i64 0, i64 %32
%36 = load i32, i32* %35
%37 = getelementptr inbounds [20 x i32], [20 x i32]* %9, i64 0, i64 %32
%38 = load i32, i32* %37
%39 = call i32 @twiddleTransf(i32 %34, i32 %36, i32 %38, double* %3, double* %4)
%40 = add nuw nsw i64 %32, 1
%41 = load i32, i32* %10
%42 = sext i32 %41 to i64
%43 = icmp slt i64 %32, %42
br i1 %43, label %31, label %44
44: ; preds = %31, %5
ret void
}