anchor.diff:            logger                       :: pid(),
             last_scheduled               :: pid(),
             message_info                 :: message_info(),
  +          need_to_replay     = false   :: boolean(),
             non_racing_system  = []      :: [atom()],
             optimal            = true    :: boolean(),
             previous_was_enabled = true   :: boolean(),
  
positive.code: 
  %%------------------------------------------------------------------------------
  
  has_more_to_explore(State) ->
    #scheduler_state{exploring = N, logger = Logger, trace = Trace} = State,
    TracePrefix = find_prefix(Trace, State),
    case TracePrefix =:= [] of
      true -> {false, State#scheduler_state{trace = []}};
      false ->
        S = io_lib:format("New interleaving ~p. Replaying...", [N]),
        ?time(Logger, S),
        NewState = replay_prefix(TracePrefix, State),
        ?debug(Logger, "~s~n",["Replay done."]),
        FinalState = NewState#scheduler_state{trace = TracePrefix},
        {true, FinalState}
    end.
  
  find_prefix([], _State) -> [];
  find_prefix([#trace_state{wakeup_tree = []}|Rest], State) ->
    find_prefix(Rest, State);
  find_prefix([#trace_state{graph_ref = Sibling} = Other|Rest], State) ->
    #scheduler_state{logger = Logger} = State,
    [#trace_state{graph_ref = Parent}|_] = Rest,
    concuerror_logger:graph_set_node(Logger, Parent, Sibling),
    [Other#trace_state{graph_ref = make_ref(), clock_map = dict:new()}|Rest].
  
  
  %% =============================================================================
  %% ENGINE (manipulation of the Erlang processes under the scheduler)
  
negative.code: replay_prefix_aux([#trace_state{done = [Event|_], index = I}|Rest], State) ->
    #scheduler_state{logger = _Logger, print_depth = PrintDepth} = State,
    ?trace(_Logger, "~s~n", [?pretty_s(I, Event)]),
    {ok, #event{actor = Actor} = NewEvent} = get_next_event_backend(Event, State),
    try
      true = Event =:= NewEvent
    catch
  