'Resolves jump tables.
:param cfg: A CFG instance.
:param int addr: IRSB address.
:param int func_addr: The function address.
:param pyvex.IRSB block: The IRSB.
:return: A bool indicating whether the indirect jump is resolved successfully, and a list of resolved targets
:rtype: tuple'

def resolve(self, cfg, addr, func_addr, block, jumpkind):

    if (jumpkind != 'Ijk_Boring'):
        l.error('JumpTableResolver    only    supports    boring    jumps.')
        return (False, None)
    project = cfg.project
    self._max_targets = cfg._indirect_jump_target_limit
    b = Blade(cfg.graph, addr, (-1), cfg=cfg, project=project, ignore_sp=False, ignore_bp=False, max_level=3)
    stmt_loc = (addr, 'default')
    if (stmt_loc not in b.slice):
        return (False, None)
    (load_stmt_loc, load_stmt) = (None, None)
    stmts_to_remove = [stmt_loc]
    while True:
        preds = b.slice.predecessors(stmt_loc)
        if (len(preds) != 1):
            return (False, None)
        (block_addr, stmt_idx) = stmt_loc = preds[0]
        block = project.factory.block(block_addr).vex
        stmt = block.statements[stmt_idx]
        if isinstance(stmt, (pyvex.IRStmt.WrTmp, pyvex.IRStmt.Put)):
            if isinstance(stmt.data, (pyvex.IRExpr.Get, pyvex.IRExpr.RdTmp)):
                stmts_to_remove.append(stmt_loc)
                stmt_loc = (block_addr, stmt_idx)
                continue
            elif isinstance(stmt.data, pyvex.IRExpr.Load):
                stmt_loc = (block_addr, stmt_idx)
                (load_stmt, load_stmt_loc) = (stmt, stmt_loc)
                stmts_to_remove.append(stmt_loc)
        break
    if (load_stmt_loc is None):
        return (False, None)
    b.slice.remove_nodes_from(stmts_to_remove)
    if (l.level == logging.DEBUG):
        self._dbg_repr_slice(b)
    sources = [n_ for n_ in b.slice.nodes() if (b.slice.in_degree(n_) == 0)]
    annotatedcfg = AnnotatedCFG(project, None, detect_loops=False)
    annotatedcfg.from_digraph(b.slice)
    for (src_irsb, _) in sources:
        start_state = self._initial_state(src_irsb)
        if self._bss_regions:
            bss_memory_read_bp = BP(when=BP_BEFORE, enabled=True, action=self._bss_memory_read_hook)
            start_state.inspect.add_breakpoint('mem_read', bss_memory_read_bp)
        start_state.regs.bp = (start_state.arch.initial_sp + 8192)
        init_registers_on_demand_bp = BP(when=BP_BEFORE, enabled=True, action=self._init_registers_on_demand)
        start_state.inspect.add_breakpoint('mem_read', init_registers_on_demand_bp)
        slicecutor = Slicecutor(project, annotatedcfg, start=start_state, targets=(load_stmt_loc[0],), force_taking_exit=True)
        try:
            slicecutor.run()
        except KeyError as ex:
            l.debug('KeyError    occurred    due    to    incomplete    program    slice.', exc_info=ex)
            continue
        for r in slicecutor.reached_targets:
            succ = project.factory.successors(r)
            all_states = (succ.flat_successors + succ.unconstrained_successors)
            if (not all_states):
                l.warning('Slicecutor    failed    to    execute    the    program    slice.    No    output    state    is    available.')
                continue
            state = all_states[0]
            load_addr_tmp = load_stmt.data.addr.tmp
            if (load_addr_tmp not in state.scratch.temps):
                continue
            jump_addr = state.scratch.temps[load_addr_tmp]
            total_cases = jump_addr._model_vsa.cardinality
            all_targets = []
            if (total_cases > self._max_targets):
                l.debug('%d    targets    are    resolved    for    the    indirect    jump    at    %#x.    It    may    not    be    a    jump    table', total_cases, addr)
                return (False, None)
            jump_table = []
            for (idx, a) in enumerate(state.se.any_n_int(jump_addr, total_cases)):
                if (((idx % 100) == 0) and (idx != 0)):
                    l.debug('%d    targets    have    been    resolved    for    the    indirect    jump    at    %#x...', idx, addr)
                jump_target = state.memory.load(a, (state.arch.bits / 8), endness=state.arch.memory_endness)
                target = state.se.any_int(jump_target)
                all_targets.append(target)
                jump_table.append(target)
            l.info('Jump    table    resolution:    resolved    %d    targets    from    %#x.', len(all_targets), addr)
            ij = cfg.indirect_jumps[addr]
            ij.jumptable = True
            ij.jumptable_addr = state.se.min(jump_addr)
            ij.jumptable_targets = jump_table
            ij.jumptable_entries = total_cases
            return (True, all_targets)
    return (False, None)
