Local Open Scope nat.
Local Open Scope logic.
Definition fsig_of_funspec (fs: funspec)  :=
match fs with mk_funspec fsig _ _ _ _ _ _=> fsig end.
Local Arguments nested_field_type cs t gfs : simpl never.

Lemma call_memcpy_tuchar:  (* Uses CompSpecs from sha. *)
forall (shp : share) (tp: type) (pathp: list gfield) (lop: Z) (vp': list val) (p: val)
(shq: share) (tq: type) (pathq: list gfield) (loq: Z) (contents: list int) (q: val)
(len : Z)
(R': list mpred)
(np nq : Z)
(vp vp'': reptype (nested_field_type tp pathp))
(vq : reptype (nested_field_type tq pathq))
(e_p e_q e_n : expr)
Espec Delta P Q R,
typeof e_p = tptr tuchar ->
typeof e_q = tptr tuchar ->
typeof e_n = tuint ->
(var_types Delta) ! _memcpy = None ->
(glob_specs Delta) ! _memcpy = Some (snd memcpy_spec) ->
(glob_types Delta) ! _memcpy = Some (type_of_funspec (snd memcpy_spec)) ->
writable_share shp ->  readable_share shq ->
nested_field_type tp pathp = tarray tuchar np ->
nested_field_type tq pathq = tarray tuchar nq ->
(0 <= lop)%Z ->
(0 <= len <= Int.max_unsigned)%Z ->
(lop + len <= np)%Z ->
(0 <= loq)%Z ->  (loq + len <=  (*Zlength contents <=*) nq)%Z ->
JMeq vq (map Vint contents) ->
JMeq vp vp' ->
JMeq vp'' (splice_into_list lop (lop+len) (sublist loq (loq + len) (map Vint contents)) vp') ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |--
tc_exprlist Delta [tptr tvoid; tptr tvoid; tuint] [e_p; e_q; e_n]  &&
local (`(eq (field_address0 tp (ArraySubsc lop :: pathp) p)) (eval_expr e_p)) &&
local (`(eq (field_address0 tq (ArraySubsc loq :: pathq) q)) (eval_expr e_q)) &&
local (`(eq (Vint (Int.repr len))) (eval_expr e_n)) &&
PROP () (LOCALx Q (SEPx (field_at shp tp pathp vp p ::
field_at shq tq pathq vq q :: R'))) ->
@semax _ Espec Delta
(PROPx P (LOCALx Q (SEPx R)))
(Scall None
(Evar _memcpy
(Tfunction
(Tcons (tptr tvoid) (Tcons (tptr tvoid) (Tcons tuint Tnil)))
(tptr tvoid) cc_default))
[e_p; e_q; e_n])
(normal_ret_assert (PROPx P (LOCALx Q
(SEPx (field_at shp tp pathp vp'' p ::
field_at shq tq pathq vq q :: R'))))).