#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*/ fftrecurs(float *, int, float *, int, int, int);
int /*<<< orphan*/ frstage(float *, int, float *);
int /*<<< orphan*/ rfft1pt(float *);
int /*<<< orphan*/ rfft2pt(float *);
int /*<<< orphan*/ rfft4pt(float *);
int /*<<< orphan*/ rfft8pt(float *);
int /*<<< orphan*/ scbitrevR2(float *, int, int /*<<< orphan*/ *, float);
void rffts1(float *ioptr, int M, float *Utbl, int16_t *BRLow) {
  float scale;
  int StageCnt;
  int NDiffU;
  M = M - 1;
  switch (M) {
  case -1:
    break;
  case 0:
    rfft1pt(ioptr);
    break;
  case 1:
    rfft2pt(ioptr);
    break;
  case 2:
    rfft4pt(ioptr);
    break;
  case 3:
    rfft8pt(ioptr);
    break;
  default:
    scale = 0.5;
    scbitrevR2(ioptr, M, BRLow, scale);
    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, 2, NDiffU, StageCnt);
    else
      fftrecurs(ioptr, M, Utbl, 2, NDiffU, StageCnt);
    frstage(ioptr, M + 1, Utbl);
  }
}


x86 assembly (clang, -O0):
<rffts1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x4,%eax
ja     1226 <rffts1+0x86>
mov    -0x38(%rbp),%rax
lea    0xe24(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1316 <rffts1+0x176>
mov    -0x8(%rbp),%rdi
call   1050 <rfft1pt@plt>
jmp    1316 <rffts1+0x176>
mov    -0x8(%rbp),%rdi
call   1060 <rfft2pt@plt>
jmp    1316 <rffts1+0x176>
mov    -0x8(%rbp),%rdi
call   1090 <rfft4pt@plt>
jmp    1316 <rffts1+0x176>
mov    -0x8(%rbp),%rdi
call   1040 <rfft8pt@plt>
jmp    1316 <rffts1+0x176>
movss  0xdd2(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
movss  -0x24(%rbp),%xmm0
call   1030 <scbitrevR2@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x28(%rbp)
movl   $0x2,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
imul   $0x3,-0x28(%rbp),%ecx
sub    %ecx,%eax
cmp    $0x1,%eax
jne    128d <rffts1+0xed>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   1080 <bfR2@plt>
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
imul   $0x3,-0x28(%rbp),%ecx
sub    %ecx,%eax
cmp    $0x2,%eax
jne    12ba <rffts1+0x11a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   10a0 <bfR4@plt>
mov    -0x2c(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0xb,-0xc(%rbp)
jg     12e6 <rffts1+0x146>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    $0x2,%ecx
call   1070 <bfstages@plt>
jmp    1303 <rffts1+0x163>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    $0x2,%ecx
call   10b0 <fftrecurs@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%rdx
call   10c0 <frstage@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rffts1>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r15
cmp    $0x4,%esi
ja     120d <rffts1+0x6d>
mov    %ebx,%eax
lea    0xe49(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <rfft1pt@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <rfft2pt@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <rfft4pt@plt>
mov    %r15,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <rfft8pt@plt>
mov    %rdx,%r14
lea    -0x1(%rbx),%r12d
movss  0xde4(%rip),%xmm0
mov    %r15,%rdi
mov    %r12d,%esi
mov    %rcx,%rdx
call   1030 <scbitrevR2@plt>
lea    -0x2(%rbx),%eax
cltq
imul   $0x55555556,%rax,%rbp
mov    %rbp,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rbp
add    %ecx,%ebp
lea    0x0(%rbp,%rbp,2),%ecx
sub    %ecx,%eax
cmp    $0x2,%eax
je     1271 <rffts1+0xd1>
mov    $0x2,%r8d
cmp    $0x1,%eax
jne    1287 <rffts1+0xe7>
mov    %r15,%rdi
mov    %r12d,%esi
mov    $0x2,%edx
call   1080 <bfR2@plt>
mov    $0x4,%r8d
jmp    1287 <rffts1+0xe7>
mov    %r15,%rdi
mov    %r12d,%esi
mov    $0x2,%edx
call   10a0 <bfR4@plt>
mov    $0x8,%r8d
mov    %r15,%rdi
mov    %r12d,%esi
mov    %r14,%rdx
mov    $0x2,%ecx
mov    %ebp,%r9d
cmp    $0xc,%ebx
jg     12a4 <rffts1+0x104>
call   1070 <bfstages@plt>
jmp    12a9 <rffts1+0x109>
call   10b0 <fftrecurs@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    10c0 <frstage@plt>

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

LLVM IR (-O2):
define void @rffts1(float* %0, i32 %1, float* %2, i32* %3) {
%5 = add nsw i32 %1, -1
switch i32 %1, label %14 [
i32 0, label %33
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
]
6: ; preds = %4
%7 = tail call i32 @rfft1pt(float* %0)
br label %33
8: ; preds = %4
%9 = tail call i32 @rfft2pt(float* %0)
br label %33
10: ; preds = %4
%11 = tail call i32 @rfft4pt(float* %0)
br label %33
12: ; preds = %4
%13 = tail call i32 @rfft8pt(float* %0)
br label %33
14: ; preds = %4
%15 = tail call i32 @scbitrevR2(float* %0, i32 %5, i32* %3, float 5.000000e-01)
%16 = add nsw i32 %1, -2
%17 = sdiv i32 %16, 3
%18 = mul nsw i32 %17, -3
%19 = add i32 %18, %16
switch i32 %19, label %24 [
i32 1, label %20
i32 2, label %22
]
20: ; preds = %14
%21 = tail call i32 @bfR2(float* %0, i32 %5, i32 2)
br label %24
22: ; preds = %14
%23 = tail call i32 @bfR4(float* %0, i32 %5, i32 2)
br label %24
24: ; preds = %14, %20, %22
%25 = phi i32 [ 8, %22 ], [ 4, %20 ], [ 2, %14 ]
%26 = icmp slt i32 %1, 13
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = tail call i32 @bfstages(float* %0, i32 %5, float* %2, i32 2, i32 %25, i32 %17)
br label %31
29: ; preds = %24
%30 = tail call i32 @fftrecurs(float* %0, i32 %5, float* %2, i32 2, i32 %25, i32 %17)
br label %31
31: ; preds = %29, %27
%32 = tail call i32 @frstage(float* %0, i32 %1, float* %2)
br label %33
33: ; preds = %31, %12, %10, %8, %6, %4
ret void
}