// File: /workspace/github_cpp_makefile_star2_O3/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 %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpl $0x1, 0x8(%rdi)
jne 0xa88e
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x38fe(%rip), %rsi      # 0xe010
callq 0x20a0
testl %eax, %eax
je 0xa7f4
leaq -0x58(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %r12
movq %r12, %rdi
callq 0x31ec
movq %r12, %rdi
callq 0x265c
movl %eax, %r12d
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xa75d
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r12b, %r12b
je 0xa89d
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x31ec
movq %r15, %rdi
callq 0x2778
movl %eax, %r15d
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xa7a5
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movslq %r15d, %r15
shlq $0x5, %r15
addq %r14, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2050
testl %eax, %eax
js 0xa861
movq 0x8(%r14), %rdx
cmpq 0x8(%r15), %rdx
jne 0xa7e8
testq %rdx, %rdx
je 0xa86b
movq (%r15), %rsi
movq (%r14), %rdi
callq 0x2220
testl %eax, %eax
je 0xa86b
xorl %eax, %eax
movb %al, (%rbx)
movb %al, 0x6(%rbx)
jmp 0xa88e
leaq 0xa0(%r14), %rsi
leaq 0xc0(%r14), %rdx
leaq -0x88(%rbp), %r15
movq %r15, %rdi
callq 0xa180
movq %r12, %rdi
movq %r15, %rsi
callq 0xa1e4
movq %r14, %rdi
movq %rax, %rsi
callq 0x2050
testl %eax, %eax
js 0xa866
leaq -0x88(%rbp), %rsi
movq %r12, %rdi
callq 0xa1e4
movq 0x8(%r14), %rdx
cmpq 0x8(%rax), %rdx
jne 0xa858
testq %rdx, %rdx
je 0xa871
movq (%rax), %rsi
movq (%r14), %rdi
callq 0x2220
testl %eax, %eax
je 0xa871
xorl %eax, %eax
movb %al, (%rbx)
movb %al, 0x6(%rbx)
jmp 0xa875
movb $0x1, (%rbx)
jmp 0xa88e
movb $0x1, (%rbx)
jmp 0xa875
movb $0x1, 0x6(%rbx)
jmp 0xa88e
movb $0x1, 0x6(%rbx)
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa88e
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x772c(%rip), %rdi      # 0x11fd0
leaq 0x395e(%rip), %rsi      # 0xe209
callq 0x21f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21d0
leaq 0x394f(%rip), %rsi      # 0xe211
movq %rax, %rdi
callq 0x21f0
xorl %edi, %edi
callq 0x2260
jmp 0xa8e9
movq %rax, %rbx
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa91b
movq -0x78(%rbp), %rsi
jmp 0xa913
movq %rax, %rdi
callq 0xa2f5
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xa91b
movq -0x38(%rbp), %rsi
jmp 0xa913
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xa91b
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320