Local Open Scope logic.
Record module {reptype: Type} :=  {
mf_rep: reptype;
mf_Gimport: list (ident*funspec);
mf_Gexport :  list (reptype -> ident*funspec);
mf_Gintern :  list (reptype -> ident*funspec);
mf_G' :=  map (fun f => f mf_rep)
(mf_Gexport ++ mf_Gintern);
mf_G := mf_Gimport ++ mf_G';
mf_V : varspecs;
mf_funs: list (ident * fundef);
mf_funs_correct: forall (Espec: OracleKind),
semax_func mf_V mf_G mf_funs mf_G'
}.
Definition builtins:  list (ident * globdef fundef type) :=
((___builtin_fabs,
Gfun(External (EF_builtin ___builtin_fabs
(mksignature (AST.Tfloat :: nil) (Some AST.Tfloat)))
(Tcons tdouble Tnil) tdouble)) ::
(___builtin_memcpy_aligned,
Gfun(External (EF_builtin ___builtin_memcpy_aligned
(mksignature
(AST.Tint :: AST.Tint :: AST.Tint :: AST.Tint :: nil)
None))
(Tcons (tptr tvoid)
(Tcons (tptr tvoid) (Tcons tuint (Tcons tuint Tnil)))) tvoid)) ::
(___builtin_annot_intval,
Gfun(External (EF_builtin ___builtin_annot_intval
(mksignature (AST.Tint :: AST.Tint :: nil)
(Some AST.Tint)))
(Tcons (tptr tschar) (Tcons tint Tnil)) tint)) :: nil).
Definition Gbuiltins := do_builtins builtins.
Fixpoint varspecs_sub (al bl: varspecs) : bool :=
match al, bl with
| (a,v)::al', (b,w)::bl' =>
match Pos.compare a b
with Lt => false
| Eq => if eqb_type v w then varspecs_sub al' bl' else false
| Gt => varspecs_sub al' bl
end
| nil, _ => true
| _::_, _ => false
end.
Fixpoint funspecs_sub (al bl: funspecs) : Prop :=
match al, bl with
| (a,v)::al', (b,w)::bl' =>
match Pos.compare a b
with Lt => False
| Eq => v=w /\ funspecs_sub al' bl'
| Gt => funspecs_sub al' bl
end
| nil, _ => True
| _::_, _ => False
end.
Admitted.
Ltac next_module H :=
first
[ apply semax_func_cons; [ reflexivity | apply H | ]
| eapply semax_func_app;
[apply H | | reflexivity | reflexivity
|   try apply varspecs_sub_refl; try reflexivity
|   try apply varspecs_sub_refl; try reflexivity
|   try apply funspecs_sub_refl; try (repeat split; simpl; auto)
|   try apply funspecs_sub_refl; try (repeat split; simpl; auto)
]
].
(**************************************************************)
Instance QS: listspec t_struct_elem _next.
Admitted.
Admitted.

Lemma body_fifo_get: semax_body V G f_fifo_get (fifo_get_spec fifo).