// File: /workspace/github_cpp_makefile_star2_O3/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, %r15
movq %rsi, %rbx
movq %rdi, %r12
movq %rdi, 0x8(%rdi)
leaq 0x10(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
xorl %eax, %eax
movq %rax, 0x20(%rdi)
leaq -0x88(%rbp), %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 0x62ce
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, %rdi
callq 0x6544
movq 0x18(%r15), %rax
movq -0x10(%rax), %rbx
movq -0x8(%rax), %rdi
movq (%rbx), %rsi
movq %r14, -0x58(%rbp)
callq 0x3e6f
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(%r15), %rsi
cmpq %rsi, 0x18(%r15)
je 0x47e6
xorl %r14d, %r14d
leaq -0x50(%rbp), %rbx
leaq -0xa8(%rbp), %r12
xorl %r13d, %r13d
addq %r14, %rsi
movq %rbx, %rdi
movq %r12, %rdx
callq 0x64e0
movq 0x10(%r15), %rax
movq -0x40(%rbp), %rcx
movq %rcx, 0x10(%rax,%r14)
movups -0x50(%rbp), %xmm0
movups %xmm0, (%rax,%r14)
incq %r13
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rax
subq %rsi, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
addq $0x18, %r14
cmpq %r13, %rax
ja 0x4797
jmp 0x47e8
xorl %eax, %eax
movq %r15, -0x60(%rbp)
movq -0x70(%rbp), %rcx
subq -0x78(%rbp), %rcx
shrq $0x3, %rcx
imull $0xaaaaaaab, %ecx, %edx # imm = 0xAAAAAAAB
decl %edx
leal -0x1(%rax), %ecx
cmpl %ecx, %edx
jl 0x4902
leaq -0xd8(%rbp), %r15
movl %edx, -0x2c(%rbp)
movslq %edx, %rcx
leaq (,%rcx,8), %rdx
leaq (%rdx,%rdx,2), %r13
movq -0x78(%rbp), %rdx
movups (%rdx,%r13), %xmm0
movaps %xmm0, -0x50(%rbp)
movq 0x10(%rdx,%r13), %rsi
movq %rsi, -0x40(%rbp)
subq %rax, %rcx
movq -0x58(%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 -0x60(%rbp), %rax
movq 0x18(%rax), %rcx
cmpq 0x10(%rax), %rcx
je 0x48f0
xorl %ebx, %ebx
xorl %r12d, %r12d
movq -0x78(%rbp), %r14
leaq (%rcx,%rbx), %rsi
addq $-0x18, %rsi
movq %r15, %rdi
leaq -0x50(%rbp), %rdx
callq 0x64e0
addq %r13, %r14
addq %rbx, %r14
leaq -0xc0(%rbp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x647a
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 -0x60(%rbp), %rdx
movq 0x18(%rdx), %rcx
movq %rcx, %rax
subq 0x10(%rdx), %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rax
addq $-0x18, %rbx
cmpq %r12, %rax
ja 0x4873
jmp 0x48f2
xorl %eax, %eax
movl -0x2c(%rbp), %edx
decl %edx
leal -0x1(%rax), %ecx
cmpl %ecx, %edx
jge 0x4812
movq -0x90(%rbp), %r13
movq 0x10(%r13), %rsi
cmpq %rsi, 0x18(%r13)
je 0x4971
xorl %r14d, %r14d
leaq -0x50(%rbp), %rbx
leaq -0xa8(%rbp), %r15
xorl %r12d, %r12d
addq %r14, %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x64e0
movq 0x10(%r13), %rax
movq -0x40(%rbp), %rcx
movq %rcx, 0x10(%rax,%r14)
movups -0x50(%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 0x4924
movq %r13, %rdi
callq 0x3eec
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x4987
callq 0x2180
movq %r13, %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x499e
movq %rax, %rbx
jmp 0x49b0
jmp 0x49a9
jmp 0x49a9
jmp 0x49a9
movq %rax, %rbx
movq -0x58(%rbp), %r14
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x49be
callq 0x2180
movq (%r14), %rdi
testq %rdi, %rdi
je 0x49cb
callq 0x2180
movq %rbx, %rdi
callq 0x22a0
nop