// File: /workspace/github_cpp_makefile_star2_O1/kebwi[P]Trifid/src/FFT/fftlib.cpp
// Function: rfft8pt(double*)
inline void rfft8pt(Float_t *ioptr){
/***   RADIX 16 rfft	***/
Float_t w0r = 1.0/MYROOT2; /* cos(pi/4)	*/
Float_t w1r = MYCOSPID8; /* cos(pi/8)	*/
Float_t w1i = MYSINPID8; /* sin(pi/8)	*/
Float_t f0r, f0i, f1r, f1i, f2r, f2i, f3r, f3i;
Float_t f4r, f4i, f5r, f5i, f6r, f6i, f7r, f7i;
Float_t t0r, t0i, t1r, t1i;
const Float_t Two = 2.0;
const Float_t scale = 0.5;

	/* bit reversed load */
f0r = ioptr[0];
f0i = ioptr[1];
f1r = ioptr[8];
f1i = ioptr[9];
f2r = ioptr[4];
f2i = ioptr[5];
f3r = ioptr[12];
f3i = ioptr[13];
f4r = ioptr[2];
f4i = ioptr[3];
f5r = ioptr[10];
f5i = ioptr[11];
f6r = ioptr[6];
f6i = ioptr[7];
f7r = ioptr[14];
f7i = ioptr[15];
			/* Butterflys		*/
			/*
			f0	-	-	t0	-	-	f0	-	-	f0
			f1	-  1 -	f1	-	-	f1	-	-	f1
			f2	-	-	f2	-  1 -	f2	-	-	f2
			f3	-  1 -	t1	- -i -	f3	-	-	f3
			f4	-	-	t0	-	-	f4	-  1 -	t0
			f5	-  1 -	f5	-	-	f5	- w3 -	f4
			f6	-	-	f6	-  1 -	f6	- -i -	t1
			f7	-  1 -	t1	- -i -	f7	- iw3-	f6
			*/

t0r = f0r + f1r;
t0i = f0i + f1i;
f1r = f0r - f1r;
f1i = f0i - f1i;

t1r = f2r - f3r;
t1i = f2i - f3i;
f2r = f2r + f3r;
f2i = f2i + f3i;

f0r = t0r + f2r;
f0i = t0i + f2i;
f2r = t0r - f2r;
f2i = t0i - f2i;

f3r = f1r - t1i;
f3i = f1i + t1r;
f1r = f1r + t1i;
f1i = f1i - t1r;


t0r = f4r + f5r;
t0i = f4i + f5i;
f5r = f4r - f5r;
f5i = f4i - f5i;

t1r = f6r - f7r;
t1i = f6i - f7i;
f6r = f6r + f7r;
f6i = f6i + f7i;

f4r = t0r + f6r;
f4i = t0i + f6i;
f6r = t0r - f6r;
f6i = t0i - f6i;

f7r = f5r - t1i;
f7i = f5i + t1r;
f5r = f5r + t1i;
f5i = f5i - t1r;


t0r = f0r - f4r;
t0i = f4i - f0i;	// neg for rfft
f0r = f0r + f4r;
f0i = f0i + f4i;

t1r = f2r - f6i;
t1i = f2i + f6r;
f2r = f2r + f6i;
f2i = f2i - f6r;

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

f6r = f3r + f7r * w0r - f7i * w0r;
f6i = f3i + f7r * w0r + f7i * w0r;
f3r = f3r * Two - f6r;
f3i = f3i * Two - f6i;

	/* finish rfft */
f5r = 	f0r + f0i;    /* compute Re(x[0]) */
f5i = 	f0r - f0i;    /* compute Re(x[N/2]) */

f0r = f2r + t1r;
f0i = f2i - t1i;
f7r = f2i + t1i;
f7i = t1r - f2r;

f2r = f0r + w0r * f7r + w0r * f7i;
f2i = f0i - w0r * f7r + w0r * f7i;
t1r = Two * f0r - f2r;
t1i = f2i - Two * f0i;


f0r = f1r + f6r;
f0i = f1i - f6i;
f7r = f1i + f6i;
f7i = f6r - f1r;

f1r = f0r + w1r * f7r + w1i * f7i;
f1i = f0i - w1i * f7r + w1r * f7i;
f6r = Two * f0r - f1r;
f6i = f1i - Two * f0i;

f0r = f3r + f4r;
f0i = f3i - f4i;
f7r = f3i + f4i;
f7i = f4r - f3r;

f3r = f0r + w1i * f7r + w1r * f7i;
f3i = f0i - w1r * f7r + w1i * f7i;
f4r = Two * f0r - f3r;
f4i = f3i - Two * f0i;

	/* store result */
ioptr[8] = t0r;
ioptr[9] = t0i;
ioptr[0] = f5r;
ioptr[1] = f5i;

ioptr[4] = scale*f2r;
ioptr[5] = scale*f2i;
ioptr[12] = scale*t1r;
ioptr[13] = scale*t1i;

ioptr[2] = scale*f1r;
ioptr[3] = scale*f1i;
ioptr[6] = scale*f3r;
ioptr[7] = scale*f3i;
ioptr[10] = scale*f4r;
ioptr[11] = scale*f4i;
ioptr[14] = scale*f6r;
ioptr[15] = scale*f6i;
}

