// File: /workspace/github_cpp_makefile_star2_O1/sthapliyal37[P]Microprocessor_8085_Updated/DataTransfer.cpp
// Function: MVI(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::__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 MVI (string instruction,string instruction2,string* registers,bool* flags,map<string,string> &memory)
{
	int length=instruction.length();
	int length2=instruction2.length();
	//cout<<instruction<<" "<<instruction2<<endl;	
	if(length==1&&length2==2)
	{
	        if(instruction=="M")
	        {
	            string address=registers[5]+registers[6];
	            if(validityData(instruction))
	                memory[address]=instruction2;
	        }

	else if(validityRegisters(instruction)&&validityData(instruction2))
	{
			
			if(instruction == "A" && instruction2 == "00")
			{
				
				flags[6] = true;
				flags[2] = true;
			}
			else if(instruction=="A" && instruction2!="00")
            		{
				string temp = instruction2;
				int array[2];
        		        hexToDecimal(temp,array);
        		        int value=array[1]*16+array[0];
        		        bitset<8> dataInBinary(value);
        		        int parity = dataInBinary.count();
        		        if(parity%2 == 0 && parity!=0)
        		           flags[2] = true;
        		        else
        		           flags[2] = false;
        		}
			registers[registerNumber(instruction)]=instruction2;
	//	cout<<registerNumber(instruction)<<" "<<registers[registerNumber(instruction)]<<endl;		
	}

}
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
cmpl $0x1, 0x8(%rdi)
jne 0xbc5c
movq %rsi, %rbx
movl 0x8(%rsi), %eax
cmpl $0x2, %eax
jne 0xbc5c
movq %r8, %r13
movq %rcx, %r12
movq %rdx, %r14
movq %rdi, %r15
leaq 0x2675(%rip), %rsi      # 0xe010
callq 0x20a0
testl %eax, %eax
je 0xba0b
movq %r12, -0x50(%rbp)
leaq -0x88(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x98(%rbp), %r12
movq %r12, %rdi
callq 0x3224
movq %r12, %rdi
callq 0x265c
movl %eax, %r12d
testb %al, %al
je 0xbaa7
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x78(%rbp), %rdi
callq 0x3224
leaq -0x78(%rbp), %rdi
callq 0x294d
movl %eax, %r13d
jmp 0xbaaa
leaq 0xa0(%r14), %rsi
addq $0xc0, %r14
leaq -0x48(%rbp), %rdi
movq %r14, %rdx
callq 0xa216
leaq -0xc8(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xd8(%rbp), %rdi
callq 0x3224
leaq -0xd8(%rbp), %rdi
callq 0x294d
movl %eax, %r14d
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0xba71
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
je 0xba8d
leaq -0x48(%rbp), %rsi
movq %r13, %rdi
callq 0xa27a
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2110
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbc5c
movq -0x38(%rbp), %rsi
jmp 0xbc54
xorl %r13d, %r13d
testb %r12b, %r12b
je 0xbac8
leaq -0x68(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbac8
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
movq -0x50(%rbp), %r12
je 0xbaee
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0xbc5c
leaq 0x2564(%rip), %rsi      # 0xe062
movq %r15, %rdi
callq 0x20a0
testl %eax, %eax
jne 0xbb21
leaq 0x26d9(%rip), %rsi      # 0xe1ea
movq %rbx, %rdi
callq 0x20a0
testl %eax, %eax
je 0xbbf4
leaq 0x253a(%rip), %rsi      # 0xe062
movq %r15, %rdi
callq 0x20a0
testl %eax, %eax
jne 0xbc00
leaq 0x26ab(%rip), %rsi      # 0xe1ea
movq %rbx, %rdi
callq 0x20a0
testl %eax, %eax
je 0xbc00
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %r12
movq %r12, %rdi
callq 0x3224
leaq -0xa8(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq -0xb8(%rbp), %rdi
callq 0x3224
leaq -0xb8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x475e
movq -0x50(%rbp), %r12
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0xbbbf
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x2210
movl -0x54(%rbp), %eax
shll $0x4, %eax
addl -0x58(%rbp), %eax
testb %al, %al
setp %cl
testb $-0x1, %al
setne %al
andb %cl, %al
movb %al, 0x2(%r12)
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0xbc00
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0xbc00
movb $0x1, %al
movb %al, 0x6(%r12)
movb %al, 0x2(%r12)
leaq -0xe8(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xf8(%rbp), %r15
movq %r15, %rdi
callq 0x3224
movq %r15, %rdi
callq 0x2778
cltq
shlq $0x5, %rax
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2110
movq -0xf8(%rbp), %rdi
cmpq %r12, %rdi
je 0xbc5c
movq -0xe8(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r13, %rdi
je 0xbc91
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0xbc91
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
jmp 0xbcfc
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0xbd0a
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0xbd0a
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r12, %rdi
je 0xbcf4
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0xbcf4
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
cmpq %r12, %rdi
je 0xbd2c
movq -0xe8(%rbp), %rsi
jmp 0xbd24
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbd2c
movq -0x38(%rbp), %rsi
jmp 0xbd24
movq %rax, %rbx
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0xbd2c
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320