// File: aadityanaik[P]LongNums/src/longnums.cpp
// Function: LongNumber::operator=(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void LongNumber::operator=(const std::string& num) {
	digits.erase(digits.begin(), digits.end());
	int element = 0, i;

	for(i = num.length() - 9; i > 0; i = i - 9) {
		element = 0;
		int multiplier = 1;
		int count = 8;
		while(count >= 0) {
			if(num[i + count] >= '0' && num[i + count] <= '9') {
				element += ((int)num[i + count] - 48) * multiplier;
				multiplier *= 10;
				count--;
			} else {
				digits.erase(digits.begin(), digits.end());
				digits.push_back(0);
				return;
			}
		}
		digits.push_back(element);
	}

	i = i + 9 - 1;
	element = 0;
	int multiplier = 1;
	while(i >= 1) {
		if(num[i] >= '0' && num[i] <= '9') {
			element += ((int)num[i] - 48) * multiplier;
			multiplier *= 10;
			i--;
		} else {
			throw InvalidInputException();
		}
	}

	if(num[0] == '+') {
		negative = false;
	} else if(num[0] == '-') {
		negative = true;
	} else if (num[0] >= '0' && num[0] <= '9') {
		negative = false;
		element += ((int)num[i] - 48) * multiplier;
	} else {
			throw InvalidInputException();
	}

	if(element != 0) {
		digits.push_back(element);
	}

	while(!digits.empty() && (*(digits.end() - 1) == 0)) {
		digits.erase(digits.end() - 1);
	}

	if(digits.empty()) {
		negative = false;
		digits.push_back(0);
	}
}

// Assembly:
subq $0xd8, %rsp
movq %rdi, 0xd0(%rsp)
movq %rsi, 0xc8(%rsp)
movq 0xd0(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x7b90
movq %rax, 0xb8(%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x7d20
movq 0x20(%rsp), %rdi
callq 0x7c00
movq %rax, 0xa8(%rsp)
leaq 0xb0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x7d20
movq 0x20(%rsp), %rdi
movq 0xc0(%rsp), %rsi
movq 0xb0(%rsp), %rdx
callq 0x7c80
movq %rax, 0xa0(%rsp)
movl $0x0, 0x9c(%rsp)
movq 0xc8(%rsp), %rdi
callq 0x21d0
subq $0x9, %rax
movl %eax, 0x98(%rsp)
cmpl $0x0, 0x98(%rsp)
jle 0x2da5
movl $0x0, 0x9c(%rsp)
movl $0x1, 0x94(%rsp)
movl $0x8, 0x90(%rsp)
cmpl $0x0, 0x90(%rsp)
jl 0x2d7d
movq 0xc8(%rsp), %rdi
movl 0x98(%rsp), %eax
addl 0x90(%rsp), %eax
movslq %eax, %rsi
callq 0x2180
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x2cfb
movq 0xc8(%rsp), %rdi
movl 0x98(%rsp), %eax
addl 0x90(%rsp), %eax
movslq %eax, %rsi
callq 0x2180
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x2cfb
movq 0xc8(%rsp), %rdi
movl 0x98(%rsp), %eax
addl 0x90(%rsp), %eax
movslq %eax, %rsi
callq 0x2180
movsbl (%rax), %eax
subl $0x30, %eax
imull 0x94(%rsp), %eax
addl 0x9c(%rsp), %eax
movl %eax, 0x9c(%rsp)
imull $0xa, 0x94(%rsp), %eax
movl %eax, 0x94(%rsp)
movl 0x90(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x90(%rsp)
jmp 0x2d78
movq 0x20(%rsp), %rdi
callq 0x7b90
movq %rax, 0x80(%rsp)
leaq 0x88(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x7d20
movq 0x20(%rsp), %rdi
callq 0x7c00
movq %rax, 0x70(%rsp)
leaq 0x78(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x7d20
movq 0x20(%rsp), %rdi
movq 0x88(%rsp), %rsi
movq 0x78(%rsp), %rdx
callq 0x7c80
movq 0x20(%rsp), %rdi
movq %rax, 0x68(%rsp)
movl $0x0, 0x64(%rsp)
leaq 0x64(%rsp), %rsi
callq 0x76f0
jmp 0x308c
jmp 0x2c41
movq 0x20(%rsp), %rdi
leaq 0x9c(%rsp), %rsi
callq 0x7d60
movl 0x98(%rsp), %eax
subl $0x9, %eax
movl %eax, 0x98(%rsp)
jmp 0x2c12
movl 0x98(%rsp), %eax
addl $0x9, %eax
subl $0x1, %eax
movl %eax, 0x98(%rsp)
movl $0x0, 0x9c(%rsp)
movl $0x1, 0x60(%rsp)
cmpl $0x1, 0x98(%rsp)
jl 0x2ea3
movq 0xc8(%rsp), %rdi
movslq 0x98(%rsp), %rsi
callq 0x2180
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x2e5e
movq 0xc8(%rsp), %rdi
movslq 0x98(%rsp), %rsi
callq 0x2180
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x2e5e
movq 0xc8(%rsp), %rdi
movslq 0x98(%rsp), %rsi
callq 0x2180
movsbl (%rax), %eax
subl $0x30, %eax
imull 0x60(%rsp), %eax
addl 0x9c(%rsp), %eax
movl %eax, 0x9c(%rsp)
imull $0xa, 0x60(%rsp), %eax
movl %eax, 0x60(%rsp)
movl 0x98(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x98(%rsp)
jmp 0x2e9e
movl $0x8, %edi
callq 0x20a0
movq %rax, %rdi
movq %rdi, 0x18(%rsp)
xorl %esi, %esi
movl $0x8, %edx
callq 0x20c0
movq 0x18(%rsp), %rdi
callq 0x7dd0
movq 0x18(%rsp), %rdi
leaq 0xbe96(%rip), %rsi      # 0xed28
leaq 0x4f67(%rip), %rdx      # 0x7e00
callq 0x2220
jmp 0x2dcc
movq 0xc8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2180
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x2eca
movq 0x20(%rsp), %rax
movb $0x0, 0x18(%rax)
jmp 0x2fa0
movq 0xc8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2180
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2ef1
movq 0x20(%rsp), %rax
movb $0x1, 0x18(%rax)
jmp 0x2f9e
movq 0xc8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2180
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x2f5c
movq 0xc8(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2180
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x2f5c
movq 0x20(%rsp), %rax
movb $0x0, 0x18(%rax)
movq 0xc8(%rsp), %rdi
movslq 0x98(%rsp), %rsi
callq 0x2180
movsbl (%rax), %eax
subl $0x30, %eax
imull 0x60(%rsp), %eax
addl 0x9c(%rsp), %eax
movl %eax, 0x9c(%rsp)
jmp 0x2f9c
movl $0x8, %edi
callq 0x20a0
movq %rax, %rdi
movq %rdi, 0x10(%rsp)
xorl %esi, %esi
movl $0x8, %edx
callq 0x20c0
movq 0x10(%rsp), %rdi
callq 0x7dd0
movq 0x10(%rsp), %rdi
leaq 0xbd98(%rip), %rsi      # 0xed28
leaq 0x4e69(%rip), %rdx      # 0x7e00
callq 0x2220
jmp 0x2f9e
jmp 0x2fa0
cmpl $0x0, 0x9c(%rsp)
je 0x2fbc
movq 0x20(%rsp), %rdi
leaq 0x9c(%rsp), %rsi
callq 0x7d60
jmp 0x2fbe
movq 0x20(%rsp), %rdi
callq 0x7e10
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0xf(%rsp)
jne 0x300c
movq 0x20(%rsp), %rdi
callq 0x7c00
movq %rax, 0x50(%rsp)
leaq 0x50(%rsp), %rdi
movl $0x1, %esi
callq 0x7e60
movq %rax, 0x58(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x7c30
cmpl $0x0, (%rax)
sete %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
testb $0x1, %al
jne 0x3016
jmp 0x3061
movq 0x20(%rsp), %rdi
callq 0x7c00
movq %rax, 0x38(%rsp)
leaq 0x38(%rsp), %rdi
movl $0x1, %esi
callq 0x7e60
movq %rax, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x7d20
movq 0x20(%rsp), %rdi
movq 0x48(%rsp), %rsi
callq 0x7eb0
movq %rax, 0x30(%rsp)
jmp 0x2fbe
movq 0x20(%rsp), %rdi
callq 0x7e10
testb $0x1, %al
jne 0x3071
jmp 0x308c
movq 0x20(%rsp), %rdi
movb $0x0, 0x18(%rdi)
movl $0x0, 0x2c(%rsp)
leaq 0x2c(%rsp), %rsi
callq 0x76f0
addq $0xd8, %rsp
retq
nopw %cs:(%rax,%rax)