Instance CompSpecs : compspecs. make_compspecs prog. Defined.
Definition Vprog : varspecs. mk_varspecs prog. Defined.
Fixpoint fib_of_nat (n: nat): Z :=
match n with
| O => 0
| S n' =>
match n' with
| O => 1
| S n'' => fib_of_nat n'' + fib_of_nat n'
end
end.
Definition fib_of_Z (n: Z): Z := fib_of_nat (Z.to_nat n).
Definition fib_spec fun_id :=
DECLARE fun_id
WITH n : Z
PRE  [ _n OF tint ]
PROP (0 <= n < 45) (* 50th term is too large to be a 32bit int *)
LOCAL (temp _n (Vint (Int.repr n)))
SEP ()
POST [ tint ]
PROP () LOCAL (temp ret_temp (Vint (Int.repr (fib_of_Z n))))
SEP ().
Definition Gprog : funspecs :=
ltac:(with_library prog [ fib_spec _fib_loop; fib_spec _fib_loop_save_var; fib_spec _fib_rec ]).

Lemma body_fib_loop_save_var: semax_body Vprog Gprog f_fib_loop_save_var (fib_spec _fib_loop_save_var).