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

/* Variables and functions */
int /*<<< orphan*/ ibfR2(float *, int, int);
int /*<<< orphan*/ ibfR4(float *, int, int);
int /*<<< orphan*/ ibfstages(float *, int, float *, int, int, int);
int /*<<< orphan*/ ifftrecurs(float *, int, float *, int, int, int);
int /*<<< orphan*/ ifrstage(float *, int, float *);
int /*<<< orphan*/ rifft1pt(float *, float);
int /*<<< orphan*/ rifft2pt(float *, float);
int /*<<< orphan*/ rifft4pt(float *, float);
int /*<<< orphan*/ rifft8pt(float *, float);
int /*<<< orphan*/ scbitrevR2(float *, int, int /*<<< orphan*/ *, float);
void riffts1(float *ioptr, int M, float *Utbl, int16_t *BRLow) {
  float scale;
  int StageCnt;
  int NDiffU;
  scale = (float)(1.0 / (double)((int)((uint32_t)1 << (M))));
  M = M - 1;
  switch (M) {
  case -1:
    break;
  case 0:
    rifft1pt(ioptr, scale);
    break;
  case 1:
    rifft2pt(ioptr, scale);
    break;
  case 2:
    rifft4pt(ioptr, scale);
    break;
  case 3:
    rifft8pt(ioptr, scale);
    break;
  default:
    ifrstage(ioptr, M + 1, Utbl);
    scbitrevR2(ioptr, M, BRLow, scale);
    StageCnt = (M - 1) / 3;
    NDiffU = 2;
    if ((M - 1 - (StageCnt * 3)) == 1) {
      ibfR2(ioptr, M, NDiffU);
      NDiffU *= 2;
    }
    if ((M - 1 - (StageCnt * 3)) == 2) {
      ibfR4(ioptr, M, NDiffU);
      NDiffU *= 4;
    }
    if (M <= (int)(11 - (sizeof(float) / 8)))
      ibfstages(ioptr, M, Utbl, 2, NDiffU, StageCnt);
    else
      ifftrecurs(ioptr, M, Utbl, 2, NDiffU, StageCnt);
  }
}


