// File: /workspace/github_cpp_makefile_star2_O2/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, %r12
movq %rsi, %rbx
movq %rdi, 0x8(%rdi)
leaq 0x10(%rdi), %r14
xorps %xmm0, %xmm0
andq $0x0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
leaq -0x88(%rbp), %rax
movq %rax, 0x8(%rax)
leaq -0x78(%rbp), %r15
movups %xmm0, (%r15)
andq $0x0, 0x10(%r15)
movq (%rsi), %rax
movq %rax, -0x10(%r15)
movq %rdi, -0x38(%rbp)
movq %rax, (%rdi)
addq $0x10, %rsi
movq %r15, %rdi
callq 0x5c00
movq -0x70(%rbp), %rax
subq -0x78(%rbp), %rax
pushq $0x18
popq %rcx
cqto
idivq %rcx
movq 0x8(%rbx), %rcx
movq (%rcx), %rcx
leaq -0xb0(%rbp), %rdx
movq %rcx, (%rdx)
movq %rcx, 0x8(%rdx)
andq $0x0, 0x10(%rdx)
movq %r14, -0x30(%rbp)
movq %r14, %rdi
movq %rax, %rsi
callq 0x5e1e
movq 0x18(%r12), %rsi
addq $-0x18, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x3950
xorl %r15d, %r15d
leaq -0x60(%rbp), %rbx
leaq -0xb0(%rbp), %r14
xorl %r13d, %r13d
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rcx
movq %rcx, %rax
subq %rsi, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
cmpq %r13, %rax
jbe 0x4176
addq %r15, %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5d82
movq 0x10(%r12), %rax
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%rax,%r15)
movups -0x60(%rbp), %xmm0
movups %xmm0, (%rax,%r15)
incq %r13
addq $0x18, %r15
jmp 0x412b
movq -0x70(%rbp), %rax
subq -0x78(%rbp), %rax
cqto
idivq %rdi
movq %rax, %rdi
leal -0x1(%rax), %r9d
leaq -0xe0(%rbp), %r10
movq %r12, -0x98(%rbp)
subq %rsi, %rcx
decl %edi
movq %rcx, %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
leal -0x1(%rax), %ecx
cmpl %ecx, %edi
movq -0x30(%rbp), %r8
jl 0x429f
movl %r9d, -0x3c(%rbp)
movslq %r9d, %rcx
imulq $0x18, %rcx, %r14
movq %rdi, -0x90(%rbp)
movslq %edi, %rcx
movq -0x78(%rbp), %rdx
imulq $0x18, %rcx, %rsi
movups (%rdx,%rsi), %xmm0
movaps %xmm0, -0x60(%rbp)
movq 0x10(%rdx,%rsi), %rdi
movq %rdi, -0x50(%rbp)
subq %rax, %rcx
movq (%r8), %rax
imulq $0x18, %rcx, %rcx
movups (%rdx,%rsi), %xmm0
movq 0x10(%rdx,%rsi), %rdx
movq %rdx, 0x28(%rax,%rcx)
movups %xmm0, 0x18(%rax,%rcx)
xorl %r15d, %r15d
xorl %ebx, %ebx
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rcx
movq %rcx, %rax
subq %rsi, %rax
cqto
pushq $0x18
popq %rdi
idivq %rdi
cmpq %rbx, %rax
jbe 0x428c
movq -0x78(%rbp), %r13
leaq (%rcx,%r15), %rsi
addq $-0x18, %rsi
movq %r10, %rdi
leaq -0x60(%rbp), %rdx
movq %r10, %r12
callq 0x5d82
addq %r14, %r13
addq %r15, %r13
leaq -0xc8(%rbp), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x5d30
movq -0x78(%rbp), %rax
addq %r14, %rax
movq -0xb8(%rbp), %rcx
movq %rcx, 0x10(%r15,%rax)
movups -0xc8(%rbp), %xmm0
movups %xmm0, (%r15,%rax)
incq %rbx
addq $-0x18, %r15
movq %r12, %r10
movq -0x98(%rbp), %r12
jmp 0x4207
movl -0x3c(%rbp), %r9d
decl %r9d
movq -0x90(%rbp), %rdi
jmp 0x4198
xorl %r15d, %r15d
leaq -0x60(%rbp), %rbx
leaq -0xb0(%rbp), %r14
xorl %r12d, %r12d
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rax
subq %rsi, %rax
cqto
pushq $0x18
popq %rcx
idivq %rcx
cmpq %r12, %rax
jbe 0x42fc
addq %r15, %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5d82
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%rax,%r15)
movups -0x60(%rbp), %xmm0
movups %xmm0, (%rax,%r15)
incq %r12
addq $0x18, %r15
jmp 0x42b0
movq -0x38(%rbp), %rdi
callq 0x3970
leaq -0x78(%rbp), %rdi
callq 0x4a9e
movq -0x38(%rbp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x30(%rbp), %r14
jmp 0x4343
movq %rax, %rbx
jmp 0x4343
jmp 0x4338
jmp 0x4338
jmp 0x4338
movq %rax, %rbx
movq -0x30(%rbp), %r14
leaq -0x78(%rbp), %r15
movq %r15, %rdi
callq 0x4a9e
movq %r14, %rdi
callq 0x4a9e
movq %rbx, %rdi
callq 0x22b0
nop