(** Translation of [switch] statements *)

Inductive Rint: Z -> val -> Prop :=
  | Rint_intro: forall n, Rint (Int.unsigned n) (Vint n).(** Translation of [switch] statements *)

Inductive Rint: Z -> val -> Prop :=
  | Rint_intro: forall n, Rint (Int.unsigned n) (Vint n).Inductive Rlong: Z -> val -> Prop :=
  | Rlong_intro: forall n, Rlong (Int64.unsigned n) (Vlong n).Inductive Rlong: Z -> val -> Prop :=
  | Rlong_intro: forall n, Rlong (Int64.unsigned n) (Vlong n).

(* Specifications: *)
Lemma sel_switch_correct_rec: forall sp e m varg i x, R i varg -> forall t arg le, wf_comptree modulus t -> nth_error le arg = Some varg -> comptree_match modulus i t = Some x -> eval_exitexpr tge sp e m le (sel_switch make_cmp_eq make_cmp_ltu make_sub make_to_int arg t) x.
Lemma sel_switch_correct: forall dfl cases arg sp e m varg i t le, validate_switch modulus dfl cases t = true -> eval_expr tge sp e m le arg varg -> R i varg -> 0 <= i < modulus -> eval_exitexpr tge sp e m le (XElet arg (sel_switch make_cmp_eq make_cmp_ltu make_sub make_to_int O t)) (switch_target i dfl cases).
Lemma sel_switch_int_correct: forall dfl cases arg sp e m i t le, validate_switch Int.modulus dfl cases t = true -> eval_expr tge sp e m le arg (Vint i) -> eval_exitexpr tge sp e m le (XElet arg (sel_switch_int O t)) (switch_target (Int.unsigned i) dfl cases).
Lemma sel_switch_long_correct: forall dfl cases arg sp e m i t le, validate_switch Int64.modulus dfl cases t = true -> eval_expr tge sp e m le arg (Vlong i) -> eval_exitexpr tge sp e m le (XElet arg (sel_switch_long O t)) (switch_target (Int64.unsigned i) dfl cases).