// File: /workspace/github_cpp_makefile_star2_O1/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
leaq -0x1(%rsi), %r15
cmpq $0x4, %rsi
movq %xmm0, 0x18(%rsp)
ja 0x25fcf
leaq 0x9bf5(%rip), %rax      # 0x2f904
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
testq %r14, %r14
jle 0x25d64
movl $0x2, %eax
movl %r15d, %ecx
shlq %cl, %rax
shlq $0x3, %rax
incq %r14
movsd (%rbx), %xmm3
movsd 0x8(%rbx), %xmm1
movapd %xmm3, %xmm2
addsd %xmm1, %xmm2
subsd %xmm1, %xmm3
mulsd %xmm0, %xmm2
movsd %xmm2, (%rbx)
mulsd %xmm0, %xmm3
movsd %xmm3, 0x8(%rbx)
addq %rax, %rbx
decq %r14
cmpq $0x1, %r14
jg 0x25d2f
xorl %r14d, %r14d
testq %r14, %r14
jle 0x2621e
movl $0x2, %eax
movl %r15d, %ecx
shlq %cl, %rax
addq $0x18, %rbx
shlq $0x3, %rax
incq %r14
movsd -0x18(%rbx), %xmm6
movsd -0x10(%rbx), %xmm1
movsd -0x8(%rbx), %xmm2
addsd %xmm2, %xmm2
movsd (%rbx), %xmm3
addsd %xmm3, %xmm3
movapd %xmm6, %xmm4
addsd %xmm1, %xmm4
subsd %xmm1, %xmm6
movapd %xmm4, %xmm1
addsd %xmm2, %xmm1
movapd %xmm6, %xmm5
subsd %xmm3, %xmm5
subsd %xmm2, %xmm4
addsd %xmm3, %xmm6
mulsd %xmm0, %xmm1
movsd %xmm1, -0x18(%rbx)
mulsd %xmm0, %xmm5
movsd %xmm5, -0x10(%rbx)
mulsd %xmm0, %xmm4
movsd %xmm4, -0x8(%rbx)
mulsd %xmm0, %xmm6
movsd %xmm6, (%rbx)
addq %rax, %rbx
decq %r14
cmpq $0x1, %r14
jg 0x25d83
jmp 0x2621e
testq %r14, %r14
jle 0x2621e
movl $0x2, %r12d
movl %r15d, %ecx
shlq %cl, %r12
shlq $0x3, %r12
incq %r14
movq %rbx, %rdi
callq 0x29a9b
movq 0x18(%rsp), %xmm0
addq %r12, %rbx
decq %r14
cmpq $0x1, %r14
jg 0x25e12
jmp 0x2621e
testq %r14, %r14
jle 0x2621e
movl $0x2, %eax
movl %r15d, %ecx
shlq %cl, %rax
addq $0x38, %rbx
shlq $0x3, %rax
incq %r14
movsd 0x9a4f(%rip), %xmm13    # 0x2f8a8
movsd 0x9a3f(%rip), %xmm1     # 0x2f8a0
movsd -0x38(%rbx), %xmm2
movsd -0x30(%rbx), %xmm5
movsd -0x28(%rbx), %xmm4
movsd -0x20(%rbx), %xmm7
movsd -0x18(%rbx), %xmm6
addsd %xmm6, %xmm6
movsd -0x10(%rbx), %xmm8
addsd %xmm8, %xmm8
movsd -0x8(%rbx), %xmm9
movsd (%rbx), %xmm10
movapd %xmm2, %xmm3
addsd %xmm5, %xmm3
subsd %xmm5, %xmm2
movapd %xmm4, %xmm5
addsd %xmm9, %xmm5
movapd %xmm7, %xmm11
subsd %xmm10, %xmm11
subsd %xmm9, %xmm4
addsd %xmm10, %xmm7
movapd %xmm4, %xmm10
mulsd %xmm13, %xmm10
addsd %xmm5, %xmm10
mulsd %xmm13, %xmm7
addsd %xmm7, %xmm10
mulsd %xmm1, %xmm4
addsd %xmm11, %xmm4
addsd %xmm7, %xmm4
addsd %xmm5, %xmm5
subsd %xmm10, %xmm5
addsd %xmm11, %xmm11
movapd %xmm4, %xmm12
subsd %xmm11, %xmm12
movapd %xmm3, %xmm9
addsd %xmm6, %xmm9
movapd %xmm2, %xmm7
subsd %xmm8, %xmm7
subsd %xmm6, %xmm3
addsd %xmm8, %xmm2
movapd %xmm10, %xmm6
subsd %xmm5, %xmm6
movapd %xmm4, %xmm8
subsd %xmm12, %xmm8
addsd %xmm10, %xmm5
addsd %xmm4, %xmm12
movapd %xmm9, %xmm4
addsd %xmm5, %xmm4
movapd %xmm7, %xmm10
addsd %xmm12, %xmm10
subsd %xmm5, %xmm9
subsd %xmm12, %xmm7
movapd %xmm3, %xmm5
addsd %xmm8, %xmm5
movapd %xmm2, %xmm11
subsd %xmm6, %xmm11
subsd %xmm8, %xmm3
addsd %xmm2, %xmm6
mulsd %xmm0, %xmm4
movsd %xmm4, -0x38(%rbx)
mulsd %xmm0, %xmm10
movsd %xmm10, -0x30(%rbx)
mulsd %xmm0, %xmm3
movsd %xmm3, -0x28(%rbx)
mulsd %xmm0, %xmm6
movsd %xmm6, -0x20(%rbx)
mulsd %xmm0, %xmm9
movsd %xmm9, -0x18(%rbx)
mulsd %xmm0, %xmm7
movsd %xmm7, -0x10(%rbx)
mulsd %xmm0, %xmm5
movsd %xmm5, -0x8(%rbx)
mulsd %xmm0, %xmm11
movsd %xmm11, (%rbx)
addq %rax, %rbx
decq %r14
cmpq $0x1, %r14
jg 0x25e61
jmp 0x2621e
testq %r14, %r14
jle 0x2621e
leaq -0x2(%rsi), %rdi
movabsq $0x5555555555555556, %rcx # imm = 0x5555555555555556
movq %rdi, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
movq %rax, 0x10(%rsp)
leaq (%rax,%rax,2), %rax
subq %rax, %rdi
xorl %eax, %eax
movq %rdi, 0x38(%rsp)
cmpq $0x1, %rdi
sete %al
setne %dl
cmpq $0x3, %r15
setb %dil
movl $0x1, %r9d
movl %r15d, %ecx
shlq %cl, %r9
movl $0x2, %r10d
shlq %cl, %r10
movq %r10, 0x30(%rsp)
shrq $0x3, %r9
movq %r9, 0x20(%rsp)
orb %dl, %dil
movb %dil, 0xf(%rsp)
leaq 0x2(,%rax,2), %rax
movq %rax, 0x28(%rsp)
movq %rsi, 0x40(%rsp)
movq %rbx, %rdi
movq %r8, %r13
movq %r8, %rdx
callq 0x29ed6
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rbp
movq %r12, %rdx
movsd 0x18(%rsp), %xmm0
callq 0x28ab0
movq 0x28(%rsp), %r12
cmpb $0x0, 0xf(%rsp)
jne 0x261b2
movq 0x20(%rsp), %rax
movq %rbx, %rcx
movsd 0x20(%rcx), %xmm0
movsd (%rcx), %xmm1
movsd 0x8(%rcx), %xmm2
movsd 0x28(%rcx), %xmm3
movsd 0x40(%rcx), %xmm4
movsd 0x60(%rcx), %xmm5
movsd 0x48(%rcx), %xmm6
movsd 0x68(%rcx), %xmm7
movapd %xmm1, %xmm8
addsd %xmm0, %xmm8
movapd %xmm2, %xmm9
addsd %xmm3, %xmm9
subsd %xmm0, %xmm1
subsd %xmm3, %xmm2
movapd %xmm4, %xmm0
addsd %xmm5, %xmm0
movapd %xmm6, %xmm3
addsd %xmm7, %xmm3
subsd %xmm5, %xmm4
subsd %xmm7, %xmm6
movsd %xmm8, (%rcx)
movsd %xmm9, 0x8(%rcx)
movsd %xmm1, 0x20(%rcx)
movsd %xmm2, 0x28(%rcx)
movsd %xmm0, 0x40(%rcx)
movsd %xmm3, 0x48(%rcx)
movsd %xmm4, 0x60(%rcx)
movsd %xmm6, 0x68(%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 0x26095
movl $0x4, %r12d
cmpq $0x2, 0x38(%rsp)
jne 0x261cc
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x28f99
shll $0x2, %r12d
movq %r13, %rdx
movl $0x2, %ecx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %r8
cmpq $0xa, %r15
ja 0x261ef
movq 0x10(%rsp), %r9
callq 0x2793c
jmp 0x261f9
movq 0x10(%rsp), %r9
callq 0x2528f
movq 0x30(%rsp), %rax
leaq (%rbx,%rax,8), %rbx
leaq -0x1(%r14), %rax
cmpq $0x1, %r14
movq %rax, %r14
movq %rbp, %r12
movq %r13, %r8
movq 0x40(%rsp), %rsi
jg 0x26058
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq