// File: /workspace/github_cpp_makefile_star2_O3/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
movq %rdx, %r14
movq 0x8(%rdi), %rdx
cmpl $0x1, %edx
jne 0x9531
movq %rsi, %rbx
movq %rdi, %r15
leaq -0x1b8(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rdi), %rsi
addq %rsi, %rdx
leaq -0x1c8(%rbp), %r12
movq %r12, %rdi
callq 0x31ec
movq %r12, %rdi
callq 0x265c
movl %eax, %r12d
movq -0x1c8(%rbp), %rdi
cmpq %r13, %rdi
je 0x8f7a
movq -0x1b8(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r12b, %r12b
je 0x9531
leaq -0x198(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x1a8(%rbp), %r15
movq %r15, %rdi
callq 0x31ec
movq %r15, %rdi
callq 0x2778
movl %eax, %r15d
movq -0x1a8(%rbp), %rdi
cmpq %r12, %rdi
je 0x8fce
movq -0x198(%rbp), %rsi
incq %rsi
callq 0x2210
cmpl $0x5, %r15d
ja 0x9531
movl $0x2a, %eax
btl %r15d, %eax
jae 0x9531
leaq -0xd8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x5209(%rip), %rdx      # 0xe202
leaq -0xe8(%rbp), %rdi
movq %rdx, %rsi
callq 0x328a
leaq -0x78(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x51eb(%rip), %rdx      # 0xe202
leaq -0x88(%rbp), %rdi
movq %rdx, %rsi
callq 0x328a
leaq -0xb8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x51ca(%rip), %rdx      # 0xe202
leaq -0xc8(%rbp), %rdi
movq %rdx, %rsi
callq 0x328a
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x51a9(%rip), %rdx      # 0xe202
leaq -0xa8(%rbp), %rdi
movq %rdx, %rsi
callq 0x328a
leaq -0xf8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x5189(%rip), %rsi      # 0xe203
leaq 0x5186(%rip), %rdx      # 0xe207
leaq -0x108(%rbp), %rdi
callq 0x328a
movl %r15d, %r15d
shlq $0x5, %r15
leaq -0x178(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rbx,%r15), %rsi
movq 0x8(%rbx,%r15), %rdx
addq %rsi, %rdx
leaq -0x188(%rbp), %rdi
callq 0x31ec
leaq -0x188(%rbp), %rdi
callq 0x294d
addq %r15, %rbx
testb %al, %al
je 0x9119
leaq -0x158(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
leaq -0x168(%rbp), %rdi
callq 0x31ec
leaq -0x168(%rbp), %rdi
callq 0x294d
movl %eax, %r15d
movq -0x168(%rbp), %rdi
cmpq %r13, %rdi
je 0x911c
movq -0x158(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x911c
xorl %r15d, %r15d
movq -0x188(%rbp), %rdi
cmpq %r12, %rdi
je 0x9137
movq -0x178(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r15b, %r15b
je 0x9543
leaq -0x48(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
movq %rbx, %rdx
callq 0xa180
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
leaq -0x48(%rbp), %rdi
callq 0x20b0
leaq -0x58(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x9188
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x9190
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x68(%rbp), %r15
movq %rdx, 0x8(%r15)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xe8(%rbp), %rdi
movq %r15, %rsi
callq 0x2270
movq (%r15), %rdi
cmpq %r13, %rdi
je 0x91ce
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x91e7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x138(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x148(%rbp), %rdi
callq 0x31ec
leaq -0x118(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
addq %rsi, %rdx
leaq -0x128(%rbp), %rdi
callq 0x31ec
leaq -0x68(%rbp), %rdi
leaq -0x148(%rbp), %rsi
leaq -0x128(%rbp), %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x4724
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %r14
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x927c
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x128(%rbp), %rdi
cmpq %r15, %rdi
je 0x9297
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x148(%rbp), %rdi
cmpq %r12, %rdi
leaq -0x38(%rbp), %r15
je 0x92b6
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x88(%rbp), %rax
movb (%rax), %r14b
leaq -0x48(%rbp), %rdi
movq %r15, (%rdi)
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
addq %rsi, %rdx
callq 0x31ec
leaq -0x48(%rbp), %rdi
movq 0x8(%rdi), %rsi
movsbl %r14b, %r8d
movl $0x1, %ecx
xorl %edx, %edx
callq 0x2360
movq -0x88(%rbp), %rax
movsbl 0x1(%rax), %r8d
leaq -0x48(%rbp), %rdi
movq 0x8(%rdi), %rsi
movl $0x1, %ecx
xorl %edx, %edx
callq 0x2360
movq %r13, -0x68(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x9335
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x933d
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x68(%rbp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xc8(%rbp), %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x937b
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x9390
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x88(%rbp), %rax
movb 0x2(%rax), %r14b
leaq -0x48(%rbp), %rdi
movq %r15, (%rdi)
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
addq %rsi, %rdx
callq 0x31ec
leaq -0x48(%rbp), %rdi
movq 0x8(%rdi), %rsi
movsbl %r14b, %r8d
movl $0x1, %ecx
xorl %edx, %edx
callq 0x2360
movq -0x88(%rbp), %rax
movsbl 0x3(%rax), %r8d
leaq -0x48(%rbp), %rdi
movq 0x8(%rdi), %rsi
movl $0x1, %ecx
xorl %edx, %edx
callq 0x2360
movq %r13, -0x68(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x9410
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x9418
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq -0x68(%rbp), %r14
movq %rdx, 0x8(%r14)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0xa8(%rbp), %rdi
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x9456
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x946b
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0xc8(%rbp), %rsi
movq %rbx, %rdi
callq 0x2110
addq $0x20, %rbx
leaq -0xa8(%rbp), %rsi
movq %rbx, %rdi
callq 0x2110
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x94af
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x94d1
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x94f3
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x950f
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x9531
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x2210
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8a86(%rip), %rdi      # 0x11fd0
leaq 0x4ca9(%rip), %rsi      # 0xe1fa
callq 0x21f0
xorl %edi, %edi
callq 0x2260
movq %rax, %rbx
movq -0x168(%rbp), %rdi
cmpq %r13, %rdi
je 0x9652
movq -0x158(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x9652
jmp 0x958f
jmp 0x958f
jmp 0x968e
jmp 0x958f
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
jne 0x95fd
jmp 0x9691
jmp 0x968e
movq %rax, %rbx
movq -0x128(%rbp), %rdi
cmpq %r15, %rdi
je 0x95c8
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x95c8
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r12, %rdi
je 0x9691
movq -0x138(%rbp), %rsi
jmp 0x9665
jmp 0x968e
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9691
movq -0x38(%rbp), %rsi
jmp 0x9665
jmp 0x968e
movq %rax, %rbx
jmp 0x96b3
movq %rax, %rbx
jmp 0x96d5
movq %rax, %rbx
jmp 0x96f7
movq %rax, %rbx
jmp 0x9713
movq %rax, %rbx
jmp 0x9735
movq %rax, %rbx
movq -0x1a8(%rbp), %rdi
cmpq %r12, %rdi
je 0x9735
movq -0x198(%rbp), %rsi
jmp 0x972d
movq %rax, %rbx
movq -0x188(%rbp), %rdi
cmpq %r12, %rdi
je 0x9691
movq -0x178(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x9691
movq %rax, %rbx
movq -0x1c8(%rbp), %rdi
cmpq %r13, %rdi
je 0x9735
movq -0x1b8(%rbp), %rsi
jmp 0x972d
movq %rax, %rbx
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x96b3
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x96d5
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x96f7
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x9713
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x9735
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320