rewrite' alloc.
apply semax_prop; auto; intros _.
forward.
rewrite' alloc. rewrite' @sepcon_comm.  rewrite' @sepcon_assoc.
forward.
rewrite' alloc. rewrite' @sepcon_comm. do 2  rewrite' @sepcon_assoc.
forward.
forward.
rewrite lseg_eq. normalize.
apply andp_derives;  [ | apply funassert_e; reflexivity].
rewrite (sepcon_comm (allocpool _)). repeat rewrite <- sepcon_assoc.
rewrite (sepcon_comm (next (S (S (s0 a))) _)).
apply sepcon_derives; auto.
repeat rewrite sepcon_assoc. rewrite (next_gt_0 (s0 a)).
normalize.
eapply derives_trans;  [ |  eapply lseg_cons; try omega].
eapply sepcon_derives; [ apply derives_refl |].
rewrite sepcon_comm.
eapply derives_trans;  [ |  eapply lseg_cons; try omega].
eapply sepcon_derives; [ apply derives_refl |].
apply next_lseg;  omega.
Qed.

Lemma prove_LOOP: semax_body myspec LOOPspec LOOPbody.
eapply semax_pre; [intro ; call_tac; apply derives_refl | simpl ].