Definition abbreviate {A:Type} (x:A) := x.
Arguments abbreviate [A] [x].
Ltac clear_Delta :=
match goal with
| Delta := @abbreviate tycontext _ |- _ =>
first [clear Delta | clearbody Delta]
| _ => idtac
end;
match goal with
|  DS := @abbreviate (PTree.t funspec) _  |- _ =>
first [clear DS | clearbody DS]
| |- _ => idtac
end.
Ltac clear_Delta_specs :=
lazymatch goal with
|  DS := @abbreviate (PTree.t funspec) _  |- _ => clearbody DS
| |- _ => idtac
end.
Ltac findvars :=
match goal with DD: tc_environ ?Delta ?rho |- _ =>
let H := fresh in
assert (H := reflect_temps_valid _ _ DD);
try (unfold Delta in H);
cbv beta iota zeta delta [abbreviate PTree.fold PTree.prev PTree.prev_append PTree.xfold temp_types fst snd
reflect_temps reflect_temps_f] in H;
simpl in H;
repeat match goal with
(*  this clause causes some problems when interacting with make_args' | |- context [eval_var ?J ?T rho] => try fold J in H; let Name := fresh "_id" in forget (eval_var J T rho) as Name *)
| Name: name ?J |- context [eval_id ?J rho] =>
fold J in H;
clear Name;
forget (eval_id J rho) as Name
| |- context [eval_id ?J rho] =>
try fold J in H;
let Name := fresh "_id" in forget (eval_id J rho) as Name
| Name: name _ |- _ =>
clear Name
end;
repeat match type of H with
| _ (eval_id _ _) /\ _ =>  destruct H as [_ H]
| is_int _ _ ?i /\ _ => let TC := fresh "TC" in destruct H as [TC H];
let i' := fresh "id" in rename i into i';
apply is_int_e in TC; destruct TC as [i [? TC]]; subst i';
simpl in TC;
match type of TC with True => clear TC | _ => idtac end
| _ /\ _ => destruct H as [?TC H]
end;
clear H
end.

Lemma sem_cast_pointer2':
forall (v : val) (t1 t2: type),
match t1 with
| Tpointer _ _ => is_true (negb (eqb_type t1 int_or_ptr_type))
| Tint I32 _ _ => if Archi.ptr64 then False else True
| Tlong _ _ => if Archi.ptr64 then True else False
| _ => False end ->
match t2 with
| Tpointer _ _ => is_true (negb (eqb_type t2 int_or_ptr_type))
| Tint I32 _ _ => if Archi.ptr64 then False else True
| Tlong _ _ => if Archi.ptr64 then True else False
| _ => False end ->
is_pointer_or_null v -> force_val (sem_cast t1 t2 v) = v.