// File: Mariotti94[P]BigFloat/BigFloat.cc
// Function: BigFloat::CompareNum(BigFloat const&, BigFloat const&)
int BigFloat::CompareNum(const BigFloat& left, const BigFloat& right)
{
    if((left.number.size() - left.decimals) > (right.number.size() - right.decimals))
        return 1;
    else if((left.number.size() - left.decimals) < (right.number.size() - right.decimals))
        return 2;

    if(left.decimals > right.decimals) {
        BigFloat tmp;
        tmp = right;
        while(left.decimals > tmp.decimals) {
            tmp.decimals++;
            tmp.number.push_front('0');
        }

        for(int i = left.number.size() - 1; i >= 0; i--) {
            if(left.number[i] > tmp.number[i])
                return 1;
            else if(left.number[i] < tmp.number[i])
                return 2;
        }
        return 0;
    }
    else if(left.decimals < right.decimals) {
        BigFloat tmp;
        tmp = left;
        while(tmp.decimals < right.decimals) {
            tmp.decimals++;
            tmp.number.push_front('0');
        }

        for(int i = tmp.number.size() - 1; i >= 0; i--) {
            if(tmp.number[i] > right.number[i])
                return 1;
            else if(tmp.number[i] < right.number[i])
                return 2;
        }
        return 0;
    }
    else {
        for(int i = left.number.size() - 1; i >= 0; i--) {
            if(left.number[i] > right.number[i])
                return 1;
            else if(left.number[i] < right.number[i])
                return 2;
        }
        return 0;
    }
}

