// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x10(%rbp), %rcx
shlq $0x34, %rcx
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
subq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
decq %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
incq %rax
movq %rax, -0x48(%rbp)
subq $0x4, %rax
ja 0x3b60f
movq -0x48(%rbp), %rax
leaq 0x12524(%rip), %rcx     # 0x4da14
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x3b73d
jmp 0x3b500
cmpq $0x0, -0x18(%rbp)
jle 0x3b53e
movq -0x8(%rbp), %rdi
movsd -0x30(%rbp), %xmm0
callq 0x46620
movq -0x10(%rbp), %rcx
movl $0x1, %eax
shlq %cl, %rax
shlq %rax
shlq $0x3, %rax
addq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3b500
jmp 0x3b540
jmp 0x3b542
cmpq $0x0, -0x18(%rbp)
jle 0x3b580
movq -0x8(%rbp), %rdi
movsd -0x30(%rbp), %xmm0
callq 0x46690
movq -0x10(%rbp), %rcx
movl $0x1, %eax
shlq %cl, %rax
shlq %rax
shlq $0x3, %rax
addq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3b542
jmp 0x3b73d
jmp 0x3b587
cmpq $0x0, -0x18(%rbp)
jle 0x3b5c5
movq -0x8(%rbp), %rdi
movsd -0x30(%rbp), %xmm0
callq 0x467a0
movq -0x10(%rbp), %rcx
movl $0x1, %eax
shlq %cl, %rax
shlq %rax
shlq $0x3, %rax
addq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3b587
jmp 0x3b73d
jmp 0x3b5cc
cmpq $0x0, -0x18(%rbp)
jle 0x3b60a
movq -0x8(%rbp), %rdi
movsd -0x30(%rbp), %xmm0
callq 0x46b10
movq -0x10(%rbp), %rcx
movl $0x1, %eax
shlq %cl, %rax
shlq %rax
shlq $0x3, %rax
addq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3b5cc
jmp 0x3b73d
jmp 0x3b611
cmpq $0x0, -0x18(%rbp)
jle 0x3b73b
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x1, %rsi
movq -0x20(%rbp), %rdx
callq 0x476c0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x28(%rbp), %rdx
movsd -0x30(%rbp), %xmm0
callq 0x43240
movq -0x10(%rbp), %rax
subq $0x1, %rax
movl $0x3, %ecx
cqto
idivq %rcx
movq %rax, -0x38(%rbp)
movq $0x2, -0x40(%rbp)
movq -0x10(%rbp), %rax
subq $0x1, %rax
imulq $0x3, -0x38(%rbp), %rcx
subq %rcx, %rax
cmpq $0x1, %rax
jne 0x3b697
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x43ae0
movq -0x40(%rbp), %rax
shlq %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
subq $0x1, %rax
imulq $0x3, -0x38(%rbp), %rcx
subq %rcx, %rax
cmpq $0x2, %rax
jne 0x3b6ca
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x43fc0
movq -0x40(%rbp), %rax
shlq $0x2, %rax
movq %rax, -0x40(%rbp)
cmpq $0xa, -0x10(%rbp)
ja 0x3b6f1
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x40(%rbp), %r8
movq -0x38(%rbp), %r9
movl $0x2, %ecx
callq 0x40290
jmp 0x3b70f
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x40(%rbp), %r8
movq -0x38(%rbp), %r9
movl $0x2, %ecx
callq 0x3aea0
movq -0x10(%rbp), %rcx
movl $0x1, %eax
shlq %cl, %rax
shlq %rax
shlq $0x3, %rax
addq -0x8(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x18(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x3b611
jmp 0x3b73d
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)