// File: /workspace/github_cpp_makefile_star2_O2/sthapliyal37[P]Microprocessor_8085_Updated/Logical.cpp
// Function: CMP(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 CMP(string instruction,string registers[],bool flag[],map<string,string>& memory)
{
	int l1=instruction.length();
	if(l1==1)
	{
		if(instruction=="M")
		{
		    string address=registers[5]+registers[6];
			if(registers[0]<memory[address])
			{
			    flag[0]=true;
			}
			else if(registers[0]==memory[address])
			{
				flag[6]=true;
			}
			else
			{
				flag[0]=false;
				flag[6]=false;
			}
		}
		else if(validityRegisters(instruction))
		{
			int index=registerNumber(instruction);
    		if(registers[0]<registers[index])
    		{
				flag[0]=true;
			}
			else if(registers[0]==registers[index])
			{
				flag[6]=true;
			}
			else
			{
			    flag[0]=false;
				flag[6]=false;
			}
		}
		else{
			
			cout<<"Error: "<<instruction<<"\nInvalid registers\nThe program will quit\n";
			exit(0);
		}
	}


}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
cmpl $0x1, 0x8(%rdi)
jne 0x78d4
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x2834(%rip), %rsi      # 0xa010
callq 0x2f0d
testb %al, %al
je 0x7821
leaq 0xa0(%r14), %rsi
leaq 0xc0(%r14), %rdx
leaq -0x40(%rbp), %r15
movq %r15, %rdi
callq 0x71f4
movq %r12, %rdi
movq %r15, %rsi
callq 0x724c
movq %r14, %rdi
movq %rax, %rsi
callq 0x7444
testb %al, %al
je 0x788e
movb $0x1, (%rbx)
jmp 0x78cb
leaq -0x80(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x2280
movq %r12, %rdi
callq 0x262c
movl %eax, %r12d
leaq -0x80(%rbp), %rdi
callq 0x20f0
testb %r12b, %r12b
je 0x78ea
leaq -0x60(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x2280
movq %r12, %rdi
callq 0x2740
movl %eax, %r15d
leaq -0x60(%rbp), %rdi
callq 0x20f0
movslq %r15d, %r15
shlq $0x5, %r15
addq %r14, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x7444
testb %al, %al
je 0x78af
movb $0x1, (%rbx)
jmp 0x78d4
leaq -0x40(%rbp), %rsi
movq %r12, %rdi
callq 0x724c
movq %r14, %rdi
movq %rax, %rsi
callq 0x7a4a
testb %al, %al
je 0x78c4
movb $0x1, 0x6(%rbx)
jmp 0x78cb
movq %r14, %rdi
movq %r15, %rsi
callq 0x7a4a
testb %al, %al
je 0x78e1
movb $0x1, 0x6(%rbx)
jmp 0x78d4
xorl %eax, %eax
movb %al, (%rbx)
movb %al, 0x6(%rbx)
leaq -0x40(%rbp), %rdi
callq 0x20f0
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
movb %al, (%rbx)
movb %al, 0x6(%rbx)
jmp 0x78d4
movq 0x66df(%rip), %rdi      # 0xdfd0
leaq 0x2911(%rip), %rsi      # 0xa209
callq 0x21e0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21d0
leaq 0x2902(%rip), %rsi      # 0xa211
movq %rax, %rdi
callq 0x21e0
xorl %edi, %edi
callq 0x2240
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
jmp 0x7937
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
jmp 0x7937
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2310