// File: /workspace/github_cpp_makefile_star2_O1/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 0xa92e
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x385e(%rip), %rsi      # 0xe010
callq 0x20a0
testl %eax, %eax
je 0xa894
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 0x3224
movq %r12, %rdi
callq 0x265c
movl %eax, %r12d
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xa7fd
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r12b, %r12b
je 0xa93d
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 0x3224
movq %r15, %rdi
callq 0x2778
movl %eax, %r15d
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xa845
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 0xa901
movq 0x8(%r14), %rdx
cmpq 0x8(%r15), %rdx
jne 0xa888
testq %rdx, %rdx
je 0xa90b
movq (%r15), %rsi
movq (%r14), %rdi
callq 0x2220
testl %eax, %eax
je 0xa90b
xorl %eax, %eax
movb %al, (%rbx)
movb %al, 0x6(%rbx)
jmp 0xa92e
leaq 0xa0(%r14), %rsi
leaq 0xc0(%r14), %rdx
leaq -0x88(%rbp), %r15
movq %r15, %rdi
callq 0xa216
movq %r12, %rdi
movq %r15, %rsi
callq 0xa27a
movq %r14, %rdi
movq %rax, %rsi
callq 0x2050
testl %eax, %eax
js 0xa906
leaq -0x88(%rbp), %rsi
movq %r12, %rdi
callq 0xa27a
movq 0x8(%r14), %rdx
cmpq 0x8(%rax), %rdx
jne 0xa8f8
testq %rdx, %rdx
je 0xa911
movq (%rax), %rsi
movq (%r14), %rdi
callq 0x2220
testl %eax, %eax
je 0xa911
xorl %eax, %eax
movb %al, (%rbx)
movb %al, 0x6(%rbx)
jmp 0xa915
movb $0x1, (%rbx)
jmp 0xa92e
movb $0x1, (%rbx)
jmp 0xa915
movb $0x1, 0x6(%rbx)
jmp 0xa92e
movb $0x1, 0x6(%rbx)
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa92e
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 0x768c(%rip), %rdi      # 0x11fd0
leaq 0x38be(%rip), %rsi      # 0xe209
callq 0x21f0
movq %rax, %rdi
movq %r15, %rsi
callq 0x21d0
leaq 0x38af(%rip), %rsi      # 0xe211
movq %rax, %rdi
callq 0x21f0
xorl %edi, %edi
callq 0x2260
jmp 0xa989
movq %rax, %rbx
leaq -0x78(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xa9bb
movq -0x78(%rbp), %rsi
jmp 0xa9b3
movq %rax, %rdi
callq 0xa38b
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0xa9bb
movq -0x38(%rbp), %rsi
jmp 0xa9b3
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r13, %rdi
je 0xa9bb
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320