// File: /workspace/github_cpp_makefile_star2_O3/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 $0x158, %rsp            # imm = 0x158
movq %rcx, -0x78(%rbp)
movq %rdx, %rax
movq 0x8(%rdi), %rdx
cmpl $0x1, %edx
jne 0x7c31
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 0x78ec
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 0x78ec
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x178(%rbp), %rdi
cmpq %r14, %rdi
je 0x7907
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
movq -0x50(%rbp), %r13
je 0x7c31
leaq 0x66f5(%rip), %rsi      # 0xe010
movq %r12, %rdi
callq 0x20a0
testl %eax, %eax
je 0x7a41
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 0x7977
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 0x4986
leaq -0x48(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x7a0a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x7a25
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x7c31
movq -0xe8(%rbp), %rsi
jmp 0x7c29
leaq -0x38(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x67b2(%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 0x7aba
movq %rdx, -0x98(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x88(%rbp)
jmp 0x7ac2
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 0x7b05
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x128(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7b24
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x2210
leaq 0x66bd(%rip), %rsi      # 0xe1e8
leaq -0x48(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
js 0x7c1c
leaq 0x66aa(%rip), %rsi      # 0xe1ed
leaq -0x48(%rbp), %rdi
callq 0x20a0
testl %eax, %eax
jg 0x7c1c
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 0x4986
leaq -0x98(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x7be8
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xb8(%rbp), %rdi
cmpq %r12, %rdi
je 0x7c03
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x7c1c
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x7c31
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 0x7c66
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7c66
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0x7ca2
movq -0x60(%rbp), %rsi
jmp 0x7c95
jmp 0x7c9f
movq %rax, %rbx
leaq -0x128(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x7ca2
movq -0x128(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7ca2
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x7d4e
movq -0x38(%rbp), %rsi
jmp 0x7d46
movq %rax, %rbx
jmp 0x7d4e
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0x7ce3
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7ce3
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r15, %rdi
je 0x7d4e
movq -0xe8(%rbp), %rsi
jmp 0x7d46
movq %rax, %rbx
movq -0x158(%rbp), %rdi
cmpq %r14, %rdi
je 0x7d4e
movq -0x148(%rbp), %rsi
jmp 0x7d46
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r15, %rdi
je 0x7d33
movq -0x108(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x7d33
movq %rax, %rbx
movq -0x178(%rbp), %rdi
cmpq %r14, %rdi
je 0x7d4e
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320