// File: /workspace/github_cpp_makefile_star2_O1/asd00012334[P]Abstract-Algebra-2018/main.cpp
// Function: SplitDegree(Polynomial<prime::IntType, int> const&, int)
std::map<DegreeList,int> SplitDegree(Polynomial<prime::IntType, int> const& f,int N){
    using namespace std;
    using namespace prime;
	
	if(f.degree()==0) throw std::exception();
    
	std::map<DegreeList, int> out;
    IntType intType;
    Polynomial<prime::IntType, int> x(&intType,vector<int>{0,1});
    for(int i=0;i<N;++i){
        int p = primeList[i];
        Zp zp(p);
        Polynomial<Zp,ZpElement> g = f % zp, xp = x % zp;
        Polynomial<Zp,ZpElement> nonDeterminant = x % zp;
        DegreeList a;
        int gdegree = g.degree(), totalDegree=0;
        for(int deg=1;totalDegree<gdegree;++deg){
            /// Distinct degree factorization
            /// x^p^deg mod g
            nonDeterminant = powerMod(nonDeterminant,p,g);
            a.push_back(0);
            while(totalDegree<gdegree){
                auto factor = gcd(nonDeterminant-xp,g);
                //std::cout<<"gcd( "<<nonDeterminant-xp<<", "<<g<<" ) = "<<factor<<"\n";
                g = g / factor;
                int partDegree = factor.degree();
                //std::cout<<partDegree<<"partDegree\n";
                if(partDegree == 0) break;
                totalDegree += partDegree;
                a.back()+=partDegree/deg;
            }
        }
		if(a.size()==0) a.push_back(0);
		a[0] += f.degree() - gdegree;
        if(out.count(a)) out[a]+=1; else out[a] = 0;
    }
    int id = out[std::vector<int>{f.degree()}];
    for(auto &e: out) e.second=round((double)e.second/id);
    return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %edx, %ebx
movq %rdi, -0x30(%rbp)
movq 0x10(%rsi), %rax
movq %rsi, -0x58(%rbp)
movq 0x18(%rsi), %rcx
subq %rax, %rcx
shrq $0x2, %rcx
decq %rcx
testl %ecx, %ecx
jle 0x2f73
movl %ecx, %edx
movl %ecx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
decq %rcx
cmpl $0x0, (%rax,%rsi,4)
je 0x2a69
testl %edx, %edx
jle 0x2f73
movq -0x30(%rbp), %rcx
leaq 0x8(%rcx), %r15
movl $0x0, 0x8(%rcx)
xorl %eax, %eax
movq %rax, 0x10(%rcx)
movq %r15, 0x18(%rcx)
movq %r15, 0x20(%rcx)
movq %rax, 0x28(%rcx)
movabsq $0x100000000, %rax      # imm = 0x100000000
leaq -0x120(%rbp), %rsi
movq %rax, (%rsi)
leaq -0x88(%rbp), %rdi
leaq -0xd8(%rbp), %rcx
movl $0x2, %edx
callq 0x4098
leaq -0x170(%rbp), %rdi
leaq -0x31(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x40d6
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x2b01
callq 0x2180
testl %ebx, %ebx
jle 0x2e71
movl %ebx, %eax
movq %rax, -0xe0(%rbp)
xorl %eax, %eax
movq %r15, -0xe8(%rbp)
movq %rax, -0xf0(%rbp)
leaq 0x800a687(%rip), %rcx   # 0x800d1b0
movslq (%rcx,%rax,4), %rax
movq %rax, -0x60(%rbp)
movq %rax, -0xf8(%rbp)
leaq -0x88(%rbp), %rdi
movq -0x58(%rbp), %rsi
leaq -0xf8(%rbp), %rbx
movq %rbx, %rdx
callq 0x26e4
leaq -0x120(%rbp), %rdi
leaq -0x170(%rbp), %r12
movq %r12, %rsi
movq %rbx, %rdx
callq 0x26e4
leaq -0xd8(%rbp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x26e4
xorpd %xmm0, %xmm0
movapd %xmm0, -0x50(%rbp)
movq $0x0, -0x40(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x4126
movl %eax, %r15d
testl %eax, %eax
jle 0x2d6a
movl $0x1, %r12d
xorl %r13d, %r13d
leaq -0x1c0(%rbp), %rbx
movq %rbx, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x43e0
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
movq -0x60(%rbp), %rdx
leaq -0x88(%rbp), %rcx
callq 0x4196
movq -0xb0(%rbp), %rax
movq %rax, -0xd8(%rbp)
leaq -0xd8(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x630e
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x2c1e
callq 0x2180
movq -0x1b0(%rbp), %rdi
testq %rdi, %rdi
je 0x2c2f
callq 0x2180
movl $0x0, -0xb0(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x2c53
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x2c63
leaq -0x50(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x68ac
cmpl %r15d, %r13d
jge 0x2d5e
leaq -0x148(%rbp), %rbx
movq %rbx, %rdi
leaq -0xd8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x450e
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
leaq -0x88(%rbp), %rdx
callq 0x4429
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0x2cb0
callq 0x2180
leaq -0x198(%rbp), %r14
movq %r14, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x43e0
leaq -0x148(%rbp), %rdi
leaq -0x88(%rbp), %rbx
movq %rbx, %rsi
movq %r14, %rdx
callq 0x4698
movq -0x148(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %rbx, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x630e
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0x2d12
callq 0x2180
movq -0x188(%rbp), %rdi
testq %rdi, %rdi
je 0x2d23
callq 0x2180
leaq -0xb0(%rbp), %rdi
callq 0x4126
movl %eax, %ebx
testl %eax, %eax
je 0x2d45
addl %ebx, %r13d
movl %ebx, %eax
cltd
idivl %r12d
movq -0x48(%rbp), %rcx
addl %eax, -0x4(%rcx)
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x2d56
callq 0x2180
testl %ebx, %ebx
jne 0x2c63
incl %r12d
cmpl %r15d, %r13d
jl 0x2bae
movq -0x48(%rbp), %rsi
cmpq -0x50(%rbp), %rsi
jne 0x2da4
movl $0x0, -0xb0(%rbp)
cmpq -0x40(%rbp), %rsi
je 0x2d94
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x2da4
leaq -0x50(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x68ac
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
subq %rcx, %rax
shrq $0x2, %rax
leaq -0x1(%rax), %rdx
decl %eax
testl %eax, %eax
jle 0x2dd4
movl %edx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
decq %rdx
cmpl $0x0, (%rcx,%rsi,4)
je 0x2dbb
jmp 0x2dd6
xorl %eax, %eax
subl %r15d, %eax
movq -0x50(%rbp), %rcx
addl %eax, (%rcx)
movq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x6aa6
movq -0xe8(%rbp), %r15
cmpq %r15, %rax
je 0x2e09
movq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x4a06
incl (%rax)
jmp 0x2e1c
movq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x4a06
movl $0x0, (%rax)
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x2e2a
callq 0x2180
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x2e3b
callq 0x2180
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x2e4c
callq 0x2180
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x2e5a
callq 0x2180
movq -0xf0(%rbp), %rax
incq %rax
cmpq -0xe0(%rbp), %rax
jne 0x2b1b
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rax
subq %rcx, %rax
shrq $0x2, %rax
leaq -0x1(%rax), %rdx
decl %eax
testl %eax, %eax
jle 0x2ea1
movl %edx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
decq %rdx
cmpl $0x0, (%rcx,%rsi,4)
je 0x2e88
jmp 0x2ea3
xorl %eax, %eax
leaq -0xd8(%rbp), %rsi
movl %eax, (%rsi)
leaq -0x120(%rbp), %rdi
leaq -0xb0(%rbp), %rcx
movl $0x1, %edx
callq 0x4098
leaq -0x88(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x5de8
leaq -0x88(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x4aa2
movl (%rax), %r14d
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x2efb
callq 0x2180
movq -0x120(%rbp), %rdi
testq %rdi, %rdi
je 0x2f0c
callq 0x2180
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rbx
cmpq %r15, %rbx
je 0x2f4c
cvtsi2sd %r14d, %xmm0
movsd %xmm0, -0x60(%rbp)
xorps %xmm0, %xmm0
cvtsi2sdl 0x38(%rbx), %xmm0
divsd -0x60(%rbp), %xmm0
callq 0x20c0
cvttsd2si %xmm0, %eax
movl %eax, 0x38(%rbx)
movq %rbx, %rdi
callq 0x2110
movq %rax, %rbx
cmpq %r15, %rax
jne 0x2f23
movq -0x160(%rbp), %rdi
testq %rdi, %rdi
je 0x2f5d
callq 0x2180
movq -0x30(%rbp), %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x20d0
movq 0xa024(%rip), %rcx      # 0xcfa8
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0xa046(%rip), %rsi      # 0xcfd8
movq 0xa057(%rip), %rdx      # 0xcff0
movq %rax, %rdi
callq 0x2280
movq %rax, %rbx
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x2fba
callq 0x2180
jmp 0x2fba
movq %rax, %rbx
movq -0x120(%rbp), %rdi
jmp 0x30aa
jmp 0x2fe3
movq %rax, %rbx
movq -0x88(%rbp), %rdi
jmp 0x30bb
movq %rax, %rbx
jmp 0x30c5
jmp 0x3025
jmp 0x3025
movq %rax, %rbx
jmp 0x30b4
movq %rax, %rbx
jmp 0x30a6
movq %rax, %rbx
jmp 0x3095
jmp 0x3025
jmp 0x3025
jmp 0x3025
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x301a
callq 0x2180
jmp 0x301a
movq %rax, %rbx
movq -0x1b0(%rbp), %rdi
jmp 0x306c
jmp 0x3040
movq %rax, %rbx
jmp 0x3076
movq %rax, %rbx
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0x3048
callq 0x2180
jmp 0x3048
movq %rax, %rbx
jmp 0x3059
movq %rax, %rbx
movq -0x188(%rbp), %rdi
testq %rdi, %rdi
je 0x3059
callq 0x2180
movq -0xa0(%rbp), %rdi
jmp 0x306c
movq %rax, %rbx
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0x3076
callq 0x2180
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3084
callq 0x2180
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x3095
callq 0x2180
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x30a6
callq 0x2180
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x30b4
callq 0x2180
movq -0x160(%rbp), %rdi
testq %rdi, %rdi
je 0x30c5
callq 0x2180
movq -0x30(%rbp), %rdi
callq 0x521e
movq %rbx, %rdi
callq 0x22a0