Section RESTORE_CALLEE_SAVE.
Variable j: meminj.
Variable cs: list stackframe.
Variable fb: block.
Variable sp: block.
Variable ls0: locset.
Variable m: mem.
Definition agree_unused (ls0: locset) (rs: regset) : Prop :=
forall r, ~(mreg_within_bounds b r) -> Val.inject j (ls0 (R r)) (rs r).
End RESTORE_CALLEE_SAVE.

Lemma restore_callee_save_correct:
forall m j sp ls ls0 pa ra P rs k cs fb,
m |= frame_contents j sp ls ls0 pa ra ** P ->
agree_unused j ls0 rs ->
exists rs',
star step tge
(State cs fb (Vptr sp Ptrofs.zero) (restore_callee_save fe k) rs m)
E0 (State cs fb (Vptr sp Ptrofs.zero) k rs' m)
/\ (forall r,
is_callee_save r = true -> Val.inject j (ls0 (R r)) (rs' r))
/\ (forall r,
is_callee_save r = false -> rs' r = rs r).