#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*/ ifft2pt(float *, float const);
int /*<<< orphan*/ ifft4pt(float *, float const);
int /*<<< orphan*/ ifft8pt(float *, float const);
int /*<<< orphan*/ ifftrecurs(float *, int, float *, int, int, int);
int /*<<< orphan*/ scbitrevR2(float *, int, int /*<<< orphan*/ *, float const);
void iffts1(float *ioptr, int M, float *Utbl, int16_t *BRLow) {
  int StageCnt;
  int NDiffU;
  const float scale = 1.0 / ((uint32_t)1 << (M));
  switch (M) {
  case 0:
    break;
  case 1:
    ifft2pt(ioptr, scale);
    break;
  case 2:
    ifft4pt(ioptr, scale);
    break;
  case 3:
    ifft8pt(ioptr, scale);
    break;
  default:
    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, 1, NDiffU, StageCnt);
    else
      ifftrecurs(ioptr, M, Utbl, 1, NDiffU, StageCnt);
  }
}


x86 assembly (clang, -O0):
<iffts1>:
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  0xe53(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x38(%rbp)
sub    $0x3,%rax
ja     121d <iffts1+0x9d>
mov    -0x38(%rbp),%rax
lea    0xe32(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    12f2 <iffts1+0x172>
mov    -0x8(%rbp),%rdi
movss  -0x2c(%rbp),%xmm0
call   1060 <ifft2pt@plt>
jmp    12f2 <iffts1+0x172>
mov    -0x8(%rbp),%rdi
movss  -0x2c(%rbp),%xmm0
call   1080 <ifft4pt@plt>
jmp    12f2 <iffts1+0x172>
mov    -0x8(%rbp),%rdi
movss  -0x2c(%rbp),%xmm0
call   1040 <ifft8pt@plt>
jmp    12f2 <iffts1+0x172>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
movss  -0x2c(%rbp),%xmm0
call   1030 <scbitrevR2@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    1277 <iffts1+0xf7>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1090 <ibfR2@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    12a4 <iffts1+0x124>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x28(%rbp),%edx
call   10a0 <ibfR4@plt>
mov    -0x28(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0xb,-0xc(%rbp)
jg     12d0 <iffts1+0x150>
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 <ibfstages@plt>
jmp    12ed <iffts1+0x16d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    $0x1,%ecx
call   1070 <ifftrecurs@plt>
jmp    12f2 <iffts1+0x172>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iffts1>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%rax
mov    %esi,%ebx
mov    $0x1,%esi
mov    %ebx,%ecx
shl    %cl,%esi
mov    %rdi,%r14
cvtsi2sd %esi,%xmm0
movsd  0xe5b(%rip),%xmm1
divsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cmp    $0x3,%ebx
ja     120c <iffts1+0x8c>
mov    %ebx,%eax
lea    0xe4a(%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    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1060 <ifft2pt@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1080 <ifft4pt@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <ifft8pt@plt>
mov    %rdx,%r15
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
call   1030 <scbitrevR2@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     1268 <iffts1+0xe8>
mov    $0x2,%r8d
cmp    $0x1,%eax
jne    127d <iffts1+0xfd>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
call   1090 <ibfR2@plt>
mov    $0x4,%r8d
jmp    127d <iffts1+0xfd>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
call   10a0 <ibfR4@plt>
mov    $0x8,%r8d
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r15,%rdx
mov    $0x1,%ecx
mov    %r12d,%r9d
add    $0x8,%rsp
cmp    $0xb,%ebx
jg     12a2 <iffts1+0x122>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <ibfstages@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1070 <ifftrecurs@plt>

LLVM IR (-O0):
define void @iffts1(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
%11 = alloca float
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* %11
%17 = load i32, i32* %6
switch i32 %17, label %31 [
i32 0, label %18
i32 1, label %19
i32 2, label %23
i32 3, label %27
]
18: ; preds = %4
br label %85
19: ; preds = %4
%20 = load float*, float** %5
%21 = load float, float* %11
%22 = call i32 @ifft2pt(float* %20, float %21)
br label %85
23: ; preds = %4
%24 = load float*, float** %5
%25 = load float, float* %11
%26 = call i32 @ifft4pt(float* %24, float %25)
br label %85
27: ; preds = %4
%28 = load float*, float** %5
%29 = load float, float* %11
%30 = call i32 @ifft8pt(float* %28, float %29)
br label %85
31: ; preds = %4
%32 = load float*, float** %5
%33 = load i32, i32* %6
%34 = load i32*, i32** %8
%35 = load float, float* %11
%36 = call i32 @scbitrevR2(float* %32, i32 %33, i32* %34, float %35)
%37 = load i32, i32* %6
%38 = sub nsw i32 %37, 1
%39 = sdiv i32 %38, 3
store i32 %39, i32* %9
store i32 2, i32* %10
%40 = load i32, i32* %6
%41 = sub nsw i32 %40, 1
%42 = load i32, i32* %9
%43 = mul nsw i32 %42, 3
%44 = sub nsw i32 %41, %43
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %53
46: ; preds = %31
%47 = load float*, float** %5
%48 = load i32, i32* %6
%49 = load i32, i32* %10
%50 = call i32 @ibfR2(float* %47, i32 %48, i32 %49)
%51 = load i32, i32* %10
%52 = mul nsw i32 %51, 2
store i32 %52, i32* %10
br label %53
53: ; preds = %46, %31
%54 = load i32, i32* %6
%55 = sub nsw i32 %54, 1
%56 = load i32, i32* %9
%57 = mul nsw i32 %56, 3
%58 = sub nsw i32 %55, %57
%59 = icmp eq i32 %58, 2
br i1 %59, label %60, label %67
60: ; preds = %53
%61 = load float*, float** %5
%62 = load i32, i32* %6
%63 = load i32, i32* %10
%64 = call i32 @ibfR4(float* %61, i32 %62, i32 %63)
%65 = load i32, i32* %10
%66 = mul nsw i32 %65, 4
store i32 %66, i32* %10
br label %67
67: ; preds = %60, %53
%68 = load i32, i32* %6
%69 = icmp sle i32 %68, 11
br i1 %69, label %70, label %77
70: ; preds = %67
%71 = load float*, float** %5
%72 = load i32, i32* %6
%73 = load float*, float** %7
%74 = load i32, i32* %10
%75 = load i32, i32* %9
%76 = call i32 @ibfstages(float* %71, i32 %72, float* %73, i32 1, i32 %74, i32 %75)
br label %84
77: ; preds = %67
%78 = load float*, float** %5
%79 = load i32, i32* %6
%80 = load float*, float** %7
%81 = load i32, i32* %10
%82 = load i32, i32* %9
%83 = call i32 @ifftrecurs(float* %78, i32 %79, float* %80, i32 1, i32 %81, i32 %82)
br label %84
84: ; preds = %77, %70
br label %85
85: ; preds = %84, %27, %23, %19, %18
ret void
}

LLVM IR (-O2):
define void @iffts1(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
switch i32 %1, label %15 [
i32 0, label %32
i32 1, label %9
i32 2, label %11
i32 3, label %13
]
9: ; preds = %4
%10 = tail call i32 @ifft2pt(float* %0, float %8)
br label %32
11: ; preds = %4
%12 = tail call i32 @ifft4pt(float* %0, float %8)
br label %32
13: ; preds = %4
%14 = tail call i32 @ifft8pt(float* %0, float %8)
br label %32
15: ; preds = %4
%16 = tail call i32 @scbitrevR2(float* %0, i32 %1, i32* %3, float %8)
%17 = add nsw i32 %1, -1
%18 = sdiv i32 %17, 3
%19 = mul nsw i32 %18, -3
%20 = add i32 %19, %17
switch i32 %20, label %25 [
i32 1, label %21
i32 2, label %23
]
21: ; preds = %15
%22 = tail call i32 @ibfR2(float* %0, i32 %1, i32 2)
br label %25
23: ; preds = %15
%24 = tail call i32 @ibfR4(float* %0, i32 %1, i32 2)
br label %25
25: ; preds = %15, %21, %23
%26 = phi i32 [ 8, %23 ], [ 4, %21 ], [ 2, %15 ]
%27 = icmp slt i32 %1, 12
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 @ibfstages(float* %0, i32 %1, float* %2, i32 1, i32 %26, i32 %18)
br label %32
30: ; preds = %25
%31 = tail call i32 @ifftrecurs(float* %0, i32 %1, float* %2, i32 1, i32 %26, i32 %18)
br label %32
32: ; preds = %28, %30, %13, %11, %9, %4
ret void
}