// Assembly:
movsd (%rdi), %xmm3
movsd 0x8(%rdi), %xmm2
movsd 0x40(%rdi), %xmm1
movsd 0x48(%rdi), %xmm6
movsd 0x20(%rdi), %xmm4
movsd 0x28(%rdi), %xmm7
movsd 0x60(%rdi), %xmm14
movsd 0x68(%rdi), %xmm9
movsd 0x10(%rdi), %xmm0
movsd %xmm0, -0x30(%rsp)
movsd 0x18(%rdi), %xmm10
movsd 0x50(%rdi), %xmm12
movsd 0x58(%rdi), %xmm11
movsd 0x30(%rdi), %xmm13
movsd 0x38(%rdi), %xmm15
movsd 0x70(%rdi), %xmm0
movsd %xmm0, -0x20(%rsp)
movapd %xmm3, %xmm5
addsd %xmm1, %xmm5
subsd %xmm1, %xmm3
movapd %xmm2, %xmm8
addsd %xmm6, %xmm8
subsd %xmm6, %xmm2
movapd %xmm4, %xmm0
subsd %xmm14, %xmm0
addsd %xmm14, %xmm4
movapd %xmm7, %xmm6
subsd %xmm9, %xmm6
addsd %xmm9, %xmm7
movapd %xmm5, %xmm1
addsd %xmm4, %xmm1
movsd %xmm1, -0x28(%rsp)
subsd %xmm4, %xmm5
movapd %xmm8, %xmm4
addsd %xmm7, %xmm4
subsd %xmm7, %xmm8
movapd %xmm3, %xmm1
subsd %xmm6, %xmm1
movsd %xmm1, -0x10(%rsp)
addsd %xmm3, %xmm6
movapd %xmm2, %xmm3
addsd %xmm0, %xmm3
subsd %xmm0, %xmm2
movsd %xmm2, -0x18(%rsp)
movsd -0x30(%rsp), %xmm0
movapd %xmm0, %xmm7
addsd %xmm12, %xmm7
subsd %xmm12, %xmm0
movapd %xmm0, %xmm2
movapd %xmm10, %xmm14
addsd %xmm11, %xmm14
subsd %xmm11, %xmm10
movapd %xmm13, %xmm0
movsd -0x20(%rsp), %xmm1
subsd %xmm1, %xmm0
addsd %xmm1, %xmm13
movsd 0x78(%rdi), %xmm11
movapd %xmm15, %xmm9
subsd %xmm11, %xmm9
addsd %xmm11, %xmm15
movapd %xmm7, %xmm1
addsd %xmm13, %xmm1
subsd %xmm13, %xmm7
movapd %xmm14, %xmm12
addsd %xmm15, %xmm12
subsd %xmm15, %xmm14
movapd %xmm2, %xmm13
subsd %xmm9, %xmm13
addsd %xmm2, %xmm9
movapd %xmm10, %xmm2
addsd %xmm0, %xmm2
subsd %xmm0, %xmm10
movsd -0x28(%rsp), %xmm11
movapd %xmm11, %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rsp)
addsd %xmm11, %xmm1
movapd %xmm12, %xmm0
subsd %xmm4, %xmm0
movsd %xmm0, -0x28(%rsp)
addsd %xmm4, %xmm12
movapd %xmm5, %xmm15
subsd %xmm14, %xmm15
addsd %xmm5, %xmm14
movapd %xmm8, %xmm0
addsd %xmm7, %xmm0
subsd %xmm7, %xmm8
movsd 0x630d(%rip), %xmm4     # 0x2f8a0
mulsd %xmm4, %xmm9
movapd %xmm6, %xmm5
subsd %xmm9, %xmm5
mulsd 0x62fe(%rip), %xmm10    # 0x2f8a8
addsd %xmm10, %xmm5
movsd -0x18(%rsp), %xmm11
addsd %xmm11, %xmm9
addsd %xmm10, %xmm9
mulsd %xmm4, %xmm13
movapd %xmm13, %xmm10
movsd -0x10(%rsp), %xmm7
addsd %xmm7, %xmm10
mulsd %xmm4, %xmm2
subsd %xmm2, %xmm10
addsd %xmm3, %xmm13
addsd %xmm2, %xmm13
movapd %xmm1, %xmm2
addsd %xmm12, %xmm2
movsd %xmm2, -0x8(%rsp)
subsd %xmm12, %xmm1
movsd %xmm1, -0x30(%rsp)
movapd %xmm8, %xmm2
subsd %xmm0, %xmm2
addsd %xmm0, %xmm8
movapd %xmm14, %xmm12
addsd %xmm15, %xmm12
subsd %xmm14, %xmm15
movapd %xmm8, %xmm14
mulsd %xmm4, %xmm14
mulsd %xmm4, %xmm15
mulsd 0x6271(%rip), %xmm8     # 0x2f8a8
addsd %xmm12, %xmm14
addsd %xmm15, %xmm14
addsd %xmm2, %xmm8
addsd %xmm15, %xmm8
addsd %xmm2, %xmm2
movapd %xmm8, %xmm15
subsd %xmm2, %xmm15
movapd %xmm11, %xmm1
addsd %xmm11, %xmm1
subsd %xmm9, %xmm1
addsd %xmm3, %xmm3
subsd %xmm13, %xmm3
movapd %xmm1, %xmm0
subsd %xmm13, %xmm0
addsd %xmm1, %xmm13
addsd %xmm6, %xmm6
subsd %xmm5, %xmm6
movapd %xmm7, %xmm4
addsd %xmm7, %xmm4
subsd %xmm10, %xmm4
movapd %xmm10, %xmm2
addsd %xmm6, %xmm2
subsd %xmm6, %xmm10
movsd 0x6206(%rip), %xmm6     # 0x2f8b0
movapd %xmm13, %xmm11
mulsd %xmm6, %xmm11
addsd %xmm2, %xmm11
movsd 0x61f7(%rip), %xmm7     # 0x2f8b8
movapd %xmm10, %xmm1
mulsd %xmm7, %xmm1
addsd %xmm11, %xmm1
mulsd 0x61e8(%rip), %xmm13    # 0x2f8c0
addsd %xmm0, %xmm13
mulsd %xmm6, %xmm10
addsd %xmm13, %xmm10
addsd %xmm0, %xmm0
movapd %xmm10, %xmm11
subsd %xmm0, %xmm11
movapd %xmm3, %xmm13
subsd %xmm9, %xmm13
addsd %xmm9, %xmm3
movapd %xmm5, %xmm9
addsd %xmm4, %xmm9
subsd %xmm4, %xmm5
movapd %xmm3, %xmm0
mulsd %xmm7, %xmm0
addsd %xmm9, %xmm0
mulsd %xmm5, %xmm6
addsd %xmm0, %xmm6
mulsd %xmm7, %xmm5
mulsd 0x6195(%rip), %xmm3     # 0x2f8c8
addsd %xmm13, %xmm3
addsd %xmm3, %xmm5
addsd %xmm13, %xmm13
movapd %xmm5, %xmm3
subsd %xmm13, %xmm3
movsd -0x20(%rsp), %xmm0
movsd %xmm0, 0x40(%rdi)
movsd -0x28(%rsp), %xmm0
movsd %xmm0, 0x48(%rdi)
movsd -0x8(%rsp), %xmm0
movsd %xmm0, (%rdi)
addsd %xmm12, %xmm12
subsd %xmm14, %xmm12
movsd -0x30(%rsp), %xmm0
movsd %xmm0, 0x8(%rdi)
movsd 0x18c1(%rip), %xmm4     # 0x2b048
mulsd %xmm4, %xmm14
movsd %xmm14, 0x20(%rdi)
mulsd %xmm4, %xmm8
movsd %xmm8, 0x28(%rdi)
mulsd %xmm4, %xmm12
movsd %xmm12, 0x60(%rdi)
mulsd %xmm4, %xmm15
movsd %xmm15, 0x68(%rdi)
addsd %xmm2, %xmm2
subsd %xmm1, %xmm2
mulsd %xmm4, %xmm1
movsd %xmm1, 0x10(%rdi)
mulsd %xmm4, %xmm10
movsd %xmm10, 0x18(%rdi)
addsd %xmm9, %xmm9
subsd %xmm6, %xmm9
mulsd %xmm4, %xmm6
movsd %xmm6, 0x30(%rdi)
mulsd %xmm4, %xmm5
movsd %xmm5, 0x38(%rdi)
mulsd %xmm4, %xmm9
movsd %xmm9, 0x50(%rdi)
mulsd %xmm4, %xmm3
movsd %xmm3, 0x58(%rdi)
mulsd %xmm4, %xmm2
movsd %xmm2, 0x70(%rdi)
mulsd %xmm4, %xmm11
movsd %xmm11, 0x78(%rdi)
retq