Local Open Scope logic.
Inductive repr : Z -> val -> Prop :=
| mk_repr : forall z, z >= 0 -> repr z (Vint (Int.repr z)).
Definition odd_spec :=
DECLARE _odd
WITH sh : share, z : Z, v : val
PRE [ _n OF tuint] PROP(repr z v) LOCAL (`(eq v) (eval_id _n)) SEP ()
POST [ tint ] local (`(eq (Vint (if Z.odd z then Int.one else Int.zero))) retval).
Definition even_spec :=
DECLARE _even
WITH z : Z, v : val
PRE [ _n OF tuint] PROP(repr z v) LOCAL (`(eq v) (eval_id _n)) SEP ()
POST [ tint ] local (`(eq (Vint (if Z.even z then Int.one else Int.zero))) retval).
Definition main_spec :=
DECLARE _main
WITH z : Z, v : val
PRE [ ] PROP(repr 42 v) LOCAL () SEP ()
POST [ tint ] local (`(eq (Vint (if Z.even 42 then Int.one else Int.zero))) retval).
Definition Vprog : varspecs := nil.
Definition Gprog : funspecs :=
ltac:(with_library prog [ odd_spec; even_spec; main_spec]).

Lemma body_even : semax_body Vprog Gprog f_even even_spec.