// File: /workspace/github_cpp_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
callq 0x4ae0
movl 0x8(%r14), %eax
pushq $0x1
popq %rbp
pushq $0x8
popq %r12
leaq 0xc(%rsp), %r15
andl $0x0, 0xc(%rsp)
leal -0x9(%rax), %r13d
movq (%r14), %rcx
testl %r13d, %r13d
jle 0x2889
xorl %edx, %edx
movl %r12d, %esi
movl %ebp, %edi
testl %esi, %esi
js 0x284b
leal (%rax,%rsi), %r8d
addl $-0x9, %r8d
movzbl (%rcx,%r8), %r8d
leal -0x30(%r8), %r9d
cmpb $0x9, %r9b
ja 0x285b
addl $-0x30, %r8d
imull %edi, %r8d
addl %r8d, %edx
movl %edx, 0xc(%rsp)
imull $0xa, %edi, %edi
decl %esi
jmp 0x281a
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4ae6
movl %r13d, %eax
jmp 0x2802
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
callq 0x4ae0
leaq 0x14(%rsp), %rsi
andl $0x0, (%rsi)
movq %rbx, %rdi
callq 0x4da8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x1
popq %rsi
xorl %edx, %edx
movl %eax, %edi
leal -0x1(%rdi), %eax
cmpl $0x2, %edi
jl 0x28bd
movl %eax, %edi
movzbl (%rcx,%rdi), %edi
leal -0x30(%rdi), %r8d
cmpb $0x9, %r8b
ja 0x2936
addl $-0x30, %edi
imull %esi, %edi
addl %edi, %edx
movl %edx, 0xc(%rsp)
imull $0xa, %esi, %esi
jmp 0x288e
movzbl (%rcx), %edi
cmpl $0x2d, %edi
je 0x28d0
cmpl $0x2b, %edi
jne 0x28d6
movb $0x0, 0x18(%rbx)
jmp 0x28f6
movb $0x1, 0x18(%rbx)
jmp 0x28f6
addb $-0x30, %dil
cmpb $0x9, %dil
ja 0x2936
movb $0x0, 0x18(%rbx)
cltq
movsbl (%rcx,%rax), %eax
addl $-0x30, %eax
imull %esi, %eax
addl %eax, %edx
movl %edx, 0xc(%rsp)
testl %edx, %edx
je 0x2907
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0x4ae6
movq 0x8(%rbx), %rsi
cmpq %rsi, (%rbx)
je 0x2928
cmpl $0x0, -0x4(%rsi)
jne 0x287a
addq $-0x4, %rsi
movq %rbx, %rdi
callq 0x4b04
jmp 0x2907
movb $0x0, 0x18(%rbx)
leaq 0x10(%rsp), %rsi
jmp 0x286f
pushq $0x8
popq %rdi
callq 0x2080
leaq 0x6423(%rip), %rcx      # 0x8d68
movq %rcx, (%rax)
leaq 0x63d9(%rip), %rsi      # 0x8d28
movq 0x668a(%rip), %rdx      # 0x8fe0
movq %rax, %rdi
callq 0x2160