// File: /workspace/github_cpp_makefile_star2_O3/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 0x20(%rdi), %xmm6
movsd 0x38(%rdi), %xmm13
subsd 0x60(%rdi), %xmm6
movsd 0x78(%rdi), %xmm0
movapd %xmm0, -0x18(%rsp)
movupd 0x28(%rdi), %xmm5
movapd %xmm5, %xmm3
movsd %xmm13, %xmm5           # xmm5 = xmm13[0],xmm5[1]
subsd %xmm0, %xmm13
movupd 0x68(%rdi), %xmm4
subpd %xmm4, %xmm3
movupd 0x40(%rdi), %xmm15
movupd 0x50(%rdi), %xmm8
movupd (%rdi), %xmm12
movupd 0x10(%rdi), %xmm1
movupd 0x20(%rdi), %xmm0
movapd %xmm12, %xmm9
movapd %xmm1, %xmm7
movapd %xmm1, %xmm10
movsd %xmm12, %xmm1           # xmm1 = xmm12[0],xmm1[1]
addpd %xmm15, %xmm12
subpd %xmm15, %xmm9
unpckhpd %xmm9, %xmm9            # xmm9 = xmm9[1,1]
movupd 0x60(%rdi), %xmm11
addpd %xmm0, %xmm11
movapd %xmm9, %xmm2
addsd %xmm6, %xmm2
subsd %xmm6, %xmm9
addpd %xmm8, %xmm7
movapd %xmm7, %xmm14
shufpd $0x1, %xmm7, %xmm14     # xmm14 = xmm14[1],xmm7[0]
subsd %xmm8, %xmm10
movlpd -0x18(%rsp), %xmm4      # xmm4 = mem[0],xmm4[1]
addpd %xmm5, %xmm4
movapd %xmm10, %xmm6
subsd %xmm13, %xmm6
addsd %xmm13, %xmm10
movsd 0x603f(%rip), %xmm0     # 0x2ea08
mulsd %xmm0, %xmm10
movsd %xmm15, %xmm8           # xmm8 = xmm15[0],xmm8[1]
subpd %xmm8, %xmm1
movapd %xmm1, %xmm13
addpd %xmm3, %xmm1
movapd %xmm1, %xmm8
subsd %xmm10, %xmm8
addsd %xmm9, %xmm10
mulsd %xmm0, %xmm6
movapd %xmm7, %xmm15
movsd %xmm12, %xmm15          # xmm15 = xmm12[0],xmm15[1]
shufpd $0x2, %xmm12, %xmm7     # xmm7 = xmm7[0],xmm12[1]
subpd %xmm11, %xmm12
subpd %xmm4, %xmm14
movapd %xmm12, %xmm0
addpd %xmm14, %xmm0
subpd %xmm14, %xmm12
subpd %xmm3, %xmm13
movapd 0x2a56(%rip), %xmm5     # 0x2b480
movapd %xmm1, %xmm3
unpckhpd %xmm1, %xmm3            # xmm3 = xmm3[1],xmm1[1]
xorpd %xmm5, %xmm3
unpcklpd %xmm9, %xmm3            # xmm3 = xmm3[0],xmm9[0]
movapd %xmm12, %xmm14
subpd %xmm0, %xmm14
addpd %xmm0, %xmm12
movapd %xmm14, %xmm9
mulsd 0x5fb0(%rip), %xmm14    # 0x2ea08
movsd %xmm12, %xmm9           # xmm9 = xmm12[0],xmm9[1]
unpckhpd %xmm12, %xmm12          # xmm12 = xmm12[1,1]
mulpd 0x5ea5(%rip), %xmm12    # 0x2e910
addpd %xmm9, %xmm12
unpcklpd %xmm14, %xmm14          # xmm14 = xmm14[0,0]
addpd %xmm12, %xmm14
movapd %xmm11, %xmm0
unpcklpd %xmm4, %xmm0            # xmm0 = xmm0[0],xmm4[0]
addpd %xmm15, %xmm0
unpckhpd %xmm11, %xmm4           # xmm4 = xmm4[1],xmm11[1]
addpd %xmm7, %xmm4
movapd %xmm0, %xmm7
subpd %xmm4, %xmm7
addpd %xmm0, %xmm4
movapd %xmm4, %xmm0
unpckhpd %xmm4, %xmm0            # xmm0 = xmm0[1],xmm4[1]
movapd %xmm4, %xmm11
addsd %xmm0, %xmm11
subsd %xmm0, %xmm4
movupd %xmm7, 0x40(%rdi)
movapd %xmm6, %xmm12
movsd %xmm11, (%rdi)
movsd %xmm4, 0x8(%rdi)
movapd 0x5e51(%rip), %xmm4     # 0x2e920
movapd %xmm14, %xmm7
xorpd %xmm5, %xmm7
shufpd $0x2, %xmm14, %xmm7     # xmm7 = xmm7[0],xmm14[1]
mulpd %xmm4, %xmm14
movupd %xmm14, 0x20(%rdi)
movapd 0x5e3f(%rip), %xmm0     # 0x2e930
mulpd %xmm0, %xmm9
addpd %xmm7, %xmm9
movapd %xmm13, %xmm11
unpckhpd %xmm13, %xmm11          # xmm11 = xmm11[1],xmm13[1]
mulpd %xmm4, %xmm9
movupd %xmm9, 0x60(%rdi)
movapd %xmm11, %xmm9
addsd %xmm13, %xmm6
mulsd 0x5eed(%rip), %xmm11    # 0x2ea10
addsd %xmm10, %xmm11
movapd %xmm11, %xmm7
xorpd %xmm5, %xmm7
unpcklpd %xmm7, %xmm6            # xmm6 = xmm6[0],xmm7[0]
movapd 0x5e03(%rip), %xmm7     # 0x2e940
mulpd %xmm7, %xmm3
addpd %xmm6, %xmm3
movapd %xmm3, %xmm6
xorpd %xmm5, %xmm6
unpcklpd %xmm6, %xmm8            # xmm8 = xmm8[0],xmm6[0]
xorpd %xmm5, %xmm9
unpcklpd %xmm13, %xmm9           # xmm9 = xmm9[0],xmm13[0]
addsd %xmm2, %xmm12
mulpd %xmm7, %xmm9
addpd %xmm8, %xmm9
movapd %xmm9, %xmm6
xorpd %xmm5, %xmm6
unpcklpd %xmm12, %xmm6           # xmm6 = xmm6[0],xmm12[0]
mulpd 0x5dcf(%rip), %xmm1     # 0x2e950
addpd %xmm6, %xmm1
movapd %xmm3, %xmm6
addpd %xmm1, %xmm6
subpd %xmm1, %xmm3
movapd %xmm1, %xmm7
unpckhpd %xmm1, %xmm7            # xmm7 = xmm7[1],xmm1[1]
addsd %xmm2, %xmm2
movapd %xmm3, %xmm1
movsd %xmm6, %xmm1            # xmm1 = xmm6[0],xmm1[1]
unpckhpd %xmm6, %xmm6            # xmm6 = xmm6[1,1]
mulpd 0x5daf(%rip), %xmm6     # 0x2e960
subsd %xmm7, %xmm2
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd 0x5daf(%rip), %xmm3     # 0x2e970
addpd %xmm1, %xmm6
addpd %xmm6, %xmm3
movapd %xmm9, %xmm7
unpcklpd %xmm2, %xmm7            # xmm7 = xmm7[0],xmm2[0]
movapd %xmm9, %xmm8
unpckhpd %xmm9, %xmm8            # xmm8 = xmm8[1],xmm9[1]
unpcklpd %xmm11, %xmm6           # xmm6 = xmm6[0],xmm11[0]
subpd %xmm6, %xmm7
movapd %xmm9, %xmm6
addpd %xmm8, %xmm6
shufpd $0x2, %xmm7, %xmm6      # xmm6 = xmm6[0],xmm7[1]
addsd %xmm11, %xmm2
subsd %xmm8, %xmm9
unpcklpd %xmm2, %xmm2            # xmm2 = xmm2[0,0]
mulpd 0x5d76(%rip), %xmm2     # 0x2e980
addpd %xmm6, %xmm2
unpcklpd %xmm9, %xmm9            # xmm9 = xmm9[0,0]
mulpd 0x5d74(%rip), %xmm9     # 0x2e990
addpd %xmm2, %xmm9
movapd %xmm9, %xmm2
xorpd %xmm5, %xmm2
xorpd %xmm3, %xmm5
shufpd $0x2, %xmm3, %xmm5      # xmm5 = xmm5[0],xmm3[1]
mulpd %xmm4, %xmm3
movupd %xmm3, 0x10(%rdi)
shufpd $0x2, %xmm9, %xmm2      # xmm2 = xmm2[0],xmm9[1]
mulpd %xmm4, %xmm9
movupd %xmm9, 0x30(%rdi)
mulpd %xmm0, %xmm6
addpd %xmm2, %xmm6
mulpd %xmm4, %xmm6
movupd %xmm6, 0x50(%rdi)
mulpd %xmm0, %xmm1
addpd %xmm5, %xmm1
mulpd %xmm4, %xmm1
movupd %xmm1, 0x70(%rdi)
retq