Section CLEANUP.
Variables prog tprog: program.
Hypothesis TRANSL: match_prog prog tprog.
Let ge := Genv.globalenv prog.
Let tge := Genv.globalenv tprog.
Proof (Genv.find_symbol_transf TRANSL).
Proof (Genv.senv_transf TRANSL).
Proof (Genv.find_funct_transf TRANSL).
Proof (Genv.find_funct_ptr_transf TRANSL).
(** Correctness of [labels_branched_to]. *)
Definition instr_branches_to (i: instruction) (lbl: label) : Prop :=
match i with
| Lgoto lbl' => lbl = lbl'
| Lcond cond args lbl' => lbl = lbl'
| Ljumptable arg tbl => In lbl tbl
| _ => False
end.
Remark add_label_branched_to_incr:
forall ls i, Labelset.Subset ls (add_label_branched_to ls i).
Remark add_label_branched_to_contains:
forall ls i lbl,
instr_branches_to i lbl ->
Labelset.In lbl (add_label_branched_to ls i).
(** Commutation with [find_label]. *)

Corollary find_label_translated:
forall f i c' lbl c,
incl (i :: c') (fn_code f) ->
find_label lbl (fn_code f) = Some c ->
instr_branches_to i lbl ->
find_label lbl (fn_code (transf_function f)) =
Some (remove_unused_labels (labels_branched_to (fn_code f)) c).