// File: /workspace/github_cpp_makefile_star2_O3/kebwi[P]Trifid/src/FFT/fftlib.cpp
// Function: iffts1(double*, long, long, double*, short*)
void iffts1(Float_t *ioptr, long M, long Rows, Float_t *Utbl, short *BRLow){
/* Compute in-place inverse complex fft on the rows of the input array	*/
/* INPUTS */
/* *ioptr = input data array	*/
/* M = log2 of fft size	*/
/* 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 = output data array	*/

long 	StageCnt;
long 	NDiffU;
const Float_t scale = 1.0/POW2(M);

switch (M){
case 0:
	break;
case 1:
	for (;Rows>0;Rows--){
		ifft2pt(ioptr, scale);				/* a 2 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
case 2:
	for (;Rows>0;Rows--){
		ifft4pt(ioptr, scale);				/* a 4 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
case 3:
	for (;Rows>0;Rows--){
		ifft8pt(ioptr, scale);				/* an 8 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
default:
	for (;Rows>0;Rows--){

		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, 1, NDiffU, StageCnt);		/*  RADIX 8 Stages	*/

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r9
movq %rsi, %r12
movl $0x1, %esi
movl %r12d, %ecx
shlq %cl, %rsi
movq %rdx, %r14
movq %rdi, %rbx
movq %r12, %rax
shlq $0x34, %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
subq %rax, %rcx
movq %rcx, %xmm0
cmpq $0x3, %r12
movdqa %xmm0, 0x20(%rsp)
ja 0x25071
leaq 0x9ad2(%rip), %rax      # 0x2ea28
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
testq %r14, %r14
jle 0x25230
punpcklqdq %xmm0, %xmm0    # xmm0 = xmm0[0,0]
incq %r14
movupd (%rbx), %xmm3
movupd 0x10(%rbx), %xmm1
movapd %xmm3, %xmm2
addpd %xmm1, %xmm2
mulpd %xmm0, %xmm2
movupd %xmm2, (%rbx)
subpd %xmm1, %xmm3
mulpd %xmm0, %xmm3
movupd %xmm3, 0x10(%rbx)
addq $0x20, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x24f6f
jmp 0x25230
testq %r14, %r14
jle 0x25230
punpcklqdq %xmm0, %xmm0    # xmm0 = xmm0[0,0]
incq %r14
movupd (%rbx), %xmm1
movupd 0x10(%rbx), %xmm7
movupd 0x20(%rbx), %xmm2
movupd 0x30(%rbx), %xmm3
movapd %xmm1, %xmm4
addpd %xmm2, %xmm4
movapd %xmm7, %xmm5
addpd %xmm3, %xmm5
movapd %xmm4, %xmm6
addpd %xmm5, %xmm6
mulpd %xmm0, %xmm6
movupd %xmm6, (%rbx)
subpd %xmm2, %xmm1
subpd %xmm3, %xmm7
shufpd $0x1, %xmm7, %xmm7      # xmm7 = xmm7[1,0]
movapd %xmm1, %xmm2
subpd %xmm7, %xmm2
addpd %xmm1, %xmm7
movapd %xmm7, %xmm1
movsd %xmm2, %xmm1            # xmm1 = xmm2[0],xmm1[1]
mulpd %xmm0, %xmm1
movupd %xmm1, 0x10(%rbx)
subpd %xmm5, %xmm4
mulpd %xmm0, %xmm4
movupd %xmm4, 0x20(%rbx)
shufpd $0x2, %xmm2, %xmm7      # xmm7 = xmm7[0],xmm2[1]
mulpd %xmm0, %xmm7
movupd %xmm7, 0x30(%rbx)
addq $0x40, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x24fb7
jmp 0x25230
testq %r14, %r14
jle 0x25230
incq %r14
movq %rbx, %rdi
callq 0x27f61
movdqa 0x20(%rsp), %xmm0
subq $-0x80, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x25051
jmp 0x25230
movq %rsi, (%rsp)
movq %r9, 0x10(%rsp)
testq %r14, %r14
jle 0x25230
leaq -0x1(%r12), %rax
movabsq $0x5555555555555556, %rcx # imm = 0x5555555555555556
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
movq %rax, 0x8(%rsp)
leaq (%rax,%rax,2), %rax
negq %rax
leaq (%r12,%rax), %r13
decq %r13
shrq $0x3, (%rsp)
movl $0x2, %eax
movl %r12d, %ecx
shlq %cl, %rax
movq %rax, 0x18(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r8, %rbp
movq %r8, %rdx
callq 0x28150
movl $0x2, %r15d
cmpq $0x1, %r13
jne 0x251c6
movq (%rsp), %rax
movq %rbx, %rcx
movupd (%rcx), %xmm0
movupd 0x20(%rcx), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
subpd %xmm1, %xmm0
movupd 0x40(%rcx), %xmm1
movupd 0x60(%rcx), %xmm3
movapd %xmm1, %xmm4
addpd %xmm3, %xmm4
movupd %xmm2, (%rcx)
movupd %xmm0, 0x20(%rcx)
movupd %xmm4, 0x40(%rcx)
subpd %xmm3, %xmm1
movupd %xmm1, 0x60(%rcx)
movsd 0x10(%rcx), %xmm0
movsd 0x38(%rcx), %xmm1
movsd 0x18(%rcx), %xmm2
movsd 0x30(%rcx), %xmm3
movsd 0x50(%rcx), %xmm4
movsd 0x78(%rcx), %xmm5
movsd 0x58(%rcx), %xmm6
movsd 0x70(%rcx), %xmm7
movapd %xmm0, %xmm8
subsd %xmm1, %xmm8
movapd %xmm2, %xmm9
addsd %xmm3, %xmm9
addsd %xmm1, %xmm0
subsd %xmm3, %xmm2
movapd %xmm4, %xmm1
subsd %xmm5, %xmm1
movapd %xmm6, %xmm3
addsd %xmm7, %xmm3
addsd %xmm5, %xmm4
subsd %xmm7, %xmm6
movsd %xmm8, 0x10(%rcx)
movsd %xmm9, 0x18(%rcx)
movsd %xmm0, 0x30(%rcx)
movsd %xmm2, 0x38(%rcx)
movsd %xmm1, 0x50(%rcx)
movsd %xmm3, 0x58(%rcx)
movsd %xmm4, 0x70(%rcx)
movsd %xmm6, 0x78(%rcx)
subq $-0x80, %rcx
decq %rax
jne 0x250ef
movl $0x4, %r15d
cmpq $0x2, %r13
jne 0x251de
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x284c1
shll $0x2, %r15d
movq 0x10(%rsp), %rdx
movl $0x1, %ecx
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %r8
cmpq $0xa, %r12
ja 0x25203
movq 0x8(%rsp), %r9
callq 0x27149
jmp 0x2520d
movq 0x8(%rsp), %r9
callq 0x24e53
movq 0x18(%rsp), %rax
leaq (%rbx,%rax,8), %rbx
leaq -0x1(%r14), %rax
cmpq $0x1, %r14
movq %rax, %r14
movdqa 0x20(%rsp), %xmm0
movq %rbp, %r8
jg 0x250c7
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq