Instance CompSpecs : compspecs. make_compspecs prog. Defined.
Definition Vprog : varspecs. mk_varspecs prog. Defined.
Definition putchar_spec := DECLARE _putchar putchar_spec.
Definition getchar_spec := DECLARE _getchar getchar_spec.
Definition getchar_blocking_spec :=
DECLARE _getchar_blocking
WITH k : byte -> IO_itree
PRE [ ]
PROP ()
LOCAL ()
SEP (ITREE (r <- read stdin;; k r))
POST [ tint ]
EX i : byte,
PROP ()
LOCAL (temp ret_temp (Vubyte i))
SEP (ITREE (k i)).
Definition putchar_blocking_spec :=
DECLARE _putchar_blocking
WITH c : byte, k : IO_itree
PRE [ _c OF tint ]
PROP ()
LOCAL (temp _c (Vubyte c))
SEP (ITREE (r <- write stdout c ;; k))
POST [ tint ]
PROP ()
LOCAL (temp ret_temp (Vubyte c))
SEP (ITREE k).

Lemma div_10_dec : forall n, 0 < n ->
(Z.to_nat (n / 10) < Z.to_nat n)%nat.