// File: /workspace/github_cpp_makefile_star2_O1/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 0x9599
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 0x3224
movq %r12, %rdi
callq 0x265c
movl %eax, %r12d
movq -0x1c8(%rbp), %rdi
cmpq %r13, %rdi
je 0x8fd7
movq -0x1b8(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r12b, %r12b
je 0x9599
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 0x3224
movq %r15, %rdi
callq 0x2778
movl %eax, %r15d
movq -0x1a8(%rbp), %rdi
cmpq %r12, %rdi
je 0x902b
movq -0x198(%rbp), %rsi
incq %rsi
callq 0x2210
cmpl $0x5, %r15d
ja 0x9599
movl $0x2a, %eax
btl %r15d, %eax
jae 0x9599
leaq -0xd8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x51ac(%rip), %rdx      # 0xe202
leaq -0xe8(%rbp), %rdi
movq %rdx, %rsi
callq 0x32be
leaq -0x78(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x518e(%rip), %rdx      # 0xe202
leaq -0x88(%rbp), %rdi
movq %rdx, %rsi
callq 0x32be
leaq -0xb8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x516d(%rip), %rdx      # 0xe202
leaq -0xc8(%rbp), %rdi
movq %rdx, %rsi
callq 0x32be
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x514c(%rip), %rdx      # 0xe202
leaq -0xa8(%rbp), %rdi
movq %rdx, %rsi
callq 0x32be
leaq -0xf8(%rbp), %rax
movq %rax, -0x10(%rax)
leaq 0x512c(%rip), %rsi      # 0xe203
leaq 0x5129(%rip), %rdx      # 0xe207
leaq -0x108(%rbp), %rdi
callq 0x32be
movl %r15d, %r12d
shlq $0x5, %r12
leaq -0x178(%rbp), %r13
movq %r13, -0x10(%r13)
movq (%rbx,%r12), %rsi
movq 0x8(%rbx,%r12), %rdx
addq %rsi, %rdx
leaq -0x188(%rbp), %rdi
callq 0x3224
leaq -0x188(%rbp), %rdi
callq 0x294d
movl %eax, %r15d
addq %r12, %rbx
testb %al, %al
je 0x915d
leaq -0x118(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
leaq -0x128(%rbp), %rdi
callq 0x3224
leaq -0x128(%rbp), %rdi
callq 0x294d
movl %eax, %r12d
jmp 0x9160
xorl %r12d, %r12d
testb %r15b, %r15b
je 0x9184
leaq -0x118(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9184
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x188(%rbp), %rdi
cmpq %r13, %rdi
je 0x919f
movq -0x178(%rbp), %rsi
incq %rsi
callq 0x2210
testb %r12b, %r12b
je 0x95ab
leaq -0x48(%rbp), %rdi
leaq -0xe8(%rbp), %rsi
movq %rbx, %rdx
callq 0xa216
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
leaq -0x48(%rbp), %rdi
callq 0x20b0
leaq -0x58(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x91f1
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x91f9
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 %r12, %rdi
je 0x9237
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9250
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2210
leaq -0x158(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
addq %rsi, %rdx
leaq -0x168(%rbp), %rdi
callq 0x3224
leaq -0x138(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x108(%rbp), %rsi
movq -0x100(%rbp), %rdx
addq %rsi, %rdx
leaq -0x148(%rbp), %rdi
callq 0x3224
leaq -0x68(%rbp), %rdi
leaq -0x168(%rbp), %rsi
leaq -0x148(%rbp), %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x4798
leaq -0x88(%rbp), %rdi
leaq -0x68(%rbp), %r14
movq %r14, %rsi
callq 0x2270
movq (%r14), %rdi
cmpq %r12, %rdi
je 0x92e4
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x92ff
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x168(%rbp), %rdi
cmpq %r13, %rdi
leaq -0x38(%rbp), %r15
je 0x931e
movq -0x158(%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 0x3224
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 %r12, -0x68(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x939d
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x93a5
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 %r12, %rdi
je 0x93e3
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x93f8
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 0x3224
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 %r12, -0x68(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x9478
movq %rdx, -0x68(%rbp)
movq (%rcx), %rdx
movq %rdx, -0x58(%rbp)
jmp 0x9480
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 %r12, %rdi
je 0x94be
movq -0x58(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
je 0x94d3
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 0x9517
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x9539
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x955b
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x9577
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x9599
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 0x8a1e(%rip), %rdi      # 0x11fd0
leaq 0x4c41(%rip), %rsi      # 0xe1fa
callq 0x21f0
xorl %edi, %edi
callq 0x2260
movq %rax, %rbx
movq -0x128(%rbp), %rdi
leaq -0x118(%rbp), %rax
cmpq %rax, %rdi
je 0x96c1
movq -0x118(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x96c1
jmp 0x95fe
jmp 0x95fe
jmp 0x96fd
jmp 0x95fe
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r15, %rdi
jne 0x966c
jmp 0x9700
jmp 0x96fd
movq %rax, %rbx
movq -0x148(%rbp), %rdi
cmpq %r15, %rdi
je 0x9637
movq -0x138(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x9637
movq %rax, %rbx
movq -0x168(%rbp), %rdi
cmpq %r13, %rdi
je 0x9700
movq -0x158(%rbp), %rsi
jmp 0x96d4
jmp 0x96fd
movq %rax, %rbx
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9700
movq -0x38(%rbp), %rsi
jmp 0x96d4
jmp 0x96fd
movq %rax, %rbx
jmp 0x9722
movq %rax, %rbx
jmp 0x9744
movq %rax, %rbx
jmp 0x9766
movq %rax, %rbx
jmp 0x9782
movq %rax, %rbx
jmp 0x97a4
movq %rax, %rbx
movq -0x1a8(%rbp), %rdi
cmpq %r12, %rdi
je 0x97a4
movq -0x198(%rbp), %rsi
jmp 0x979c
movq %rax, %rbx
movq -0x188(%rbp), %rdi
cmpq %r13, %rdi
je 0x9700
movq -0x178(%rbp), %rsi
incq %rsi
callq 0x2210
jmp 0x9700
movq %rax, %rbx
movq -0x1c8(%rbp), %rdi
cmpq %r13, %rdi
je 0x97a4
movq -0x1b8(%rbp), %rsi
jmp 0x979c
movq %rax, %rbx
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x9722
movq -0xf8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x9744
movq -0x98(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x9766
movq -0xb8(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x9782
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x2210
movq -0xe8(%rbp), %rdi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rdi
je 0x97a4
movq -0xd8(%rbp), %rsi
incq %rsi
callq 0x2210
movq %rbx, %rdi
callq 0x2320