// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rax
cmpq 0x8(%rdi), %rax
je 0x28a2
movq %rax, 0x8(%rbx)
movl 0x8(%r14), %r12d
leal -0x9(%r12), %eax
testl %eax, %eax
jle 0x2928
movl %eax, %eax
leaq 0xc(%rsp), %r15
movq %rax, %r12
movl $0x0, 0xc(%rsp)
movq (%r14), %rcx
addq %rax, %rcx
xorl %eax, %eax
movl $0x1, %edx
movl $0x9, %esi
movzbl -0x1(%rcx,%rsi), %edi
leal -0x30(%rdi), %r8d
cmpb $0x9, %r8b
ja 0x2984
addl $-0x30, %edi
imull %edx, %edi
addl %edi, %eax
movl %eax, 0xc(%rsp)
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
decq %rsi
jne 0x28d3
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x2912
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x291d
movq %rbx, %rdi
movq %r15, %rdx
callq 0x57fa
leaq -0x9(%r12), %rax
cmpq $0x9, %r12
jg 0x28b6
movl $0x0, 0xc(%rsp)
leal -0x1(%r12), %esi
movq (%r14), %rcx
xorl %eax, %eax
movl $0x1, %edx
testl %esi, %esi
jle 0x2971
decl %r12d
movzbl (%rcx,%r12), %esi
leal -0x30(%rsi), %edi
cmpb $0x9, %dil
ja 0x2a6c
addl $-0x30, %esi
imull %edx, %esi
addl %esi, %eax
movl %eax, 0xc(%rsp)
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
cmpl $0x1, %r12d
jg 0x2943
xorl %esi, %esi
movzbl (%rcx), %edi
cmpl $0x2d, %edi
je 0x29b3
cmpl $0x2b, %edi
jne 0x29b9
movb $0x0, 0x18(%rbx)
jmp 0x29de
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
cmpq %rsi, %rax
je 0x2997
movq %rax, 0x8(%rbx)
movq %rax, %rsi
movl $0x0, 0x14(%rsp)
cmpq 0x10(%rbx), %rsi
jne 0x2a43
leaq 0x14(%rsp), %rdx
jmp 0x2a58
movb $0x1, 0x18(%rbx)
jmp 0x29de
addb $-0x30, %dil
cmpb $0x9, %dil
ja 0x2a6c
movb $0x0, 0x18(%rbx)
movslq %esi, %rsi
movsbl (%rcx,%rsi), %ecx
addl $-0x30, %ecx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, 0xc(%rsp)
movq 0x8(%rbx), %rsi
testl %eax, %eax
je 0x2a09
cmpq 0x10(%rbx), %rsi
je 0x29f8
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x2a09
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
callq 0x57fa
movq 0x8(%rbx), %rsi
movq (%rbx), %rax
cmpq %rsi, %rax
je 0x2a31
addq $-0x4, %rsi
cmpl $0x0, (%rsi)
jne 0x2a60
movq %rsi, 0x8(%rbx)
leaq -0x4(%rsi), %rcx
cmpq %rax, %rsi
movq %rcx, %rsi
jne 0x2a15
addq $0x4, %rcx
movq %rcx, %rsi
movb $0x0, 0x18(%rbx)
movl $0x0, 0x10(%rsp)
cmpq 0x10(%rbx), %rsi
je 0x2a53
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x2a60
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x56c6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movl $0x8, %edi
callq 0x2070
leaq 0x62eb(%rip), %rcx      # 0x8d68
movq %rcx, (%rax)
leaq 0x62a1(%rip), %rsi      # 0x8d28
movq 0x6552(%rip), %rdx      # 0x8fe0
movq %rax, %rdi
callq 0x2150