Local Open Scope Z.
Local Open Scope logic.
Definition Body_final_if1 :=
(Ssequence
(Scall None
(Evar _memset (Tfunction
(Tcons (tptr tvoid)
(Tcons tint (Tcons tuint Tnil)))
(tptr tvoid) cc_default))
((Ebinop Oadd (Etempvar _p (tptr tuchar)) (Etempvar _n tuint)
(tptr tuchar)) :: (Econst_int (Int.repr 0) tint) ::
(Ebinop Osub
(Ebinop Omul (Econst_int (Int.repr 16) tint)
(Econst_int (Int.repr 4) tint) tint) (Etempvar _n tuint)
tuint) :: nil))
(Ssequence
(Sset _n (Econst_int (Int.repr 0) tint))
(Scall None
(Evar _sha256_block_data_order (Tfunction
(Tcons
(tptr t_struct_SHA256state_st)
(Tcons (tptr tvoid)
Tnil)) tvoid cc_default))
((Etempvar _c (tptr t_struct_SHA256state_st)) ::
(Etempvar _p (tptr tuchar)) :: nil)))).

Lemma final_if1:
forall (Espec : OracleKind)  (a : s256abs) (md c : val) (wsh shmd : share) (gv : globals) (r_data : list val)
(Hwsh: writable_share wsh),
sublist 0 (Zlength (s256a_data a)) r_data = map Vubyte (s256a_data a) ->
Zlength r_data = CBLOCKz ->
semax (func_tycontext f_SHA256_Final Vprog Gtot nil)
(PROP ( )
LOCAL (temp _n (Vint (Int.repr (Zlength (s256a_data a) + 1)));
temp _p (field_address t_struct_SHA256state_st [StructField _data] c);
temp _md md; temp _c c; gvars gv)
SEP (K_vector gv;
field_at wsh t_struct_SHA256state_st [StructField _h] (map Vint (s256a_regs a)) c;
field_at wsh t_struct_SHA256state_st [StructField _Nl] (Vint (lo_part (s256a_len a))) c;
field_at wsh t_struct_SHA256state_st [StructField _Nh] (Vint (hi_part (s256a_len a))) c;
field_at wsh t_struct_SHA256state_st [StructField _data]
((map Vubyte (s256a_data a) ++ [Vint (Int.repr 128)]) ++ sublist (Zlength (s256a_data a) + 1) CBLOCKz r_data) c;
field_at wsh t_struct_SHA256state_st [StructField _num]
(Vint (Int.repr (Zlength (s256a_data a)))) c; memory_block shmd 32 md))
(Sifthenelse
(Ebinop Ogt (Etempvar _n tuint)
(Ebinop Osub
(Ebinop Omul (Econst_int (Int.repr 16) tint) (Econst_int (Int.repr 4) tint) tint)
(Econst_int (Int.repr 8) tint) tint) tint) Body_final_if1 Sskip)
(normal_ret_assert (
@exp (environ -> mpred) _ _ (fun hashed': list int =>
@exp (environ -> mpred) _ _ (fun dd': list byte =>
@exp (environ -> mpred) _ _ (fun pad: Z =>
PROP  (pad=0%Z \/ dd'=nil;
Zlength dd' + 8 <= CBLOCKz;
0 <= pad < 8;
(LBLOCKz | Zlength hashed');
intlist_to_bytelist hashed' ++ dd' =
intlist_to_bytelist (s256a_hashed a) ++  (s256a_data a)
++ [Byte.repr 128%Z] ++ list_repeat (Z.to_nat pad) Byte.zero)
LOCAL
(temp _n (Vint (Int.repr (Zlength dd')));
temp _p (field_address t_struct_SHA256state_st [StructField _data] c);
temp _md md; temp _c c;
gvars gv)
SEP  (data_at wsh t_struct_SHA256state_st
(map Vint (hash_blocks init_registers hashed'),
(Vint (lo_part (s256a_len a)),
(Vint (hi_part (s256a_len a)),
(map Vubyte dd'
++ list_repeat (Z.to_nat (CBLOCKz - Zlength dd')) Vundef,
Vundef))))
c;
K_vector gv;
memory_block shmd 32 md)))))).