// File: /workspace/github_cpp_makefile_star2_O3/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 0x2f64
movl %ecx, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
decq %rcx
cmpl $0x0, (%rax,%rdx,4)
je 0x2a64
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 0x40a4
leaq -0x170(%rbp), %rdi
leaq -0x31(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x40e2
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x2af2
callq 0x2180
testl %ebx, %ebx
jle 0x2e62
movl %ebx, %eax
movq %rax, -0xe0(%rbp)
xorl %eax, %eax
movq %r15, -0xe8(%rbp)
movq %rax, -0xf0(%rbp)
leaq 0x800a696(%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 0x4132
movl %eax, %r15d
testl %eax, %eax
jle 0x2d5b
movl $0x1, %r12d
xorl %r13d, %r13d
leaq -0x1c0(%rbp), %rbx
movq %rbx, %rdi
leaq -0xd8(%rbp), %rsi
callq 0x43e6
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
movq -0x60(%rbp), %rdx
leaq -0x88(%rbp), %rcx
callq 0x41a2
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 0x62ce
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x2c0f
callq 0x2180
movq -0x1b0(%rbp), %rdi
testq %rdi, %rdi
je 0x2c20
callq 0x2180
movl $0x0, -0xb0(%rbp)
movq -0x48(%rbp), %rsi
cmpq -0x40(%rbp), %rsi
je 0x2c44
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x2c54
leaq -0x50(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x686e
cmpl %r15d, %r13d
jge 0x2d4f
leaq -0x148(%rbp), %rbx
movq %rbx, %rdi
leaq -0xd8(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x4514
leaq -0xb0(%rbp), %rdi
movq %rbx, %rsi
leaq -0x88(%rbp), %rdx
callq 0x442f
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0x2ca1
callq 0x2180
leaq -0x198(%rbp), %r14
movq %r14, %rdi
leaq -0xb0(%rbp), %rsi
callq 0x43e6
leaq -0x148(%rbp), %rdi
leaq -0x88(%rbp), %rbx
movq %rbx, %rsi
movq %r14, %rdx
callq 0x469c
movq -0x148(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %rbx, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x62ce
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0x2d03
callq 0x2180
movq -0x188(%rbp), %rdi
testq %rdi, %rdi
je 0x2d14
callq 0x2180
leaq -0xb0(%rbp), %rdi
callq 0x4132
movl %eax, %ebx
testl %eax, %eax
je 0x2d36
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 0x2d47
callq 0x2180
testl %ebx, %ebx
jne 0x2c54
incl %r12d
cmpl %r15d, %r13d
jl 0x2b9f
movq -0x48(%rbp), %rsi
cmpq -0x50(%rbp), %rsi
jne 0x2d95
movl $0x0, -0xb0(%rbp)
cmpq -0x40(%rbp), %rsi
je 0x2d85
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x2d95
leaq -0x50(%rbp), %rdi
leaq -0xb0(%rbp), %rdx
callq 0x686e
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 0x2dc5
movl %edx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
decq %rdx
cmpl $0x0, (%rcx,%rsi,4)
je 0x2dac
jmp 0x2dc7
xorl %eax, %eax
subl %r15d, %eax
movq -0x50(%rbp), %rcx
addl %eax, (%rcx)
movq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x6a4e
movq -0xe8(%rbp), %r15
cmpq %r15, %rax
je 0x2dfa
movq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x49d4
incl (%rax)
jmp 0x2e0d
movq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x49d4
movl $0x0, (%rax)
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x2e1b
callq 0x2180
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x2e2c
callq 0x2180
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x2e3d
callq 0x2180
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x2e4b
callq 0x2180
movq -0xf0(%rbp), %rax
incq %rax
cmpq -0xe0(%rbp), %rax
jne 0x2b0c
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 0x2e92
movl %edx, %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
decq %rdx
cmpl $0x0, (%rcx,%rsi,4)
je 0x2e79
jmp 0x2e94
xorl %eax, %eax
leaq -0xd8(%rbp), %rsi
movl %eax, (%rsi)
leaq -0x120(%rbp), %rdi
leaq -0xb0(%rbp), %rcx
movl $0x1, %edx
callq 0x40a4
leaq -0x88(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x5dac
leaq -0x88(%rbp), %rsi
movq -0x30(%rbp), %rdi
callq 0x4a72
movl (%rax), %r14d
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x2eec
callq 0x2180
movq -0x120(%rbp), %rdi
testq %rdi, %rdi
je 0x2efd
callq 0x2180
movq -0x30(%rbp), %rax
movq 0x18(%rax), %rbx
cmpq %r15, %rbx
je 0x2f3d
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 0x2f14
movq -0x160(%rbp), %rdi
testq %rdi, %rdi
je 0x2f4e
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 0xa033(%rip), %rcx      # 0xcfa8
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0xa055(%rip), %rsi      # 0xcfd8
movq 0xa066(%rip), %rdx      # 0xcff0
movq %rax, %rdi
callq 0x2280
movq %rax, %rbx
movq -0x88(%rbp), %rdi
testq %rdi, %rdi
je 0x2fab
callq 0x2180
jmp 0x2fab
movq %rax, %rbx
movq -0x120(%rbp), %rdi
jmp 0x309b
jmp 0x2fd4
movq %rax, %rbx
movq -0x88(%rbp), %rdi
jmp 0x30ac
movq %rax, %rbx
jmp 0x30b6
jmp 0x3016
jmp 0x3016
movq %rax, %rbx
jmp 0x30a5
movq %rax, %rbx
jmp 0x3097
movq %rax, %rbx
jmp 0x3086
jmp 0x3016
jmp 0x3016
jmp 0x3016
movq %rax, %rbx
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x300b
callq 0x2180
jmp 0x300b
movq %rax, %rbx
movq -0x1b0(%rbp), %rdi
jmp 0x305d
jmp 0x3031
movq %rax, %rbx
jmp 0x3067
movq %rax, %rbx
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0x3039
callq 0x2180
jmp 0x3039
movq %rax, %rbx
jmp 0x304a
movq %rax, %rbx
movq -0x188(%rbp), %rdi
testq %rdi, %rdi
je 0x304a
callq 0x2180
movq -0xa0(%rbp), %rdi
jmp 0x305d
movq %rax, %rbx
movq -0x138(%rbp), %rdi
testq %rdi, %rdi
je 0x3067
callq 0x2180
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x3075
callq 0x2180
movq -0xc8(%rbp), %rdi
testq %rdi, %rdi
je 0x3086
callq 0x2180
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x3097
callq 0x2180
movq -0x78(%rbp), %rdi
testq %rdi, %rdi
je 0x30a5
callq 0x2180
movq -0x160(%rbp), %rdi
testq %rdi, %rdi
je 0x30b6
callq 0x2180
movq -0x30(%rbp), %rdi
callq 0x51e8
movq %rbx, %rdi
callq 0x22a0