let return_value return_type kf state =
  (* Process return of function *)
  let return_type = unrollType return_type in
  match return_type with
  | TComp _ when is_fully_arithmetic return_type ->
      Cvalue_type.V.top_int, state
  | TPtr(typ,_) | (TComp _ as typ) -> begin
      let new_base =
        Leaf_Table.memo
          (fun kf ->
             let new_varinfo =
               makeGlobalVar
                 ~logic:true
                 (Cabs2cil.fresh_global
                    ("alloced_return_" ^ Kernel_function.get_name kf))
                 typ
             in
             let new_offsetmap =
               Cvalue_type.V_Offsetmap.sized_zero (memory_size ())
             in
             Cvalue_type.Default_offsetmap.create_initialized_var
               new_varinfo
               (Base.Known (Int.zero, max_bit_address ()))
               new_offsetmap)
          kf
      in
      let initial_value =
        if isIntegralType typ
        then Cvalue_type.V.top_int
        else if isFloatingType typ
        then Cvalue_type.V.top_float
        else
          Cvalue_type.V.inject_top_origin
            (Origin.Leaf (LocationSetLattice.currentloc_singleton()))
            (Cvalue_type.V.Top_Param.O.singleton new_base)
            (*top_leaf_origin ()*)
      in
      let modu = try
        if isVoidType typ then Int.one else Int_Base.project (osizeof typ)
      with Int_Base.Error_Top ->
        assert (Cvalue_type.V.is_isotropic initial_value);
        Int.one
      in
      let returned_loc =
        try
          Location_Bytes.inject
            new_base
            (Ival.filter_ge_int (Some Int.zero)
               (Ival.create_all_values
                   ~signed:true
                   ~modu
                   ~size:(sizeofpointer ())))
        with Int_Base.Error_Top ->
          Location_Bytes.inject
            new_base
            Ival.top
      in
      let state =
        Relations_type.Model.create_initial
          ~base:new_base
          ~v:initial_value ~modu:(Int.mul Int.eight modu) ~state
      in
      returned_loc, state
    end
  | TInt _ | TEnum _ ->  Cvalue_type.V.top_int, state
  | TFloat _ ->  Cvalue_type.V.top_float, state
  | TVoid _ -> Cvalue_type.V.top (* this value will never be used *), state
  | TFun _ | TNamed _ | TArray _ | TBuiltin_va_list _ -> assert false