// File: /workspace/github_cpp_makefile_star2_O2/ushitora-anqou[P]aqtfhe2/./aqtfhe2.hpp
// Function: aqtfhe2::detail::fft_processor<1024ul>::fft(aqtfhe2::detail::array_slice<double, 1024ul>)
void fft(array_slice<double, N> out)
    {
        constexpr size_t n = N * 2, ns4 = n / 4;
        double tmp0[4], tmp1[4], tmp2[4], tmp3[4];
        auto itre = out.begin(), itim = out.begin() + ns4;

        // size 2
        for (size_t block = 0; block < ns4; block += 4) {
            auto re = itre + block;
            auto im = itim + block;

            tmp0[0] = re[0] + re[1];
            tmp0[1] = re[0] - re[1];
            tmp0[2] = re[2] + re[3];
            tmp0[3] = re[2] - re[3];
            copy4(re, tmp0);

            tmp1[0] = im[0] + im[1];
            tmp1[1] = im[0] - im[1];
            tmp1[2] = im[2] + im[3];
            tmp1[3] = im[2] - im[3];
            copy4(im, tmp1);
        }

        // size 4
        for (size_t block = 0; block < ns4; block += 4) {
            auto re = itre + block;
            auto im = itim + block;

            tmp0[0] = re[0] + re[2];
            tmp0[1] = re[1] + im[3];
            tmp0[2] = re[0] - re[2];
            tmp0[3] = re[1] - im[3];

            tmp1[0] = im[0] + im[2];
            tmp1[1] = im[1] - re[3];
            tmp1[2] = im[0] - im[2];
            tmp1[3] = im[1] + re[3];

            copy4(re, tmp0);
            copy4(im, tmp1);
        }

        // general loop
        auto cur_tt = tables_direct_.cbegin();
        for (size_t halfnn = 4; halfnn < ns4; halfnn *= 2) {
            size_t nn = 2 * halfnn;
            for (size_t block = 0; block < ns4; block += nn) {
                for (size_t off = 0; off < halfnn; off += 4) {
                    auto re0 = itre + block + off;
                    auto im0 = itim + block + off;
                    auto re1 = itre + block + halfnn + off;
                    auto im1 = itim + block + halfnn + off;
                    auto tcs = cur_tt + 2 * off;
                    auto tsn = tcs + 4;

                    dotp4(tmp0, re1, tcs);   // re*cos
                    dotp4(tmp1, re1, tsn);   // re*sin
                    dotp4(tmp2, im1, tcs);   // im*cos
                    dotp4(tmp3, im1, tsn);   // im*sin
                    sub4(tmp0, tmp0, tmp3);  // re2
                    add4(tmp1, tmp1, tmp2);  // im2
                    add4(tmp2, re0, tmp0);   // re + re
                    add4(tmp3, im0, tmp1);   // im + im
                    sub4(tmp0, re0, tmp0);   // re - re
                    sub4(tmp1, im0, tmp1);   // im - im
                    copy4(re0, tmp2);
                    copy4(im0, tmp3);
                    copy4(re1, tmp0);
                    copy4(im1, tmp1);
                }
            }
            cur_tt += nn;
        }

        // multiply by omb^j
        for (size_t j = 0; j < ns4; j += 4) {
            auto r0 = cur_tt + 2 * j;
            auto r1 = r0 + 4;
            //(re*cos-im*sin) + i (im*cos+re*sin)
            auto d0 = itre + j;
            auto d1 = itim + j;

            dotp4(tmp0, d0, r0);  // re*cos
            dotp4(tmp1, d1, r0);  // im*cos
            dotp4(tmp2, d0, r1);  // re*sin
            dotp4(tmp3, d1, r1);  // im*sin
            sub4(d0, tmp0, tmp3);
            add4(d1, tmp1, tmp2);
        }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
leaq 0x1000(%rsi), %rbx
leaq 0x40(%rsp), %r14
leaq 0x20(%rsp), %r15
movq %rdi, (%rsp)
movq %rsi, 0x8(%rsp)
xorl %r13d, %r13d
movq %rbx, %r12
cmpq $0x200, %r13            # imm = 0x200
jae 0x4517
vmovupd -0x1000(%r12), %ymm0
leaq -0x1000(%r12), %rdi
movq %r14, %rsi
vhaddpd %ymm0, %ymm0, %ymm1
vhsubpd %ymm0, %ymm0, %ymm0
vunpcklpd %ymm0, %ymm1, %ymm0 # ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
vmovupd %ymm0, 0x40(%rsp)
vzeroupper
callq 0x485f
vmovupd (%r12), %ymm0
movq %r12, %rdi
movq %r15, %rsi
vhaddpd %ymm0, %ymm0, %ymm1
vhsubpd %ymm0, %ymm0, %ymm0
vunpcklpd %ymm0, %ymm1, %ymm0 # ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
vmovupd %ymm0, 0x20(%rsp)
vzeroupper
callq 0x485f
addq $0x4, %r13
addq $0x20, %r12
jmp 0x44af
leaq 0x40(%rsp), %r14
leaq 0x20(%rsp), %r15
xorl %r12d, %r12d
cmpq $0x200, %r12            # imm = 0x200
jae 0x45bd
vmovsd -0xff0(%rbx), %xmm1
vmovupd -0x1000(%rbx), %xmm0
leaq -0x1000(%rbx), %rdi
movq %r14, %rsi
vmovhpd 0x18(%rbx), %xmm1, %xmm1 # xmm1 = xmm1[0],mem[0]
vaddpd %xmm0, %xmm1, %xmm2
vsubpd %xmm1, %xmm0, %xmm0
vmovapd %xmm2, 0x40(%rsp)
vmovapd %xmm0, 0x50(%rsp)
vmovsd 0x10(%rbx), %xmm0
vmovupd (%rbx), %xmm1
vmovddup -0xfe8(%rbx), %xmm4     # xmm4 = mem[0,0]
vmovsd 0x8(%rbx), %xmm3
vaddsd %xmm1, %xmm0, %xmm2
vsubpd %xmm0, %xmm1, %xmm0
vaddpd %xmm4, %xmm1, %xmm1
vsubsd %xmm4, %xmm3, %xmm3
vmovsd %xmm0, %xmm1, %xmm0     # xmm0 = xmm0[0],xmm1[1]
vmovsd %xmm2, 0x20(%rsp)
vmovsd %xmm3, 0x28(%rsp)
vmovapd %xmm0, 0x30(%rsp)
callq 0x485f
movq %rbx, %rdi
movq %r15, %rsi
callq 0x485f
addq $0x4, %r12
addq $0x20, %rbx
jmp 0x4524
pushq $0x4
popq %rax
cmpq $0x200, %rax            # imm = 0x200
jae 0x47a2
movq 0x8(%rsp), %rbx
leaq (%rax,%rax), %rcx
movq %rax, 0x78(%rsp)
movq %rcx, 0x18(%rsp)
movq %rax, %rcx
shlq $0x4, %rcx
movq %rcx, 0x60(%rsp)
leaq (,%rax,8), %rcx
movq %rcx, 0x70(%rsp)
xorl %ecx, %ecx
cmpq $0x1ff, %rcx            # imm = 0x1FF
ja 0x4789
movq (%rsp), %rdx
xorl %esi, %esi
movq %rbx, 0x68(%rsp)
movq %rcx, 0x80(%rsp)
cmpq %rax, %rsi
jae 0x4775
movq 0x70(%rsp), %rcx
movq %rdx, 0x10(%rsp)
leaq 0x20(%rdx), %r12
movl $0x1000, %eax           # imm = 0x1000
movq %rsi, 0x98(%rsp)
movq 0x10(%rsp), %rdx
leaq (%rbx,%rax), %rdi
movq %rdi, 0x88(%rsp)
leaq 0x40(%rsp), %rdi
leaq (%rbx,%rcx), %rbp
movq %rbp, %rsi
leaq (%rbp,%rax), %r15
callq 0x4877
leaq 0x20(%rsp), %r13
movq %rbp, %rsi
movq %r12, %rdx
movq %r13, %rdi
callq 0x4877
movq 0x10(%rsp), %rdx
leaq 0xa0(%rsp), %rdi
movq %r15, %rsi
movq %r15, 0x90(%rsp)
callq 0x4877
leaq 0xc0(%rsp), %r14
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rdi
callq 0x4877
leaq 0x40(%rsp), %rdi
movq %r14, %rdx
movq %rdi, %rsi
movq %rdi, %r12
callq 0x4894
leaq 0xa0(%rsp), %r15
movq %r13, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x48b1
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x48b1
movq 0x88(%rsp), %r15
movq %r14, %rdi
movq %r13, %rdx
movq %r15, %rsi
callq 0x48b1
movq %r12, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x4894
movq %r13, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x4894
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
callq 0x485f
movq %r15, %rdi
movq %r14, %rsi
callq 0x485f
movq %rbp, %rdi
movq %r12, %rsi
callq 0x485f
movq 0x90(%rsp), %rdi
movq %r13, %rsi
callq 0x485f
movq 0x98(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x80(%rsp), %rcx
movq 0x78(%rsp), %rax
addq $0x20, %rbx
addq $0x4, %rsi
addq $0x40, %rdx
jmp 0x461a
movq 0x68(%rsp), %rbx
addq 0x18(%rsp), %rcx
addq 0x60(%rsp), %rbx
jmp 0x45fa
movq (%rsp), %rax
movq 0x18(%rsp), %rcx
leaq (%rax,%rcx,8), %rax
movq %rax, (%rsp)
movq %rcx, %rax
jmp 0x45c0
xorl %ebx, %ebx
cmpq $0x200, %rbx            # imm = 0x200
jae 0x484d
movq (%rsp), %r15
movq 0x8(%rsp), %r14
leaq 0x40(%rsp), %rdi
leaq 0x20(%r15), %rbp
leaq 0x1000(%r14), %r13
movq %r14, %rsi
movq %r15, %rdx
callq 0x4877
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x4877
leaq 0xa0(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4877
leaq 0xc0(%rsp), %r12
movq %r13, %rsi
movq %rbp, %rdx
movq %r12, %rdi
callq 0x4877
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
movq %r12, %rdx
callq 0x4894
leaq 0x20(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
movq %r13, %rdi
callq 0x48b1
addq $0x40, %r15
addq $0x20, %r14
addq $0x4, %rbx
movq %r15, (%rsp)
movq %r14, 0x8(%rsp)
jmp 0x47a4
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq