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.
Program Fixpoint chars_of_nat n { measure n } : list int :=
match (n / 10)%nat with
| O => [Int.repr (Z.of_nat n + char0)]
| n' => chars_of_nat n' ++ [Int.repr (Z.of_nat (n mod 10) + char0)]
end.
Next Obligation.
Opaque bind.
Opaque Nat.div Nat.modulo.

(* Specifications: *)
Lemma intr_eq : forall n, intr n =
match n with
| O => []
| _ => intr (n / 10) ++ [Int.repr (Z.of_nat (n mod 10) + char0)]
end.