// File: /workspace/github_cpp_makefile_star2_O3/aadityanaik[P]LongNums/src/longnums.cpp
// Function: LongNumber::operator-(LongNumber)
LongNumber LongNumber::operator-(LongNumber X) {
	if(negative ==  X.negative) {
		LongNumber answer;
		if(this->absolute() >= X.absolute()) {
			int temp;
			bool borrow = false;
			answer.digits.erase(answer.digits.begin(), answer.digits.end());
			for(int i = 0, j = 0;i < digits.size();i++, j++) {
				temp = digits[i];
				if(borrow) {
					temp--;
				}
				if(j < X.digits.size()) {
					temp -= X.digits[j];
				}
				if(temp < 0) {
					temp += BASE;
					borrow = true;
				} else {
					borrow = false;
				}
				answer.digits.push_back(temp);
			}

			while(*(answer.digits.end()-1) == 0 && answer.digits.size() > 1) {
				answer.digits.erase(answer.digits.end()-1);
			}

			if(answer != 0) {
				answer.negative = negative;
			}
		} else {
			answer = X - (*this);
			if(answer != 0) {
				answer.negative=!negative;
			}
		}

		return answer;
	} else {
		//add
		LongNumber number, answer;
		number.digits = X.digits;
		number.negative = !X.negative;

		answer = (*this) + number;
		return answer;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movb 0x18(%rsi), %al
cmpb 0x18(%rdx), %al
jne 0x34f0
movq %rbx, %rdi
callq 0x27ac
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x2c0c
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x2c0c
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x2f6a
movb $0x1, %bpl
testb %al, %al
jne 0x338f
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x2fc6
movl %eax, %ebp
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x339e
callq 0x20b0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x33ad
callq 0x20b0
testb %bpl, %bpl
je 0x3583
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
cmpq %rdx, %rax
je 0x33c9
movq %rax, 0x8(%rbx)
movq %rax, %rdx
movq (%r14), %rax
movq 0x8(%r14), %rcx
cmpq %rax, %rcx
je 0x3463
xorl %r13d, %r13d
leaq 0x4(%rsp), %r12
xorl %edx, %edx
movl (%rax,%r13,4), %ebp
movzbl %dl, %edx
andl $0x1, %edx
subl %edx, %ebp
movl %ebp, 0x4(%rsp)
movq (%r15), %rdx
movq 0x8(%r15), %rsi
subq %rdx, %rsi
sarq $0x2, %rsi
cmpq %r13, %rsi
jbe 0x340e
subl (%rdx,%r13,4), %ebp
movl %ebp, 0x4(%rsp)
movl %ebp, %edx
testl %ebp, %ebp
jns 0x3420
movl 0x5cce(%rip), %edx      # 0x90e8
addl %ebp, %edx
movl %edx, 0x4(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x3436
movl %edx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x3448
movq %rbx, %rdi
movq %r12, %rdx
callq 0x57fa
movq (%r14), %rax
movq 0x8(%r14), %rcx
shrl $0x1f, %ebp
incq %r13
movq %rcx, %rsi
subq %rax, %rsi
sarq $0x2, %rsi
movl %ebp, %edx
cmpq %r13, %rsi
ja 0x33e3
movq 0x8(%rbx), %rdx
cmpl $0x0, -0x4(%rdx)
jne 0x34a9
leaq -0x4(%rdx), %rdi
movq (%rbx), %rax
movq %rdx, %rcx
subq %rax, %rcx
cmpq $0x5, %rcx
jb 0x34a9
leaq 0x4(%rdi), %rsi
cmpq %rdx, %rsi
je 0x3494
subq %rsi, %rdx
callq 0x2140
movq (%rbx), %rax
movq 0x8(%rbx), %rdx
leaq -0x4(%rdx), %rcx
movq %rcx, 0x8(%rbx)
leaq -0x8(%rdx), %rdi
cmpl $0x0, -0x8(%rdx)
movq %rcx, %rdx
je 0x3470
leaq 0x28(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x8(%rsp), %rdi
callq 0x2a96
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2fc6
movl %eax, %ebp
movq (%r15), %rdi
testq %rdi, %rdi
je 0x34de
callq 0x20b0
testb %bpl, %bpl
jne 0x3617
movb 0x18(%r14), %al
jmp 0x3614
leaq 0x8(%rsp), %rdi
callq 0x27ac
movq %rbx, %rdi
callq 0x27ac
leaq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x5412
movb 0x18(%r15), %al
xorb $0x1, %al
leaq 0x8(%rsp), %rsi
movb %al, 0x18(%rsi)
leaq 0x48(%rsp), %rdi
callq 0x2806
leaq 0x28(%rsp), %rdi
leaq 0x48(%rsp), %rdx
movq %r14, %rsi
callq 0x3046
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x5412
movb 0x40(%rsp), %al
movb %al, 0x18(%rbx)
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x355c
callq 0x20b0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x356b
callq 0x20b0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x3617
callq 0x20b0
jmp 0x3617
leaq 0x68(%rsp), %rdi
movq %r14, %rsi
callq 0x2806
leaq 0x8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
movq %r15, %rsi
callq 0x3320
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5412
movb 0x20(%rsp), %al
movb %al, 0x18(%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x35c5
callq 0x20b0
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x35d4
callq 0x20b0
leaq 0x28(%rsp), %rsi
movq $0x0, (%rsi)
leaq 0x8(%rsp), %rdi
callq 0x2a96
leaq 0x8(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2fc6
movl %eax, %ebp
movq (%r15), %rdi
testq %rdi, %rdi
je 0x3609
callq 0x20b0
testb %bpl, %bpl
jne 0x3617
movb 0x18(%r14), %al
xorb $0x1, %al
movb %al, 0x18(%rbx)
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x36ac
jmp 0x36ac
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x3647
callq 0x20b0
jmp 0x3647
movq %rax, %r14
movq 0x68(%rsp), %rdi
jmp 0x3694
jmp 0x36ac
movq %rax, %r14
movq 0x28(%rsp), %rdi
testq %rdi, %rdi
je 0x3667
callq 0x20b0
jmp 0x3667
movq %rax, %r14
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x367d
callq 0x20b0
jmp 0x367d
jmp 0x367a
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x36a3
callq 0x20b0
jmp 0x36a3
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x36af
callq 0x20b0
jmp 0x36af
movq %rax, %r14
movq 0x8(%rsp), %rdi
jmp 0x36b2
jmp 0x36ac
movq %rax, %r14
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x36bc
callq 0x20b0
movq %r14, %rdi
callq 0x2180