Inductive asm_ev_step ge: state -> mem -> list mem_event -> state -> mem -> Prop :=
  | exec_step_internal:
      forall b ofs f i rs m1 m rs' m' T,
      rs PC = Vptr b ofs ->
      Genv.find_funct_ptr ge b = Some (Internal f) ->
      find_instr (Ptrofs.unsigned ofs) f.(fn_code) = Some i ->
      exec_instr ge f i rs m = Next rs' m' ->
      drf_instr ge (fn_code f) i rs m = Some T ->
      asm_ev_step ge (State rs m1) m T (State rs' m') m'
  | exec_step_builtin:
      forall b ofs f ef args res rs m1 m vargs t T1 T2 vres rs' m',
      rs PC = Vptr b ofs ->
      Genv.find_funct_ptr ge b = Some (Internal f) ->
      find_instr (Ptrofs.unsigned ofs) f.(fn_code) = Some (Pbuiltin ef args res) ->
      eval_builtin_args_ev _ ge rs (rs RSP) m args vargs T1 ->
      builtin_event ef m vargs T2 ->
(*      ev_elim m (T1++T2) m' ->*)
  (* Must it be the case that builtins don't produce trace events? *)
      external_call ef ge vargs m (*nil*) t vres m' ->
      rs' = nextinstr_nf
             (set_res res vres
               (undef_regs (map preg_of (destroyed_by_builtin ef)) rs)) ->
      asm_ev_step ge (State rs m1) m (T1++T2) (State rs' m') m'.Inductive asm_ev_step ge: state -> mem -> list mem_event -> state -> mem -> Prop :=
  | exec_step_internal:
      forall b ofs f i rs m1 m rs' m' T,
      rs PC = Vptr b ofs ->
      Genv.find_funct_ptr ge b = Some (Internal f) ->
      find_instr (Ptrofs.unsigned ofs) f.(fn_code) = Some i ->
      exec_instr ge f i rs m = Next rs' m' ->
      drf_instr ge (fn_code f) i rs m = Some T ->
      asm_ev_step ge (State rs m1) m T (State rs' m') m'
  | exec_step_builtin:
      forall b ofs f ef args res rs m1 m vargs t T1 T2 vres rs' m',
      rs PC = Vptr b ofs ->
      Genv.find_funct_ptr ge b = Some (Internal f) ->
      find_instr (Ptrofs.unsigned ofs) f.(fn_code) = Some (Pbuiltin ef args res) ->
      eval_builtin_args_ev _ ge rs (rs RSP) m args vargs T1 ->
      builtin_event ef m vargs T2 ->
(*      ev_elim m (T1++T2) m' ->*)
  (* Must it be the case that builtins don't produce trace events? *)
      external_call ef ge vargs m (*nil*) t vres m' ->
      rs' = nextinstr_nf
             (set_res res vres
               (undef_regs (map preg_of (destroyed_by_builtin ef)) rs)) ->
      asm_ev_step ge (State rs m1) m (T1++T2) (State rs' m') m'.Inductive asm_ev_step ge: state -> mem -> list mem_event -> state -> mem -> Prop :=
  | exec_step_internal:
      forall b ofs f i rs m1 m rs' m' T,
      rs PC = Vptr b ofs ->
      Genv.find_funct_ptr ge b = Some (Internal f) ->
      find_instr (Ptrofs.unsigned ofs) f.(fn_code) = Some i ->
      exec_instr ge f i rs m = Next rs' m' ->
      drf_instr ge (fn_code f) i rs m = Some T ->
      asm_ev_step ge (State rs m1) m T (State rs' m') m'
  | exec_step_builtin:
      forall b ofs f ef args res rs m1 m vargs t T1 T2 vres rs' m',
      rs PC = Vptr b ofs ->
      Genv.find_funct_ptr ge b = Some (Internal f) ->
      find_instr (Ptrofs.unsigned ofs) f.(fn_code) = Some (Pbuiltin ef args res) ->
      eval_builtin_args_ev _ ge rs (rs RSP) m args vargs T1 ->
      builtin_event ef m vargs T2 ->
(*      ev_elim m (T1++T2) m' ->*)
  (* Must it be the case that builtins don't produce trace events? *)
      external_call ef ge vargs m (*nil*) t vres m' ->
      rs' = nextinstr_nf
             (set_res res vres
               (undef_regs (map preg_of (destroyed_by_builtin ef)) rs)) ->
      asm_ev_step ge (State rs m1) m (T1++T2) (State rs' m') m'.

Lemma asm_ev_ax2 g (Hsafe : safe_genv g) : forall c m c' m' (CS:corestep (Asm_mem_sem g Hsafe (*hf*)) c m c' m'), exists T, asm_ev_step g c m T c' m'.