anchor.diff:            undefined ->
                 Apply;
             Vid ->
  -              true = lists:member('V', Flags),  %% sanity check
                 ?CALL(setelement, [?INTEGER(3), Apply, ?INTEGER(Vid)])
         end]}.
   
  
positive.code: 
  %% ===========================================================================
  %% ===========================================================================
  
  choose(true, X, _)  -> X;
  choose(false, _, X) -> X.
  
  get_value(Key, Plist) ->
      proplists:get_value(Key, Plist, []).
  
negative.code: avp_header(Spec) ->
      Native = get_value(avp_types, Spec),
      Imported = get_value(import_avps, Spec),
      Vid = orddict:find(vendor, Spec),
  
      Vs = lists:flatmap(fun({V,Ns}) -> [{N,V} || N <- Ns] end,
                         get_value(avp_vendor_id, Spec)),
  
      lists:flatmap(fun(A) -> c_avp_header(A, Vs, Vid) end,
                    Native ++ Imported).
  
  c_avp_header({Name, Code, _Type, Flags}, Vs, Vid) ->
      [{?clause, [?Atom(Name)],
        [],
        [?TERM({Code, encode_avp_flags(Flags), vid(Name, Flags, Vs, Vid)})]}];
  
  c_avp_header({Mod, Avps}, Vs, _Vid) ->
      lists:map(fun(A) -> c_imported_avp_header(A, Mod, Vs) end, Avps).
  
  %% Note that avp_vendor_id in the inherited dictionary is ignored. The
  %% value must be changed in the inheriting dictionary. This is
  %% consistent with the semantics of avp_name/2.
  c_imported_avp_header({Name, _Code, _Type, _Flags}, Mod, Vs) ->
      Apply = ?APPLY(Mod, avp_header, [?Atom(Name)]),
      {?clause, [?Atom(Name)],
       [],
  