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

switch (M){
case 0:
	break;
case 1:
	for (;Rows>0;Rows--){
		fft2pt(ioptr);				/* a 2 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
case 2:
	for (;Rows>0;Rows--){
		fft4pt(ioptr);				/* a 4 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
case 3:
	for (;Rows>0;Rows--){
		fft8pt(ioptr);				/* an 8 pt fft */
		ioptr += 2*POW2(M);
	}
	break;
default:
	for (;Rows>0;Rows--){

		bitrevR2(ioptr, M, BRLow);						/* 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, 1, NDiffU, StageCnt);		/*  RADIX 8 Stages	*/

		else{
			fftrecurs(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 $0x28, %rsp
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
cmpq $0x3, %rsi
ja 0x24c7a
leaq 0xa04e(%rip), %rax      # 0x2ea18
movslq (%rax,%r12,4), %rcx
addq %rax, %rcx
jmpq *%rcx
testq %r14, %r14
jle 0x24e44
incq %r14
movupd (%rbx), %xmm0
movupd 0x10(%rbx), %xmm1
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
movupd %xmm2, (%rbx)
subpd %xmm1, %xmm0
movupd %xmm0, 0x10(%rbx)
addq $0x20, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x249df
jmp 0x24e44
testq %r14, %r14
jle 0x24e44
incq %r14
movupd (%rbx), %xmm0
movupd 0x10(%rbx), %xmm1
movupd 0x20(%rbx), %xmm2
movupd 0x30(%rbx), %xmm3
movapd %xmm0, %xmm4
addpd %xmm2, %xmm4
movapd %xmm1, %xmm5
addpd %xmm3, %xmm5
movapd %xmm4, %xmm6
addpd %xmm5, %xmm6
movupd %xmm6, (%rbx)
subpd %xmm2, %xmm0
subpd %xmm3, %xmm1
shufpd $0x1, %xmm1, %xmm1      # xmm1 = xmm1[1,0]
movapd %xmm0, %xmm2
addpd %xmm1, %xmm2
subpd %xmm1, %xmm0
movapd %xmm0, %xmm1
movsd %xmm2, %xmm1            # xmm1 = xmm2[0],xmm1[1]
movupd %xmm1, 0x10(%rbx)
subpd %xmm5, %xmm4
movupd %xmm4, 0x20(%rbx)
shufpd $0x2, %xmm2, %xmm0      # xmm0 = xmm0[0],xmm2[1]
movupd %xmm0, 0x30(%rbx)
addq $0x40, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x24a1b
jmp 0x24e44
testq %r14, %r14
jle 0x24e44
incq %r14
movupd 0x40(%rbx), %xmm15
movupd 0x60(%rbx), %xmm14
movupd 0x50(%rbx), %xmm0
movupd (%rbx), %xmm4
movupd 0x10(%rbx), %xmm11
movupd 0x20(%rbx), %xmm13
movupd 0x30(%rbx), %xmm7
movupd 0x70(%rbx), %xmm6
movapd %xmm4, %xmm3
addpd %xmm15, %xmm3
movapd %xmm13, %xmm10
addpd %xmm14, %xmm10
movapd %xmm3, %xmm5
addpd %xmm10, %xmm5
movapd %xmm11, %xmm9
addpd %xmm0, %xmm9
movapd %xmm7, %xmm12
movsd %xmm11, %xmm12          # xmm12 = xmm11[0],xmm12[1]
shufpd $0x1, %xmm7, %xmm11     # xmm11 = xmm11[1],xmm7[0]
movapd %xmm6, %xmm8
movsd %xmm0, %xmm8            # xmm8 = xmm0[0],xmm8[1]
shufpd $0x1, %xmm6, %xmm0      # xmm0 = xmm0[1],xmm6[0]
subpd %xmm0, %xmm11
subpd %xmm8, %xmm12
addpd %xmm6, %xmm7
movapd %xmm9, %xmm6
addpd %xmm7, %xmm6
movapd %xmm12, %xmm0
unpckhpd %xmm12, %xmm0           # xmm0 = xmm0[1],xmm12[1]
movapd %xmm12, %xmm8
subsd %xmm0, %xmm8
movapd %xmm11, %xmm1
unpckhpd %xmm11, %xmm1           # xmm1 = xmm1[1],xmm11[1]
addsd %xmm12, %xmm0
movapd %xmm11, %xmm12
addsd %xmm1, %xmm12
subsd %xmm1, %xmm11
movapd %xmm5, %xmm1
addpd %xmm6, %xmm1
movupd %xmm1, (%rbx)
subpd %xmm15, %xmm4
subpd %xmm14, %xmm13
shufpd $0x1, %xmm13, %xmm13    # xmm13 = xmm13[1,0]
movapd %xmm4, %xmm14
addpd %xmm13, %xmm14
subpd %xmm13, %xmm4
movapd %xmm0, %xmm13
movapd 0x68ed(%rip), %xmm15    # 0x2b480
xorpd %xmm15, %xmm13
unpcklpd %xmm0, %xmm13           # xmm13 = xmm13[0],xmm0[0]
movapd %xmm4, %xmm0
movsd %xmm14, %xmm0           # xmm0 = xmm14[0],xmm0[1]
movapd 0x9d52(%rip), %xmm2     # 0x2e900
mulpd %xmm2, %xmm13
addpd %xmm0, %xmm13
movsd 0x9e48(%rip), %xmm2     # 0x2ea08
mulsd %xmm2, %xmm11
unpcklpd %xmm11, %xmm11          # xmm11 = xmm11[0,0]
subpd %xmm11, %xmm13
addpd %xmm0, %xmm0
subpd %xmm13, %xmm0
movupd %xmm0, 0x10(%rbx)
subpd %xmm10, %xmm3
subpd %xmm7, %xmm9
shufpd $0x1, %xmm9, %xmm9      # xmm9 = xmm9[1,0]
movapd %xmm3, %xmm0
addpd %xmm9, %xmm0
subpd %xmm9, %xmm3
movapd %xmm3, %xmm1
movsd %xmm0, %xmm1            # xmm1 = xmm0[0],xmm1[1]
movupd %xmm1, 0x20(%rbx)
shufpd $0x2, %xmm14, %xmm4     # xmm4 = xmm4[0],xmm14[1]
movapd %xmm12, %xmm1
xorpd %xmm15, %xmm1
unpcklpd %xmm12, %xmm1           # xmm1 = xmm1[0],xmm12[0]
mulsd %xmm2, %xmm8
unpcklpd %xmm8, %xmm8            # xmm8 = xmm8[0,0]
addpd %xmm4, %xmm8
mulpd 0x9ccc(%rip), %xmm1     # 0x2e900
addpd %xmm8, %xmm1
addpd %xmm4, %xmm4
subpd %xmm1, %xmm4
movupd %xmm4, 0x30(%rbx)
subpd %xmm6, %xmm5
movupd %xmm5, 0x40(%rbx)
movupd %xmm13, 0x50(%rbx)
shufpd $0x2, %xmm0, %xmm3      # xmm3 = xmm3[0],xmm0[1]
movupd %xmm3, 0x60(%rbx)
movupd %xmm1, 0x70(%rbx)
subq $-0x80, %rbx
decq %r14
cmpq $0x1, %r14
ja 0x24aa1
jmp 0x24e44
movq %rcx, 0x10(%rsp)
testq %r14, %r14
jle 0x24e44
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
movl $0x1, %edx
movl %r12d, %ecx
shlq %cl, %rdx
negq %rax
leaq (%r12,%rax), %r13
decq %r13
shrq $0x3, %rdx
movq %rdx, 0x18(%rsp)
movl $0x2, %eax
shlq %cl, %rax
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r8, %rbp
movq %r8, %rdx
callq 0x26a19
movl $0x2, %r15d
cmpq $0x1, %r13
jne 0x24dd8
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
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 0x24d01
movl $0x4, %r15d
cmpq $0x2, %r13
jne 0x24df0
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x26d07
shll $0x2, %r15d
movl $0x1, %ecx
movq %rbx, %rdi
movq %r12, %rsi
cmpq $0xa, %r12
ja 0x24e15
movq 0x10(%rsp), %rdx
movq %r15, %r8
movq 0x8(%rsp), %r9
callq 0x25ba5
jmp 0x24e27
movq 0x10(%rsp), %rdx
movq %r15, %r8
movq 0x8(%rsp), %r9
callq 0x248f4
movq 0x20(%rsp), %rax
leaq (%rbx,%rax,8), %rbx
leaq -0x1(%r14), %rax
cmpq $0x1, %r14
movq %rax, %r14
movq %rbp, %r8
jg 0x24cd8
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq