anchor.diff:      Fs = [function(F) || F <- Fs0],
       {ok,{Mod,Exp,Attr,Fs,Lc}}.
   
  -function({function,Name,Arity,CLabel,Is}) ->
  +function({function,Name,Arity,CLabel,Is0}) ->
       try
  -        Idx = beam_utils:index_labels(Is),
  -        {function,Name,Arity,CLabel,rewrite(Is,Idx)}
  +        Is1 = beam_utils:anno_defs(Is0),
  +        Idx = beam_utils:index_labels(Is1),
  +        Is = rewrite(reverse(Is1), Idx),
  +        {function,Name,Arity,CLabel,Is}
       catch
           Class:Error ->
               Stack = erlang:get_stacktrace(),
  
positive.code:             erlang:raise(Class, Error, Stack)
      end.
  
  rewrite(Is,Idx) ->
      rewrite(Is,Idx,[]).
  
  rewrite([{test,is_tuple,Fail,[Src]}=I1,
           {test,test_arity,Fail,[Src,N]}=I2|Is],Idx,Acc) ->
      case is_tagged_tuple(Is,Fail,Src,Idx) of
          no ->
              rewrite(Is,Idx,[I2,I1|Acc]);
          {Atom,[{block,[]}|Is1]} ->
              rewrite(Is1,Idx,[{test,is_tagged_tuple,Fail,[Src,N,Atom]}|Acc]);
          {Atom,Is1} ->
              rewrite(Is1,Idx,[{test,is_tagged_tuple,Fail,[Src,N,Atom]}|Acc])
      end;
  rewrite([I|Is],Idx,Acc) ->
      rewrite(Is,Idx,[I|Acc]);
  rewrite([],_,Acc) -> reverse(Acc).
  
  is_tagged_tuple([{block,[{set,[Dst],[Src],{get_tuple_element,0}}=B|Bs]},
                   {test,is_eq_exact,Fail,[Dst,{atom,_}=Atom]}|Is],Fail,Src,Idx) ->
  
      %% if Dst is killed in the instruction stream and at fail label,
      %% we can safely remove get_tuple_element.
      %%
      %% if Dst is not killed in the stream, we cannot remove get_tuple_element
      %% since it is referenced.
  
      case is_killed(Dst,Is,Fail,Idx) of
          true  -> {Atom,[{block,Bs}|Is]};
          false -> {Atom,[{block,[B|Bs]}|Is]}
      end;
  is_tagged_tuple([{block,[{set,_,_,_}=B|Bs]},
                   {test,is_eq_exact,_,_}=I|Is],Fail,Src,Idx) ->
      case is_tagged_tuple([{block,Bs},I|Is],Fail,Src,Idx) of
          {Atom,[{block,Bsr}|Isr]} -> {Atom,[{block,[B|Bsr]}|Isr]};
          no                       -> no
      end;
  is_tagged_tuple(_Is,_Fail,_Src,_Idx) ->
      no.
  
  is_killed(Dst,Is,{_,Lbl},Idx) ->
      beam_utils:is_killed(Dst,Is,Idx) andalso
          beam_utils:is_killed_at(Dst,Lbl,Idx).
  
negative.code: %%     ...
  %%     {test,is_eq_exact,Fail,[Dst,Atom]}.
  %%     ...
  %% To:
  %%     ...
  %%     {test,is_tagged_tuple,Fail,[Src,Sz,Atom]}.
  %%     ...
  %%
  
  -module(beam_record).
  -export([module/2]).
  
  -import(lists, [reverse/1,reverse/2]).
  
  -spec module(beam_utils:module_code(), [compile:option()]) ->
                      {'ok',beam_utils:module_code()}.
  