// File: /workspace/github_cpp_makefile_star2_O1/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 0x3862
movq %rsi, %r14
movq %rdi, %rbx
movl %eax, 0xba48(%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 0x3850
leaq 0x10(%rsp), %r15
leaq 0x28(%rsp), %r12
leaq 0x48(%rsp), %rbp
addq $-0x4, %rdi
callq 0x4daa
movq 0x8(%r14), %rcx
imull -0x4(%rcx), %eax
cltd
idivl 0xba00(%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 0x3799
movl $0x0, 0x28(%rsp)
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x3789
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x3794
movq %r15, %rdi
movq %r12, %rdx
callq 0x50de
decl %r13d
jne 0x3764
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x37b6
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x37c3
movq %r15, %rdi
leaq 0xc(%rsp), %rdx
callq 0x5204
movl 0x18(%rbx), %edx
movq %r12, %rdi
movq %r15, %rsi
callq 0x30c0
movq %rbp, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x3900
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x33a6
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x3801
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x3818
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x382f
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 0x3720
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 0x67ce(%rip), %rsi      # 0xa044
movq %rax, %rdi
callq 0x2060
movq 0xb76b(%rip), %rsi      # 0xeff0
movq 0xb73c(%rip), %rdx      # 0xefc8
movq %r14, %rdi
callq 0x2190
movq %rax, %rbx
movq %r14, %rdi
callq 0x20c0
jmp 0x38f7
jmp 0x38dd
jmp 0x38dd
movq %rax, %rbx
jmp 0x38c4
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x38c4
movq 0x58(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x38e0
movq 0x38(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
jmp 0x38e0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x38f7
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x2110
movq %rbx, %rdi
callq 0x21b0
nop