// File: /workspace/github_cpp_makefile_star2_O3/ushitora-anqou[P]aqtfhe2/./aqtfhe2.hpp
// Function: aqtfhe2::detail::fft_processor<1024ul>::ifft(aqtfhe2::detail::array_slice<double, 1024ul>)
void ifft(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;

        // multiply by omb^j
        for (size_t j = 0; j < ns4; j += 4) {
            auto r0 = tables_reverse_.cbegin() + 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);
        }

        // at the beginning of iteration nn
        // a_{j,i} has P_{i%nn}(omega^j)
        // where j between [rev(1) and rev(3)[
        // and i between [0 and nn[
        auto cur_tt = tables_reverse_.cbegin();
        for (size_t nn = ns4; nn >= 8; nn /= 2) {
            size_t halfnn = nn / 2;
            cur_tt += 2 * nn;
            for (size_t block = 0; block < ns4; block += nn) {
                for (size_t off = 0; off < halfnn; off += 4) {
                    auto d00 = itre + block + off;
                    auto d01 = itim + block + off;
                    auto d10 = itre + block + halfnn + off;
                    auto d11 = itim + block + halfnn + off;
                    add4(tmp0, d00, d10);  // re + re
                    add4(tmp1, d01, d11);  // im + im
                    sub4(tmp2, d00, d10);  // re - re
                    sub4(tmp3, d01, d11);  // im - im
                    copy4(d00, tmp0);
                    copy4(d01, tmp1);
                    auto r0 = cur_tt + 2 * off;
                    auto r1 = r0 + 4;
                    dotp4(tmp0, tmp2, r0);  // re*cos
                    dotp4(tmp1, tmp3, r1);  // im*sin
                    sub4(d10, tmp0, tmp1);
                    dotp4(tmp0, tmp2, r1);  // re*sin
                    dotp4(tmp1, tmp3, r0);  // im*cos
                    add4(d11, tmp0, 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] + re[3];
            tmp0[2] = re[0] - re[2];
            tmp0[3] = im[3] - im[1];

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

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

        // 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);
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x4000(%rdi), %rcx
addq $0x4020, %rdi           # imm = 0x4020
movq $-0x4, %rax
vmovupd 0x1020(%rsi,%rax,8), %ymm1
vmovupd -0x20(%rdi), %ymm2
vmovupd (%rdi), %ymm3
vmovupd 0x20(%rsi,%rax,8), %ymm0
addq $0x40, %rdi
vmulpd %ymm1, %ymm2, %ymm4
vmulpd %ymm1, %ymm3, %ymm1
vfmsub231pd %ymm2, %ymm0, %ymm1 # ymm1 = (ymm0 * ymm2) - ymm1
vfmadd231pd %ymm0, %ymm3, %ymm4 # ymm4 = (ymm3 * ymm0) + ymm4
vmovupd %ymm1, 0x20(%rsi,%rax,8)
vmovupd %ymm4, 0x1020(%rsi,%rax,8)
addq $0x4, %rax
cmpq $0x1fc, %rax            # imm = 0x1FC
jb 0x4f36
movl $0x200, %edi            # imm = 0x200
movq %rdi, %r8
movq %r8, %rax
shlq $0x4, %rax
xorl %edx, %edx
shrq %rdi
leaq (,%r8,8), %r10
movq %rsi, %rbx
xorl %r14d, %r14d
leaq 0x20(%rcx,%rax), %r9
addq %rax, %rcx
movl $0x1ff, %eax            # imm = 0x1FF
leaq -0x1(%rdi), %r11
divq %r8
shrq $0x2, %r11
leaq (,%rdi,8), %rdx
shlq $0x5, %r11
addq $0x20, %r11
leaq (%rbx,%rdx), %r15
xorl %r12d, %r12d
vmovupd (%rbx,%r12), %ymm0
vmovupd (%r15,%r12), %ymm1
vmovupd 0x1000(%rbx,%r12), %ymm3
vmovupd 0x1000(%r15,%r12), %ymm4
vaddpd %ymm0, %ymm1, %ymm2
vaddpd %ymm3, %ymm4, %ymm5
vsubpd %ymm1, %ymm0, %ymm0
vsubpd %ymm4, %ymm3, %ymm1
vmovupd %ymm2, (%rbx,%r12)
vmovupd %ymm5, 0x1000(%rbx,%r12)
vmulpd (%r9,%r12,2), %ymm1, %ymm2
vfmsub231pd -0x20(%r9,%r12,2), %ymm0, %ymm2 # ymm2 = (ymm0 * mem) - ymm2
vmovupd %ymm2, (%r15,%r12)
vmulpd (%r9,%r12,2), %ymm0, %ymm0
vfmadd231pd -0x20(%r9,%r12,2), %ymm1, %ymm0 # ymm0 = (ymm1 * mem) + ymm0
vmovupd %ymm0, 0x1000(%r15,%r12)
addq $0x20, %r12
cmpq %r12, %r11
jne 0x4fd0
addq %r10, %rbx
leaq 0x1(%r14), %r15
cmpq %rax, %r14
movq %r15, %r14
jne 0x4fc9
cmpq $0xf, %r8
ja 0x4f84
movq $-0x1000, %rax          # imm = 0xF000
vmovupd 0x1000(%rsi,%rax), %xmm0
vmovupd 0x1010(%rsi,%rax), %xmm1
vmovupd 0x2000(%rsi,%rax), %xmm4
vmovupd 0x2010(%rsi,%rax), %xmm5
vaddpd %xmm0, %xmm1, %xmm2
vsubpd %xmm1, %xmm0, %xmm3
vsubpd %xmm4, %xmm5, %xmm6
vmovsd %xmm4, %xmm0, %xmm0     # xmm0 = xmm4[0],xmm0[1]
vmovsd %xmm5, %xmm1, %xmm1     # xmm1 = xmm5[0],xmm1[1]
vsubpd %xmm1, %xmm0, %xmm0
vinsertf128 $0x1, %xmm3, %ymm2, %ymm3
vinsertf128 $0x1, %xmm6, %ymm2, %ymm2
vaddpd %xmm5, %xmm4, %xmm6
vblendpd $0xa, %ymm2, %ymm3, %ymm2 # ymm2 = ymm3[0],ymm2[1],ymm3[2],ymm2[3]
vmovupd %ymm2, 0x1000(%rsi,%rax)
vmovupd %xmm6, 0x2000(%rsi,%rax)
vmovupd %xmm0, 0x2010(%rsi,%rax)
addq $0x20, %rax
jne 0x5067
movq $-0x1000, %rax          # imm = 0xF000
vmovupd 0x1000(%rsi,%rax), %ymm0
vhaddpd %ymm0, %ymm0, %ymm1
vhsubpd %ymm0, %ymm0, %ymm0
vunpcklpd %ymm0, %ymm1, %ymm0 # ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
vmovupd %ymm0, 0x1000(%rsi,%rax)
vmovupd 0x2000(%rsi,%rax), %ymm0
vhaddpd %ymm0, %ymm0, %ymm1
vhsubpd %ymm0, %ymm0, %ymm0
vunpcklpd %ymm0, %ymm1, %ymm0 # ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
vmovupd %ymm0, 0x2000(%rsi,%rax)
addq $0x20, %rax
jne 0x50e1
popq %rbx
popq %r12
popq %r14
popq %r15
vzeroupper
retq