let action_assigns trans =
  let add_if_needed v lv (known_vars, assigns as acc) =
    if Cil_datatype.Varinfo.Set.mem v known_vars then acc
    else
      Cil_datatype.Varinfo.Set.add v known_vars,
      (Logic_const.new_identified_term lv, FromAny)::assigns
  in
  let treat_one_action acc =
    function
      | Counter_init (host,off) | Counter_incr (host,off) 
      | Copy_value ((host,off),_) ->
        let my_var = 
          match host with
            | TVar ({ lv_origin = Some v}) -> v
            | _ -> Aorai_option.fatal "Auxiliary variable is not a C global"
        in 
        let my_off = 
          match off with
            | TNoOffset -> TNoOffset
            | TIndex _ -> TIndex(Logic_const.trange (None,None), TNoOffset)
            | TField _ -> 
              Aorai_option.fatal "Unexpected offset in auxiliary variable"
        in
        add_if_needed my_var
          (Logic_const.term (TLval(host,my_off)) 
             (Cil.typeOfTermLval (host,my_off)))
          acc
      | Pebble_init(_,v,c) ->
        let cc = Extlib.the c.lv_origin in
        let cv = Extlib.the v.lv_origin in
        add_if_needed cv (Logic_const.tvar v)
          (add_if_needed cc (Logic_const.tvar c) acc)
      | Pebble_move(_,v1,_,v2) ->
        let cv1 = Extlib.the v1.lv_origin in
        let cv2 = Extlib.the v2.lv_origin in
        add_if_needed cv1 (Logic_const.tvar v1) 
          (add_if_needed cv2 (Logic_const.tvar v2) acc)
  in
  let treat_one acc tr =
    let empty_pebble = 
      match tr.start.multi_state, tr.stop.multi_state with
        | Some(_,aux), None -> 
          let caux = Extlib.the aux.lv_origin in
          add_if_needed caux (Logic_const.tvar aux) acc
        | _ -> acc
    in
    List.fold_left treat_one_action empty_pebble (snd tr.cross)
  in
  Writes 
    (snd (List.fold_left treat_one (Cil_datatype.Varinfo.Set.empty,[]) trans))