// File: /workspace/github_cpp_makefile_star2_O3/kebwi[P]Trifid/src/FFT/fftlib.cpp
// Function: rffts1(double*, long, long, double*, short*)
void rffts1(Float_t *ioptr, long M, long Rows, Float_t *Utbl, short *BRLow){
/* Compute in-place real fft on the rows of the input array	*/
/* The result is the complex spectra of the positive frequencies */
/* except the location for the first complex number contains the real */
/* values for DC and Nyquest */
/* INPUTS */
/* *ioptr = real 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	in the following order */
/* 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]). */

Float_t	scale;
long 	StageCnt;
long 	NDiffU;

M=M-1;
switch (M){
case -1:
	break;
case 0:
	for (;Rows>0;Rows--){
		rfft1pt(ioptr);				/* a 2 pt fft */
		ioptr += 2*POW2(M);
	}
case 1:
	for (;Rows>0;Rows--){
		rfft2pt(ioptr);				/* a 4 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
case 2:
	for (;Rows>0;Rows--){
		rfft4pt(ioptr);				/* an 8 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
case 3:
	for (;Rows>0;Rows--){
		rfft8pt(ioptr);				/* a 16 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
default:
	scale = 0.5;
	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 ){
			bfR2(ioptr, M, NDiffU);			/* 1 radix 2 stage */
			NDiffU *= 2;
		}

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

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

		else{
			fftrecurs(ioptr, M, Utbl, 2, NDiffU, StageCnt);		/*  RADIX 8 Stages	*/
			frstage(ioptr, M+1, Utbl);
		}

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
cmpq $0x4, %rsi
ja 0x254bf
leaq 0x97d1(%rip), %rax      # 0x2ea38
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
testq %r14, %r14
jle 0x256c4
movl $0x1, %eax
movl %r12d, %ecx
shlq %cl, %rax
addq $0x8, %rbx
shlq $0x3, %rax
incq %r14
movsd -0x8(%rbx), %xmm0
movsd (%rbx), %xmm1
movapd %xmm0, %xmm2
addsd %xmm1, %xmm2
subsd %xmm1, %xmm0
movsd %xmm2, -0x8(%rbx)
movsd %xmm0, (%rbx)
addq %rax, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x2528f
jmp 0x256c4
testq %r14, %r14
jle 0x256c4
movl $0x1, %r15d
movl %r12d, %ecx
shlq %cl, %r15
shlq $0x3, %r15
incq %r14
movq %rbx, %rdi
callq 0x28906
addq %r15, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x252da
jmp 0x256c4
testq %r14, %r14
jle 0x256c4
movl $0x1, %eax
movl %r12d, %ecx
shlq %cl, %rax
addq $0x18, %rbx
shlq $0x3, %rax
incq %r14
movsd -0x18(%rbx), %xmm0
movsd -0x10(%rbx), %xmm1
movsd -0x8(%rbx), %xmm2
movsd (%rbx), %xmm3
movapd %xmm0, %xmm4
addsd %xmm2, %xmm4
movapd %xmm1, %xmm5
addsd %xmm3, %xmm5
subsd %xmm1, %xmm3
movapd %xmm4, %xmm1
addsd %xmm5, %xmm1
movsd %xmm1, -0x18(%rbx)
unpcklpd %xmm0, %xmm4            # xmm4 = xmm4[0],xmm0[0]
unpcklpd %xmm2, %xmm5            # xmm5 = xmm5[0],xmm2[0]
subpd %xmm5, %xmm4
movupd %xmm4, -0x10(%rbx)
movsd %xmm3, (%rbx)
addq %rax, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x25312
jmp 0x256c4
testq %r14, %r14
jle 0x256c4
movl $0x1, %eax
movl %r12d, %ecx
shlq %cl, %rax
addq $0x30, %rbx
shlq $0x3, %rax
incq %r14
movapd 0x957d(%rip), %xmm0     # 0x2e910
movsd 0x966d(%rip), %xmm1     # 0x2ea08
movapd 0x957d(%rip), %xmm2     # 0x2e920
movapd 0x60d5(%rip), %xmm3     # 0x2b480
movapd 0x957d(%rip), %xmm4     # 0x2e930
movupd -0x30(%rbx), %xmm8
movupd -0x20(%rbx), %xmm6
movupd -0x10(%rbx), %xmm7
movupd (%rbx), %xmm5
movapd %xmm6, %xmm9
movapd %xmm8, %xmm10
movsd %xmm6, %xmm10           # xmm10 = xmm6[0],xmm10[1]
movsd %xmm8, %xmm6            # xmm6 = xmm8[0],xmm6[1]
subpd %xmm7, %xmm8
subpd %xmm5, %xmm9
shufpd $0x1, %xmm9, %xmm9      # xmm9 = xmm9[1,0]
movapd %xmm8, %xmm11
addpd %xmm9, %xmm11
subpd %xmm9, %xmm8
movapd %xmm8, %xmm12
addpd %xmm11, %xmm12
subpd %xmm11, %xmm8
movapd %xmm8, %xmm9
movsd %xmm12, %xmm9           # xmm9 = xmm12[0],xmm9[1]
unpckhpd %xmm12, %xmm12          # xmm12 = xmm12[1,1]
mulpd %xmm0, %xmm12
addpd %xmm9, %xmm12
mulsd %xmm1, %xmm8
unpcklpd %xmm8, %xmm8            # xmm8 = xmm8[0,0]
addpd %xmm12, %xmm8
movapd %xmm7, %xmm11
movsd %xmm5, %xmm11           # xmm11 = xmm5[0],xmm11[1]
addpd %xmm10, %xmm11
movsd %xmm7, %xmm5            # xmm5 = xmm7[0],xmm5[1]
addpd %xmm6, %xmm5
movapd %xmm5, %xmm6
addpd %xmm11, %xmm6
movapd %xmm6, %xmm7
unpckhpd %xmm6, %xmm7            # xmm7 = xmm7[1],xmm6[1]
subpd %xmm11, %xmm5
movapd %xmm6, %xmm10
addsd %xmm7, %xmm10
subsd %xmm7, %xmm6
movupd %xmm5, -0x10(%rbx)
movsd %xmm10, -0x30(%rbx)
movsd %xmm6, -0x28(%rbx)
movapd %xmm8, %xmm5
xorpd %xmm3, %xmm5
shufpd $0x2, %xmm8, %xmm5      # xmm5 = xmm5[0],xmm8[1]
mulpd %xmm2, %xmm8
movupd %xmm8, -0x20(%rbx)
mulpd %xmm4, %xmm9
addpd %xmm5, %xmm9
mulpd %xmm2, %xmm9
movupd %xmm9, (%rbx)
addq %rax, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x253b3
jmp 0x256c4
testq %r14, %r14
jle 0x256c4
movq %rcx, %r13
leaq -0x1(%r12), %rbp
leaq -0x2(%r12), %rsi
movabsq $0x5555555555555556, %rcx # imm = 0x5555555555555556
movq %rsi, %rax
imulq %rcx
movq %rdx, %rax
shrq $0x3f, %rax
addq %rdx, %rax
movq %rax, (%rsp)
leaq (%rax,%rax,2), %rax
movl $0x1, %edx
movl %ebp, %ecx
shlq %cl, %rdx
subq %rax, %rsi
movq %rsi, 0x8(%rsp)
shrq $0x3, %rdx
movq %rdx, 0x10(%rsp)
movl $0x2, %eax
shlq %cl, %rax
movq %rax, 0x18(%rsp)
movq %r8, 0x20(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r8, %rdx
movsd 0x4b13(%rip), %xmm0     # 0x2a048
callq 0x28150
movl $0x2, %r15d
movq 0x8(%rsp), %rax
cmpq $0x1, %rax
jne 0x25643
movl $0x4, %r15d
cmpq $0x3, %rbp
jb 0x25661
movq 0x10(%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
addsd %xmm1, %xmm8
movapd %xmm2, %xmm9
subsd %xmm3, %xmm9
subsd %xmm1, %xmm0
addsd %xmm3, %xmm2
movapd %xmm4, %xmm1
addsd %xmm5, %xmm1
movapd %xmm6, %xmm3
subsd %xmm7, %xmm3
subsd %xmm5, %xmm4
addsd %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 0x25567
movl $0x4, %r15d
movq 0x8(%rsp), %rax
cmpq $0x2, %rax
jne 0x2565b
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
callq 0x26d07
shll $0x2, %r15d
cmpq $0xa, %rbp
ja 0x2567d
movl $0x2, %ecx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r15, %r8
movq (%rsp), %r9
callq 0x25ba5
jmp 0x25697
movl $0x2, %ecx
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
movq %r15, %r8
movq (%rsp), %r9
callq 0x248f4
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x28c70
movq 0x18(%rsp), %rax
leaq (%rbx,%rax,8), %rbx
leaq -0x1(%r14), %rax
cmpq $0x1, %r14
movq %rax, %r14
movq 0x20(%rsp), %r8
jg 0x25524
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq