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

	if(flag[0] == false)
		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 (%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x105c6
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdi
callq 0x3170
jmp 0x10843
movb $0x0, -0x29(%rbp)
leaq -0x2a(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x3440
movq -0x108(%rbp), %rdi
movq -0x120(%rbp), %rdx
leaq 0x4c13(%rip), %rsi      # 0x15202
callq 0x50d0
jmp 0x105f6
leaq -0x2a(%rbp), %rdi
callq 0x32f0
movq -0x118(%rbp), %rsi
movaps 0x4c33(%rip), %xmm0     # 0x15240
movaps %xmm0, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3110
jmp 0x10626
leaq -0x88(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7a50
jmp 0x10638
leaq -0x88(%rbp), %rdi
callq 0x3190
movl $0x3, -0x8c(%rbp)
cmpl $0x0, -0x8c(%rbp)
jl 0x1079c
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 0x10746
cmpl $0x9, -0x90(%rbp)
jg 0x10746
movq -0x108(%rbp), %rdx
movl -0x90(%rbp), %eax
addl $0x30, %eax
movsbl %al, %esi
leaq -0xb0(%rbp), %rdi
callq 0x84f0
jmp 0x106da
movq -0x108(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3330
leaq -0xb0(%rbp), %rdi
callq 0x3190
jmp 0x10786
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x2a(%rbp), %rdi
callq 0x32f0
jmp 0x10853
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x10833
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x3190
jmp 0x10833
movq -0x108(%rbp), %rdx
movl -0x90(%rbp), %eax
addl $0x37, %eax
movsbl %al, %esi
leaq -0xd0(%rbp), %rdi
callq 0x84f0
jmp 0x10767
movq -0x108(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x3330
leaq -0xd0(%rbp), %rdi
callq 0x3190
jmp 0x10788
movl -0x8c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x1064e
movq -0x108(%rbp), %rsi
leaq -0xf0(%rbp), %rdi
callq 0x3110
jmp 0x107b1
leaq -0xf0(%rbp), %rdi
callq 0x3db0
movb %al, -0x121(%rbp)
jmp 0x107c5
leaq -0xf0(%rbp), %rdi
callq 0x3190
movb -0x121(%rbp), %al
testb $0x1, %al
jne 0x107dd
jmp 0x10807
movb $0x1, -0x29(%rbp)
movl $0x1, -0xf4(%rbp)
jmp 0x10811
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x3190
jmp 0x10833
movl $0x0, -0xf4(%rbp)
testb $0x1, -0x29(%rbp)
jne 0x10823
movq -0x108(%rbp), %rdi
callq 0x3190
movl -0xf4(%rbp), %eax
testl %eax, %eax
je 0x10831
jmp 0x1082f
jmp 0x10843
jmp 0x10841
movq -0x108(%rbp), %rdi
callq 0x3190
jmp 0x10853
ud2
movq -0x100(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3430
nopl (%rax)