converts an input state into a state with symbolic registers
        :return: the symbolic state
779669
def make_symbolic_state(project, reg_list, stack_length=80):
        
        input_state = Identifier.make_initial_state(project, stack_length)
        symbolic_state = input_state.copy()
        # overwrite all registers
        for reg in reg_list:
            symbolic_state.registers.store(reg, symbolic_state.solver.BVS("sreg_" + reg + "-", project.arch.bits))
        # restore sp
        symbolic_state.regs.sp = input_state.regs.sp
        # restore bp
        symbolic_state.regs.bp = input_state.regs.bp
        return symbolic_state
376354
def outputForInput(self, inState, inputSymbol):
        
        for (anInState, anInputSymbol,
             outState, outputSymbols) in self._transitions:
            if (inState, inputSymbol) == (anInState, anInputSymbol):
                return (outState, list(outputSymbols))
        raise NoTransition(state=inState, symbol=inputSymbol)
715616
def _construct_state_machines(self):
        
        state_machines = dict()
        for state_machine in [StateMachineRecomputing(self.logger, self),
                              StateMachineContinuous(self.logger, self),
                              StateMachineDiscrete(self.logger, self),
                              StateMachineFreerun(self.logger)]:
            state_machines[state_machine.name] = state_machine
        return state_machines
862804
function cloneState(state) {
  return {
    options: state.options,
    stack: state.stack.slice(),
    nodes: state.nodes.slice()
  };
}
1199024
def _categorize_successor(self, state):
        

        self.all_successors.append(state)
        target = state.scratch.target

        # categorize the state
        if o.APPROXIMATE_GUARDS in state.options and state.solver.is_false(state.scratch.guard, exact=False):
            if o.VALIDATE_APPROXIMATIONS in state.options:
                if state.satisfiable():
                    raise Exception('WTF')
            self.unsat_successors.append(state)
        elif o.APPROXIMATE_SATISFIABILITY in state.options and not state.solver.satisfiable(exact=False):
            if o.VALIDATE_APPROXIMATIONS in state.options:
                if state.solver.satisfiable():
                    raise Exception('WTF')
            self.unsat_successors.append(state)
        elif not state.scratch.guard.symbolic and state.solver.is_false(state.scratch.guard):
            self.unsat_successors.append(state)
        elif o.LAZY_SOLVES not in state.options and not state.satisfiable():
            self.unsat_successors.append(state)
        elif o.NO_SYMBOLIC_JUMP_RESOLUTION in state.options and state.solver.symbolic(target):
            self.unconstrained_successors.append(state)
        elif not state.solver.symbolic(target) and not state.history.jumpkind.startswith("Ijk_Sys"):
            # a successor with a concrete IP, and it's not a syscall
            self.successors.append(state)
            self.flat_successors.append(state)
        elif state.history.jumpkind.startswith("Ijk_Sys"):
            # syscall
            self.successors.append(state)

            # Misuse the ip_at_syscall register to save the return address for this syscall
            # state.ip *might be* changed to be the real address of syscall SimProcedures by syscall handling code in
            # angr
            state.regs.ip_at_syscall = state.ip

            try:
                symbolic_syscall_num, concrete_syscall_nums = self._resolve_syscall(state)
                if concrete_syscall_nums is not None:
                    for i, n in enumerate(concrete_syscall_nums):
                        split_state = state if i == len(concrete_syscall_nums) - 1 else state.copy()
                        split_state.add_constraints(symbolic_syscall_num == n)
                        if split_state.supports_inspect:
                            split_state.inspect.downsize()
                        self._fix_syscall_ip(split_state)

                        self.flat_successors.append(split_state)
                else:
                    # We cannot resolve the syscall number
                    # However, we still put it to the flat_successors list, and angr.SimOS.handle_syscall will pick it
                    # up, and create a "unknown syscall" stub for it.
                    self._fix_syscall_ip(state)
                    self.flat_successors.append(state)
            except AngrUnsupportedSyscallError:
                self.unsat_successors.append(state)

        else:
            # a successor with a symbolic IP
            _max_targets = state.options.symbolic_ip_max_targets
            _max_jumptable_targets = state.options.jumptable_symbolic_ip_max_targets
            try:
                if o.NO_IP_CONCRETIZATION in state.options:
                    # Don't try to concretize the IP
                    cond_and_targets = [ (claripy.true, target) ]
                    max_targets = 0
                elif o.KEEP_IP_SYMBOLIC in state.options:
                    s = claripy.Solver()
                    addrs = s.eval(target, _max_targets + 1, extra_constraints=tuple(state.ip_constraints))
                    if len(addrs) > _max_targets:
                        # It is not a library
                        l.debug("It is not a Library")
                        addrs = state.solver.eval_upto(target, _max_targets + 1)
                        l.debug("addrs :%s", addrs)
                    cond_and_targets = [ (target == addr, addr) for addr in addrs ]
                    max_targets = _max_targets
                else:
                    cond_and_targets = self._eval_target_jumptable(state, target, _max_jumptable_targets + 1)
                    if cond_and_targets is None:
                        # Fallback to the traditional and slow method
                        cond_and_targets = self._eval_target_brutal(state, target, _max_targets + 1)
                        max_targets = _max_targets
                    else:
                        max_targets = _max_jumptable_targets

                if len(cond_and_targets) > max_targets:
                    l.warning(
                        "Exit state has over %d possible solutions. Likely unconstrained; skipping. %s",
                        max_targets,
                        target.shallow_repr()
                    )
                    self.unconstrained_successors.append(state)
                else:
                    for cond, a in cond_and_targets:
                        split_state = state.copy()
                        if o.KEEP_IP_SYMBOLIC in split_state.options:
                            split_state.regs.ip = target
                        else:
                            split_state.add_constraints(cond, action=True)
                            split_state.regs.ip = a
                        if split_state.supports_inspect:
                            split_state.inspect.downsize()
                        self.flat_successors.append(split_state)
                    self.successors.append(state)
            except SimSolverModeError:
                self.unsat_successors.append(state)

        return state
1148937
def get_state_by_X(self, x, xtyp):
        
        _state = self.state_db.get(KEY_PATTERN[xtyp].format(x))
        if _state:
            return _state
        else:
            raise KeyError('Unknown {}: "{}"'.format(xtyp, x))
141355
def transitionStates(self,state):
        
        newstates,rates         = self.transition(state)              
        newindices              = self.getStateIndex(newstates)
        return newindices,rates
1154937
function( state ) {
			var key,
				clonedState = {};

			for( key in state ) {
				if( key !== LOCAL ) {
					clonedState[ key ] = state[ key ];
				}
			}

			return clonedState;
		}
355024
def _generate_state(self, trans):
        
        state = PDAState()
        state.id = self.nextstate()
        state.type = 2
        state.sym = state.id
        state.trans = trans.copy()
        self.toadd.append(state)
        return state.id
1182336
def _embed_state(embedding, state):
    """"""
    return {u: state[v] for v, chain in embedding.items() for u in chain}
1250374
def initialState(self, state):
        

        if self._initialState is not _NO_STATE:
            raise ValueError(
                "initial state already set to {}".format(self._initialState))

        self._initialState = state
239015
def get_initial_state(self, source_length: mx.sym.Symbol, source_seq_len: int) -> AttentionState:
        
        dynamic_source = mx.sym.reshape(mx.sym.zeros_like(source_length), shape=(-1, 1, 1))
        # dynamic_source: (batch_size, source_seq_len, num_hidden_dynamic_source)
        dynamic_source = mx.sym.broadcast_to(dynamic_source, shape=(0, source_seq_len, self.dynamic_source_num_hidden))
        return AttentionState(context=None, probs=None, dynamic_source=dynamic_source)
