// File: /workspace/github_cpp_makefile_star2_O1/kebwi[P]Trifid/src/FFT/fftlib.cpp
// Function: bitrevR2(double*, long, short*)
inline void bitrevR2(Float_t *ioptr, long M, short *BRLow){
/*** bit reverse and first radix 2 stage of forward or inverse fft ***/
Float_t	f0r;
Float_t	f0i;
Float_t	f1r;
Float_t	f1i;
Float_t	f2r;
Float_t	f2i;
Float_t	f3r;
Float_t	f3i;
Float_t	f4r;
Float_t	f4i;
Float_t	f5r;
Float_t	f5i;
Float_t	f6r;
Float_t	f6i;
Float_t	f7r;
Float_t	f7i;
Float_t	t0r;
Float_t	t0i;
Float_t	t1r;
Float_t	t1i;
Float_t	*p0r;
Float_t	*p1r;
Float_t	*IOP;
Float_t 	*iolimit;
long 	Colstart;
long 	iCol;
unsigned long 	posA;
unsigned long 	posAi;
unsigned long 	posB;
unsigned long 	posBi;

const unsigned long Nrems2 = POW2((M+3)/2);
const unsigned long Nroot_1_ColInc = POW2(M)-Nrems2;
const unsigned long Nroot_1 = POW2(M/2-1)-1;
const unsigned long ColstartShift = (M+1)/2 +1;
posA = POW2(M);		// 1/2 of POW2(M) complexes
posAi = posA + 1;
posB = posA + 2;
posBi = posB + 1;

iolimit = ioptr + Nrems2;
for (; ioptr < iolimit; ioptr += POW2(M/2+1)){
	for (Colstart = Nroot_1; Colstart >= 0; Colstart--){
		iCol = Nroot_1;
		p0r = ioptr+ Nroot_1_ColInc + BRLow[Colstart]*4;
		IOP = ioptr + (Colstart << ColstartShift);
		p1r = IOP + BRLow[iCol]*4;
		f0r = *(p0r);
		f0i = *(p0r+1);
		f1r = *(p0r+posA);
		f1i = *(p0r+posAi);
		for (; iCol > Colstart;){
			f2r = *(p0r+2);
			f2i = *(p0r+(2+1));
			f3r = *(p0r+posB);
			f3i = *(p0r+posBi);
			f4r = *(p1r);
			f4i = *(p1r+1);
			f5r = *(p1r+posA);
			f5i = *(p1r+posAi);
			f6r = *(p1r+2);
			f6i = *(p1r+(2+1));
			f7r = *(p1r+posB);
			f7i = *(p1r+posBi);
			
			t0r	= f0r + f1r;
			t0i	= f0i + f1i;
			f1r = f0r - f1r;
			f1i = f0i - f1i;
			t1r = f2r + f3r;
			t1i = f2i + f3i;
			f3r = f2r - f3r;
			f3i = f2i - f3i;
			f0r = f4r + f5r;
			f0i = f4i + f5i;
			f5r = f4r - f5r;
			f5i = f4i - f5i;
			f2r = f6r + f7r;
			f2i = f6i + f7i;
			f7r = f6r - f7r;
			f7i = f6i - f7i;

			*(p1r) = t0r;
			*(p1r+1) = t0i;
			*(p1r+2) = f1r;
			*(p1r+(2+1)) = f1i;
			*(p1r+posA) = t1r;
			*(p1r+posAi) = t1i;
			*(p1r+posB) = f3r;
			*(p1r+posBi) = f3i;
			*(p0r) = f0r;
			*(p0r+1) = f0i;
			*(p0r+2) = f5r;
			*(p0r+(2+1)) = f5i;
			*(p0r+posA) = f2r;
			*(p0r+posAi) = f2i;
			*(p0r+posB) = f7r;
			*(p0r+posBi) = f7i;

			p0r -= Nrems2;
			f0r = *(p0r);
			f0i = *(p0r+1);
			f1r = *(p0r+posA);
			f1i = *(p0r+posAi);
			iCol -= 1;
			p1r = IOP + BRLow[iCol]*4;
		};
		f2r = *(p0r+2);
		f2i = *(p0r+(2+1));
		f3r = *(p0r+posB);
		f3i = *(p0r+posBi);

		t0r   = f0r + f1r;
		t0i   = f0i + f1i;
		f1r = f0r - f1r;
		f1i = f0i - f1i;
		t1r   = f2r + f3r;
		t1i   = f2i + f3i;
		f3r = f2r - f3r;
		f3i = f2i - f3i;

		*(p0r) = t0r;
		*(p0r+1) = t0i;
		*(p0r+2) = f1r;
		*(p0r+(2+1)) = f1i;
		*(p0r+posA) = t1r;
		*(p0r+posAi) = t1i;
		*(p0r+posB) = f3r;
		*(p0r+posBi) = f3i;

	};
};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r10
leaq 0x3(%rsi), %rcx
movq %rcx, %rax
shrq $0x3f, %rax
addl %ecx, %eax
shrl %eax
movl $0x1, %esi
movl %eax, %ecx
shlq %cl, %rsi
movl $0x1, %r9d
movl %r10d, %ecx
shlq %cl, %r9
movq %r10, %r8
shrq $0x3f, %r8
addq %r10, %r8
sarq %r8
leal -0x1(%r8), %ecx
movq $-0x1, %r14
shlq %cl, %r14
movl $0x8, %r11d
movl %eax, %ecx
shlq %cl, %r11
testq %r11, %r11
jle 0x274eb
movq %r9, %rax
subq %rsi, %rax
movq %rax, -0x48(%rsp)
notq %r14
leaq 0x1(%r10), %rax
shrq $0x3f, %rax
leaq (%r10,%rax), %rbx
incq %rbx
sarq %rbx
incq %rbx
incb %r8b
movl %r8d, %ecx
movl $0x1, %eax
shlq %cl, %rax
leaq 0x1(%r9), %rcx
movq %rcx, -0x30(%rsp)
leaq (%rdi,%rsi,8), %rcx
movq %rcx, -0x50(%rsp)
leaq (,%r9,8), %rcx
leaq (,%rsi,8), %r15
movq %rcx, %r8
subq %r15, %r8
leaq (%rdi,%r8), %r10
addq $0x8, %r10
movq %r10, -0x68(%rsp)
movq %rax, -0x40(%rsp)
leaq (,%rax,8), %rax
movq %rax, -0x58(%rsp)
shlq $0x4, %rsi
subq %rsi, %rcx
movq %rcx, -0x38(%rsp)
movq %r9, %rax
shlq $0x4, %rax
movq %rax, %rcx
subq %rsi, %rax
leaq 0x10(%rdi), %rsi
movq %rsi, -0x78(%rsp)
subq %r15, %rcx
negq %r15
addq %rdi, %rcx
movq %rcx, -0x70(%rsp)
addq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x80(%rsp)
addq %rdi, %r8
movq %r8, -0x60(%rsp)
movq %r14, -0x20(%rsp)
movq %rbx, -0x28(%rsp)
movq -0x48(%rsp), %rax
leaq (%rdi,%rax,8), %r12
movq %r14, %r10
movq %rdi, -0x10(%rsp)
movq %r12, -0x18(%rsp)
movswq (%rdx,%r10,2), %r11
movq %r11, %rsi
shlq $0x5, %rsi
leaq (%r12,%rsi), %rax
movq %r10, %r8
movl %ebx, %ecx
shlq %cl, %r8
movsd (%r12,%rsi), %xmm10
movsd 0x8(%r12,%rsi), %xmm9
movsd (%rax,%r9,8), %xmm3
movsd 0x8(%rax,%r9,8), %xmm2
cmpq %r14, %r10
jge 0x2741c
shlq $0x2, %r11
leaq (%rdi,%r8,8), %r13
leaq (,%r11,8), %r12
movq -0x38(%rsp), %rax
movq %r11, -0x8(%rsp)
leaq (%rax,%r11,8), %rdi
movq -0x60(%rsp), %rcx
movq -0x80(%rsp), %r11
movq -0x70(%rsp), %r8
movq -0x78(%rsp), %rax
movq -0x68(%rsp), %rbx
movq %r14, %rsi
movswq (%rdx,%rsi,2), %r14
shlq $0x5, %r14
leaq (%r14,%r13), %rbp
movsd 0x10(%rcx,%r12), %xmm0
movsd 0x18(%rcx,%r12), %xmm5
movsd 0x10(%r8,%r12), %xmm13
movsd 0x18(%r8,%r12), %xmm14
movsd (%r13,%r14), %xmm6
movsd 0x8(%r13,%r14), %xmm7
movsd (%rbp,%r9,8), %xmm15
movsd 0x8(%rbp,%r9,8), %xmm12
movsd 0x10(%r13,%r14), %xmm8
movsd 0x18(%r13,%r14), %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x10(%rbp,%r9,8), %xmm11
movapd %xmm10, %xmm4
addsd %xmm3, %xmm4
subsd %xmm3, %xmm10
movapd %xmm9, %xmm3
addsd %xmm2, %xmm3
subsd %xmm2, %xmm9
movapd %xmm0, %xmm2
addsd %xmm13, %xmm2
subsd %xmm13, %xmm0
movsd %xmm0, (%rsp)
movapd %xmm5, %xmm13
addsd %xmm14, %xmm13
subsd %xmm14, %xmm5
movapd %xmm6, %xmm14
addsd %xmm15, %xmm14
subsd %xmm15, %xmm6
movapd %xmm7, %xmm15
addsd %xmm12, %xmm15
subsd %xmm12, %xmm7
movapd %xmm8, %xmm12
addsd %xmm11, %xmm12
subsd %xmm11, %xmm8
movsd 0x18(%rbp,%r9,8), %xmm11
movapd %xmm9, %xmm1
movsd 0x8(%rsp), %xmm9
movapd %xmm9, %xmm0
addsd %xmm11, %xmm0
subsd %xmm11, %xmm9
movsd %xmm4, (%r13,%r14)
movsd %xmm3, 0x8(%r13,%r14)
movsd %xmm10, 0x10(%r13,%r14)
movsd %xmm1, 0x18(%r13,%r14)
movsd %xmm2, (%rbp,%r9,8)
movsd %xmm13, 0x8(%rbp,%r9,8)
movsd (%rsp), %xmm1
movsd %xmm1, 0x10(%rbp,%r9,8)
movsd %xmm5, 0x18(%rbp,%r9,8)
movsd %xmm14, (%rcx,%r12)
movsd %xmm15, 0x8(%rcx,%r12)
movsd %xmm6, 0x10(%rcx,%r12)
movsd %xmm7, 0x18(%rcx,%r12)
movsd %xmm12, (%r8,%r12)
movsd %xmm0, 0x8(%r8,%r12)
movsd %xmm8, 0x10(%r8,%r12)
movsd %xmm9, 0x18(%r8,%r12)
decq %rsi
movsd -0x10(%rax,%rdi), %xmm10
movsd -0x8(%rax,%rdi), %xmm9
movsd -0x8(%r11,%r12), %xmm3
movsd (%r11,%r12), %xmm2
addq %r15, %rbx
addq %r15, %rax
addq %r15, %r8
addq %r15, %r11
addq %r15, %rcx
cmpq %r10, %rsi
jg 0x27257
movq -0x8(%rsp), %rdi
leaq (%rbx,%rdi,8), %r11
leaq (%r8,%rdi,8), %rsi
leaq (%rcx,%rdi,8), %rax
leaq (%r8,%rdi,8), %rcx
addq $0x8, %rcx
movq -0x20(%rsp), %r14
movq -0x10(%rsp), %rdi
movq -0x28(%rsp), %rbx
movq -0x18(%rsp), %r12
jmp 0x27431
leaq (%r12,%rsi), %r11
addq $0x8, %r11
leaq (%rax,%r9,8), %rsi
movq -0x30(%rsp), %rcx
leaq (%rax,%rcx,8), %rcx
movsd 0x10(%rax), %xmm0
movsd 0x18(%rax), %xmm4
movsd 0x10(%rax,%r9,8), %xmm5
movsd 0x18(%rax,%r9,8), %xmm6
movapd %xmm10, %xmm7
addsd %xmm3, %xmm7
movapd %xmm9, %xmm8
addsd %xmm2, %xmm8
subsd %xmm3, %xmm10
subsd %xmm2, %xmm9
movapd %xmm0, %xmm2
addsd %xmm5, %xmm2
movapd %xmm4, %xmm3
addsd %xmm6, %xmm3
subsd %xmm5, %xmm0
subsd %xmm6, %xmm4
movsd %xmm7, (%rax)
movsd %xmm8, (%r11)
movsd %xmm10, 0x10(%rax)
movsd %xmm9, 0x18(%rax)
movsd %xmm2, (%rsi)
movsd %xmm3, (%rcx)
movsd %xmm0, 0x10(%rax,%r9,8)
movsd %xmm4, 0x18(%rax,%r9,8)
leaq -0x1(%r10), %rax
testq %r10, %r10
movq %rax, %r10
jg 0x271e2
movq -0x40(%rsp), %rax
leaq (%rdi,%rax,8), %rdi
movq -0x58(%rsp), %rax
addq %rax, -0x68(%rsp)
addq %rax, -0x78(%rsp)
addq %rax, -0x70(%rsp)
addq %rax, -0x80(%rsp)
addq %rax, -0x60(%rsp)
cmpq -0x50(%rsp), %rdi
jb 0x271cc
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq