(** ** Construction 1: allocating the stack frame at function entry *)

Ltac splitall := repeat (match goal with |- _ /\ _ => split end).

Theorem allocate_stack: forall m sz m' sp bc ge rm am, Mem.alloc m 0 sz = (m', sp) -> genv_match bc ge -> romatch bc m rm -> mmatch bc m am -> bc_nostack bc -> exists bc', bc_incr bc bc' /\ bc' sp = BCstack /\ genv_match bc' ge /\ romatch bc' m' rm /\ mmatch bc' m' mfunction_entry /\ (forall b, Plt b sp -> bc' b = bc b) /\ (forall v x, vmatch bc v x -> vmatch bc' v (Ifptr Nonstack)).