let auto_func_behaviors loc f st (_st_status, tr_status as state) =
  let event = f,st in
  let call_or_ret = 
    match st with
      | Promelaast.Call -> "call" 
      | Promelaast.Return -> "return"
  in
  Aorai_option.debug
    "func behavior for %a (%s)" Kernel_function.pretty f call_or_ret;
  let (states, trans) as auto = Data_for_aorai.getAutomata() in
    (* requires is not needed for pre_func, as it is enforced by the
       requires of the original C function itself (and the call to pre_func
       by definition the first instruction of the function).
     *)

  let post_cond =
    let called_pre =
      Logic_const.new_predicate
        (Logic_const.prel ~loc
           (Req,
            Logic_const.tvar ~loc
              (Data_for_aorai.get_logic_var Data_for_aorai.curOpStatus),
            (Logic_utils.mk_dummy_term
               (TConst (Data_for_aorai.op_status_to_cenum st))
               Cil.intType)))
    in
    let called_pre_2 =
      Logic_const.new_predicate
        (Logic_const.prel ~loc
           (Req,
            Logic_const.tvar ~loc
              (Data_for_aorai.get_logic_var Data_for_aorai.curOp),
            (Logic_utils.mk_dummy_term
               (TConst(Data_for_aorai.func_to_cenum
                         (Kernel_function.get_name f))) Cil.intType)))
    in
      (* let old_pred = Aorai_utils.mk_old_state_pred loc in *)
    [(Normal, called_pre); (Normal, called_pre_2)]
  in  
  let requires =
    if st = Promelaast.Call then [] else force_transition loc f st state
  in
  let glob_assigns = aorai_assigns loc in
  let trans_assigns = 
    action_assigns (List.filter (fun x -> tr_status.(x.numt)) trans)
  in
  let assigns = Logic_utils.concat_assigns glob_assigns trans_assigns in
  let global_behavior =
    Cil.mk_behavior ~requires ~post_cond ~assigns ()
  in
  let mk_behavior acc st =
    mk_behavior ~loc auto event state st @ acc
  in
  global_behavior :: (List.fold_left mk_behavior [] states)