// File: /workspace/github_cpp_makefile_star2_O1/sthapliyal37[P]Microprocessor_8085_Updated/arithmetic.cpp
// Function: ADD(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>&)
void ADD(string instruction,string* registers,bool* flag,map<string,string> &memory)
{
	int length=instruction.length();
	if(length == 1){
		
		if(validityRegisters(instruction) || validityRegisterPair(instruction)){
			
			if(instruction != "M"){
				int registerID = registerNumber(instruction);
				registers[0] = hexAdd(registers[registerID],registers[0],flag,true);
				
			}
			else{                         
		
				string address = "";
				address = address + registers[5] + registers[6];
				if(address >= "0000" && address <= "FFFF"){
					registers[0] = hexAdd(memory[address],registers[0],flag,true);				 
				}						
			}
			
			}
			}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdx, -0x50(%rbp)
movq 0x8(%rdi), %rdx
cmpl $0x1, %edx
jne 0x75d9
movq %rdi, %r12
movq %rsi, %rbx
movq %rcx, %r15
leaq -0xc0(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%rdi), %rsi
addq %rsi, %rdx
leaq -0xd0(%rbp), %r14
movq %r14, %rdi
callq 0x3224
movq %r14, %rdi
callq 0x265c
movl %eax, %r14d
movb $0x1, %r13b
testb %al, %al
jne 0x7282
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %rdi
callq 0x3224
leaq -0xb0(%rbp), %rdi
callq 0x270f
movl %eax, %r13d
testb %r14b, %r14b
jne 0x72a6
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x72a6
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x72c8
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0x75d9
leaq 0x6d38(%rip), %rsi      # 0xe010
movq %r12, %rdi
callq 0x20a0
testl %eax, %eax
je 0x73ff
leaq -0x160(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0x170(%rbp), %r14
movq %r14, %rdi
callq 0x3224
movq %r14, %rdi
callq 0x2778
movl %eax, %r14d
movq -0x170(%rbp), %rdi
cmpq %r15, %rdi
je 0x7334
movq -0x160(%rbp), %rsi
incq %rsi
callq 0x2210
movslq %r14d, %rax
shlq $0x5, %rax
leaq -0x120(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rbx,%rax), %rsi
movq 0x8(%rbx,%rax), %rdx
addq %rsi, %rdx
leaq -0x130(%rbp), %rdi
callq 0x3224
leaq -0x100(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x110(%rbp), %rdi
callq 0x3224
leaq -0x48(%rbp), %rdi
leaq -0x130(%rbp), %rsi
leaq -0x110(%rbp), %rdx
movq -0x50(%rbp), %rcx
movl $0x1, %r8d
callq 0x44ff
leaq -0x48(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x73c8
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x110(%rbp), %rdi
cmpq %r12, %rdi
je 0x73e3
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x130(%rbp), %rdi
cmpq %r15, %rdi
je 0x75d9
movq -0x120(%rbp), %rsi
jmp 0x75d1
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x6df3(%rip), %rdx      # 0xe202
leaq -0x48(%rbp), %rdi
movq %rdx, %rsi
callq 0x32be
leaq 0xa0(%rbx), %rdx
leaq -0x150(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xa216
movq 0xc0(%rbx), %rsi
movq 0xc8(%rbx), %rdx
leaq -0x150(%rbp), %rdi
callq 0x20b0
leaq -0x80(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7473
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x747b
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x90(%rbp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x74b9
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x74d8
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x2210
leaq 0x6d09(%rip), %rsi      # 0xe1e8
leaq -0x48(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
js 0x75c4
leaq 0x6cf6(%rip), %rsi      # 0xe1ed
leaq -0x48(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
jg 0x75c4
leaq -0x48(%rbp), %rsi
movq %r15, %rdi
callq 0xa27a
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x3224
leaq -0xe0(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xf0(%rbp), %rdi
callq 0x3224
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0xf0(%rbp), %rdx
movq -0x50(%rbp), %rcx
movl $0x1, %r8d
callq 0x44ff
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x7590
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xf0(%rbp), %rdi
cmpq %r15, %rdi
je 0x75ab
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x75c4
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x75d9
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0xf0(%rbp), %rdi
cmpq %r15, %rdi
je 0x760e
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x760e
movq %rax, %r14
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x764a
movq -0x60(%rbp), %rsi
jmp 0x763d
jmp 0x7647
movq %rax, %r14
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x764a
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x764a
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x7704
movq -0x38(%rbp), %rsi
jmp 0x76fc
movq %rax, %r14
jmp 0x7704
movq %rax, %r14
movq -0x110(%rbp), %rdi
cmpq %r12, %rdi
je 0x768b
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x768b
movq %rax, %r14
movq -0x130(%rbp), %rdi
cmpq %r15, %rdi
je 0x7704
movq -0x120(%rbp), %rsi
jmp 0x76fc
movq %rax, %r14
movq -0x170(%rbp), %rdi
cmpq %r15, %rdi
je 0x7704
movq -0x160(%rbp), %rsi
jmp 0x76fc
movq %rax, %r14
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x76e2
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x76e2
movq %rax, %r14
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x7704
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2210
movq %r14, %rdi
callq 0x2320