void FFT1D(direction, M, N, x, scratch, upriv, umain2, MyNum, l_transtime,
           MyFirst, MyLast, pad_length, P, test_result, doprint, dostats,
           Global) int direction;
int M;
int N;
int *l_transtime;
double *x;
double *upriv;
double *scratch;
double *umain2;
int MyFirst;
int MyLast;
int pad_length;
int P;
int test_result;
int doprint;
int dostats;
struct GlobalMemory *Global;
{
  int j;
  int m1;
  int n1;
  m1 = M / 2;
  n1 = 1 << m1;
  Transpose(n1, x, scratch, MyNum, MyFirst, MyLast, pad_length);
  for (j = MyFirst; j < MyLast; j++) {
    FFT1DOnce(direction, m1, n1, upriv, &scratch[2 * j * (n1 + pad_length)]);
    TwiddleOneCol(direction, n1, N, j, umain2,
                  &scratch[2 * j * (n1 + pad_length)], pad_length);
  }
  Transpose(n1, scratch, x, MyNum, MyFirst, MyLast, pad_length);
  for (j = MyFirst; j < MyLast; j++) {
    FFT1DOnce(direction, m1, n1, upriv, &x[2 * j * (n1 + pad_length)]);
    if (direction == -1)
      Scale(n1, N, &x[2 * j * (n1 + pad_length)]);
  }
  Transpose(n1, x, scratch, MyNum, MyFirst, MyLast, pad_length);
}


