// File: /workspace/github_cpp_makefile_star2_O3/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 $0x158, %rsp            # imm = 0x158
movq %rcx, -0x78(%rbp)
movq %rdx, %rax
movq 0x8(%rdi), %rdx
cmpl $0x1, %edx
jne 0x7597
movq %rsi, %rbx
movq %rdi, %r12
movq %rax, -0x50(%rbp)
leaq -0x168(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%rdi), %rsi
addq %rsi, %rdx
leaq -0x178(%rbp), %r13
movq %r13, %rdi
callq 0x31ec
movq %r13, %rdi
callq 0x265c
movb $0x1, %r13b
testb %al, %al
jne 0x7252
leaq -0x108(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0x118(%rbp), %rdi
callq 0x31ec
leaq -0x118(%rbp), %rdi
callq 0x270f
movl %eax, %r13d
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x7252
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x178(%rbp), %rdi
cmpq %r14, %rdi
je 0x726d
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
movq -0x50(%rbp), %r13
je 0x7597
leaq 0x6d8f(%rip), %rsi      # 0xe010
movq %r12, %rdi
callq 0x20a0
testl %eax, %eax
je 0x73a7
leaq -0x148(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0x158(%rbp), %r15
movq %r15, %rdi
callq 0x31ec
movq %r15, %rdi
callq 0x2778
movl %eax, %r15d
movq -0x158(%rbp), %rdi
cmpq %r14, %rdi
je 0x72dd
movq -0x148(%rbp), %rsi
incq %rsi
callq 0x2210
movslq %r15d, %rax
shlq $0x5, %rax
leaq -0xe8(%rbp), %r15
movq %r15, -0x10(%r15)
movq (%rbx,%rax), %rsi
movq 0x8(%rbx,%rax), %rdx
addq %rsi, %rdx
leaq -0xf8(%rbp), %rdi
callq 0x31ec
leaq -0xc8(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x31ec
leaq -0x48(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
leaq -0xd8(%rbp), %rdx
movq %r13, %rcx
movl $0x1, %r8d
callq 0x448f
leaq -0x48(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x7370
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x738b
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x7597
movq -0xe8(%rbp), %rsi
jmp 0x758f
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x6e4c(%rip), %rdx      # 0xe202
leaq -0x48(%rbp), %rdi
movq %rdx, %rsi
callq 0x328a
leaq 0xa0(%rbx), %rdx
leaq -0x138(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0xa180
movq 0xc0(%rbx), %rsi
movq 0xc8(%rbx), %rdx
leaq -0x138(%rbp), %rdi
callq 0x20b0
leaq -0x88(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x7420
movq %rdx, -0x98(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x88(%rbp)
jmp 0x7428
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x98(%rbp), %r12
movq %rdx, 0x8(%r12)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x48(%rbp), %rdi
movq %r12, %rsi
callq 0x2270
movq (%r12), %rdi
cmpq %r13, %rdi
je 0x746b
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x128(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x748a
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x2210
leaq 0x6d57(%rip), %rsi      # 0xe1e8
leaq -0x48(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
js 0x7582
leaq 0x6d44(%rip), %rsi      # 0xe1ed
leaq -0x48(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
jg 0x7582
leaq -0x48(%rbp), %rsi
movq -0x78(%rbp), %rdi
callq 0xa1e4
leaq -0x60(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x31ec
leaq -0xa8(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %rdi
callq 0x31ec
leaq -0x98(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
movq -0x50(%rbp), %rcx
movl $0x1, %r8d
callq 0x448f
leaq -0x98(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x754e
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xb8(%rbp), %rdi
cmpq %r12, %rdi
je 0x7569
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x7582
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x7597
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r12, %rdi
je 0x75cc
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x75cc
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x7608
movq -0x60(%rbp), %rsi
jmp 0x75fb
jmp 0x7605
movq %rax, %rbx
leaq -0x128(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7608
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7608
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x76b4
movq -0x38(%rbp), %rsi
jmp 0x76ac
movq %rax, %rbx
jmp 0x76b4
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x7649
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7649
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x76b4
movq -0xe8(%rbp), %rsi
jmp 0x76ac
movq %rax, %rbx
movq -0x158(%rbp), %rdi
cmpq %r14, %rdi
je 0x76b4
movq -0x148(%rbp), %rsi
jmp 0x76ac
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x7699
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7699
movq %rax, %rbx
movq -0x178(%rbp), %rdi
cmpq %r14, %rdi
je 0x76b4
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320