// File: /workspace/github_cpp_makefile_star2_O3/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 $0x48, %rsp
movq %r8, %r12
movq %rcx, %r8
movq %rdx, %r14
movq %rdi, %rbx
movq %rsi, %rax
shlq $0x34, %rax
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
subq %rax, %rcx
movq %rcx, %xmm0
cmpq $0x4, %rsi
movdqa %xmm0, 0x30(%rsp)
ja 0x2598c
leaq 0x932f(%rip), %rax      # 0x2ea4c
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
testq %r14, %r14
jle 0x25b96
movl $0x1, %eax
movl %esi, %ecx
shlq %cl, %rax
punpcklqdq %xmm0, %xmm0    # xmm0 = xmm0[0,0]
shlq $0x3, %rax
incq %r14
movupd (%rbx), %xmm3
movapd %xmm3, %xmm1
shufpd $0x1, %xmm3, %xmm1      # xmm1 = xmm1[1],xmm3[0]
movapd %xmm1, %xmm2
addpd %xmm3, %xmm2
subpd %xmm3, %xmm1
movsd %xmm2, %xmm1            # xmm1 = xmm2[0],xmm1[1]
mulpd %xmm0, %xmm1
movupd %xmm1, (%rbx)
addq %rax, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x25744
jmp 0x25b96
testq %r14, %r14
jle 0x25b96
movl $0x1, %r12d
movl %esi, %ecx
shlq %cl, %r12
shlq $0x3, %r12
incq %r14
movq %rbx, %rdi
callq 0x28f08
movdqa 0x30(%rsp), %xmm0
addq %r12, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x25795
jmp 0x25b96
testq %r14, %r14
jle 0x25b96
movl $0x1, %eax
movl %esi, %ecx
shlq %cl, %rax
punpcklqdq %xmm0, %xmm0    # xmm0 = xmm0[0,0]
addq $0x10, %rbx
shlq $0x3, %rax
incq %r14
movupd -0x10(%rbx), %xmm4
movupd (%rbx), %xmm1
movapd %xmm4, %xmm2
shufpd $0x1, %xmm4, %xmm2      # xmm2 = xmm2[1],xmm4[0]
addpd %xmm1, %xmm1
movapd %xmm2, %xmm3
addpd %xmm4, %xmm3
subpd %xmm4, %xmm2
movsd %xmm3, %xmm2            # xmm2 = xmm3[0],xmm2[1]
movapd %xmm2, %xmm3
addpd %xmm1, %xmm3
subpd %xmm1, %xmm2
movapd %xmm2, %xmm1
movsd %xmm3, %xmm1            # xmm1 = xmm3[0],xmm1[1]
mulpd %xmm0, %xmm1
movupd %xmm1, -0x10(%rbx)
shufpd $0x2, %xmm3, %xmm2      # xmm2 = xmm2[0],xmm3[1]
mulpd %xmm0, %xmm2
movupd %xmm2, (%rbx)
addq %rax, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x257d6
jmp 0x25b96
testq %r14, %r14
jle 0x25b96
movl $0x1, %eax
movl %esi, %ecx
shlq %cl, %rax
punpcklqdq %xmm0, %xmm0    # xmm0 = xmm0[0,0]
addq $0x30, %rbx
shlq $0x3, %rax
incq %r14
movapd 0x913e(%rip), %xmm11    # 0x2e9a0
movapd 0x9146(%rip), %xmm1     # 0x2e9b0
movapd 0x5c0e(%rip), %xmm2     # 0x2b480
movapd 0x90b6(%rip), %xmm3     # 0x2e930
movupd -0x30(%rbx), %xmm4
movupd -0x20(%rbx), %xmm8
movupd -0x10(%rbx), %xmm6
movupd (%rbx), %xmm7
movapd %xmm4, %xmm5
shufpd $0x1, %xmm4, %xmm5      # xmm5 = xmm5[1],xmm4[0]
addpd %xmm6, %xmm6
movapd %xmm5, %xmm9
addpd %xmm4, %xmm9
subpd %xmm4, %xmm5
movsd %xmm9, %xmm5            # xmm5 = xmm9[0],xmm5[1]
movapd %xmm8, %xmm4
addpd %xmm7, %xmm4
subpd %xmm7, %xmm8
movapd %xmm8, %xmm7
movsd %xmm4, %xmm7            # xmm7 = xmm4[0],xmm7[1]
unpcklpd %xmm8, %xmm8            # xmm8 = xmm8[0,0]
mulpd %xmm11, %xmm8
addpd %xmm7, %xmm8
unpckhpd %xmm4, %xmm4            # xmm4 = xmm4[1,1]
mulpd %xmm1, %xmm4
addpd %xmm8, %xmm4
movapd %xmm4, %xmm8
xorpd %xmm2, %xmm8
shufpd $0x2, %xmm4, %xmm8      # xmm8 = xmm8[0],xmm4[1]
mulpd %xmm3, %xmm7
addpd %xmm8, %xmm7
movapd %xmm5, %xmm8
addpd %xmm6, %xmm8
subpd %xmm6, %xmm5
movapd %xmm5, %xmm6
movsd %xmm8, %xmm6            # xmm6 = xmm8[0],xmm6[1]
movapd %xmm4, %xmm9
addpd %xmm7, %xmm9
movapd %xmm6, %xmm10
addpd %xmm9, %xmm10
mulpd %xmm0, %xmm10
movupd %xmm10, -0x30(%rbx)
shufpd $0x2, %xmm8, %xmm5      # xmm5 = xmm5[0],xmm8[1]
subpd %xmm7, %xmm4
shufpd $0x1, %xmm4, %xmm4      # xmm4 = xmm4[1,0]
movapd %xmm5, %xmm7
subpd %xmm4, %xmm7
addpd %xmm5, %xmm4
movapd %xmm4, %xmm5
movsd %xmm7, %xmm5            # xmm5 = xmm7[0],xmm5[1]
mulpd %xmm0, %xmm5
movupd %xmm5, -0x20(%rbx)
subpd %xmm9, %xmm6
mulpd %xmm0, %xmm6
movupd %xmm6, -0x10(%rbx)
shufpd $0x2, %xmm7, %xmm4      # xmm4 = xmm4[0],xmm7[1]
mulpd %xmm0, %xmm4
movupd %xmm4, (%rbx)
addq %rax, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x2587a
jmp 0x25b96
testq %r14, %r14
jle 0x25b96
leaq -0x1(%rsi), %rbp
leaq -0x2(%rsi), %rdi
movabsq $0x5555555555555556, %rcx # imm = 0x5555555555555556
movq %rdi, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
movl $0x1, %edx
movl %ebp, %ecx
shlq %cl, %rdx
movq %rax, 0x8(%rsp)
leaq (%rax,%rax,2), %rax
subq %rax, %rdi
movq %rdi, 0x10(%rsp)
shrq $0x3, %rdx
movq %rdx, 0x18(%rsp)
movl $0x2, %eax
shlq %cl, %rax
movq %rax, 0x20(%rsp)
movq %rsi, 0x28(%rsp)
movq %rbx, %rdi
movq %r8, %r13
movq %r8, %rdx
callq 0x2922c
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %r15
movq %r12, %rdx
movapd 0x30(%rsp), %xmm0
callq 0x28150
movl $0x2, %r12d
movq 0x10(%rsp), %rax
cmpq $0x1, %rax
jne 0x25b1b
movl $0x4, %r12d
cmpq $0x3, %rbp
jb 0x25b39
movq 0x18(%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 0x25a3f
movl $0x4, %r12d
movq 0x10(%rsp), %rax
cmpq $0x2, %rax
jne 0x25b33
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x284c1
shll $0x2, %r12d
cmpq $0xa, %rbp
ja 0x25b56
movl $0x2, %ecx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %r8
movq 0x8(%rsp), %r9
callq 0x27149
jmp 0x25b71
movl $0x2, %ecx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r12, %r8
movq 0x8(%rsp), %r9
callq 0x24e53
movq 0x20(%rsp), %rax
leaq (%rbx,%rax,8), %rbx
leaq -0x1(%r14), %rax
cmpq $0x1, %r14
movq %rax, %r14
movq %r15, %r12
movq 0x28(%rsp), %rsi
movq %r13, %r8
jg 0x259ed
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq