// File: /workspace/github_cpp_makefile_star2_O1/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), %rax
movq 0x8(%rdi), %rcx
cmpq %rcx, %rax
je 0x28d6
movq 0x8(%rbx), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
addq %rsi, %rax
cmpq %rax, %rdx
je 0x28d6
movq %rax, 0x8(%rbx)
leaq 0xc(%rsp), %rax
movl $0x0, (%rax)
movq 0x8(%r14), %r13
movl %r13d, %r15d
leal 0x7ffffff7(%r13), %ebp
movq %r15, %rcx
addq $-0x9, %r15
testl %r15d, %r15d
jle 0x2a00
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl $0x0, 0xc(%rsp)
movq (%r14), %rax
movl %r15d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movb 0x8(%rax,%rcx), %sil
leal -0x30(%rsi), %edx
xorl %ecx, %ecx
movl $0x0, %r12d
cmpb $0x9, %dl
ja 0x2976
addq %rbp, %rax
movl $0x8, %r8d
movl $0x1, %edx
movl $0x8, %edi
movl %ecx, %r9d
movzbl %sil, %ecx
addl $-0x30, %ecx
imull %edx, %ecx
addl %r9d, %ecx
movl %ecx, 0xc(%rsp)
subq $0x1, %rdi
setb %r12b
jb 0x29c1
addl %edx, %edx
leal (%rdx,%rdx,4), %edx
movb -0x1(%rax,%r8), %sil
leal -0x30(%rsi), %r9d
movq %rdi, %r8
cmpb $0x9, %r9b
jbe 0x2941
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
cmpq %rcx, %rax
je 0x2998
movq 0x8(%rbx), %rdx
movq %rdx, %rsi
subq %rcx, %rsi
addq %rsi, %rax
cmpq %rax, %rdx
je 0x2998
movq %rax, 0x8(%rbx)
movl $0x0, 0x14(%rsp)
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x29b2
movl $0x0, (%rsi)
jmp 0x29d1
movq %rbx, %rdi
leaq 0x14(%rsp), %rdx
callq 0x57c4
jmp 0x29d9
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x29f1
movl 0xc(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
addl $-0x9, %r13d
addl $0x7ffffff7, %ebp       # imm = 0x7FFFFFF7
testb %r12b, %r12b
jne 0x28ef
jmp 0x2b2f
movq %rbx, %rdi
leaq 0xc(%rsp), %rdx
callq 0x58f8
jmp 0x29d9
movl $0x0, 0xc(%rsp)
decl %ecx
testl %ecx, %ecx
jle 0x2a4a
movl 0xc(%rsp), %ecx
movq (%r14), %rdx
movl $0x1, %eax
decl %r13d
movzbl (%rdx,%r13), %esi
leal -0x30(%rsi), %edi
cmpb $0x9, %dil
ja 0x2b3e
addl $-0x30, %esi
imull %eax, %esi
addl %esi, %ecx
movl %ecx, 0xc(%rsp)
addl %eax, %eax
leal (%rax,%rax,4), %eax
cmpl $0x1, %r13d
jg 0x2a1a
xorl %ecx, %ecx
jmp 0x2a4f
movl $0x1, %eax
movq (%r14), %rdx
movzbl (%rdx), %esi
cmpl $0x2d, %esi
je 0x2a65
cmpl $0x2b, %esi
jne 0x2a6b
movb $0x0, 0x18(%rbx)
jmp 0x2a8e
movb $0x1, 0x18(%rbx)
jmp 0x2a8e
addb $-0x30, %sil
cmpb $0x9, %sil
ja 0x2b3e
movb $0x0, 0x18(%rbx)
movslq %ecx, %rcx
movsbl (%rdx,%rcx), %ecx
addl $-0x30, %ecx
imull %eax, %ecx
addl %ecx, 0xc(%rsp)
movl 0xc(%rsp), %eax
testl %eax, %eax
je 0x2ab9
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x2aac
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x2ab9
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
callq 0x58f8
movq 0x8(%rbx), %rsi
cmpq %rsi, (%rbx)
sete %al
je 0x2b00
cmpl $0x0, -0x4(%rsi)
jne 0x2af6
movq (%rbx), %rcx
movq 0x8(%rbx), %rsi
addq $-0x4, %rsi
cmpq %rcx, %rsi
sete %al
je 0x2afc
leaq -0x4(%rsi), %rdx
cmpl $0x0, -0x4(%rsi)
movq %rdx, %rsi
je 0x2ad6
addq $0x4, %rdx
movq %rdx, 0x8(%rbx)
movq %rdx, %rsi
testb %al, %al
jne 0x2b00
jmp 0x2b2f
movq %rsi, 0x8(%rbx)
movb $0x0, 0x18(%rbx)
movl $0x0, 0x10(%rsp)
cmpq 0x10(%rbx), %rsi
je 0x2b22
movl $0x0, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x2b2f
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x57c4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x2070
leaq 0x6219(%rip), %rcx      # 0x8d68
movq %rcx, (%rax)
leaq 0x61cf(%rip), %rsi      # 0x8d28
movq 0x6480(%rip), %rdx      # 0x8fe0
movq %rax, %rdi
callq 0x2150