// File: /workspace/github_cpp_makefile_star2_O2/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 $0x1a8, %rsp            # imm = 0x1A8
movl %edx, %r14d
movq %rdi, %r15
movq %rsi, -0x68(%rbp)
movq %rsi, %rdi
callq 0x3af8
testl %eax, %eax
je 0x2d1f
leaq 0x8(%r15), %rbx
andl $0x0, 0x8(%r15)
andq $0x0, 0x10(%r15)
movq %rbx, 0x18(%r15)
movq %rbx, 0x20(%r15)
movq %r15, -0x38(%rbp)
andq $0x0, 0x28(%r15)
movabsq $0x100000000, %rax      # imm = 0x100000000
leaq -0xe0(%rbp), %rsi
movq %rax, (%rsi)
leaq -0x98(%rbp), %rdi
pushq $0x2
popq %rdx
leaq -0x130(%rbp), %rcx
callq 0x3b28
movq %rbx, -0xa0(%rbp)
leaq -0x180(%rbp), %rdi
leaq -0x29(%rbp), %rsi
leaq -0x98(%rbp), %rdx
callq 0x3b5e
leaq -0x98(%rbp), %rdi
callq 0x4b28
xorl %eax, %eax
testl %r14d, %r14d
cmovlel %eax, %r14d
movq %r14, -0xa8(%rbp)
leaq -0x70(%rbp), %r15
leaq -0x108(%rbp), %r12
leaq -0x158(%rbp), %rbx
cmpq -0xa8(%rbp), %rax
je 0x2c5b
movq %rax, -0xb0(%rbp)
leaq 0x800979e(%rip), %rcx   # 0x800c1a0
movslq (%rcx,%rax,4), %rax
movq %rax, -0xb8(%rbp)
movq %rax, -0x70(%rbp)
leaq -0x98(%rbp), %r14
movq %r14, %rdi
movq -0x68(%rbp), %rsi
movq %r15, %rdx
callq 0x2658
leaq -0xe0(%rbp), %rdi
leaq -0x180(%rbp), %r13
movq %r13, %rsi
movq %r15, %rdx
callq 0x2658
leaq -0x130(%rbp), %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x2658
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
andq $0x0, -0x50(%rbp)
movq %r14, %rdi
callq 0x3b9e
movl %eax, -0x40(%rbp)
xorl %r13d, %r13d
pushq $0x1
popq %rax
movl %eax, -0x44(%rbp)
cmpl -0x40(%rbp), %r13d
jge 0x2bb9
leaq -0x1d0(%rbp), %r15
movq %r15, %rdi
leaq -0x130(%rbp), %rsi
callq 0x3ddc
movq %r12, %r14
movq %r12, %rdi
movq %r15, %rsi
movq -0xb8(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x3c0c
leaq -0x130(%rbp), %rdi
movq %r14, %rsi
callq 0x3e20
leaq -0xf8(%rbp), %rdi
callq 0x4a9e
leaq -0x1c0(%rbp), %rdi
callq 0x4a9e
andl $0x0, -0x108(%rbp)
leaq -0x60(%rbp), %rdi
movq %r14, %rsi
callq 0x60ec
cmpl -0x40(%rbp), %r13d
jge 0x2bb1
movq %rbx, %rdi
leaq -0x130(%rbp), %rsi
leaq -0xe0(%rbp), %rdx
callq 0x3f16
movq %r12, %r14
movq %r12, %rdi
movq %rbx, %rsi
leaq -0x98(%rbp), %rdx
callq 0x3e4a
movq %rbx, %r15
leaq -0x148(%rbp), %rdi
callq 0x4a9e
leaq -0x1a8(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3ddc
movq %r15, %r14
movq %r15, %rdi
leaq -0x98(%rbp), %r15
movq %r15, %rsi
movq %rbx, %rdx
callq 0x406c
movq %r15, %rdi
movq %r14, %rsi
callq 0x3e20
movq %r14, %rbx
leaq -0x148(%rbp), %rdi
callq 0x4a9e
leaq -0x198(%rbp), %rdi
callq 0x4a9e
movq %r12, %rdi
callq 0x3b9e
movl %eax, %r15d
testl %eax, %eax
je 0x2b9c
addl %r15d, %r13d
movl %r15d, %eax
cltd
idivl -0x44(%rbp)
movq -0x58(%rbp), %rcx
addl %eax, -0x4(%rcx)
leaq -0xf8(%rbp), %rdi
callq 0x4a9e
testl %r15d, %r15d
jne 0x2ae8
incl -0x44(%rbp)
jmp 0x2a72
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0x2bd6
andl $0x0, -0x108(%rbp)
leaq -0x60(%rbp), %rdi
movq %r12, %rsi
callq 0x60ec
movq -0x68(%rbp), %rdi
callq 0x3af8
subl -0x40(%rbp), %eax
movq -0x60(%rbp), %rcx
addl %eax, (%rcx)
movq -0x38(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x435c
testq %rax, %rax
je 0x2c0b
movq -0x38(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4380
incl (%rax)
jmp 0x2c1b
movq -0x38(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4380
andl $0x0, (%rax)
leaq -0x60(%rbp), %rdi
callq 0x4b28
leaq -0x120(%rbp), %rdi
callq 0x4a9e
leaq -0xd0(%rbp), %rdi
callq 0x4a9e
leaq -0x88(%rbp), %rdi
callq 0x4a9e
movq -0xb0(%rbp), %rax
incq %rax
leaq -0x70(%rbp), %r15
jmp 0x29e7
movq -0x68(%rbp), %rdi
callq 0x3af8
leaq -0x130(%rbp), %rsi
movl %eax, (%rsi)
leaq -0xe0(%rbp), %rdi
pushq $0x1
popq %rdx
leaq -0x108(%rbp), %rcx
callq 0x3b28
leaq -0x98(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x57b0
movq -0xa0(%rbp), %r14
leaq -0x98(%rbp), %rsi
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x43ee
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, -0x40(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4b28
leaq -0xe0(%rbp), %rdi
callq 0x4b28
movq 0x18(%rbx), %rbx
cmpq %r14, %rbx
je 0x2cfd
cvtsi2sdl 0x38(%rbx), %xmm0
divsd -0x40(%rbp), %xmm0
callq 0x20c0
cvttsd2si %xmm0, %eax
movl %eax, 0x38(%rbx)
movq %rbx, %rdi
callq 0x2120
movq %rax, %rbx
jmp 0x2cd5
leaq -0x170(%rbp), %rdi
callq 0x4b28
movq -0x38(%rbp), %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x20e0
movq 0x927a(%rip), %rcx      # 0xbfa8
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x929c(%rip), %rsi      # 0xbfd8
movq 0x92ad(%rip), %rdx      # 0xbff0
movq %rax, %rdi
callq 0x2290
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
callq 0x4b28
jmp 0x2d5f
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
callq 0x4b28
jmp 0x2e39
jmp 0x2d9b
movq %rax, %rbx
leaq -0x98(%rbp), %rdi
jmp 0x2e40
movq %rax, %rbx
jmp 0x2e45
jmp 0x2dca
movq %rax, %rbx
jmp 0x2e2d
movq %rax, %rbx
jmp 0x2e21
movq %rax, %rbx
jmp 0x2e39
jmp 0x2dca
jmp 0x2dca
movq %rax, %rbx
jmp 0x2dbf
jmp 0x2dca
jmp 0x2dca
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
callq 0x4a9e
leaq -0x1c0(%rbp), %rdi
jmp 0x2e07
jmp 0x2dcf
movq %rax, %rbx
jmp 0x2e0c
movq %rax, %rbx
jmp 0x2e00
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
callq 0x4a9e
jmp 0x2df4
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
jmp 0x2e07
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
callq 0x4a9e
leaq -0xf8(%rbp), %rdi
callq 0x4a9e
leaq -0x60(%rbp), %rdi
callq 0x4b28
leaq -0x120(%rbp), %rdi
callq 0x4a9e
leaq -0xd0(%rbp), %rdi
callq 0x4a9e
leaq -0x88(%rbp), %rdi
callq 0x4a9e
leaq -0x170(%rbp), %rdi
callq 0x4b28
movq -0x38(%rbp), %rdi
callq 0x4bac
movq %rbx, %rdi
callq 0x22b0