Definition maybe_retval (Q: environ -> mpred) retty ret :=
match ret with
| Some id => fun rho => Q (get_result1 id rho)
| None =>
match retty with
| Tvoid => (fun rho => Q (globals_only rho))
| _ => fun rho => EX v: val, Q (make_args (ret_temp::nil) (v::nil) rho)
end
end.

(* Specifications: *)
Lemma VALspec_range_free:
forall n b phi1 jm,
app_pred (VALspec_range n Share.top (b, 0)) phi1 ->
join_sub phi1 (m_phi jm) ->
{m' | free (m_dry jm) b 0 n = Some m' }.
Lemma Forall_filter: forall {A} P (l: list A) f, Forall P l -> Forall P (filter f l).
Lemma can_free_list:
forall Delta F f jm ge ve te
(NOREP: list_norepet (map (@fst _ _) (fn_vars f)))
(COMPLETE: Forall (fun it => complete_type cenv_cs (snd it) = true) (fn_vars f))
(HGG:  genv_cenv ge = cenv_cs),
guard_environ (func_tycontext' f Delta) (Some f)
(construct_rho (filter_genv ge) ve te) ->
(F * stackframe_of f (construct_rho (filter_genv ge)ve te))%pred (m_phi jm) ->
exists m2, free_list (m_dry jm) (blocks_of_env ge ve) = Some m2.
Lemma necR_m_dry':
forall jm jm', m_dry jm = m_dry jm' ->
(necR (m_phi jm) (m_phi jm')) ->
necR jm jm'.
Lemma age_juicy_mem_i:
forall jm jm', m_dry jm = m_dry jm' ->
age (m_phi jm) (m_phi jm') ->
age jm jm'.
Lemma free_juicy_mem_resource_decay:
forall jm b lo hi m' jm'
(H : free (m_dry jm) b lo hi = Some m')
(H0 : forall ofs : Z,  lo <= ofs < hi ->
perm_of_res (m_phi jm @ (b, ofs)) = Some Freeable),
free_juicy_mem jm m' b lo hi H = jm' ->
resource_decay (nextblock (m_dry jm)) (m_phi jm) (m_phi jm').
Lemma free_list_resource_decay:
forall bl jm jm',
free_list_juicy_mem jm bl jm' ->
resource_decay (nextblock (m_dry jm)) (m_phi jm) (m_phi jm').