anchor.diff:  	    Error
       end;
   call_state_function(
  -  #{callback_mode := CallbackMode,
  -    module := Module} = S,
  +  #{callback_mode := CallbackMode, module := Module} = S,
     Type, Content, State, Data) ->
       try
   	case CallbackMode of
  
positive.code: 	      S#{
  		state := NextState,
  		data := NewData,
  		timer_refs := TimerRefs,
  		timer_types := TimerTypes,
  		cancel_timers := CancelTimers,
  		hibernate := Hibernate},
  	      [Event|Events])
      end.
  
  loop_event_result(
    Parent, Debug,
    #{state := State, postponed := P_0} = S,
    TimerRefs_0, TimerTypes_0, CancelTimers_0,
    Events, Event, NextState, NewData,
    Hibernate, TimeoutsR, Postpone, NextEventsR) ->
      %%
      %% All options have been collected and next_events are buffered.
      %% Do the actual state transition.
      %%
      {NewDebug,P_1} = % Move current event to postponed if Postpone
  	case Postpone of
  	    true ->
  		{sys_debug(Debug, S, State, {postpone,Event,State}),
  		 [Event|P_0]};
  	    false ->
  		{sys_debug(Debug, S, State, {consume,Event,State}),
  		 P_0}
  	end,
      {Events_1,NewP,{TimerTypes_1,CancelTimers_1}} =
  	%% Move all postponed events to queue and cancel the
  	%% state timeout if the state changes
  	if
  	    NextState =:= State ->
  		{Events,P_1,{TimerTypes_0,CancelTimers_0}};
  	    true ->
  		{lists:reverse(P_1, Events),[],
  		 cancel_timer_by_type(
  		   state_timeout, TimerTypes_0, CancelTimers_0)}
  		    %% The state timer is removed from TimerTypes_1
  		    %% but remains in TimerRefs_0 until we get
  		    %% the cancel_timer msg
  	end,
      {TimerRefs_2,TimerTypes_2,NewCancelTimers,TimeoutEvents} =
  	%% Stop and start timers non-event timers
  	parse_timers(TimerRefs_0, TimerTypes_1, CancelTimers_1, TimeoutsR),
      %% Place next events last in reversed queue
      Events_2R = lists:reverse(Events_1, NextEventsR),
      %% Enqueue immediate timeout events and start event timer
      {NewTimerRefs,NewTimerTypes,Events_3R} =
  	process_timeout_events(
  	  TimerRefs_2, TimerTypes_2, TimeoutEvents, Events_2R),
      NewEvents = lists:reverse(Events_3R),
      loop_events(
        Parent, NewDebug, S, NewTimerRefs, NewTimerTypes, NewCancelTimers,
        NewEvents, Hibernate, NextState, NewData, NewP).
  
  %% Loop until out of enqueued events
  %%
  loop_events(
    Parent, Debug, S, TimerRefs, TimerTypes, CancelTimers,
    [] = _Events, Hibernate, State, Data, P) ->
      %% Update S and loop back to loop/3 to receive a new event
      NewS =
  	S#{
  	  state := State,
  	  data := Data,
  	  postponed := P,
  	  timer_refs := TimerRefs,
  	  timer_types := TimerTypes,
  	  cancel_timers := CancelTimers,
  	  hibernate := Hibernate},
      loop(Parent, Debug, NewS);
  loop_events(
    Parent, Debug, S, TimerRefs, TimerTypes, CancelTimers,
    [Event|Events], Hibernate, State, Data, P) ->
      %% Update S and continue with enqueued events
      NewS =
  	S#{
  	  state := State,
  	  data := Data,
  	  postponed := P},
      loop_event(
        Parent, Debug, NewS, TimerRefs, TimerTypes, CancelTimers,
        Events, Event, Hibernate).
  
  
  
  %%---------------------------------------------------------------------------
  
negative.code: 	     {bad_action_from_state_function,Action},
  	     ?STACKTRACE()};
  	hibernate ->
  	    NewHibernate = true,
  	    parse_actions(
  	      Debug, S, State, Actions,
  	      NewHibernate, TimeoutsR, Postpone, NextEventsR);
  	{state_timeout,Time,_} = StateTimeout
  	  when is_integer(Time), Time >= 0;
  	       Time =:= infinity ->
  