// Assembly:
subq $0x178, %rsp            # imm = 0x178
movq %rdi, 0x168(%rsp)
movq %rsi, 0x160(%rsp)
movq 0x168(%rsp), %rdi
addq $0x8, %rdi
callq 0x35c0
movq 0x168(%rsp), %rcx
movslq 0x58(%rcx), %rcx
subq %rcx, %rax
movq %rax, 0x30(%rsp)
movq 0x160(%rsp), %rdi
addq $0x8, %rdi
callq 0x35c0
movq %rax, %rcx
movq 0x30(%rsp), %rax
movq 0x160(%rsp), %rdx
movslq 0x58(%rdx), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jbe 0x4609
movl $0x1, 0x174(%rsp)
jmp 0x4acf
movq 0x168(%rsp), %rdi
addq $0x8, %rdi
callq 0x35c0
movq 0x168(%rsp), %rcx
movslq 0x58(%rcx), %rcx
subq %rcx, %rax
movq %rax, 0x28(%rsp)
movq 0x160(%rsp), %rdi
addq $0x8, %rdi
callq 0x35c0
movq %rax, %rcx
movq 0x28(%rsp), %rax
movq 0x160(%rsp), %rdx
movslq 0x58(%rdx), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jae 0x466b
movl $0x2, 0x174(%rsp)
jmp 0x4acf
jmp 0x466d
movq 0x168(%rsp), %rax
movl 0x58(%rax), %eax
movq 0x160(%rsp), %rcx
cmpl 0x58(%rcx), %eax
jle 0x4849
leaq 0xe0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x28c0
movq 0x20(%rsp), %rdi
movq 0x160(%rsp), %rsi
callq 0xb470
jmp 0x46af
jmp 0x46b1
movq 0x168(%rsp), %rax
movl 0x58(%rax), %eax
cmpl 0x138(%rsp), %eax
jle 0x471c
movl 0x138(%rsp), %eax
incl %eax
movl %eax, 0x138(%rsp)
leaq 0xe8(%rsp), %rdi
movb $0x30, 0xd3(%rsp)
leaq 0xd3(%rsp), %rsi
callq 0xb4e0
jmp 0x46f4
jmp 0x46b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x2780
jmp 0x4ade
movq 0x168(%rsp), %rdi
addq $0x8, %rdi
callq 0x35c0
subq $0x1, %rax
movl %eax, 0xcc(%rsp)
cmpl $0x0, 0xcc(%rsp)
jl 0x4821
movq 0x168(%rsp), %rdi
addq $0x8, %rdi
movslq 0xcc(%rsp), %rsi
callq 0xb510
movsbl (%rax), %eax
movl %eax, 0x1c(%rsp)
leaq 0xe0(%rsp), %rdi
addq $0x8, %rdi
movslq 0xcc(%rsp), %rsi
callq 0xb540
movq %rax, %rcx
movl 0x1c(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jle 0x47a8
movl $0x1, 0x174(%rsp)
movl $0x1, 0xc8(%rsp)
jmp 0x4837
movq 0x168(%rsp), %rdi
addq $0x8, %rdi
movslq 0xcc(%rsp), %rsi
callq 0xb510
movsbl (%rax), %eax
movl %eax, 0x18(%rsp)
leaq 0xe0(%rsp), %rdi
addq $0x8, %rdi
movslq 0xcc(%rsp), %rsi
callq 0xb540
movq %rax, %rcx
movl 0x18(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x4807
movl $0x2, 0x174(%rsp)
movl $0x1, 0xc8(%rsp)
jmp 0x4837
jmp 0x4809
jmp 0x480b
movl 0xcc(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0xcc(%rsp)
jmp 0x4738
movl $0x0, 0x174(%rsp)
movl $0x1, 0xc8(%rsp)
leaq 0xe0(%rsp), %rdi
callq 0x2780
jmp 0x4acf
movq 0x168(%rsp), %rax
movl 0x58(%rax), %eax
movq 0x160(%rsp), %rcx
cmpl 0x58(%rcx), %eax
jge 0x49f2
leaq 0x48(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x28c0
movq 0x10(%rsp), %rdi
movq 0x168(%rsp), %rsi
callq 0xb470
jmp 0x4888
jmp 0x488a
movl 0xa0(%rsp), %eax
movq 0x160(%rsp), %rcx
cmpl 0x58(%rcx), %eax
jge 0x48e9
movl 0xa0(%rsp), %eax
incl %eax
movl %eax, 0xa0(%rsp)
leaq 0x50(%rsp), %rdi
movb $0x30, 0x47(%rsp)
leaq 0x47(%rsp), %rsi
callq 0xb4e0
jmp 0x48c4
jmp 0x488a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xd8(%rsp)
movl %eax, 0xd4(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x2780
jmp 0x4ade
leaq 0x48(%rsp), %rdi
addq $0x8, %rdi
callq 0x35c0
subq $0x1, %rax
movl %eax, 0x40(%rsp)
cmpl $0x0, 0x40(%rsp)
jl 0x49cd
leaq 0x48(%rsp), %rdi
addq $0x8, %rdi
movslq 0x40(%rsp), %rsi
callq 0xb540
movsbl (%rax), %eax
movl %eax, 0xc(%rsp)
movq 0x160(%rsp), %rdi
addq $0x8, %rdi
movslq 0x40(%rsp), %rsi
callq 0xb510
movq %rax, %rcx
movl 0xc(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jle 0x4963
movl $0x1, 0x174(%rsp)
movl $0x1, 0xc8(%rsp)
jmp 0x49e3
leaq 0x48(%rsp), %rdi
addq $0x8, %rdi
movslq 0x40(%rsp), %rsi
callq 0xb540
movsbl (%rax), %eax
movl %eax, 0x8(%rsp)
movq 0x160(%rsp), %rdi
addq $0x8, %rdi
movslq 0x40(%rsp), %rsi
callq 0xb510
movq %rax, %rcx
movl 0x8(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x49b9
movl $0x2, 0x174(%rsp)
movl $0x1, 0xc8(%rsp)
jmp 0x49e3
jmp 0x49bb
jmp 0x49bd
movl 0x40(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x40(%rsp)
jmp 0x48ff
movl $0x0, 0x174(%rsp)
movl $0x1, 0xc8(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x2780
jmp 0x4acf
movq 0x168(%rsp), %rdi
addq $0x8, %rdi
callq 0x35c0
subq $0x1, %rax
movl %eax, 0x3c(%rsp)
cmpl $0x0, 0x3c(%rsp)
jl 0x4ac4
movq 0x168(%rsp), %rdi
addq $0x8, %rdi
movslq 0x3c(%rsp), %rsi
callq 0xb510
movsbl (%rax), %eax
movl %eax, 0x4(%rsp)
movq 0x160(%rsp), %rdi
addq $0x8, %rdi
movslq 0x3c(%rsp), %rsi
callq 0xb510
movq %rax, %rcx
movl 0x4(%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jle 0x4a64
movl $0x1, 0x174(%rsp)
jmp 0x4acf
movq 0x168(%rsp), %rdi
addq $0x8, %rdi
movslq 0x3c(%rsp), %rsi
callq 0xb510
movsbl (%rax), %eax
movl %eax, (%rsp)
movq 0x160(%rsp), %rdi
addq $0x8, %rdi
movslq 0x3c(%rsp), %rsi
callq 0xb510
movq %rax, %rcx
movl (%rsp), %eax
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jge 0x4ab0
movl $0x2, 0x174(%rsp)
jmp 0x4acf
jmp 0x4ab2
jmp 0x4ab4
movl 0x3c(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x4a0b
movl $0x0, 0x174(%rsp)
movl 0x174(%rsp), %eax
addq $0x178, %rsp            # imm = 0x178
retq
movq 0xd8(%rsp), %rdi
callq 0x2300
nopl (%rax,%rax)