// File: /workspace/github_cpp_makefile_star2_O2/sthapliyal37[P]Microprocessor_8085_Updated/arithmetic.cpp
// Function: DCX(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*)
void DCX(string instruction,string* registers,bool* flag)
{
	int length = instruction.length();
	if(length == 1){
	
		if(validityRegisters(instruction)){
			
			int registerID = registerNumber(instruction);
			if(registerID == 1 || registerID == 3 || registerID == 5){
			
				string data16bit = "";
				string temporary = "";
				string s1 = "";
				string s2 = "";
				string x="5000";
				if(validityData(registers[registerID]) == true && validityData(registers[registerID+1]) == true){
					
					data16bit = data16bit + registers[registerID] + registers[registerID + 1];
					temporary = hexSub16bit(data16bit,x,flag,false);
					 s1 = s1 + temporary[0] + temporary[1];		
					 s2 = s2 +temporary[2] + temporary[3];
					registers[registerID] = s1;
					registers[registerID+1] = s2;
				}
				else{
					cout<<"Error: \n";
					exit(0);
				}
			}
			}}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
cmpl $0x1, 0x8(%rdi)
jne 0x6a7e
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
leaq -0x1c8(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x2280
movq %r12, %rdi
callq 0x262c
movl %eax, %r12d
leaq -0x1c8(%rbp), %rdi
callq 0x20f0
testb %r12b, %r12b
je 0x6a7e
leaq -0x1a8(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x2280
movq %r12, %rdi
callq 0x2740
movl %eax, %r15d
leaq -0x1a8(%rbp), %rdi
callq 0x20f0
cmpl $0x5, %r15d
ja 0x6a7e
pushq $0x2a
popq %rax
btl %r15d, %eax
jae 0x6a7e
leaq 0x3a2a(%rip), %rsi      # 0xa202
leaq -0x128(%rbp), %rdi
leaq -0x88(%rbp), %rdx
callq 0x2f1e
leaq 0x3a10(%rip), %rsi      # 0xa202
leaq -0x88(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
callq 0x2f1e
leaq 0x39f6(%rip), %rsi      # 0xa202
leaq -0xc8(%rbp), %rdi
leaq -0xa8(%rbp), %rdx
callq 0x2f1e
leaq 0x39dc(%rip), %rsi      # 0xa202
leaq -0xa8(%rbp), %rdi
leaq -0x108(%rbp), %rdx
callq 0x2f1e
leaq 0x39c3(%rip), %rsi      # 0xa203
leaq -0x108(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x2f1e
movl %r15d, %eax
shlq $0x5, %rax
addq %rax, %rbx
leaq -0xe8(%rbp), %rdi
movq %rbx, %rsi
callq 0x2280
leaq -0xe8(%rbp), %rdi
callq 0x28cb
testb %al, %al
je 0x6a90
leaq 0x20(%rbx), %r15
leaq -0x188(%rbp), %rdi
movq %r15, %rsi
callq 0x2280
leaq -0x188(%rbp), %rdi
callq 0x28cb
movl %eax, %r12d
leaq -0x188(%rbp), %rdi
callq 0x20f0
leaq -0xe8(%rbp), %rdi
callq 0x20f0
testb %r12b, %r12b
je 0x6a9c
leaq -0x48(%rbp), %rdi
leaq -0x128(%rbp), %rsi
movq %rbx, %rdx
callq 0x71f4
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movq %r15, %rdx
callq 0x71cb
leaq -0x128(%rbp), %r12
leaq -0x68(%rbp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0x2250
movq %r13, %rdi
callq 0x20f0
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0x168(%rbp), %rdi
movq %r12, %rsi
callq 0x2280
leaq -0x148(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x2280
leaq -0x68(%rbp), %rdi
leaq -0x168(%rbp), %rsi
leaq -0x148(%rbp), %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x3d39
leaq -0x88(%rbp), %r14
leaq -0x68(%rbp), %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x2250
movq %r12, %rdi
callq 0x20f0
leaq -0x148(%rbp), %rdi
callq 0x20f0
leaq -0x168(%rbp), %rdi
callq 0x20f0
movq (%r14), %rax
movsbl (%rax), %edx
leaq -0x48(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x401e
movq -0x88(%rbp), %rax
movsbl 0x1(%rax), %edx
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x72b5
leaq -0xc8(%rbp), %rdi
leaq -0x68(%rbp), %r14
movq %r14, %rsi
callq 0x2250
movq %r14, %rdi
callq 0x20f0
leaq -0x48(%rbp), %rdi
callq 0x20f0
movq -0x88(%rbp), %rax
movsbl 0x2(%rax), %edx
leaq -0x48(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x401e
movq -0x88(%rbp), %rax
movsbl 0x3(%rax), %edx
leaq -0x68(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x72b5
leaq -0xa8(%rbp), %rdi
movq %r14, %rsi
callq 0x2250
movq %r14, %rdi
callq 0x20f0
leaq -0x48(%rbp), %rdi
callq 0x20f0
leaq -0xc8(%rbp), %rsi
movq %rbx, %rdi
callq 0x2120
leaq -0xa8(%rbp), %rsi
movq %r15, %rdi
callq 0x2120
leaq -0x108(%rbp), %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
leaq -0xc8(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq -0x128(%rbp), %rdi
callq 0x20f0
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0xe8(%rbp), %rdi
callq 0x20f0
movq 0x752d(%rip), %rdi      # 0xdfd0
leaq 0x3750(%rip), %rsi      # 0xa1fa
callq 0x21e0
xorl %edi, %edi
callq 0x2240
jmp 0x6ae0
jmp 0x6b3e
jmp 0x6ae0
jmp 0x6b3e
movq %rax, %rbx
leaq -0x148(%rbp), %rdi
callq 0x20f0
jmp 0x6ad5
movq %rax, %rbx
leaq -0x168(%rbp), %rdi
jmp 0x6b2b
jmp 0x6b3e
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
jmp 0x6b2b
jmp 0x6b3e
movq %rax, %rbx
leaq -0x188(%rbp), %rdi
callq 0x20f0
jmp 0x6b24
movq %rax, %rbx
jmp 0x6b4d
movq %rax, %rbx
jmp 0x6b59
movq %rax, %rbx
jmp 0x6b65
movq %rax, %rbx
jmp 0x6b71
movq %rax, %rbx
jmp 0x6b7d
movq %rax, %rbx
leaq -0x1a8(%rbp), %rdi
jmp 0x6b78
movq %rax, %rbx
leaq -0xe8(%rbp), %rdi
callq 0x20f0
jmp 0x6b41
movq %rax, %rbx
leaq -0x1c8(%rbp), %rdi
jmp 0x6b78
movq %rax, %rbx
leaq -0x108(%rbp), %rdi
callq 0x20f0
leaq -0xa8(%rbp), %rdi
callq 0x20f0
leaq -0xc8(%rbp), %rdi
callq 0x20f0
leaq -0x88(%rbp), %rdi
callq 0x20f0
leaq -0x128(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x2310