anchor.diff:      OldGuard = erl_syntax:clause_guard(Clause),
       OldBody = erl_syntax:clause_body(Clause),
       %% Create new variable to use as 'SenderPid'.
  -    [{used, Used}] = ets:lookup(?NT_USED, used),
  -    Fresh = erl_syntax_lib:new_variable_name(Used),
  -    PidVar = erl_syntax:variable(Fresh),
  +    PidVar = new_variable(),
       NewPattern = [erl_syntax:tuple([PidVar, OldPattern])],
       Module = erl_syntax:atom(sched),
       Function = erl_syntax:atom(rep_receive_notify),
  
positive.code:     erl_syntax:application(Module, Function, Arguments).
  
  %% Instrument a receive expression.
  instrument_receive(Tree) ->
      Module = erl_syntax:atom(sched),
      Function = erl_syntax:atom(rep_receive),
  
negative.code: instrument_yield() ->
      erl_syntax:atom(true).
  
  %%%----------------------------------------------------------------------
  %%% Utilities
  %%%----------------------------------------------------------------------
  
  new_variable() ->
      [{used, Used}] = ets:lookup(?NT_USED, used),
      Fresh = erl_syntax_lib:new_variable_name(Used),
      ets:insert(?NT_USED, {used, sets:add_element(Fresh, Used)}),
      erl_syntax:variable(Fresh).
  
  new_underscore_variable() ->
      [{used, Used}] = ets:lookup(?NT_USED, used),
      new_underscore_variable(Used).
  
  new_underscore_variable(Used) ->
      Fresh1 = erl_syntax_lib:new_variable_name(Used),
      String = "_" ++ atom_to_list(Fresh1),
      Fresh2 = list_to_atom(String),
      case is_fresh(Fresh2, Used) of
          true ->
              ets:insert(?NT_USED, {used, sets:add_element(Fresh2, Used)}),
              erl_syntax:variable(Fresh2);
          false ->
              new_underscore_variable(Used)
      end.
  
  is_fresh(Atom, Set) ->
      not sets:is_element(Atom, Set).
  
  %%%----------------------------------------------------------------------
  %%% Logging
  %%%----------------------------------------------------------------------
  
  %% Log a list of errors, as returned by compile:file/2.
  log_error_list(List) ->
      log_list(List, "").
  