x86 assembly (clang, -O0):
<riffts1>:
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),%cl
mov    $0x1,%eax
shl    %cl,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe33(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%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     125d <riffts1+0xbd>
mov    -0x38(%rbp),%rax
lea    0xe05(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1345 <riffts1+0x1a5>
mov    -0x8(%rbp),%rdi
movss  -0x24(%rbp),%xmm0
call   1070 <rifft1pt@plt>
jmp    1345 <riffts1+0x1a5>
mov    -0x8(%rbp),%rdi
movss  -0x24(%rbp),%xmm0
call   1080 <rifft2pt@plt>
jmp    1345 <riffts1+0x1a5>
mov    -0x8(%rbp),%rdi
movss  -0x24(%rbp),%xmm0
call   1060 <rifft4pt@plt>
jmp    1345 <riffts1+0x1a5>
mov    -0x8(%rbp),%rdi
movss  -0x24(%rbp),%xmm0
call   1050 <rifft8pt@plt>
jmp    1345 <riffts1+0x1a5>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%rdx
call   1090 <ifrstage@plt>
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    12ca <riffts1+0x12a>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   10b0 <ibfR2@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    12f7 <riffts1+0x157>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   10c0 <ibfR4@plt>
mov    -0x2c(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0xb,-0xc(%rbp)
jg     1323 <riffts1+0x183>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    $0x2,%ecx
call   1040 <ibfstages@plt>
jmp    1340 <riffts1+0x1a0>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x2c(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    $0x2,%ecx
call   10a0 <ifftrecurs@plt>
jmp    1345 <riffts1+0x1a5>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<riffts1>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%rbp
mov    %esi,%ebx
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
mov    %rdi,%r15
cvtsi2sd %eax,%xmm0
movsd  0xe37(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cmp    $0x4,%esi
ja     1248 <riffts1+0xa8>
mov    %ebx,%eax
lea    0xe26(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <rifft1pt@plt>
mov    %r15,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <rifft2pt@plt>
mov    %r15,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <rifft4pt@plt>
mov    %r15,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <rifft8pt@plt>
mov    %rdx,%r14
lea    -0x1(%rbx),%r12d
mov    %r15,%rdi
mov    %ebx,%esi
movss  %xmm0,0xc(%rsp)
call   1090 <ifrstage@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %rbp,%rdx
movss  0xc(%rsp),%xmm0
call   1030 <scbitrevR2@plt>
lea    -0x2(%rbx),%eax
cltq
imul   $0x55555556,%rax,%rbp
mov    %rbp,%rax
shr    $0x3f,%rax
shr    $0x20,%rbp
add    %eax,%ebp
lea    0x0(%rbp,%rbp,2),%eax
neg    %eax
add    %ebx,%eax
add    $0xfffffffe,%eax
cmp    $0x2,%eax
je     12bf <riffts1+0x11f>
mov    $0x2,%r8d
cmp    $0x1,%eax
jne    12d5 <riffts1+0x135>
mov    %r15,%rdi
mov    %r12d,%esi
mov    $0x2,%edx
call   10b0 <ibfR2@plt>
mov    $0x4,%r8d
jmp    12d5 <riffts1+0x135>
mov    %r15,%rdi
mov    %r12d,%esi
mov    $0x2,%edx
call   10c0 <ibfR4@plt>
mov    $0x8,%r8d
mov    %r15,%rdi
mov    %r12d,%esi
mov    %r14,%rdx
mov    $0x2,%ecx
mov    %ebp,%r9d
add    $0x10,%rsp
cmp    $0xc,%ebx
jg     12fc <riffts1+0x15c>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <ibfstages@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    10a0 <ifftrecurs@plt>

LLVM IR (-O0):
define void @riffts1(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 = shl i32 1, %12
%14 = sitofp i32 %13 to double
%15 = fdiv double 1.000000e+00, %14
%16 = fptrunc double %15 to float
store float %16, float* %9
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %6
%19 = load i32, i32* %6
switch i32 %19, label %37 [
i32 -1, label %20
i32 0, label %21
i32 1, label %25
i32 2, label %29
i32 3, label %33
]
20: ; preds = %4
br label %96
21: ; preds = %4
%22 = load float*, float** %5
%23 = load float, float* %9
%24 = call i32 @rifft1pt(float* %22, float %23)
br label %96
25: ; preds = %4
%26 = load float*, float** %5
%27 = load float, float* %9
%28 = call i32 @rifft2pt(float* %26, float %27)
br label %96
29: ; preds = %4
%30 = load float*, float** %5
%31 = load float, float* %9
%32 = call i32 @rifft4pt(float* %30, float %31)
br label %96
33: ; preds = %4
%34 = load float*, float** %5
%35 = load float, float* %9
%36 = call i32 @rifft8pt(float* %34, float %35)
br label %96
37: ; preds = %4
%38 = load float*, float** %5
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
%41 = load float*, float** %7
%42 = call i32 @ifrstage(float* %38, i32 %40, float* %41)
%43 = load float*, float** %5
%44 = load i32, i32* %6
%45 = load i32*, i32** %8
%46 = load float, float* %9
%47 = call i32 @scbitrevR2(float* %43, i32 %44, i32* %45, float %46)
%48 = load i32, i32* %6
%49 = sub nsw i32 %48, 1
%50 = sdiv i32 %49, 3
store i32 %50, i32* %10
store i32 2, i32* %11
%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, 1
br i1 %56, label %57, label %64
57: ; preds = %37
%58 = load float*, float** %5
%59 = load i32, i32* %6
%60 = load i32, i32* %11
%61 = call i32 @ibfR2(float* %58, i32 %59, i32 %60)
%62 = load i32, i32* %11
%63 = mul nsw i32 %62, 2
store i32 %63, i32* %11
br label %64
64: ; preds = %57, %37
%65 = load i32, i32* %6
%66 = sub nsw i32 %65, 1
%67 = load i32, i32* %10
%68 = mul nsw i32 %67, 3
%69 = sub nsw i32 %66, %68
%70 = icmp eq i32 %69, 2
br i1 %70, label %71, label %78
71: ; preds = %64
%72 = load float*, float** %5
%73 = load i32, i32* %6
%74 = load i32, i32* %11
%75 = call i32 @ibfR4(float* %72, i32 %73, i32 %74)
%76 = load i32, i32* %11
%77 = mul nsw i32 %76, 4
store i32 %77, i32* %11
br label %78
78: ; preds = %71, %64
%79 = load i32, i32* %6
%80 = icmp sle i32 %79, 11
br i1 %80, label %81, label %88
81: ; preds = %78
%82 = load float*, float** %5
%83 = load i32, i32* %6
%84 = load float*, float** %7
%85 = load i32, i32* %11
%86 = load i32, i32* %10
%87 = call i32 @ibfstages(float* %82, i32 %83, float* %84, i32 2, i32 %85, i32 %86)
br label %95
88: ; preds = %78
%89 = load float*, float** %5
%90 = load i32, i32* %6
%91 = load float*, float** %7
%92 = load i32, i32* %11
%93 = load i32, i32* %10
%94 = call i32 @ifftrecurs(float* %89, i32 %90, float* %91, i32 2, i32 %92, i32 %93)
br label %95
95: ; preds = %88, %81
br label %96
96: ; preds = %95, %33, %29, %25, %21, %20
ret void
}

LLVM IR (-O2):
define void @riffts1(float* %0, i32 %1, float* %2, i32* %3) {
%5 = shl nuw i32 1, %1
%6 = sitofp i32 %5 to double
%7 = fdiv double 1.000000e+00, %6
%8 = fptrunc double %7 to float
%9 = add nsw i32 %1, -1
switch i32 %1, label %18 [
i32 0, label %36
i32 1, label %10
i32 2, label %12
i32 3, label %14
i32 4, label %16
]
10: ; preds = %4
%11 = tail call i32 @rifft1pt(float* %0, float %8)
br label %36
12: ; preds = %4
%13 = tail call i32 @rifft2pt(float* %0, float %8)
br label %36
14: ; preds = %4
%15 = tail call i32 @rifft4pt(float* %0, float %8)
br label %36
16: ; preds = %4
%17 = tail call i32 @rifft8pt(float* %0, float %8)
br label %36
18: ; preds = %4
%19 = tail call i32 @ifrstage(float* %0, i32 %1, float* %2)
%20 = tail call i32 @scbitrevR2(float* %0, i32 %9, i32* %3, float %8)
%21 = add nsw i32 %1, -2
%22 = sdiv i32 %21, 3
%23 = mul nsw i32 %22, -3
%24 = add i32 %23, %21
switch i32 %24, label %29 [
i32 1, label %25
i32 2, label %27
]
25: ; preds = %18
%26 = tail call i32 @ibfR2(float* %0, i32 %9, i32 2)
br label %29
27: ; preds = %18
%28 = tail call i32 @ibfR4(float* %0, i32 %9, i32 2)
br label %29
29: ; preds = %18, %25, %27
%30 = phi i32 [ 8, %27 ], [ 4, %25 ], [ 2, %18 ]
%31 = icmp slt i32 %1, 13
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 @ibfstages(float* %0, i32 %9, float* %2, i32 2, i32 %30, i32 %22)
br label %36
34: ; preds = %29
%35 = tail call i32 @ifftrecurs(float* %0, i32 %9, float* %2, i32 2, i32 %30, i32 %22)
br label %36
36: ; preds = %32, %34, %16, %14, %12, %10, %4
ret void
}