// 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.");
    
    Modular<int>::globalSetModulus(_p);
    while(this->size() >= other.size()){
        Modular<int> c =  _a.back().mulInverse() * other._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);
        (*this) -= (other * p);
    }
    
    return *this;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl 0x18(%rdi), %eax
cmpl 0x18(%rsi), %eax
jne 0x36f6
movq %rsi, %r14
movq %rdi, %rbx
movl %eax, 0xbbb6(%rip)      # 0xf138
movq 0x8(%rdi), %rdi
movq %rdi, %rax
subq (%rbx), %rax
shrq $0x2, %rax
movq 0x8(%rsi), %rcx
subq (%rsi), %rcx
shrq $0x2, %rcx
cmpl %ecx, %eax
jl 0x36e4
leaq 0x10(%rsp), %r15
leaq 0x28(%rsp), %r12
leaq 0x48(%rsp), %rbp
addq $-0x4, %rdi
callq 0x4c3c
movq 0x8(%r14), %rcx
imull -0x4(%rcx), %eax
cltd
idivl 0xbb6e(%rip)            # 0xf138
movl %edx, 0xc(%rsp)
movq 0x8(%rbx), %r13
subq (%rbx), %r13
shrq $0x2, %r13
subq (%r14), %rcx
shrq $0x2, %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
subl %ecx, %r13d
jle 0x3648
movl $0x0, 0x28(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x361b
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x3626
movq %r15, %rdi
movq %r12, %rdx
callq 0x4f7a
decl %r13d
jne 0x35f6
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x364a
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x3657
xorl %esi, %esi
movq %r15, %rdi
leaq 0xc(%rsp), %rdx
callq 0x50a0
movl 0x18(%rbx), %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2f40
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x3794
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x3228
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3695
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x36ac
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x36c3
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x8(%rbx), %rdi
movq %rdi, %rax
subq (%rbx), %rax
shrq $0x2, %rax
movq 0x8(%r14), %rcx
subq (%r14), %rcx
shrq $0x2, %rcx
cmpl %ecx, %eax
jge 0x35b2
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x2080
movq %rax, %r14
leaq 0x693a(%rip), %rsi      # 0xa044
movq %rax, %rdi
callq 0x2060
movq 0xb8d7(%rip), %rsi      # 0xeff0
movq 0xb8a8(%rip), %rdx      # 0xefc8
movq %r14, %rdi
callq 0x2190
movq %rax, %rbx
movq %r14, %rdi
callq 0x20c0
jmp 0x378b
jmp 0x3771
jmp 0x3771
movq %rax, %rbx
jmp 0x3758
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3758
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x3774
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
jmp 0x3774
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x378b
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq %rbx, %rdi
callq 0x21b0
nop