// File: /workspace/github_cpp_makefile_star2_O3/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 $0xc8, %rsp
cmpl $0x1, 0x8(%rdi)
jne 0xbba4
movq %rsi, %rbx
movl 0x8(%rsi), %eax
cmpl $0x2, %eax
jne 0xbba4
movq %r8, %r13
movq %rcx, %r12
movq %rdx, %r14
movq %rdi, %r15
leaq 0x271e(%rip), %rsi      # 0xe010
callq 0x20a0
testl %eax, %eax
je 0xb985
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %r13
movq %r13, %rdi
callq 0x31ec
movq %r13, %rdi
callq 0x265c
testb %al, %al
je 0xba21
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0x31ec
leaq -0x90(%rbp), %rdi
callq 0x294d
movl %eax, %r13d
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xba24
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0xba24
leaq 0xa0(%r14), %rsi
addq $0xc0, %r14
leaq -0x48(%rbp), %rdi
movq %r14, %rdx
callq 0xa180
leaq -0xc0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xd0(%rbp), %rdi
callq 0x31ec
leaq -0xd0(%rbp), %rdi
callq 0x294d
movl %eax, %r14d
movq -0xd0(%rbp), %rdi
cmpq %r12, %rdi
je 0xb9eb
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r14b, %r14b
je 0xba07
leaq -0x48(%rbp), %rsi
movq %r13, %rdi
callq 0xa1e4
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2110
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbba4
movq -0x38(%rbp), %rsi
jmp 0xbb9c
xorl %r13d, %r13d
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0xba46
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r13b, %r13b
je 0xbba4
leaq 0x260c(%rip), %rsi      # 0xe062
movq %r15, %rdi
callq 0x20a0
testl %eax, %eax
jne 0xba79
leaq 0x2781(%rip), %rsi      # 0xe1ea
movq %rbx, %rdi
callq 0x20a0
testl %eax, %eax
je 0xbb3c
leaq 0x25e2(%rip), %rsi      # 0xe062
movq %r15, %rdi
callq 0x20a0
testl %eax, %eax
jne 0xbb48
leaq 0x2753(%rip), %rsi      # 0xe1ea
movq %rbx, %rdi
callq 0x20a0
testl %eax, %eax
je 0xbb48
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %r13
movq %r13, %rdi
callq 0x31ec
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x31ec
leaq -0x70(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x46ea
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xbb07
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
movl -0x4c(%rbp), %eax
shll $0x4, %eax
addl -0x50(%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 0xbb48
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0xbb48
movb $0x1, %al
movb %al, 0x6(%r12)
movb %al, 0x2(%r12)
leaq -0xe0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xf0(%rbp), %r15
movq %r15, %rdi
callq 0x31ec
movq %r15, %rdi
callq 0x2778
cltq
shlq $0x5, %rax
addq %rax, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2110
movq -0xf0(%rbp), %rdi
cmpq %r12, %rdi
je 0xbba4
movq -0xe0(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rax
cmpq %rax, %rdi
je 0xbbd7
movq -0x60(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0xbbd7
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
jmp 0xbc45
movq %rax, %rbx
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0xbc53
movq -0x80(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0xbc53
movq %rax, %rbx
movq -0xd0(%rbp), %rdi
cmpq %r12, %rdi
je 0xbc3d
movq -0xc0(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0xbc3d
movq %rax, %rbx
movq -0xf0(%rbp), %rdi
cmpq %r12, %rdi
je 0xbc75
movq -0xe0(%rbp), %rsi
jmp 0xbc6d
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0xbc75
movq -0x38(%rbp), %rsi
jmp 0xbc6d
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0xbc75
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320