// File: /workspace/github_cpp_makefile_star2_O1/sthapliyal37[P]Microprocessor_8085_Updated/arithmetic.cpp
// Function: SUB(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 SUB(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] = hexSub(registers[registerID],registers[0],flag,true);
				
			}
			else{                         
				string address = "";
				address = address + registers[5] + registers[6];
				if(address >= "0000" && address <= "FFFF"){
					registers[0] = hexSub(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 0x7c77
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 0x7920
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 0x7944
leaq -0xa0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7944
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x7966
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0x7c77
leaq 0x669a(%rip), %rsi      # 0xe010
movq %r12, %rdi
callq 0x20a0
testl %eax, %eax
je 0x7a9d
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 0x79d2
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 0x49e6
leaq -0x48(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x7a66
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x110(%rbp), %rdi
cmpq %r12, %rdi
je 0x7a81
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x130(%rbp), %rdi
cmpq %r15, %rdi
je 0x7c77
movq -0x120(%rbp), %rsi
jmp 0x7c6f
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x6755(%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 0x7b11
movq %rdx, -0x90(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x80(%rbp)
jmp 0x7b19
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 0x7b57
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7b76
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x2210
leaq 0x666b(%rip), %rsi      # 0xe1e8
leaq -0x48(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
js 0x7c62
leaq 0x6658(%rip), %rsi      # 0xe1ed
leaq -0x48(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
jg 0x7c62
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 0x49e6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x7c2e
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xf0(%rbp), %rdi
cmpq %r15, %rdi
je 0x7c49
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x7c62
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x7c77
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 0x7cac
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7cac
movq %rax, %r14
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x7ce8
movq -0x60(%rbp), %rsi
jmp 0x7cdb
jmp 0x7ce5
movq %rax, %r14
leaq -0x140(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7ce8
movq -0x140(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7ce8
movq %rax, %r14
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x7da2
movq -0x38(%rbp), %rsi
jmp 0x7d9a
movq %rax, %r14
jmp 0x7da2
movq %rax, %r14
movq -0x110(%rbp), %rdi
cmpq %r12, %rdi
je 0x7d29
movq -0x100(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7d29
movq %rax, %r14
movq -0x130(%rbp), %rdi
cmpq %r15, %rdi
je 0x7da2
movq -0x120(%rbp), %rsi
jmp 0x7d9a
movq %rax, %r14
movq -0x170(%rbp), %rdi
cmpq %r15, %rdi
je 0x7da2
movq -0x160(%rbp), %rsi
jmp 0x7d9a
movq %rax, %r14
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x7d80
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7d80
movq %rax, %r14
movq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rax
cmpq %rax, %rdi
je 0x7da2
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2210
movq %r14, %rdi
callq 0x2320