anchor.diff:  	setelement(1, setelement(2, setelement(3, AnotherTuple, gurka),
   				 3.0), 93748793749387837476555412),
   
  +    NewNewTuple = set_literal_tuple_elements(NewTuple),
  +    verify_set_elements(1, NewNewTuple),
  +
       ok.
   
   set_all_elements(Tuple, Pos) when Pos =< size(Tuple) ->
       set_all_elements(setelement(Pos, Tuple, Pos+7), Pos+1);
   set_all_elements(Tuple, Pos) when Pos > size(Tuple) ->
       Tuple.
  +
  +set_literal_tuple_elements(Tuple0) when tuple_size(Tuple0) =:= 16385 ->
  +    %% Since the tuple size is known, the setelement/3 calls will be
  +    %% rewritten to set_tuple_element instructions.
  +    Tuple1 = setelement(16385, Tuple0, -16385),
  +    Tuple2 = setelement(16384, Tuple1, -16384),
  +
  +    Tuple3 = setelement(8192, Tuple2, -8192),
  +    Tuple4 = setelement(8191, Tuple3, -8191),
  +
  +    Tuple5 = setelement(4096, Tuple4, -4096),
  +    Tuple6 = setelement(4095, Tuple5, -4095),
  +
  +    Tuple7 = setelement(2048, Tuple6, -2048),
  +    Tuple8 = setelement(2047, Tuple7, -2047),
  +
  +    Tuple9 = setelement(1024, Tuple8, -1024),
  +    Tuple10 = setelement(1023, Tuple9, -1023),
  +
  +    Tuple11 = setelement(512, Tuple10, -512),
  +    Tuple12 = setelement(511, Tuple11, -511),
  +
  +    Tuple13 = setelement(256, Tuple12, -256),
  +    Tuple14 = setelement(255, Tuple13, -255),
  +
  +    Tuple15 = setelement(128, Tuple14, -128),
  +    Tuple16 = setelement(127, Tuple15, -127),
  +
  +    Tuple17 = setelement(64, Tuple16, -64),
  +    Tuple18 = setelement(63, Tuple17, -63),
  +
  +    Tuple19 = setelement(32, Tuple18, -32),
  +    Tuple20 = setelement(31, Tuple19, -31),
  +
  +    Tuple21 = setelement(16, Tuple20, -16),
  +    Tuple22 = setelement(15, Tuple21, -15),
  +
  +    Tuple23 = setelement(8, Tuple22, -8),
  +    Tuple24 = setelement(7, Tuple23, -7),
  +
  +    Tuple25 = setelement(4, Tuple24, -4),
  +    Tuple26 = setelement(3, Tuple25, -3),
  +
  +    Tuple27 = setelement(2, Tuple26, -2),
  +    setelement(1, Tuple27, -1).
  +
  +verify_set_elements(16385, Tuple) ->
  +    -16385 = element(16385, Tuple),
  +    ok;
  +verify_set_elements(N, Tuple) ->
  +    El = element(N, Tuple),
  +    if
  +        El =:= N + 7 ->
  +            true = not (is_power_of_two(N + 1) andalso is_power_of_two(N)),
  +            verify_set_elements(N + 1, Tuple);
  +        El =:= -N ->
  +            true = is_power_of_two(N + 1) orelse is_power_of_two(N),
  +            verify_set_elements(N + 1, Tuple);
  +        true ->
  +            io:format("element(~p) =:= ~p\n", [N,El]),
  +            ct:fail(bad_element)
  +    end.
  +
  +is_power_of_two(N) ->
  +    N band (N - 1) =:= 0.
   
   %% Tests list_to_tuple/1.
   
  
positive.code:     get_elements(Rest, Tuple, Pos+1);
  get_elements([], _Tuple, _Pos) ->
      ok.
      
  %% Tests set_element/3.
  
  t_setelement(Config) when is_list(Config) ->
  
negative.code:     {x,2} = setelement(1, id({1,2}), x),
      {1,x} = setelement(2, id({1,2}), x),
  
      Tuple = list_to_tuple(lists:duplicate(16385, x)),
      NewTuple = set_all_elements(Tuple, 1),
      NewTuple = list_to_tuple(lists:seq(1+7, 16385+7)),
  
      {'EXIT', {badarg, _}} = (catch setelement(0, {a, b}, x)),
      {'EXIT', {badarg, _}} = (catch setelement(3, {a, b}, x)),
  