def _get_simrun(self, addr, current_entry, current_function_addr=None):
        error_occurred = False
        state = current_entry.state
        saved_state = current_entry.state  # We don't have to make a copy here
        try:
            if not self._keep_state and \
                    self.project.is_hooked(addr) and \
                    not self.project._sim_procedures[addr][0] is simuvex.s_procedure.SimProcedureContinuation and \
                    not self.project._sim_procedures[addr][0].ADDS_EXITS and \
                    not self.project._sim_procedures[addr][0].NO_RET:
                # DON'T CREATE USELESS SIMPROCEDURES if we don't care about the accuracy of states
                # When generating CFG, a SimProcedure will not be created as it is but be created as a
                # ReturnUnconstrained stub if it satisfies the following conditions:
                # - It doesn't add any new exits.
                # - It returns as normal.
                # In this way, we can speed up the CFG generation by quite a lot as we avoid simulating
                # those functions like read() and puts(), which has no impact on the overall control flow at all.
                #
                # Special notes about _SimProcedureContinuation_ instances. Any SimProcedure that corresponds to the
                # SimProcedureContinuation we see here adds new exits, otherwise the original SimProcedure wouldn't have
                # been executed anyway. Hence it's reasonable for us to always simulate a SimProcedureContinuation
                # instance.

                old_proc = self.project._sim_procedures[addr][0]
                old_name = None
                if old_proc == simuvex.procedures.SimProcedures["stubs"]["ReturnUnconstrained"]:
                    proc_kwargs = self.project._sim_procedures[addr][1]
                    if 'resolves' in proc_kwargs:
                        old_name = proc_kwargs['resolves']

                if old_name is None:
                    old_name = old_proc.__name__.split('.')[-1]

                sim_run = simuvex.procedures.SimProcedures["stubs"]["ReturnUnconstrained"](
                    state,
                    addr=addr,
                    sim_kwargs={'resolves': "%s" % old_name}
                )
            else:
                jumpkind = state.scratch.jumpkind
                jumpkind = 'Ijk_Boring' if jumpkind is None else jumpkind
                sim_run = self.project.factory.sim_run(current_entry.state, jumpkind=jumpkind)

        except (simuvex.SimFastPathError, simuvex.SimSolverModeError) as ex:

            if saved_state.mode == 'fastpath':
                # Got a SimFastPathError or SimSolverModeError in FastPath mode.
                # We wanna switch to symbolic mode for current IRSB.
                l.debug('Switch to symbolic mode for address 0x%x', addr)
                # Make a copy of the current 'fastpath' state

                l.debug('Symbolic jumps at basic block 0x%x.' % addr)

                new_state = None
                if addr != current_function_addr:
                    new_state = self._get_symbolic_function_initial_state(current_function_addr)

                if new_state is None:
                    new_state = current_entry.state.copy()
                    new_state.set_mode('symbolic')
                new_state.options.add(simuvex.o.DO_RET_EMULATION)
                # Remove bad constraints
                # FIXME: This is so hackish...
                new_state.se._solver.constraints = [c for c in new_state.se.constraints if
                                                    c.op != 'I' or c.args[0] is not False]
                new_state.se._solver._result = None
                # Swap them
                saved_state, current_entry.state = current_entry.state, new_state
                sim_run, error_occurred, _ = self._get_simrun(addr, current_entry)

            else:
                # Got a SimSolverModeError in symbolic mode. We are screwed.
                # Skip this IRSB
                l.debug("Caught a SimIRSBError. Don't panic, this is usually expected.", ex)
                error_occurred = True
                sim_run = \
                    simuvex.procedures.SimProcedures["stubs"]["PathTerminator"](
                        state, addr=addr)

        except simuvex.SimIRSBError:
            # It's a tragedy that we came across some instructions that VEX
            # does not support. I'll create a terminating stub there
            l.debug("Caught a SimIRSBError during CFG recovery. Creating a PathTerminator.", exc_info=True)
            error_occurred = True
            sim_run = \
                simuvex.procedures.SimProcedures["stubs"]["PathTerminator"](
                    state, addr=addr)

        except claripy.ClaripyError:
            l.debug("Caught a ClaripyError during CFG recovery. Don't panic, this is usually expected.", exc_info=True)
            error_occurred = True
            # Generate a PathTerminator to terminate the current path
            sim_run = \
                simuvex.procedures.SimProcedures["stubs"]["PathTerminator"](
                    state, addr=addr)

        except simuvex.SimError:
            l.debug("Caught a SimError when during CFG recovery. Don't panic, this is usually expected.", exc_info=True)

            error_occurred = True
            # Generate a PathTerminator to terminate the current path
            sim_run = \
                simuvex.procedures.SimProcedures["stubs"]["PathTerminator"](
                    state, addr=addr)

        except AngrError:
            section = self.project.loader.main_bin.find_section_containing(addr)
            if section is None:
                sec_name = 'No section'
            else:
                sec_name = section.name
            # AngrError shouldn't really happen though
            l.error("Caught an AngrError during CFG recovery at %#x (%s)",
                    addr, sec_name, exc_info=True)
            # We might be on a wrong branch, and is likely to encounter the
            # "No bytes in memory xxx" exception
            # Just ignore it
            error_occurred = True
            sim_run = None

        return sim_run, error_occurred, saved_state
dataset/ETHPy150Open angr/angr/angr/analyses/cfg_accurate.py/CFGAccurate._get_simrun/original