'Test if jump instruction is taken or not
Returns:
- (status, address of target jumped instruction)'

def testjump(self, inst=None):

    flags = self.get_eflags()
    if (not flags):
        return None
    if (not inst):
        pc = self.getreg('pc')
        inst = self.execute_redirect(('x/i    0x%x' % pc))
        if (not inst):
            return None
    opcode = inst.split(': DCTB ')[(-1)].split()[0]
    next_addr = self.eval_target(inst)
    if (next_addr is None):
        next_addr = 0
    if (opcode == 'jmp'):
        return next_addr
    if ((opcode == 'je') and flags['ZF']):
        return next_addr
    if ((opcode == 'jne') and (not flags['ZF'])):
        return next_addr
    if ((opcode == 'jg') and (not flags['ZF']) and (flags['SF'] == flags['OF'])):
        return next_addr
    if ((opcode == 'jge') and (flags['SF'] == flags['OF'])):
        return next_addr
    if ((opcode == 'ja') and (not flags['CF']) and (not flags['ZF'])):
        return next_addr
    if ((opcode == 'jae') and (not flags['CF'])):
        return next_addr
    if ((opcode == 'jl') and (flags['SF'] != flags['OF'])):
        return next_addr
    if ((opcode == 'jle') and (flags['ZF'] or (flags['SF'] != flags['OF']))):
        return next_addr
    if ((opcode == 'jb') and flags['CF']):
        return next_addr
    if ((opcode == 'jbe') and (flags['CF'] or flags['ZF'])):
        return next_addr
    if ((opcode == 'jo') and flags['OF']):
        return next_addr
    if ((opcode == 'jno') and (not flags['OF'])):
        return next_addr
    if ((opcode == 'jz') and flags['ZF']):
        return next_addr
    if ((opcode == 'jnz') and flags['OF']):
        return next_addr
    return None
