anchor.diff:  gen_init(Fs, Regs, Y, Acc) ->
       gen_init(Fs, Regs bsr 1, Y+1, Acc).
   
  -%% init_yreg(Instructions, RegSet) -> RegSetInitialized
  -%%  Calculate the set of initialized y registers.
  -
  -init_yreg([{set,_,_,{bif,_,_}}|_], Reg) -> Reg;
  -init_yreg([{set,_,_,{alloc,_,{gc_bif,_,_}}}|_], Reg) -> Reg;
  -init_yreg([{set,_,_,{alloc,_,{put_map,_,_}}}|_], Reg) -> Reg;
  -init_yreg([{set,Ds,_,_}|Is], Reg) -> init_yreg(Is, add_yregs(Ds, Reg));
  -init_yreg(_Is, Reg) -> Reg.
  -
  -add_yregs(Ys, Reg) -> foldl(fun(Y, R0) -> add_yreg(Y, R0) end, Reg, Ys).
  -    
  -add_yreg({y,Y}, Reg) -> Reg bor (1 bsl Y);
  -add_yreg(_, Reg)     -> Reg.
  +init_yregs(Y, Is, D) when Y >= 0 ->
  +    case beam_utils:is_killed({y,Y}, Is, D) of
  +        true ->
  +            (1 bsl Y) bor init_yregs(Y-1, Is, D);
  +        false ->
  +            init_yregs(Y-1, Is, D)
  +    end;
  +init_yregs(_, _, _) -> 0.
   
   count_ones(Bits) -> count_ones(Bits, 0).
   count_ones(0, Acc) -> Acc;
  
positive.code: 	    no
      end.
  
  %% opt_alloc(Instructions) -> Instructions'
  %%  Optimises all allocate instructions.
  
  opt_alloc([{set,[],[],{alloc,Live0,Info0}},
  	   {set,[],[],{alloc,Live,Info}}|Is]) ->
      Live = Live0,				%Assertion.
      Alloc = combine_alloc(Info0, Info),
      I = {set,[],[],{alloc,Live,Alloc}},
      opt_alloc([I|Is]);
  opt_alloc([{set,[],[],{alloc,R,{_,Ns,Nh,[]}}}|Is]) ->
      [{set,[],[],opt_alloc(Is, Ns, Nh, R)}|Is];
  opt_alloc([I|Is]) -> [I|opt_alloc(Is)];
  opt_alloc([]) -> [].
  
  combine_alloc({_,Ns,Nh1,Init}, {_,nostack,Nh2,[]})  ->
      {zero,Ns,beam_utils:combine_heap_needs(Nh1, Nh2),Init}.
  	
  %% opt_alloc(Instructions, FrameSize, HeapNeed, LivingRegs) -> [Instr]
  %%  Generates the optimal sequence of instructions for
  %%  allocating and initalizing the stack frame and needed heap.
  
  opt_alloc(_Is, nostack, Nh, LivingRegs) ->
      {alloc,LivingRegs,{nozero,nostack,Nh,[]}};
  opt_alloc(Is, Ns, Nh, LivingRegs) ->
      InitRegs = init_yreg(Is, 0),
      case count_ones(InitRegs) of
  	N when N*2 > Ns ->
  	    {alloc,LivingRegs,{nozero,Ns,Nh,gen_init(Ns, InitRegs)}};
  
negative.code:         Is4 = move_allocates(Is3),
          Is5 = beam_utils:live_opt(Is4),
          Is6 = opt_blocks(Is5),
          Is7 = beam_utils:delete_live_annos(Is6),
          Is = opt_allocs(Is7),
  
          %% Done.
          {function,Name,Arity,CLabel,Is}
  