// File: /workspace/github_cpp_makefile_star2_O2/kebwi[P]Trifid/src/FFT/fftlib.cpp
// Function: riffts1(double*, long, long, double*, short*)
void riffts1(Float_t *ioptr, long M, long Rows, Float_t *Utbl, short *BRLow){
/* Compute in-place real ifft on the rows of the input array	*/
/* data order as from rffts1 */
/* INPUTS */
/* *ioptr = input data array in the following order	*/
/* M = log2 of fft size	*/
/* Re(x[0]), Re(x[N/2]), Re(x[1]), Im(x[1]), Re(x[2]), Im(x[2]), ... Re(x[N/2-1]), Im(x[N/2-1]). */
/* Rows = number of rows in ioptr array (use Rows of 1 if ioptr is a 1 dimensional array)	*/
/* *Utbl = cosine table	*/
/* *BRLow = bit reversed counter table	*/
/* OUTPUTS */
/* *ioptr = real output data array	*/

Float_t	scale;
long 	StageCnt;
long 	NDiffU;

scale = 1.0/POW2(M);
M=M-1;
switch (M){
case -1:
	break;
case 0:
	for (;Rows>0;Rows--){
		rifft1pt(ioptr, scale);				/* a 2 pt fft */
		ioptr += 2*POW2(M);
	}
case 1:
	for (;Rows>0;Rows--){
		rifft2pt(ioptr, scale);				/* a 4 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
case 2:
	for (;Rows>0;Rows--){
		rifft4pt(ioptr, scale);				/* an 8 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
case 3:
	for (;Rows>0;Rows--){
		rifft8pt(ioptr, scale);				/* a 16 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
default:
	for (;Rows>0;Rows--){

		ifrstage(ioptr, M+1, Utbl);

		scbitrevR2(ioptr, M, BRLow, scale);						/* bit reverse and first radix 2 stage */
		
		StageCnt = (M-1) / 3;		// number of radix 8 stages
		NDiffU = 2;				// one radix 2 stage already complete

		if ( (M-1-(StageCnt * 3)) == 1 ){
			ibfR2(ioptr, M, NDiffU);			/* 1 radix 2 stage */
			NDiffU *= 2;
		}

		if ( (M-1-(StageCnt * 3)) == 2 ){
			ibfR4(ioptr, M, NDiffU);			/* 1 radix 4 stage */
			NDiffU *= 4;
		}

		if (M <= MCACHE){
			ibfstages(ioptr, M, Utbl, 2, NDiffU, StageCnt);		/*  RADIX 8 Stages	*/
		}

		else{
			ifftrecurs(ioptr, M, Utbl, 2, NDiffU, StageCnt);		/*  RADIX 8 Stages	*/
		}

		ioptr += 2*POW2(M);
	}
}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r13
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rax
shlq $0x34, %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
subq %rax, %rcx
movq %rcx, %xmm0
movdqa %xmm0, (%rsp)
cmpq $0x4, %rsi
ja 0x1e046
leaq 0x8a95(%rip), %rax      # 0x269ec
movslq (%rax,%r15,4), %rcx
addq %rax, %rcx
jmpq *%rcx
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %r12
movl %r15d, %ecx
shlq %cl, %r12
shlq $0x3, %r12
testq %rbx, %rbx
jle 0x1df60
movq %r14, %rdi
movdqa (%rsp), %xmm0
callq 0x21195
decq %rbx
addq %r12, %r14
jmp 0x1df7d
pushq $0x4
popq %r12
jmp 0x1e024
pushq $0x1
popq %r12
movl %r15d, %ecx
shlq %cl, %r12
shlq $0x3, %r12
testq %rbx, %rbx
jle 0x1df60
movq %r14, %rdi
movdqa (%rsp), %xmm0
callq 0x2109d
decq %rbx
addq %r12, %r14
jmp 0x1dfae
pushq $0x1
popq %r12
movl %r15d, %ecx
shlq %cl, %r12
movdqa (%rsp), %xmm0
punpcklqdq %xmm0, %xmm0    # xmm0 = xmm0[0,0]
leaq (,%r12,8), %rax
movq %rbx, %rcx
testq %rcx, %rcx
jle 0x1e01a
movupd (%r14), %xmm1
movapd %xmm1, %xmm2
shufpd $0x1, %xmm1, %xmm2      # xmm2 = xmm2[1],xmm1[0]
movapd %xmm2, %xmm3
addpd %xmm1, %xmm3
subpd %xmm1, %xmm2
movsd %xmm3, %xmm2            # xmm2 = xmm3[0],xmm2[1]
mulpd %xmm0, %xmm2
movupd %xmm2, (%r14)
decq %rcx
addq %rax, %r14
jmp 0x1dfe6
movq %rbx, %rax
sarq $0x3f, %rax
andq %rax, %rbx
shlq $0x3, %r12
testq %rbx, %rbx
jle 0x1df60
movq %r14, %rdi
movapd (%rsp), %xmm0
callq 0x21048
decq %rbx
addq %r12, %r14
jmp 0x1e028
movq %r8, 0x20(%rsp)
leaq -0x1(%r15), %rbp
leaq -0x2(%r15), %rax
pushq $0x3
popq %rcx
cqto
idivq %rcx
movq %rax, 0x10(%rsp)
imulq $-0x3, %rax, %rax
pushq $0x2
popq %rdx
movl %ebp, %ecx
shlq %cl, %rdx
leaq (%rax,%r15), %r12
addq $-0x2, %r12
shlq $0x3, %rdx
movq %rdx, 0x18(%rsp)
testq %rbx, %rbx
jle 0x1df60
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x214b9
movq %r14, %rdi
movq %rbp, %rsi
movq 0x20(%rsp), %rdx
movdqa (%rsp), %xmm0
callq 0x202ea
cmpq $0x2, %r12
je 0x1e0cb
pushq $0x2
popq %r8
cmpq $0x1, %r12
jne 0x1e0dd
movq %r14, %rdi
movq %rbp, %rsi
pushq $0x2
popq %rdx
callq 0x2053e
pushq $0x4
jmp 0x1e0db
movq %r14, %rdi
movq %rbp, %rsi
pushq $0x2
popq %rdx
callq 0x20656
pushq $0x8
popq %r8
movq %r14, %rdi
movq %rbp, %rsi
movq %r13, %rdx
pushq $0x2
popq %rcx
cmpq $0xa, %rbp
ja 0x1e0fb
movq 0x10(%rsp), %r9
callq 0x1f5c5
jmp 0x1e105
movq 0x10(%rsp), %r9
callq 0x1db40
decq %rbx
addq 0x18(%rsp), %r14
jmp 0x1e07d