// File: sthapliyal37[P]Microprocessor_8085_Updated/Branch.cpp
// Function: JZ(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*)
string JZ(string instruction, string pc, string* registers,bool* flag){

	if(flag[6] == true)
		return instruction;
	else{
		string resultant = "";
		int value16bit[4];
		int returnValue[] = {0,0,0,3};
		int carry = 0;
		hexToDecimal(pc,value16bit);	  
		for(int i = 3;i>=0;i--){
					
			int value = value16bit[i] + returnValue[i] + carry;
			carry = value / 16;
			value = value % 16;
			if(value>=0 && value<=9)
				resultant = (char)('0' + value) + resultant;
			else{
				resultant = (char)('A'+(value-10)) + resultant;
			}
		}
		if(validityAddress(resultant))
			return resultant;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdx, -0x118(%rbp)
movq %rsi, -0x110(%rbp)
movq %rdi, -0x108(%rbp)
movq %rdi, %rax
movq %rax, -0x100(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x28(%rbp), %rax
movb 0x6(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x108c7
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdi
callq 0x3170
jmp 0x10b44
movb $0x0, -0x29(%rbp)
leaq -0x2a(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x3440
movq -0x108(%rbp), %rdi
movq -0x120(%rbp), %rdx
leaq 0x4912(%rip), %rsi      # 0x15202
callq 0x50d0
jmp 0x108f7
leaq -0x2a(%rbp), %rdi
callq 0x32f0
movq -0x118(%rbp), %rsi
movaps 0x4932(%rip), %xmm0     # 0x15240
movaps %xmm0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3110
jmp 0x10927
leaq -0x88(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7a50
jmp 0x10939
leaq -0x88(%rbp), %rdi
callq 0x3190
movl $0x3, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
jl 0x10a9d
movslq -0x8c(%rbp), %rax
movl -0x50(%rbp,%rax,4), %eax
movslq -0x8c(%rbp), %rcx
addl -0x60(%rbp,%rcx,4), %eax
addl -0x64(%rbp), %eax
movl %eax, -0x90(%rbp)
movl -0x90(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %eax, -0x64(%rbp)
movl -0x90(%rbp), %eax
movl $0x10, %ecx
cltd
idivl %ecx
movl %edx, -0x90(%rbp)
cmpl $0x0, -0x90(%rbp)
jl 0x10a47
cmpl $0x9, -0x90(%rbp)
jg 0x10a47
movq -0x108(%rbp), %rdx
movl -0x90(%rbp), %eax
addl $0x30, %eax
movsbl %al, %esi
leaq -0xb0(%rbp), %rdi
callq 0x84f0
jmp 0x109db
movq -0x108(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3330
leaq -0xb0(%rbp), %rdi
callq 0x3190
jmp 0x10a87
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2a(%rbp), %rdi
callq 0x32f0
jmp 0x10b54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x10b34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3190
jmp 0x10b34
movq -0x108(%rbp), %rdx
movl -0x90(%rbp), %eax
addl $0x37, %eax
movsbl %al, %esi
leaq -0xd0(%rbp), %rdi
callq 0x84f0
jmp 0x10a68
movq -0x108(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x3330
leaq -0xd0(%rbp), %rdi
callq 0x3190
jmp 0x10a89
movl -0x8c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x1094f
movq -0x108(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x3110
jmp 0x10ab2
leaq -0xf0(%rbp), %rdi
callq 0x3db0
movb %al, -0x121(%rbp)
jmp 0x10ac6
leaq -0xf0(%rbp), %rdi
callq 0x3190
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x10ade
jmp 0x10b08
movb $0x1, -0x29(%rbp)
movl $0x1, -0xf4(%rbp)
jmp 0x10b12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x3190
jmp 0x10b34
movl $0x0, -0xf4(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x10b24
movq -0x108(%rbp), %rdi
callq 0x3190
movl -0xf4(%rbp), %eax
testl %eax, %eax
je 0x10b32
jmp 0x10b30
jmp 0x10b44
jmp 0x10b42
movq -0x108(%rbp), %rdi
callq 0x3190
jmp 0x10b54
ud2
movq -0x100(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3430
nopl (%rax)