// File: kebwi[P]Trifid/src/FFT/fftlib.cpp
// Function: frstage(double*, long, double*)
inline void frstage(Float_t *ioptr, long M, Float_t *Utbl){
/*	Finish RFFT		*/

unsigned long 	pos;
unsigned long 	posi;
unsigned long 	diffUcnt;

Float_t 	*p0r, *p1r;
Float_t 	*u0r, *u0i;

Float_t w0r, w0i;
Float_t f0r, f0i, f1r, f1i, f4r, f4i, f5r, f5i;
Float_t t0r, t0i, t1r, t1i;
const Float_t Two = 2.0;

pos = POW2(M-1);
posi = pos + 1;

p0r = ioptr;
p1r = ioptr + pos/2;

u0r = Utbl + POW2(M-3);

w0r =  *u0r,

f0r = *(p0r);
f0i = *(p0r + 1);
f4r = *(p0r + pos);
f4i = *(p0r + posi);
f1r = *(p1r);
f1i = *(p1r + 1);
f5r = *(p1r + pos);
f5i = *(p1r + posi);

	t0r = Two * f0r + Two * f0i;    /* compute Re(x[0]) */
	t0i = Two * f0r - Two * f0i;    /* compute Re(x[N/2]) */
	t1r = f4r + f4r;
	t1i = -f4i - f4i;

	f0r = f1r + f5r;
	f0i = f1i - f5i;
	f4r = f1i + f5i;
	f4i = f5r - f1r;

	f1r = f0r + w0r * f4r + w0r * f4i;
	f1i = f0i - w0r * f4r + w0r * f4i;
	f5r = Two * f0r - f1r;
	f5i = f1i - Two * f0i;

*(p0r) = t0r;
*(p0r + 1) = t0i;
*(p0r + pos) = t1r;
*(p0r + posi) = t1i;
*(p1r) = f1r;
*(p1r + 1) = f1i;
*(p1r + pos) = f5r;
*(p1r + posi) = f5i;

u0r = Utbl + 1;
u0i = Utbl + (POW2(M-2)-1);

w0r =  *u0r,
w0i =  *u0i;
	
p0r = (ioptr + 2);
p1r = (ioptr + (POW2(M-2)-1)*2);

				/* Butterflys */
				/*
		f0	-	t0	-	-	f0
		f5	-	t1	- w0	-	f5

		f1	-	t0	-	-	f1
		f4	-	t1	-iw0 -	f4
				*/

for (diffUcnt = POW2(M-3)-1; diffUcnt > 0 ; diffUcnt--){

	f0r = *(p0r);
	f0i = *(p0r + 1);
	f5r = *(p1r + pos);
	f5i = *(p1r + posi);
	f1r = *(p1r);
	f1i = *(p1r + 1);
	f4r = *(p0r + pos);
	f4i = *(p0r + posi);

	t0r = f0r + f5r;
	t0i = f0i - f5i;
	t1r = f0i + f5i;
	t1i = f5r - f0r;

	f0r = t0r + w0r * t1r + w0i * t1i;
	f0i = t0i - w0i * t1r + w0r * t1i;
	f5r = Two * t0r - f0r;
	f5i = f0i - Two * t0i;

	t0r = f1r + f4r;
	t0i = f1i - f4i;
	t1r = f1i + f4i;
	t1i = f4r - f1r;

	f1r = t0r + w0i * t1r + w0r * t1i;
	f1i = t0i - w0r * t1r + w0i * t1i;
	f4r = Two * t0r - f1r;
	f4i = f1i - Two * t0i;

	*(p0r) = f0r;
	*(p0r + 1) = f0i;
	*(p1r + pos) = f5r;
	*(p1r + posi) = f5i;

	w0r = *++u0r;
	w0i = *--u0i;

	*(p1r) = f1r;
	*(p1r + 1) = f1i;
	*(p0r + pos) = f4r;
	*(p0r + posi) = f4i;

	p0r += 2;
	p1r -= 2;
};
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x48, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movsd 0x46ec(%rip), %xmm0     # 0x4a548
movsd %xmm0, -0xc8(%rbp)
movq -0x10(%rbp), %rcx
subq $0x1, %rcx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
shrq %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq $0x3, %rcx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x38(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x38(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0x40(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x40(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x68(%rbp), %xmm0
movsd 0x45e0(%rip), %xmm1     # 0x4a548
mulsd -0x70(%rbp), %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x68(%rbp), %xmm0
movsd 0x45be(%rip), %xmm1     # 0x4a548
mulsd -0x70(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0x88(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0x90(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
subsd -0x90(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0x78(%rbp), %xmm0
addsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x80(%rbp), %xmm0
subsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0x80(%rbp), %xmm0
addsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x98(%rbp), %xmm0
subsd -0x78(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x68(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0x88(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
movsd -0x90(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x70(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0x88(%rbp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
movsd -0x90(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x68(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x80(%rbp), %xmm0
movsd -0x70(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0xa8(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0xb0(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movsd -0xb8(%rbp), %xmm0
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xc0(%rbp), %xmm0
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x78(%rbp), %xmm0
movq -0x40(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x80(%rbp), %xmm0
movq -0x40(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movsd -0x98(%rbp), %xmm0
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xa0(%rbp), %xmm0
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
subq $0x2, %rcx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
subq $0x1, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x50(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
subq $0x2, %rcx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
subq $0x1, %rcx
shlq %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rcx
subq $0x3, %rcx
movl $0x1, %eax
shlq %cl, %rax
subq $0x1, %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jbe 0x4660c
movq -0x38(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x68(%rbp)
movq -0x38(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x98(%rbp)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0xa0(%rbp)
movq -0x40(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x78(%rbp)
movq -0x40(%rbp), %rax
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x80(%rbp)
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x68(%rbp), %xmm0
addsd -0x98(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x70(%rbp), %xmm0
subsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0x70(%rbp), %xmm0
addsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0x98(%rbp), %xmm0
subsd -0x68(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0xb8(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
movsd -0xb8(%rbp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd -0x68(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x70(%rbp), %xmm0
movsd -0xb0(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0x78(%rbp), %xmm0
addsd -0x88(%rbp), %xmm0
movsd %xmm0, -0xa8(%rbp)
movsd -0x80(%rbp), %xmm0
subsd -0x90(%rbp), %xmm0
movsd %xmm0, -0xb0(%rbp)
movsd -0x80(%rbp), %xmm0
addsd -0x90(%rbp), %xmm0
movsd %xmm0, -0xb8(%rbp)
movsd -0x88(%rbp), %xmm0
subsd -0x78(%rbp), %xmm0
movsd %xmm0, -0xc0(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd -0x60(%rbp), %xmm1
movsd -0xb8(%rbp), %xmm2
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x58(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd -0x58(%rbp), %xmm1
movsd -0xb8(%rbp), %xmm2
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
movsd -0x60(%rbp), %xmm0
movsd -0xc0(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0xa8(%rbp), %xmm0
movsd -0x78(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
addsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x80(%rbp), %xmm0
movsd -0xb0(%rbp), %xmm1
addsd %xmm1, %xmm1
subsd %xmm1, %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x68(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x70(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movsd -0x98(%rbp), %xmm0
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0xa0(%rbp), %xmm0
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x48(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x48(%rbp)
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq %rax, %rcx
addq $-0x8, %rcx
movq %rcx, -0x50(%rbp)
movsd -0x8(%rax), %xmm0
movsd %xmm0, -0x60(%rbp)
movsd -0x78(%rbp), %xmm0
movq -0x40(%rbp), %rax
movsd %xmm0, (%rax)
movsd -0x80(%rbp), %xmm0
movq -0x40(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movsd -0x88(%rbp), %xmm0
movq -0x38(%rbp), %rax
movq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movsd -0x90(%rbp), %xmm0
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movq -0x38(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
addq $-0x10, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x4623e
addq $0x48, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)