anchor.diff:         (Any) -> Any
       end.
   
  -try_remap([C|Cs], Is, FrameSize) ->
  -    {TrimInstr,Map} = expand_config(C, FrameSize),
  -    try
  -	{remap(Is, Map, []),TrimInstr}
  -    catch
  -	throw:not_possible ->
  -	    try_remap(Cs, Is, FrameSize)
  -    end;
  -try_remap([], _, _) -> throw(not_possible).
  -
   remap([{block,Bl0}|Is], Map, Acc) ->
       Bl = remap_block(Bl0, Map, []),
       remap(Is, Map, [{block,Bl}|Acc]);
  
positive.code: 			    end, Is0),
      Kills = sort(Kills0),
      try
  	{FrameSize,Layout} = frame_layout(Is1, Kills, St),
  	Configs = trim_instructions(Layout),
  	try_remap(Configs, Is1, FrameSize)
  	of
  	{Is,TrimInstr} ->
  	    trim(Is, St, reverse(TrimInstr)++Acc)
      catch
  	not_possible ->
  	    trim(Is1, St, reverse(Kills, Acc))
      end;
  trim([I|Is], St, Acc) ->
  
negative.code:     {Reg,reverse(Is)};
  take_last_dead_1(_) -> none.
  
  save_recipe(Ks, Trim, Moves, {MaxCost,Acc}=Recipes) ->
      case recipe_cost(Ks, Moves) of
          Cost when Cost =< MaxCost ->
              %% The price is right.
              {MaxCost,[{Ks,Trim,Moves}|Acc]};
  	_Cost ->
              %% Too expensive.
              Recipes
      end.
  
  recipe_cost(Ks, Moves) ->
      %% We estimate that a {move,{y,_},{y,_}} instruction is roughly twice as
      %% expensive as a {kill,{y,_}} instruction. A {trim,_} instruction is
      %% roughly as expensive as a {kill,{y,_}} instruction.
  
      recipe_cost_1(Ks, 1+2*length(Moves)).
  
  recipe_cost_1([{kill,_}|Ks], Cost) ->
      recipe_cost_1(Ks, Cost+1);
  recipe_cost_1([_|Ks], Cost) ->
      recipe_cost_1(Ks, Cost);
  recipe_cost_1([], Cost) -> Cost.
  
  %% try_remap([Recipe], [Instruction], FrameSize) ->
  %%           {[Instruction],[TrimInstruction]}.
  %%  Try to renumber Y registers in the instruction stream. The
  %%  first rececipe that works will be used.
  %%
  %%  This function will issue a `not_possible` exception if none
  %%  of the recipes were possible to apply.
  
  try_remap([R|Rs], Is, FrameSize) ->
      {TrimInstr,Map} = expand_recipe(R, FrameSize),
      try
  	{remap(Is, Map, []),TrimInstr}
      catch
  	throw:not_possible ->
  	    try_remap(Rs, Is, FrameSize)
      end;
  try_remap([], _, _) -> throw(not_possible).
  
  expand_recipe({Layout,Trim,Moves}, FrameSize) ->
      Kills = [Kill || {kill,_}=Kill <- Layout],
      {Kills++reverse(Moves, [{trim,Trim,FrameSize-Trim}]),create_map(Trim, Moves)}.
  
  