#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 */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ bfR2(float *, int, int);
int /*<<< orphan*/ bfR4(float *, int, int);
int /*<<< orphan*/ bfstages(float *, int, float *, int, int, int);
int /*<<< orphan*/ bitrevR2(float *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fft2pt(float *);
int /*<<< orphan*/ fft4pt(float *);
int /*<<< orphan*/ fft8pt(float *);
int /*<<< orphan*/ fftrecurs(float *, int, float *, int, int, int);
void ffts1(float *ioptr, int M, float *Utbl, int16_t *BRLow) {
  int StageCnt;
  int NDiffU;
  switch (M) {
  case 0:
    break;
  case 1:
    fft2pt(ioptr);
    break;
  case 2:
    fft4pt(ioptr);
    break;
  case 3:
    fft8pt(ioptr);
    break;
  default:
    bitrevR2(ioptr, M, BRLow);
    StageCnt = (M - 1) / 3;
    NDiffU = 2;
    if ((M - 1 - (StageCnt * 3)) == 1) {
      bfR2(ioptr, M, NDiffU);
      NDiffU *= 2;
    }
    if ((M - 1 - (StageCnt * 3)) == 2) {
      bfR4(ioptr, M, NDiffU);
      NDiffU *= 4;
    }
    if (M <= (int)(11 - (sizeof(float) / 8)))
      bfstages(ioptr, M, Utbl, 1, NDiffU, StageCnt);
    else
      fftrecurs(ioptr, M, Utbl, 1, NDiffU, StageCnt);
  }
}


x86 assembly (clang, -O0):
<ffts1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x30(%rbp)
sub    $0x3,%rax
ja     11eb <ffts1+0x6b>
mov    -0x30(%rbp),%rax
lea    0xe4d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    12bb <ffts1+0x13b>
mov    -0x8(%rbp),%rdi
call   1040 <fft2pt@plt>
jmp    12bb <ffts1+0x13b>
mov    -0x8(%rbp),%rdi
call   1080 <fft4pt@plt>
jmp    12bb <ffts1+0x13b>
mov    -0x8(%rbp),%rdi
call   10a0 <fft8pt@plt>
jmp    12bb <ffts1+0x13b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <bitrevR2@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
imul   $0x3,-0x24(%rbp),%ecx
sub    %ecx,%eax
cmp    $0x1,%eax
jne    1240 <ffts1+0xc0>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1060 <bfR2@plt>
mov    -0x28(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
imul   $0x3,-0x24(%rbp),%ecx
sub    %ecx,%eax
cmp    $0x2,%eax
jne    126d <ffts1+0xed>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1070 <bfR4@plt>
mov    -0x28(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0xb,-0xc(%rbp)
jg     1299 <ffts1+0x119>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    $0x1,%ecx
call   1050 <bfstages@plt>
jmp    12b6 <ffts1+0x136>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    $0x1,%ecx
call   1090 <fftrecurs@plt>
jmp    12bb <ffts1+0x13b>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffts1>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r15
cmp    $0x3,%esi
ja     11e9 <ffts1+0x69>
mov    %ebx,%eax
lea    0xe65(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fft2pt@plt>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1080 <fft4pt@plt>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    10a0 <fft8pt@plt>
mov    %rdx,%r14
mov    %r15,%rdi
mov    %ebx,%esi
mov    %rcx,%rdx
call   1030 <bitrevR2@plt>
lea    -0x1(%rbx),%eax
cltq
imul   $0x55555556,%rax,%r12
mov    %r12,%rax
shr    $0x3f,%rax
shr    $0x20,%r12
add    %eax,%r12d
lea    (%r12,%r12,2),%eax
neg    %eax
add    %ebx,%eax
add    $0xffffffff,%eax
cmp    $0x2,%eax
je     1245 <ffts1+0xc5>
mov    $0x2,%r8d
cmp    $0x1,%eax
jne    125a <ffts1+0xda>
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
call   1060 <bfR2@plt>
mov    $0x4,%r8d
jmp    125a <ffts1+0xda>
mov    %r15,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
call   1070 <bfR4@plt>
mov    $0x8,%r8d
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
mov    $0x1,%ecx
mov    %r12d,%r9d
add    $0x8,%rsp
cmp    $0xb,%ebx
jg     127f <ffts1+0xff>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <bfstages@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1090 <fftrecurs@plt>

LLVM IR (-O0):
define void @ffts1(float* %0, i32 %1, float* %2, i32* %3) {
%5 = alloca float*
%6 = alloca i32
%7 = alloca float*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store float* %0, float** %5
store i32 %1, i32* %6
store float* %2, float** %7
store i32* %3, i32** %8
%11 = load i32, i32* %6
switch i32 %11, label %22 [
i32 0, label %12
i32 1, label %13
i32 2, label %16
i32 3, label %19
]
12: ; preds = %4
br label %75
13: ; preds = %4
%14 = load float*, float** %5
%15 = call i32 @fft2pt(float* %14)
br label %75
16: ; preds = %4
%17 = load float*, float** %5
%18 = call i32 @fft4pt(float* %17)
br label %75
19: ; preds = %4
%20 = load float*, float** %5
%21 = call i32 @fft8pt(float* %20)
br label %75
22: ; preds = %4
%23 = load float*, float** %5
%24 = load i32, i32* %6
%25 = load i32*, i32** %8
%26 = call i32 @bitrevR2(float* %23, i32 %24, i32* %25)
%27 = load i32, i32* %6
%28 = sub nsw i32 %27, 1
%29 = sdiv i32 %28, 3
store i32 %29, i32* %9
store i32 2, i32* %10
%30 = load i32, i32* %6
%31 = sub nsw i32 %30, 1
%32 = load i32, i32* %9
%33 = mul nsw i32 %32, 3
%34 = sub nsw i32 %31, %33
%35 = icmp eq i32 %34, 1
br i1 %35, label %36, label %43
36: ; preds = %22
%37 = load float*, float** %5
%38 = load i32, i32* %6
%39 = load i32, i32* %10
%40 = call i32 @bfR2(float* %37, i32 %38, i32 %39)
%41 = load i32, i32* %10
%42 = mul nsw i32 %41, 2
store i32 %42, i32* %10
br label %43
43: ; preds = %36, %22
%44 = load i32, i32* %6
%45 = sub nsw i32 %44, 1
%46 = load i32, i32* %9
%47 = mul nsw i32 %46, 3
%48 = sub nsw i32 %45, %47
%49 = icmp eq i32 %48, 2
br i1 %49, label %50, label %57
50: ; preds = %43
%51 = load float*, float** %5
%52 = load i32, i32* %6
%53 = load i32, i32* %10
%54 = call i32 @bfR4(float* %51, i32 %52, i32 %53)
%55 = load i32, i32* %10
%56 = mul nsw i32 %55, 4
store i32 %56, i32* %10
br label %57
57: ; preds = %50, %43
%58 = load i32, i32* %6
%59 = icmp sle i32 %58, 11
br i1 %59, label %60, label %67
60: ; preds = %57
%61 = load float*, float** %5
%62 = load i32, i32* %6
%63 = load float*, float** %7
%64 = load i32, i32* %10
%65 = load i32, i32* %9
%66 = call i32 @bfstages(float* %61, i32 %62, float* %63, i32 1, i32 %64, i32 %65)
br label %74
67: ; preds = %57
%68 = load float*, float** %5
%69 = load i32, i32* %6
%70 = load float*, float** %7
%71 = load i32, i32* %10
%72 = load i32, i32* %9
%73 = call i32 @fftrecurs(float* %68, i32 %69, float* %70, i32 1, i32 %71, i32 %72)
br label %74
74: ; preds = %67, %60
br label %75
75: ; preds = %74, %19, %16, %13, %12
ret void
}

LLVM IR (-O2):
define void @ffts1(float* %0, i32 %1, float* %2, i32* %3) {
switch i32 %1, label %11 [
i32 0, label %28
i32 1, label %5
i32 2, label %7
i32 3, label %9
]
5: ; preds = %4
%6 = tail call i32 @fft2pt(float* %0)
br label %28
7: ; preds = %4
%8 = tail call i32 @fft4pt(float* %0)
br label %28
9: ; preds = %4
%10 = tail call i32 @fft8pt(float* %0)
br label %28
11: ; preds = %4
%12 = tail call i32 @bitrevR2(float* %0, i32 %1, i32* %3)
%13 = add nsw i32 %1, -1
%14 = sdiv i32 %13, 3
%15 = mul nsw i32 %14, -3
%16 = add i32 %15, %13
switch i32 %16, label %21 [
i32 1, label %17
i32 2, label %19
]
17: ; preds = %11
%18 = tail call i32 @bfR2(float* %0, i32 %1, i32 2)
br label %21
19: ; preds = %11
%20 = tail call i32 @bfR4(float* %0, i32 %1, i32 2)
br label %21
21: ; preds = %11, %17, %19
%22 = phi i32 [ 8, %19 ], [ 4, %17 ], [ 2, %11 ]
%23 = icmp slt i32 %1, 12
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = tail call i32 @bfstages(float* %0, i32 %1, float* %2, i32 1, i32 %22, i32 %14)
br label %28
26: ; preds = %21
%27 = tail call i32 @fftrecurs(float* %0, i32 %1, float* %2, i32 1, i32 %22, i32 %14)
br label %28
28: ; preds = %24, %26, %9, %7, %5, %4
ret void
}