Inductive match_cont (j:meminj): type -> nat -> nat -> Clight.cont -> Csharpminor.cont -> Prop :=
| match_Kstop: forall tyret nbrk ncnt,
match_cont j tyret nbrk ncnt Clight.Kstop Kstop
| match_Kseq: forall tyret nbrk ncnt s k ts tk,
transl_statement tyret nbrk ncnt s = OK ts ->
match_cont j tyret nbrk ncnt k tk ->
match_cont j tyret nbrk ncnt
(Clight.Kseq s k)
(Kseq ts tk)
| match_Kloop1: forall tyret s1 s2 k ts1 ts2 nbrk ncnt tk,
transl_statement tyret 1%nat 0%nat s1 = OK ts1 ->
transl_statement tyret 0%nat (S ncnt) s2 = OK ts2 ->
match_cont j tyret nbrk ncnt k tk ->
match_cont j tyret 1%nat 0%nat
(Clight.Kloop1 s1 s2 k)
(Kblock (Kseq ts2 (Kseq (Sloop (Sseq (Sblock ts1) ts2)) (Kblock tk))))
| match_Kloop2: forall tyret s1 s2 k ts1 ts2 nbrk ncnt tk,
transl_statement tyret 1%nat 0%nat s1 = OK ts1 ->
transl_statement tyret 0%nat (S ncnt) s2 = OK ts2 ->
match_cont j tyret nbrk ncnt k tk ->
match_cont j tyret 0%nat (S ncnt)
(Clight.Kloop2 s1 s2 k)
(Kseq (Sloop (Sseq (Sblock ts1) ts2)) (Kblock tk))
| match_Kswitch: forall tyret nbrk ncnt k tk,
match_cont j tyret nbrk ncnt k tk ->
match_cont j tyret 0%nat (S ncnt)
(Clight.Kswitch k)
(Kblock tk)
| match_Kcall_some: forall tyret nbrk ncnt nbrk' ncnt' f e k id tf te le tle tk,
transl_function f = OK tf ->
match_env j e te ->
match_tempenv j le tle ->
match_cont j (Clight.fn_return f) nbrk' ncnt' k tk ->
match_cont j tyret nbrk ncnt
(Clight.Kcall id f e le k)
(Kcall id tf te tle tk).

Lemma match_cont_inject_incr: forall j j' (I: inject_incr j j') tp n m k k'
(MC: match_cont j tp n m k k'), match_cont j' tp n m k k'.