// File: permutationlock[P]aes_math/lib/galois_field.cpp
// Function: Polynomial::toPoly[abi:cxx11]() const
string Polynomial::toPoly() const{
    
    string s = "";
    if(_a.size()==0) return s;
    if(_a[_a.size()-1].value()!=0){
        s += to_string(_a[_a.size()-1].value());
        s += "*";
        s += to_string(_p);
        s += "^";
        s += to_string(_a.size()-1);
    }
    for(int i=_a.size()-2; i>=0; i--){
        if(_a[i].value()!=0){
            s += "+";
            s += to_string(_a[i].value());
            s += "*";
            s += to_string(_p);
            s += "^";
            s += to_string(i);
        }
    }

    return s;
}

// Assembly:
subq $0x128, %rsp            # imm = 0x128
movq %rdi, 0x28(%rsp)
movq %rdi, %rax
movq %rax, 0x18(%rsp)
movq %rdi, 0x120(%rsp)
movq %rsi, 0x118(%rsp)
movq 0x118(%rsp), %rax
movq %rax, 0x20(%rsp)
movb $0x0, 0x117(%rsp)
leaq 0x116(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x22c0
movq 0x28(%rsp), %rdi
movq 0x30(%rsp), %rdx
leaq 0x10c51(%rip), %rsi     # 0x162cd
callq 0x2230
jmp 0x5683
leaq 0x116(%rsp), %rdi
callq 0x21f0
movq 0x20(%rsp), %rdi
callq 0x6840
cmpq $0x0, %rax
jne 0x56de
movb $0x1, 0x117(%rsp)
movl $0x1, 0x100(%rsp)
jmp 0x5a5e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0x116(%rsp), %rdi
callq 0x21f0
jmp 0x5a89
movq 0x20(%rsp), %rdi
callq 0x6840
movq 0x20(%rsp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x68d0
movq %rax, %rdi
callq 0x6bc0
movl %eax, 0x14(%rsp)
jmp 0x5706
movl 0x14(%rsp), %eax
cmpl $0x0, %eax
je 0x589d
movq 0x20(%rsp), %rdi
callq 0x6840
movq 0x20(%rsp), %rdi
movq %rax, %rsi
decq %rsi
callq 0x68d0
movq %rax, %rdi
callq 0x6bc0
movl %eax, 0x10(%rsp)
jmp 0x573b
movl 0x10(%rsp), %esi
leaq 0xe0(%rsp), %rdi
callq 0x6bd0
jmp 0x574e
movq 0x28(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x2220
jmp 0x5762
leaq 0xe0(%rsp), %rdi
callq 0x20e0
movq 0x28(%rsp), %rdi
leaq 0x1089b(%rip), %rsi     # 0x16016
callq 0x21a0
jmp 0x5782
movq 0x20(%rsp), %rax
movl 0x18(%rax), %esi
leaq 0xc0(%rsp), %rdi
callq 0x6bd0
jmp 0x5799
movq 0x28(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x2220
jmp 0x57ad
leaq 0xc0(%rsp), %rdi
callq 0x20e0
movq 0x28(%rsp), %rdi
leaq 0x10852(%rip), %rsi     # 0x16018
callq 0x21a0
jmp 0x57cd
movq 0x20(%rsp), %rdi
callq 0x6840
movq %rax, %rsi
decq %rsi
leaq 0xa0(%rsp), %rdi
callq 0x6d10
jmp 0x57ec
movq 0x28(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x2220
jmp 0x5800
leaq 0xa0(%rsp), %rdi
callq 0x20e0
jmp 0x589d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
jmp 0x5a7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x20e0
jmp 0x5a7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x20e0
jmp 0x5a7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x20e0
jmp 0x5a7f
movq 0x20(%rsp), %rdi
callq 0x6840
subq $0x2, %rax
movl %eax, 0x9c(%rsp)
cmpl $0x0, 0x9c(%rsp)
jl 0x5a4b
movq 0x20(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0x68d0
movq %rax, %rdi
callq 0x6bc0
movl %eax, 0xc(%rsp)
jmp 0x58e0
movl 0xc(%rsp), %eax
cmpl $0x0, %eax
je 0x5a33
movq 0x28(%rsp), %rdi
leaq 0x10721(%rip), %rsi     # 0x1601a
callq 0x21a0
jmp 0x5900
movq 0x20(%rsp), %rdi
movslq 0x9c(%rsp), %rsi
callq 0x68d0
movq %rax, %rdi
callq 0x6bc0
movl %eax, 0x8(%rsp)
jmp 0x5920
movl 0x8(%rsp), %esi
leaq 0x78(%rsp), %rdi
callq 0x6bd0
jmp 0x5930
movq 0x28(%rsp), %rdi
leaq 0x78(%rsp), %rsi
callq 0x2220
jmp 0x5941
leaq 0x78(%rsp), %rdi
callq 0x20e0
movq 0x28(%rsp), %rdi
leaq 0x106bf(%rip), %rsi     # 0x16016
callq 0x21a0
jmp 0x595e
movq 0x20(%rsp), %rax
movl 0x18(%rax), %esi
leaq 0x58(%rsp), %rdi
callq 0x6bd0
jmp 0x5972
movq 0x28(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x2220
jmp 0x5983
leaq 0x58(%rsp), %rdi
callq 0x20e0
movq 0x28(%rsp), %rdi
leaq 0x1067f(%rip), %rsi     # 0x16018
callq 0x21a0
jmp 0x59a0
movl 0x9c(%rsp), %esi
leaq 0x38(%rsp), %rdi
callq 0x6bd0
jmp 0x59b3
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0x2220
jmp 0x59c4
leaq 0x38(%rsp), %rdi
callq 0x20e0
jmp 0x5a33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0x78(%rsp), %rdi
callq 0x20e0
jmp 0x5a7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x20e0
jmp 0x5a7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x108(%rsp)
movl %eax, 0x104(%rsp)
leaq 0x38(%rsp), %rdi
callq 0x20e0
jmp 0x5a7f
jmp 0x5a35
movl 0x9c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x9c(%rsp)
jmp 0x58b2
movb $0x1, 0x117(%rsp)
movl $0x1, 0x100(%rsp)
testb $0x1, 0x117(%rsp)
jne 0x5a72
movq 0x28(%rsp), %rdi
callq 0x20e0
movq 0x18(%rsp), %rax
addq $0x128, %rsp            # imm = 0x128
retq
movq 0x28(%rsp), %rdi
callq 0x20e0
movq 0x108(%rsp), %rdi
callq 0x22b0
nopw %cs:(%rax,%rax)