Section LOADSTORE_FIELD_AT.
Context {cs: compspecs}.

Lemma semax_cast_load_nth_ram_field_at :
forall {Espec: OracleKind}{cs: compspecs} n (Delta: tycontext) sh id P Q R e1 Pre
t_to t_root gfs (p v_val: val) (v_reptype: reptype (nested_field_type t_root gfs)),
typeof e1 = nested_field_type t_root gfs ->
type_is_by_value (nested_field_type t_root gfs) = true ->
type_is_volatile (nested_field_type t_root gfs) = false ->
typeof_temp Delta id = Some t_to ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |--
local (`(eq (field_address t_root gfs p)) (eval_lvalue e1)) ->
nth_error R n = Some Pre ->
cast_pointer_to_bool (nested_field_type t_root gfs) t_to = false ->
readable_share sh ->
Pre |-- field_at sh t_root gfs v_reptype p * TT ->
JMeq v_reptype v_val ->
ENTAIL Delta, PROPx P (LOCALx Q (SEPx R)) |--
(tc_lvalue Delta e1) && local (`(tc_val t_to (eval_cast (nested_field_type t_root gfs) t_to v_val))) ->
@semax cs Espec Delta (|> PROPx P (LOCALx Q (SEPx R)))
(Sset id (Ecast e1 t_to))
(normal_ret_assert
(PROPx P
(LOCALx (temp id (eval_cast (nested_field_type t_root gfs) t_to v_val) :: remove_localdef_temp id Q)
(SEPx R)))).