x86 assembly (clang, -O0):
<FFT1D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x60(%rbp),%rax
mov    0x58(%rbp),%eax
mov    0x50(%rbp),%eax
mov    0x48(%rbp),%eax
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    0x18(%rbp),%ecx
mov    0x28(%rbp),%r8d
mov    0x30(%rbp),%r9d
mov    0x38(%rbp),%eax
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <Transpose@plt>
mov    0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    0x30(%rbp),%eax
jge    124e <FFT1D+0x10e>
mov    -0x4(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
mov    -0x34(%rbp),%r9d
add    0x38(%rbp),%r9d
imul   %r9d,%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
mov    $0x0,%al
call   1050 <FFT1DOnce@plt>
mov    -0x4(%rbp),%edi
mov    -0x34(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    0x10(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
mov    -0x34(%rbp),%r10d
add    0x38(%rbp),%r10d
imul   %r10d,%eax
cltq
shl    $0x3,%rax
add    %rax,%r9
mov    0x38(%rbp),%eax
mov    %eax,(%rsp)
mov    $0x0,%al
call   1060 <TwiddleOneCol@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11c5 <FFT1D+0x85>
mov    -0x34(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x18(%rbp),%ecx
mov    0x28(%rbp),%r8d
mov    0x30(%rbp),%r9d
mov    0x38(%rbp),%eax
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <Transpose@plt>
mov    0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    0x30(%rbp),%eax
jge    12fc <FFT1D+0x1bc>
mov    -0x4(%rbp),%edi
mov    -0x30(%rbp),%esi
mov    -0x34(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
mov    -0x34(%rbp),%r9d
add    0x38(%rbp),%r9d
imul   %r9d,%eax
cltq
shl    $0x3,%rax
add    %rax,%r8
mov    $0x0,%al
call   1050 <FFT1DOnce@plt>
cmpl   $0xffffffff,-0x4(%rbp)
jne    12e9 <FFT1D+0x1a9>
mov    -0x34(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
mov    -0x34(%rbp),%ecx
add    0x38(%rbp),%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
mov    $0x0,%al
call   1030 <Scale@plt>
jmp    12ee <FFT1D+0x1ae>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1277 <FFT1D+0x137>
mov    -0x34(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    0x18(%rbp),%ecx
mov    0x28(%rbp),%r8d
mov    0x30(%rbp),%r9d
mov    0x38(%rbp),%eax
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <Transpose@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FFT1D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x30(%rsp)
mov    %rcx,%rbp
mov    %edx,0x14(%rsp)
mov    %edi,0x10(%rsp)
mov    0x98(%rsp),%r12d
mov    0x90(%rsp),%r14d
mov    0x88(%rsp),%ebx
mov    0x78(%rsp),%eax
mov    %esi,%r15d
shr    $0x1f,%r15d
add    %esi,%r15d
sar    %r15d
mov    $0x1,%r13d
mov    %r15d,%ecx
shl    %cl,%r13d
mov    %r12d,(%rsp)
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %r8,0x20(%rsp)
mov    %r8,%rdx
mov    %eax,%ecx
mov    %ebx,%r8d
mov    %r14d,%r9d
xor    %eax,%eax
call   1040 <Transpose@plt>
cmp    %r14d,%ebx
jge    1301 <FFT1D+0x1c1>
mov    %rbp,0x28(%rsp)
lea    (%r12,%r13,1),%eax
mov    %ebx,%r12d
imul   %eax,%r12d
add    %eax,%eax
mov    %eax,0x18(%rsp)
lea    (%r12,%r12,1),%r14d
mov    %r13,%rax
mov    %r15d,0x1c(%rsp)
mov    0x10(%rsp),%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %r14d,%r14
mov    0x20(%rsp),%rcx
lea    (%rcx,%r14,8),%r15
mov    %ebp,%edi
mov    0x1c(%rsp),%esi
mov    %rax,%r13
mov    %r13d,%edx
mov    0x30(%rsp),%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1050 <FFT1DOnce@plt>
mov    0x98(%rsp),%eax
mov    %eax,(%rsp)
mov    %ebp,%edi
mov    %r13d,%esi
mov    0x14(%rsp),%edx
mov    %ebx,%ecx
mov    0x70(%rsp),%r8
mov    %r15,%r9
xor    %eax,%eax
call   1060 <TwiddleOneCol@plt>
mov    %r13,%rax
add    $0x1,%ebx
add    0x18(%rsp),%r14d
cmp    %ebx,0x90(%rsp)
jne    11f0 <FFT1D+0xb0>
mov    0x98(%rsp),%ecx
mov    %ecx,(%rsp)
mov    %eax,%edi
mov    0x20(%rsp),%rsi
mov    0x28(%rsp),%r14
mov    %r14,%rdx
mov    0x78(%rsp),%ecx
mov    0x88(%rsp),%ebx
mov    %ebx,%r8d
mov    0x90(%rsp),%ebp
mov    %ebp,%r9d
xor    %eax,%eax
call   1040 <Transpose@plt>
mov    %r13,%rdx
cmp    %ebp,%ebx
mov    0x30(%rsp),%rcx
mov    0x10(%rsp),%esi
jge    1327 <FFT1D+0x1e7>
add    %r12d,%r12d
mov    0x90(%rsp),%ebp
sub    0x88(%rsp),%ebp
jmp    12c5 <FFT1D+0x185>
xchg   %ax,%ax
add    0x18(%rsp),%r12d
add    $0xffffffff,%ebp
mov    %r13,%rdx
mov    %r14,%rcx
mov    0x28(%rsp),%r14
je     1327 <FFT1D+0x1e7>
movslq %r12d,%rax
lea    (%r14,%rax,8),%rbx
mov    %esi,%r15d
mov    %esi,%edi
mov    0x1c(%rsp),%esi
mov    %rcx,%r14
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <FFT1DOnce@plt>
mov    %r15d,%esi
cmp    $0xffffffff,%r15d
jne    12b0 <FFT1D+0x170>
mov    %r13d,%edi
mov    0x14(%rsp),%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <Scale@plt>
mov    %r15d,%esi
jmp    12b0 <FFT1D+0x170>
mov    %r12d,(%rsp)
mov    %r13d,%edi
mov    0x20(%rsp),%rsi
mov    %rbp,%rdx
mov    0x78(%rsp),%ecx
mov    %ebx,%r8d
mov    %r14d,%r9d
xor    %eax,%eax
call   1040 <Transpose@plt>
mov    %r13,%rdx
mov    %rbp,%r14
mov    0x98(%rsp),%eax
mov    %eax,(%rsp)
mov    %edx,%edi
mov    %r14,%rsi
mov    0x20(%rsp),%rdx
mov    0x78(%rsp),%ecx
mov    0x88(%rsp),%r8d
mov    0x90(%rsp),%r9d
xor    %eax,%eax
call   1040 <Transpose@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.GlobalMemory = type opaque
define void @FFT1D(i32 %0, i32 %1, i32 %2, double* %3, double* %4, double* %5, double* %6, i32 %7, i32* nocapture readnone %8, i32 %9, i32 %10, i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, %struct.GlobalMemory* nocapture readnone %16) {
%18 = sdiv i32 %1, 2
%19 = shl nuw i32 1, %18
%20 = tail call i32 (i32, double*, double*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @Transpose to i32 (i32, double*, double*, i32, i32, i32, i32, ...)*)(i32 %19, double* %3, double* %4, i32 %7, i32 %9, i32 %10, i32 %11)
%21 = icmp slt i32 %9, %10
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = tail call i32 (i32, double*, double*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @Transpose to i32 (i32, double*, double*, i32, i32, i32, i32, ...)*)(i32 %19, double* %4, double* %3, i32 %7, i32 %9, i32 %10, i32 %11)
br label %59
24: ; preds = %17
%25 = add nsw i32 %19, %11
%26 = shl i32 %25, 1
%27 = zext i32 %9 to i64
br label %28
28: ; preds = %24, %28
%29 = phi i64 [ %27, %24 ], [ %36, %28 ]
%30 = trunc i64 %29 to i32
%31 = mul i32 %26, %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %4, i64 %32
%34 = tail call i32 (i32, i32, i32, double*, double*, ...) bitcast (i32 (...)* @FFT1DOnce to i32 (i32, i32, i32, double*, double*, ...)*)(i32 %0, i32 %18, i32 %19, double* %5, double* %33)
%35 = tail call i32 (i32, i32, i32, i32, double*, double*, i32, ...) bitcast (i32 (...)* @TwiddleOneCol to i32 (i32, i32, i32, i32, double*, double*, i32, ...)*)(i32 %0, i32 %19, i32 %2, i32 %30, double* %6, double* %33, i32 %11)
%36 = add i64 %29, 1
%37 = trunc i64 %36 to i32
%38 = icmp eq i32 %37, %10
br i1 %38, label %39, label %28
39: ; preds = %28
%40 = tail call i32 (i32, double*, double*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @Transpose to i32 (i32, double*, double*, i32, i32, i32, i32, ...)*)(i32 %19, double* %4, double* %3, i32 %7, i32 %9, i32 %10, i32 %11)
br i1 %21, label %41, label %59
41: ; preds = %39
%42 = add nsw i32 %19, %11
%43 = shl i32 %42, 1
%44 = icmp eq i32 %0, -1
%45 = zext i32 %9 to i64
br label %46
46: ; preds = %41, %55
%47 = phi i64 [ %45, %41 ], [ %56, %55 ]
%48 = trunc i64 %47 to i32
%49 = mul i32 %43, %48
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %3, i64 %50
%52 = tail call i32 (i32, i32, i32, double*, double*, ...) bitcast (i32 (...)* @FFT1DOnce to i32 (i32, i32, i32, double*, double*, ...)*)(i32 %0, i32 %18, i32 %19, double* %5, double* %51)
br i1 %44, label %53, label %55
53: ; preds = %46
%54 = tail call i32 (i32, i32, double*, ...) bitcast (i32 (...)* @Scale to i32 (i32, i32, double*, ...)*)(i32 %19, i32 %2, double* %51)
br label %55
55: ; preds = %46, %53
%56 = add i64 %47, 1
%57 = trunc i64 %56 to i32
%58 = icmp eq i32 %57, %10
br i1 %58, label %59, label %46
59: ; preds = %55, %22, %39
%60 = tail call i32 (i32, double*, double*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @Transpose to i32 (i32, double*, double*, i32, i32, i32, i32, ...)*)(i32 %19, double* %3, double* %4, i32 %7, i32 %9, i32 %10, i32 %11)
ret void
}