// File: 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.");
    
    vector<Modular<int>> a;
    
    for(int i=0; i<other.size()+this->size(); i++){
        a.push_back(0);
    }
    
    Modular<int>::globalSetModulus(_p);
    // FOIL multiplication
    for(int i=0; i<this->size(); i++){
        for(int j=0; j<other.size(); j++){
            a[i+j] += _a[i]*other[j];
        }
    }
    
    // Swap in the product coefficients
    swap(_a,a);
    
    reduce();
    
    return *this;
}

// Assembly:
subq $0x98, %rsp
movq %rdi, 0x90(%rsp)
movq %rsi, 0x88(%rsp)
movq 0x90(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x18(%rax), %eax
movq 0x88(%rsp), %rcx
cmpl 0x18(%rcx), %eax
je 0x4a8f
movl $0x10, %edi
callq 0x20a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x38(%rsp)
leaq 0x115b4(%rip), %rsi     # 0x16004
callq 0x2070
jmp 0x4a57
movq 0x38(%rsp), %rdi
movq 0x1958d(%rip), %rsi     # 0x1dff0
movq 0x1955e(%rip), %rdx     # 0x1dfc8
callq 0x2290
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
callq 0x2130
jmp 0x4c6f
leaq 0x60(%rsp), %rdi
callq 0x6720
movl $0x0, 0x5c(%rsp)
movl 0x5c(%rsp), %eax
movl %eax, 0x30(%rsp)
movq 0x88(%rsp), %rdi
callq 0x4700
movl %eax, 0x34(%rsp)
jmp 0x4abc
movq 0x40(%rsp), %rdi
callq 0x4700
movl %eax, 0x2c(%rsp)
jmp 0x4acc
movl 0x30(%rsp), %eax
movl 0x2c(%rsp), %edx
movl 0x34(%rsp), %ecx
addl %edx, %ecx
cmpl %ecx, %eax
jge 0x4b37
movl $0x0, 0x54(%rsp)
leaq 0x58(%rsp), %rdi
leaq 0x54(%rsp), %rsi
callq 0x6760
jmp 0x4af7
leaq 0x60(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x6730
jmp 0x4b08
jmp 0x4b0a
movl 0x5c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x5c(%rsp)
jmp 0x4aa1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x67e0
jmp 0x4c6f
movq 0x40(%rsp), %rdi
addq $0x18, %rdi
callq 0x68f0
jmp 0x4b47
movl $0x0, 0x50(%rsp)
movq 0x40(%rsp), %rdi
movl 0x50(%rsp), %eax
movl %eax, 0x24(%rsp)
callq 0x4700
movl %eax, 0x28(%rsp)
jmp 0x4b67
movl 0x24(%rsp), %eax
movl 0x28(%rsp), %ecx
cmpl %ecx, %eax
jge 0x4c3d
movl $0x0, 0x4c(%rsp)
movl 0x4c(%rsp), %eax
movl %eax, 0x1c(%rsp)
movq 0x88(%rsp), %rdi
callq 0x4700
movl %eax, 0x20(%rsp)
jmp 0x4b9a
movl 0x1c(%rsp), %eax
movl 0x20(%rsp), %ecx
cmpl %ecx, %eax
jge 0x4c2b
movq 0x40(%rsp), %rdi
movslq 0x50(%rsp), %rsi
callq 0x67a0
movq %rax, 0x8(%rsp)
movq 0x88(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x4710
movq %rax, 0x10(%rsp)
jmp 0x4bd6
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdi
callq 0x6990
movl %eax, 0x4(%rsp)
jmp 0x4beb
movl 0x4(%rsp), %eax
movl %eax, 0x48(%rsp)
movl 0x50(%rsp), %eax
movl 0x4c(%rsp), %ecx
addl %ecx, %eax
movslq %eax, %rsi
leaq 0x60(%rsp), %rdi
callq 0x67a0
movq %rax, %rdi
leaq 0x48(%rsp), %rsi
callq 0x6910
jmp 0x4c19
jmp 0x4c1b
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
jmp 0x4b7f
jmp 0x4c2d
movl 0x50(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x50(%rsp)
jmp 0x4b4f
movq 0x40(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x69d0
movq 0x40(%rsp), %rdi
callq 0x44f0
jmp 0x4c58
leaq 0x60(%rsp), %rdi
callq 0x67e0
movq 0x40(%rsp), %rax
addq $0x98, %rsp
retq
movq 0x80(%rsp), %rdi
callq 0x22b0
nopl (%rax)