Local Open Scope logic.
Opaque Snuffle.Snuffle.

(* Specifications: *)
Lemma SnuffleS i l: Snuffle (S i) l = bind (Snuffle i l) (Snuffle 1). reflexivity. Qed.
Fixpoint WcontI (xs: list int) (j:nat) (l:list val):Prop :=
match j with O => Zlength l = 16
| (S n) => Zlength l = 16 /\
exists t0 t1 t2 t3,
Znth ((5 * (Z.of_nat n) + 4 * 0) mod 16) (map Vint xs) = Vint t0 /\
Znth ((5 * (Z.of_nat n) + 4 * 1) mod 16) (map Vint xs) = Vint t1 /\
Znth ((5 * (Z.of_nat n) + 4 * 2) mod 16) (map Vint xs) = Vint t2 /\
Znth ((5 * (Z.of_nat n) + 4 * 3) mod 16) (map Vint xs) = Vint t3 /\
exists wl, WcontI xs n wl /\
match Wcopyspec t0 t1 t2 t3 with
(s0,s1,s2,s3) => wlistJ' wl (Z.of_nat n) s0 s1 s2 s3 l
end
end.
Lemma WcontI_Zlength xs j l: WcontI xs j l -> Zlength l=16.
Definition array_copy3_statement:=
Sfor (Sset _m (Econst_int (Int.repr 0) tint))
(Ebinop Olt (Etempvar _m tint) (Econst_int (Int.repr 16) tint) tint)
(Ssequence
(Sset _t'19
(Ederef
(Ebinop Oadd (Evar _w (tarray tuint 16)) (Etempvar _m tint)
(tptr tuint)) tuint))
(Sassign
(Ederef
(Ebinop Oadd (Evar _x (tarray tuint 16)) (Etempvar _m tint)
(tptr tuint)) tuint) (Etempvar _t'19 tuint)))
(Sset _m
(Ebinop Oadd (Etempvar _m tint) (Econst_int (Int.repr 1) tint) tint)).
Lemma array_copy3 Espec:
forall FR c k h nonce out
i w x y t (xlist wlist:list val)
(WZ: forall m, 0<=m<16 -> exists mval, Znth m wlist =Vint mval),
@semax CompSpecs Espec
(func_tycontext f_core SalsaVarSpecs SalsaFunSpecs nil)
(PROP  ()
LOCAL  (temp _j (Vint (Int.repr 4)); temp _i (Vint (Int.repr i)); lvar _t (tarray tuint 4) t;
lvar _y (tarray tuint 16) y; lvar _x (tarray tuint 16) x;
lvar _w (tarray tuint 16) w; temp _in nonce; temp _out out; temp _c c;
temp _k k; temp _h (Vint (Int.repr h)))
SEP  (FR; data_at Tsh (tarray tuint 16) wlist w;
data_at Tsh (tarray tuint 16) xlist x))
array_copy3_statement
(normal_ret_assert
(PROP  ()
LOCAL  (temp _j (Vint (Int.repr 4)); temp _i (Vint (Int.repr i)); lvar _t (tarray tuint 4) t;
lvar _y (tarray tuint 16) y; lvar _x (tarray tuint 16) x;
lvar _w (tarray tuint 16) w; temp _in nonce; temp _out out; temp _c c;
temp _k k; temp _h (Vint (Int.repr h)))
SEP  (FR; data_at Tsh (tarray tuint 16) wlist w;
data_at Tsh (tarray tuint 16) wlist x))).