// File: /workspace/github_cpp_makefile_star2_O3/permutationlock[P]aes_math/lib/galois_field.cpp
// Function: Polynomial::operator/=(Polynomial const&)
Polynomial & Polynomial::operator/=(const Polynomial & other){
    if(_p != other._p) throw runtime_error("Mismatched prime.");
    
    Polynomial quot(0,_p,1);
    
    Modular<int>::globalSetModulus(_p);
    while(this->size() >= other.size()){
        Modular<int> c =  other._a.back() / _a.back();
        int diff = this->size()-other.size();
        vector<Modular<int>> v;
        for(int i=0; i< diff; i++)
            v.push_back(0);
        v.push_back(c);
        Polynomial p(v,_p);
        quot += p;
        (*this) -= (other * p);
    }
    
    swap(_a,quot._a);
    
    return *this;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl 0x18(%rdi), %edx
cmpl 0x18(%rsi), %edx
jne 0x3a0c
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x30(%rsp), %rdi
xorl %esi, %esi
movl $0x1, %ecx
callq 0x2e1c
movl 0x18(%rbx), %eax
movl %eax, 0xb8f3(%rip)      # 0xf138
movq (%rbx), %rax
movq 0x8(%rbx), %rdi
movq %rdi, %rdx
subq %rax, %rdx
shrq $0x2, %rdx
movq 0x8(%r14), %rcx
movq %rcx, %rsi
subq (%r14), %rsi
shrq $0x2, %rsi
cmpl %esi, %edx
jl 0x39c3
leaq 0x10(%rsp), %r15
leaq 0x58(%rsp), %r12
leaq 0x78(%rsp), %r13
addq $-0x4, %rdi
movl -0x4(%rcx), %ebp
callq 0x4c3c
imull %ebp, %eax
cltd
idivl 0xb8a7(%rip)            # 0xf138
movl %edx, 0xc(%rsp)
movq 0x8(%rbx), %rbp
subq (%rbx), %rbp
shrq $0x2, %rbp
movq 0x8(%r14), %rax
subq (%r14), %rax
shrq $0x2, %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
subl %eax, %ebp
jle 0x3911
movl $0x0, 0x58(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x38e5
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x38f0
movq %r15, %rdi
movq %r12, %rdx
callq 0x4f7a
decl %ebp
jne 0x38c0
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x3913
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x3920
xorl %esi, %esi
movq %r15, %rdi
leaq 0xc(%rsp), %rdx
callq 0x50a0
movl 0x18(%rbx), %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2f40
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x30e0
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x3794
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3228
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x396e
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x3985
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x399c
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq (%rbx), %rax
movq 0x8(%rbx), %rdi
movq %rdi, %rdx
subq %rax, %rdx
shrq $0x2, %rdx
movq 0x8(%r14), %rcx
movq %rcx, %rsi
subq (%r14), %rsi
shrq $0x2, %rsi
cmpl %esi, %edx
jge 0x387b
movq 0x10(%rbx), %rsi
movaps 0x30(%rsp), %xmm0
movups %xmm0, (%rbx)
movq 0x40(%rsp), %rcx
movq %rcx, 0x10(%rbx)
movq %rax, 0x30(%rsp)
movq %rdi, 0x38(%rsp)
movq %rsi, 0x40(%rsp)
testq %rax, %rax
je 0x39f7
subq %rax, %rsi
movq %rax, %rdi
callq 0x2110
movq %rbx, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x2080
movq %rax, %r14
leaq 0x6624(%rip), %rsi      # 0xa044
movq %rax, %rdi
callq 0x2060
movq 0xb5c1(%rip), %rsi      # 0xeff0
movq 0xb592(%rip), %rdx      # 0xefc8
movq %r14, %rdi
callq 0x2190
movq %rax, %rbx
movq %r14, %rdi
callq 0x20c0
jmp 0x3ac2
jmp 0x3a91
jmp 0x3a91
jmp 0x3a51
movq %rax, %rbx
jmp 0x3a73
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x3a73
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x3a94
movq 0x68(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
jmp 0x3a94
movq %rax, %rbx
jmp 0x3aab
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x3aab
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3ac2
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq %rbx, %rdi
callq 0x21b0