// File: asd00012334[P]Abstract-Algebra-2018/main.cpp
// Function: PolynomialSpecialized<quotient::FracType, quotient::fraction>::toIntCoef() const
Polynomial<prime::IntType,int>
PolynomialSpecialized<quotient::FracType,quotient::fraction>::toIntCoef()const{
    auto This = static_cast<Polynomial<quotient::FracType,quotient::fraction>const*>(this);
    Polynomial<prime::IntType,int> out;
    out.canonicalType.scalar = &prime::intType;
    out.coef.resize(This->coef.size(),0 );

    auto lcm = [](long long l, long long r)->long long{
        return l*r/std::__gcd(l,r);
    };
    long long multi=1, g=0;
    for(int i=0;i<This->coef.size();++i){
        if(This->coef[i].en == 0) continue;
        g = std::__gcd(g, This->coef[i].en);
        multi = lcm(multi,This->coef[i].dn);
    }
    for(int i=0;i<out.coef.size();++i){
        out.coef[i] = (This->coef[i].en/g)*(multi/This->coef[i].dn);
    }
    out.reduce();
    return out;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x58(%rbp)
movq %rdi, %rax
movq %rax, -0x60(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x4c60
movq -0x58(%rbp), %rdi
leaq 0x1001d69a(%rip), %rax  # 0x100201c4
movq %rax, (%rdi)
addq $0x10, %rdi
movq %rdi, -0x50(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0x4ac0
movq -0x50(%rbp), %rdi
movq %rax, %rsi
movl $0x0, -0x20(%rbp)
leaq -0x20(%rbp), %rdx
callq 0x4ca0
jmp 0x2b5b
movq $0x1, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movslq -0x44(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
callq 0x4ac0
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x2c4c
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movslq -0x44(%rbp), %rsi
callq 0x4b10
cmpq $0x0, (%rax)
jne 0x2bcd
jmp 0x2c3e
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
callq 0x4e30
jmp 0x2d31
movq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movslq -0x44(%rbp), %rsi
callq 0x4b10
movq -0x78(%rbp), %rdi
movq (%rax), %rsi
callq 0x4d50
movq %rax, -0x70(%rbp)
jmp 0x2bf8
movq -0x70(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movslq -0x44(%rbp), %rsi
callq 0x4b10
movq -0x88(%rbp), %rsi
movq 0x8(%rax), %rdx
leaq -0x2d(%rbp), %rdi
callq 0x2d40
movq %rax, -0x80(%rbp)
jmp 0x2c36
movq -0x80(%rbp), %rax
movq %rax, -0x38(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x2b72
movl $0x0, -0x48(%rbp)
movq -0x58(%rbp), %rdi
movslq -0x48(%rbp), %rax
movq %rax, -0x90(%rbp)
addq $0x10, %rdi
callq 0x48b0
movq %rax, %rcx
movq -0x90(%rbp), %rax
cmpq %rcx, %rax
jae 0x2d06
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movslq -0x48(%rbp), %rsi
callq 0x4b10
movq (%rax), %rax
cqto
idivq -0x40(%rbp)
movq %rax, -0xa0(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rdi
addq $0x10, %rdi
movslq -0x48(%rbp), %rsi
callq 0x4b10
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cqto
idivq 0x8(%rcx)
movq %rax, %rcx
movq -0xa0(%rbp), %rax
imulq %rcx, %rax
movl %eax, -0x94(%rbp)
addq $0x10, %rdi
movslq -0x48(%rbp), %rsi
callq 0x4d90
movl -0x94(%rbp), %ecx
movl %ecx, (%rax)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x2c53
movq -0x58(%rbp), %rdi
callq 0x4db0
jmp 0x2d11
movb $0x1, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x2d24
movq -0x58(%rbp), %rdi
callq 0x4e30
movq -0x60(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x22f0
nopw (%rax,%rax)