// File: /workspace/github_cpp_makefile_star2_O1/asd00012334[P]Abstract-Algebra-2018/main.cpp
// Function: DivisionSpecialized<prime::Zp, prime::ZpElement, true>::operator/(Polynomial<prime::Zp, prime::ZpElement>) const
Polynomial<ring,ringElement> operator/(Polynomial<ring,ringElement> p2)const{
        /// ?
        Polynomial<ring, ringElement> out, res;
        auto This = static_cast<Polynomial<ring,ringElement>const*>(this);
        res.canonicalType.scalar = This->canonicalType.scalar;
        out.canonicalType.scalar = This->canonicalType.scalar;

        res.coef = This->coef;
        out.coef.resize(res.coef.size(),This->r->scalar->__zero__());
        /// Reduce to monic polynomial

        auto cinv = p2.coef.back().inv();
        for(int i=0;i<p2.coef.size();++i)
            p2.coef[i] = p2.coef[i]*cinv;

        for(int i=res.coef.size()-1;i>=(int)p2.coef.size()-1;--i){
            auto tmp = res.coef[i];
            out.coef[i-p2.coef.size()+1] = tmp;
            for(int j=0;j<p2.coef.size();++j)
                res.coef[i-j] = res.coef[i-j] - p2.coef.rbegin()[j] * tmp;
        }
        for(int i=0;i<out.coef.size();++i)
            out.coef[i] = out.coef[i] * cinv;

        out.reduce();
        return out;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdx, -0x30(%rbp)
movq %rsi, %rbx
movq %rdi, %r12
xorl %eax, %eax
movq %rax, (%rdi)
movq %rdi, 0x8(%rdi)
leaq 0x10(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movq %rax, 0x20(%rdi)
leaq -0x88(%rbp), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rcx)
leaq -0x78(%rbp), %rdi
movups %xmm0, (%rdi)
movq %rax, 0x10(%rdi)
movq (%rsi), %rax
movq %rax, -0x10(%rdi)
movq %rax, (%r12)
addq $0x10, %rsi
callq 0x630e
movq -0x70(%rbp), %rsi
subq -0x78(%rbp), %rsi
sarq $0x3, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
movq 0x8(%rbx), %rax
movq (%rax), %rax
leaq -0xa8(%rbp), %rdx
movq %rax, (%rdx)
movq %rax, 0x8(%rdx)
movq $0x0, 0x10(%rdx)
movq %r14, -0x38(%rbp)
movq %r14, %rdi
callq 0x6582
movq -0x30(%rbp), %r14
movq 0x18(%r14), %rax
movq -0x10(%rax), %rbx
movq -0x8(%rax), %rdi
movq (%rbx), %rsi
callq 0x3e62
movq %r12, -0x90(%rbp)
movq %rbx, -0xa8(%rbp)
movq %rbx, -0xa0(%rbp)
movq (%rbx), %rcx
cqto
idivq %rcx
leaq (%rdx,%rcx), %rax
cqto
idivq %rcx
movq %rdx, -0x98(%rbp)
movq 0x10(%r14), %rsi
cmpq %rsi, 0x18(%r14)
je 0x47ef
xorl %r14d, %r14d
leaq -0x60(%rbp), %rbx
leaq -0xa8(%rbp), %r12
xorl %r13d, %r13d
addq %r14, %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x651e
movq -0x30(%rbp), %rdx
movq 0x10(%rdx), %rax
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%rax,%r14)
movups -0x60(%rbp), %xmm0
movups %xmm0, (%rax,%r14)
incq %r13
movq 0x10(%rdx), %rsi
movq 0x18(%rdx), %rax
subq %rsi, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
addq $0x18, %r14
cmpq %r13, %rax
ja 0x479e
movq -0x70(%rbp), %rax
subq -0x78(%rbp), %rax
shrq $0x3, %rax
imull $0xaaaaaaab, %eax, %edx # imm = 0xAAAAAAAB
decl %edx
movq -0x30(%rbp), %rdi
movq 0x18(%rdi), %rax
subq 0x10(%rdi), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
leal -0x1(%rax), %ecx
cmpl %ecx, %edx
jl 0x4935
leaq -0xd8(%rbp), %r15
movl %edx, -0x3c(%rbp)
movslq %edx, %rcx
leaq (,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %r13
movq -0x78(%rbp), %rdx
movups (%rdx,%r13), %xmm0
movaps %xmm0, -0x60(%rbp)
movq 0x10(%rdx,%r13), %rsi
movq %rsi, -0x50(%rbp)
subq %rax, %rcx
movq -0x38(%rbp), %rax
movq (%rax), %rax
leaq (%rcx,%rcx,2), %rcx
movups (%rdx,%r13), %xmm0
movq 0x10(%rdx,%r13), %rdx
movq %rdx, 0x28(%rax,%rcx,8)
movups %xmm0, 0x18(%rax,%rcx,8)
movq 0x18(%rdi), %rax
cmpq 0x10(%rdi), %rax
je 0x490b
xorl %ebx, %ebx
xorl %r12d, %r12d
movq -0x78(%rbp), %r14
leaq (%rax,%rbx), %rsi
addq $-0x18, %rsi
movq %r15, %rdi
leaq -0x60(%rbp), %rdx
callq 0x651e
addq %r13, %r14
addq %rbx, %r14
leaq -0xc0(%rbp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x64b8
movq -0x78(%rbp), %rax
addq %r13, %rax
movq -0xb0(%rbp), %rcx
movq %rcx, 0x10(%rbx,%rax)
movups -0xc0(%rbp), %xmm0
movups %xmm0, (%rbx,%rax)
incq %r12
movq -0x30(%rbp), %rdi
movq 0x18(%rdi), %rax
movq %rax, %rcx
subq 0x10(%rdi), %rcx
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
addq $-0x18, %rbx
cmpq %r12, %rcx
ja 0x4890
movl -0x3c(%rbp), %edx
decl %edx
movq 0x18(%rdi), %rax
subq 0x10(%rdi), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
leal -0x1(%rax), %ecx
cmpl %ecx, %edx
jge 0x4833
movq -0x90(%rbp), %r13
movq 0x10(%r13), %rsi
cmpq %rsi, 0x18(%r13)
je 0x49a4
xorl %r14d, %r14d
leaq -0x60(%rbp), %rbx
leaq -0xa8(%rbp), %r15
xorl %r12d, %r12d
addq %r14, %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x651e
movq 0x10(%r13), %rax
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%rax,%r14)
movups -0x60(%rbp), %xmm0
movups %xmm0, (%rax,%r14)
incq %r12
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rax
subq %rsi, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
addq $0x18, %r14
cmpq %r12, %rax
ja 0x4957
movq %r13, %rdi
callq 0x3ee0
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x49ba
callq 0x2180
movq %r13, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x49dc
movq %rax, %rbx
jmp 0x49e3
jmp 0x49dc
jmp 0x49dc
jmp 0x49dc
movq %rax, %rbx
movq -0x38(%rbp), %r14
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x49f1
callq 0x2180
movq (%r14), %rdi
testq %rdi, %rdi
je 0x49fe
callq 0x2180
movq %rbx, %rdi
callq 0x22a0