1063812
def _algebraic_rules_state():
    """"""
    u = wc("u", head=SCALAR_TYPES)
    v = wc("v", head=SCALAR_TYPES)

    n = wc("n", head=(int, str, SymbolicLabelBase))
    m = wc("m", head=(int, str, SymbolicLabelBase))
    k = wc("k", head=(int, str, SymbolicLabelBase))

    A = wc("A", head=Operator)
    A__ = wc("A__", head=Operator)
    B = wc("B", head=Operator)

    A_times = wc("A", head=OperatorTimes)
    A_local = wc("A", head=LocalOperator)
    B_local = wc("B", head=LocalOperator)

    Psi_sym = wc("Psi", head=KetSymbol)
    Psi = wc("Psi", head=State)
    Phi = wc("Phi", head=State)
    Psi_local = wc("Psi", head=LocalKet)
    Psi_tensor = wc("Psi", head=TensorKet)
    Phi_tensor = wc("Phi", head=TensorKet)

    ls = wc("ls", head=LocalSpace)

    basisket = wc('basisket', BasisKet, kwargs={'hs': ls})
    ket_a = wc('a', BasisKet)
    ket_b = wc('b', BasisKet)

    indranges__ = wc("indranges__", head=IndexRangeBase)
    sum = wc('sum', head=KetIndexedSum)
    sum2 = wc('sum2', head=KetIndexedSum)

    ScalarTimesKet._rules.update(check_rules_dict([
        ('R001', (
            pattern_head(1, Psi),
            lambda Psi: Psi)),
        ('R002', (
            pattern_head(0, Psi),
            lambda Psi: ZeroKet)),
        ('R003', (
            pattern_head(u, ZeroKet),
            lambda u: ZeroKet)),
        ('R004', (
            pattern_head(u, pattern(ScalarTimesKet, v, Psi)),
            lambda u, v, Psi: (u * v) * Psi))
    ]))

    def local_rule(A, B, Psi):
        return OperatorTimes.create(*A) * (B * Psi)

    OperatorTimesKet._rules.update(check_rules_dict([
        ('R001', (  # Id * Psi = Psi
            pattern_head(IdentityOperator, Psi),
            lambda Psi: Psi)),
        ('R002', (  # 0 * Psi = 0
            pattern_head(ZeroOperator, Psi),
            lambda Psi: ZeroKet)),
        ('R003', (  # A * 0 = 0
            pattern_head(A, ZeroKet),
            lambda A: ZeroKet)),
        ('R004', (  # A * v * Psi = v * A * Psi (pull out scalar)
            pattern_head(A, pattern(ScalarTimesKet, v, Psi)),
            lambda A, v, Psi:  v * (A * Psi))),

        ('R005', (  # |n><m| * |k> = delta_mk * |n>
            pattern_head(
                pattern(LocalSigma, n, m, hs=ls),
                pattern(BasisKet, k, hs=ls)),
            lambda ls, n, m, k:
                KroneckerDelta(
                    BasisKet(m, hs=ls).index, BasisKet(k, hs=ls).index) *
                BasisKet(n, hs=ls))),

        # harmonic oscillator
        ('R006', (  # a^+ |n> = sqrt(n+1) * |n+1>
            pattern_head(pattern(Create, hs=ls), basisket),
            lambda basisket, ls:
                sqrt(basisket.index + 1) * basisket.next())),
        ('R007', (  # a |n> = sqrt(n) * |n-1>
            pattern_head(pattern(Destroy, hs=ls), basisket),
            lambda basisket, ls:
                sqrt(basisket.index) * basisket.prev())),
        ('R008', (  # a |alpha> = alpha * |alpha> (eigenstate of annihilator)
            pattern_head(
                pattern(Destroy, hs=ls),
                pattern(CoherentStateKet, u, hs=ls)),
            lambda ls, u: u * CoherentStateKet(u, hs=ls))),

        # spin
        ('R009', (
            pattern_head(pattern(Jplus, hs=ls), basisket),
            lambda basisket, ls:
                Jpjmcoeff(basisket.space, basisket.index, shift=True) *
                basisket.next())),
        ('R010', (
            pattern_head(pattern(Jminus, hs=ls), basisket),
            lambda basisket, ls:
                Jmjmcoeff(basisket.space, basisket.index, shift=True) *
                basisket.prev())),
        ('R011', (
            pattern_head(pattern(Jz, hs=ls), basisket),
            lambda basisket, ls:
                Jzjmcoeff(basisket.space, basisket.index, shift=True) *
                basisket)),

        ('R012', (
            pattern_head(A_local, Psi_tensor),
            lambda A, Psi: act_locally(A, Psi))),
        ('R013', (
            pattern_head(A_times, Psi_tensor),
            lambda A, Psi: act_locally_times_tensor(A, Psi))),
        ('R014', (
            pattern_head(A, pattern(OperatorTimesKet, B, Psi)),
            lambda A, B, Psi: (
                (A * B) * Psi
                if (B * Psi) == OperatorTimesKet(B, Psi)
                else A * (B * Psi)))),
        ('R015', (
            pattern_head(pattern(OperatorTimes, A__, B_local), Psi_local),
            local_rule)),
        ('R016', (
            pattern_head(pattern(ScalarTimesOperator, u, A), Psi),
            lambda u, A, Psi: u * (A * Psi))),
        ('R017', (
            pattern_head(
                pattern(Displace, u, hs=ls),
                pattern(BasisKet, 0, hs=ls)),
            lambda ls, u: CoherentStateKet(u, hs=ls))),
        ('R018', (
            pattern_head(
                pattern(Displace, u, hs=ls),
                pattern(CoherentStateKet, v, hs=ls)),
            lambda ls, u, v:
                ((Displace(u, hs=ls) * Displace(v, hs=ls)) *
                 BasisKet(0, hs=ls)))),
        ('R019', (
            pattern_head(
                pattern(Phase, u, hs=ls), pattern(BasisKet, m, hs=ls)),
            lambda ls, u, m: exp(I * u * m) * BasisKet(m, hs=ls))),
        ('R020', (
            pattern_head(
                pattern(Phase, u, hs=ls),
                pattern(CoherentStateKet, v, hs=ls)),
            lambda ls, u, v: CoherentStateKet(v * exp(I * u), hs=ls))),

        ('R021', (
            pattern_head(A, sum),
            lambda A, sum: KetIndexedSum.create(A * sum.term, *sum.ranges))),
    ]))

    TensorKet._binary_rules.update(check_rules_dict([
        ('R001', (
            pattern_head(pattern(ScalarTimesKet, u, Psi), Phi),
            lambda u, Psi, Phi: u * (Psi * Phi))),
        ('R002', (
            pattern_head(Psi, pattern(ScalarTimesKet, u, Phi)),
            lambda Psi, u, Phi: u * (Psi * Phi))),
        ('R003', (  # delegate to __mul__
            pattern_head(sum, sum2),
            lambda sum, sum2: sum * sum2)),
        ('R004', (  # delegate to __mul__
            pattern_head(Psi, sum),
            lambda Psi, sum: Psi * sum)),
        ('R005', (  # delegate to __mul__
            pattern_head(sum, Psi),
            lambda sum, Psi: sum * Psi)),
    ]))

    BraKet._rules.update(check_rules_dict([
        # All rules must result in scalars or objects in the TrivialSpace
        ('R001', (
            pattern_head(Phi, ZeroKet),
            lambda Phi: Zero)),
        ('R002', (
            pattern_head(ZeroKet, Phi),
            lambda Phi: Zero)),
        ('R003', (
            pattern_head(ket_a, ket_b),
            lambda a, b: KroneckerDelta(a.index, b.index))),
        ('R004', (
            pattern_head(Psi_sym, Psi_sym),
            lambda Psi: One)),
            # we're assuming every KetSymbol is normalized. If we ever want
            # to allow non-normalized states, the best thing to dou would be to
            # add a `norm` attribute
        ('R005', (
            pattern_head(Psi_tensor, Phi_tensor),
            lambda Psi, Phi: tensor_decompose_kets(Psi, Phi, BraKet.create))),
        ('R006', (
            pattern_head(pattern(ScalarTimesKet, u, Psi), Phi),
            lambda u, Psi, Phi: u.conjugate() * (Psi.adjoint() * Phi))),
        ('R007', (
            pattern_head(pattern(OperatorTimesKet, A, Psi), Phi),
            lambda A, Psi, Phi: (Psi.adjoint() * (A.dag() * Phi)))),
        ('R008', (
            pattern_head(Psi, pattern(ScalarTimesKet, u, Phi)),
            lambda Psi, u, Phi: u * (Psi.adjoint() * Phi))),
        ('R009', (  # delegate to __mul__
            pattern_head(sum, sum2),
            lambda sum, sum2: Bra.create(sum) * sum2)),
        ('R010', (  # delegate to __mul__
            pattern_head(Psi, sum),
            lambda Psi, sum: Bra.create(Psi) * sum)),
        ('R011', (  # delegate to __mul__
            pattern_head(sum, Psi),
            lambda sum, Psi: Bra.create(sum) * Psi)),
    ]))

    KetBra._rules.update(check_rules_dict([
        ('R001', (
            pattern_head(
                pattern(BasisKet, m, hs=ls),
                pattern(BasisKet, n, hs=ls)),
            lambda ls, m, n: LocalSigma(m, n, hs=ls))),
        ('R002', (
            pattern_head(pattern(CoherentStateKet, u, hs=ls), Phi),
            lambda ls, u, Phi: (
                Displace(u, hs=ls) * (BasisKet(0, hs=ls) * Phi.adjoint())))),
        ('R003', (
            pattern_head(Phi, pattern(CoherentStateKet, u, hs=ls)),
            lambda ls, u, Phi: (
                (Phi * BasisKet(0, hs=ls).adjoint()) * Displace(-u, hs=ls)))),
        ('R004', (
            pattern_head(Psi_tensor, Phi_tensor),
            lambda Psi, Phi: tensor_decompose_kets(Psi, Phi, KetBra.create))),
        ('R005', (
            pattern_head(pattern(OperatorTimesKet, A, Psi), Phi),
            lambda A, Psi, Phi: A * (Psi * Phi.adjoint()))),
        ('R006', (
            pattern_head(Psi, pattern(OperatorTimesKet, A, Phi)),
            lambda Psi, A, Phi: (Psi * Phi.adjoint()) * A.adjoint())),
        ('R007', (
            pattern_head(pattern(ScalarTimesKet, u, Psi), Phi),
            lambda u, Psi, Phi: u * (Psi * Phi.adjoint()))),
        ('R008', (
            pattern_head(Psi, pattern(ScalarTimesKet, u, Phi)),
            lambda Psi, u, Phi: u.conjugate() * (Psi * Phi.adjoint()))),
        ('R009', (  # delegate to __mul__
            pattern_head(sum, sum2),
            lambda sum, sum2: sum * Bra.create(sum2))),
        ('R010', (  # delegate to __mul__
            pattern_head(Psi, sum),
            lambda Psi, sum: Psi * Bra.create(sum))),
        ('R011', (  # delegate to __mul__
            pattern_head(sum, Psi),
            lambda sum, Psi: sum * Bra.create(Psi))),
    ]))

    def pull_constfactor_from_sum(u, Psi, indranges):
        bound_symbols = set([r.index_symbol for r in indranges])
        if len(u.free_symbols.intersection(bound_symbols)) == 0:
            return u * KetIndexedSum.create(Psi, *indranges)
        else:
            raise CannotSimplify()

    KetIndexedSum._rules.update(check_rules_dict([
        ('R001', (  # sum over zero -> zero
            pattern_head(ZeroKet, indranges__),
            lambda indranges: ZeroKet)),
        ('R002', (  # pull constant prefactor out of sum
            pattern_head(pattern(ScalarTimesKet, u, Psi), indranges__),
            lambda u, Psi, indranges:
                pull_constfactor_from_sum(u, Psi, indranges))),
    ]))
828523
def run_to_states(self):
        
        self.execution_engine_lock.acquire()
        return_value = self._run_to_states
        self.execution_engine_lock.release()
        return return_value
1110573
def _generate_state() -> str:
        
        state = str(uuid.uuid4()).replace('-', '')
        logger.debug("Generated OAuth state: %s" % state)
        return state
897394
public void registerAllPossibleTransition(Automaton[] states) {
        for (int i = 0; i < states.length; i++) {
            for (int j = i; j < states.length; j++) {
                registerTransition(states[i], states[j]);
                registerTransition(states[j], states[i]);
            }
        }
    }
791459
def dump_state(self):
        

        state = {}

        state['tile_states'] = {}

        for address, tile in self._tiles.items():
            state['tile_states'][address] = tile.dump_state()

        return state