(*Clight-specific Imports*)
Require Export VST.veric.lift.
Require Export VST.veric.mpred.
Fixpoint modifiedvars' (c: statement) (S: idset) : idset :=
match c with
| Sset id e => insert_idset id S
| Sifthenelse _ c1 c2 => modifiedvars' c1 (modifiedvars' c2 S)
| Scall (Some id) _ _ => insert_idset id S
| Sbuiltin (Some id) _ _ _ => insert_idset id S
| Ssequence c1 c2 =>  modifiedvars' c1 (modifiedvars' c2 S)
| Sloop c1 c2 => modifiedvars' c1 (modifiedvars' c2 S)
| Sswitch e cs => modifiedvars_ls cs S
| Slabel _ c => modifiedvars' c S
| _ => S
end
with
modifiedvars_ls (cs: labeled_statements) (S: idset) : idset :=
match cs with
| LSnil => S
| LScons _ c ls => modifiedvars' c (modifiedvars_ls ls S)
end.
Definition isOK {A} (P: Errors.res A) := match P with Errors.OK _ => true | _ => false end.

Lemma modifiedvars'_union:
forall id c S,
isSome ((modifiedvars' c S) ! id) <->
(isSome ((modifiedvars' c idset0) ! id ) \/ isSome (S ! id))
with modifiedvars_ls_union:
forall id c S,
isSome ((modifiedvars_ls c S) ! id) <->
(isSome ((modifiedvars_ls c idset0) ! id ) \/ isSome (S ! id)).