// File: /workspace/github_cpp_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, %rbx
leaq 0x1000(%rsi), %rax
leaq 0x4000(%rdi), %rcx
addq $0x4020, %rbx           # imm = 0x4020
movq %rsi, %rbp
xorl %r12d, %r12d
movq %rsi, 0x60(%rsp)
movq %rax, 0x8(%rsp)
movq %rcx, 0x10(%rsp)
cmpq $0x200, %r12            # imm = 0x200
jae 0x4aa1
leaq -0x20(%rbx), %r15
leaq 0x20(%rsp), %rdi
leaq 0x1000(%rbp), %r14
movq %rbp, %rsi
movq %r15, %rdx
callq 0x4877
leaq 0x40(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x4877
leaq 0xc0(%rsp), %r15
movq %rbp, %rsi
movq %rbx, %rdx
movq %r15, %rdi
callq 0x4877
leaq 0xa0(%rsp), %r13
movq %r14, %rsi
movq %rbx, %rdx
movq %r13, %rdi
callq 0x4877
leaq 0x20(%rsp), %rsi
movq %rbp, %rdi
movq %r13, %rdx
callq 0x4894
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x48b1
addq $0x4, %r12
addq $0x40, %rbx
addq $0x20, %rbp
jmp 0x4a0c
movl $0x200, %ecx            # imm = 0x200
cmpq $0x7, %rcx
jbe 0x4c5e
movq %rcx, %rax
shlq $0x4, %rax
movq 0x60(%rsp), %r14
movq %rcx, %rdx
shrq %rdx
movq %rcx, 0x70(%rsp)
addq %rax, 0x10(%rsp)
leaq (,%rcx,8), %rax
movq %rdx, 0x18(%rsp)
movq %rax, 0x68(%rsp)
leaq (,%rdx,8), %rax
movq %rax, 0x88(%rsp)
xorl %eax, %eax
cmpq $0x1ff, %rax            # imm = 0x1FF
ja 0x4c54
movq 0x10(%rsp), %r13
movq %rax, 0x78(%rsp)
xorl %eax, %eax
movq %r14, 0x80(%rsp)
cmpq 0x18(%rsp), %rax
jae 0x4c35
movq 0x88(%rsp), %rcx
movq %rax, 0x98(%rsp)
movl $0x1000, %eax           # imm = 0x1000
leaq 0x20(%rsp), %rdi
movq %r14, %rsi
leaq (%r14,%rax), %r15
leaq (%r14,%rcx), %rbp
movq %rbp, %rdx
leaq (%rbp,%rax), %rbx
callq 0x48b1
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %rbx, 0x90(%rsp)
callq 0x48b1
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x4894
leaq 0xa0(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4894
leaq 0x20(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x485f
leaq 0x40(%rsp), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x485f
leaq 0xc0(%rsp), %rsi
leaq 0x20(%r13), %r15
movq %r12, %rdi
movq %r13, %rdx
callq 0x4877
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x4877
movq %rbp, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4894
leaq 0xc0(%rsp), %rsi
movq %r12, %rdi
movq %r15, %rdx
callq 0x4877
leaq 0xa0(%rsp), %rsi
movq %rbx, %rdi
movq %r13, %rdx
callq 0x4877
movq 0x90(%rsp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x48b1
movq 0x98(%rsp), %rax
addq $0x40, %r13
addq $0x20, %r14
addq $0x4, %rax
jmp 0x4b10
movq 0x80(%rsp), %r14
movq 0x70(%rsp), %rcx
movq 0x78(%rsp), %rax
addq 0x68(%rsp), %r14
addq %rcx, %rax
jmp 0x4af0
movq 0x18(%rsp), %rcx
jmp 0x4aa6
movq 0x8(%rsp), %r15
leaq 0x20(%rsp), %rbx
leaq 0x40(%rsp), %r14
xorl %r12d, %r12d
cmpq $0x200, %r12            # imm = 0x200
jae 0x4cf7
vmovupd -0x1000(%r15), %xmm0
vmovupd -0xff0(%r15), %xmm1
leaq -0x1000(%r15), %rdi
movq %rbx, %rsi
vaddpd %xmm0, %xmm1, %xmm2
vmovapd %xmm2, 0x20(%rsp)
vsubsd %xmm1, %xmm0, %xmm2
vmovsd %xmm2, 0x30(%rsp)
vmovupd (%r15), %xmm2
vmovupd 0x10(%r15), %xmm3
vmovsd %xmm2, %xmm0, %xmm0     # xmm0 = xmm2[0],xmm0[1]
vmovsd %xmm3, %xmm1, %xmm1     # xmm1 = xmm3[0],xmm1[1]
vsubpd %xmm2, %xmm3, %xmm4
vaddpd %xmm3, %xmm2, %xmm5
vsubpd %xmm1, %xmm0, %xmm0
vmovapd %xmm5, 0x40(%rsp)
vmovhpd %xmm4, 0x38(%rsp)
vmovapd %xmm0, 0x50(%rsp)
callq 0x485f
movq %r15, %rdi
movq %r14, %rsi
callq 0x485f
addq $0x4, %r12
addq $0x20, %r15
jmp 0x4c70
movq 0x8(%rsp), %r12
leaq 0x20(%rsp), %rbx
leaq 0x40(%rsp), %r14
xorl %r15d, %r15d
cmpq $0x200, %r15            # imm = 0x200
jae 0x4d71
vmovupd -0x1000(%r12), %ymm0
leaq -0x1000(%r12), %rdi
movq %rbx, %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
vmovupd (%r12), %ymm0
movq %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
addq $0x4, %r15
addq $0x20, %r12
jmp 0x4d09
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop