(*Generated by Sail from riscv.*)
Require Import Sail.Base.
Require Import Sail.Real.
Require Import riscv_types.
Require Import mem_metadata.
Require Import riscv_extras.
Import ListNotations.
Open Scope string.
Open Scope bool.
Open Scope Z.


Definition is_none {a : Type} (opt : option a) : bool :=
   match opt with | Some _ => false | None => true end.

Definition is_some {a : Type} (opt : option a) : bool :=
   match opt with | Some _ => true | None => false end.

Definition eq_unit (_ : unit) (_ : unit) : {_bool : bool & ArithFact (_bool)} := build_ex (true).

Definition neq_int (x : Z) (y : Z) : {_bool : bool & ArithFact (Bool.eqb (negb (x =? y)) _bool)} :=
   build_ex (negb (Z.eqb x y)).

Definition neq_bool (x : bool) (y : bool) : bool := negb (Bool.eqb x y).

Definition __id (x : Z) : {_retval : Z & ArithFact (_retval =? x)} := build_ex (x).

Definition _shl_int_general (m : Z) (n : Z) : Z :=
   if sumbool_of_bool (Z.geb n 0) then shl_int m n else shr_int m (Z.opp n).

Definition _shr_int_general (m : Z) (n : Z) : Z :=
   if sumbool_of_bool (Z.geb n 0) then shr_int m n else shl_int m (Z.opp n).

Definition fdiv_int (n : Z) (m : Z) : Z :=
   if sumbool_of_bool (andb (Z.ltb n 0) (Z.gtb m 0)) then Z.sub (Z.quot (Z.add n 1) m) 1
   else if sumbool_of_bool (andb (Z.gtb n 0) (Z.ltb m 0)) then Z.sub (Z.quot (Z.sub n 1) m) 1
   else Z.quot n m.

Definition fmod_int (n : Z) (m : Z) : Z := Z.sub n (Z.mul m (fdiv_int n m)).

Definition concat_str_bits {n : Z} (str : string) (x : mword n) : string :=
   String.append str (string_of_bits x).

Definition concat_str_dec (str : string) (x : Z) : string := String.append str (dec_str x).



Definition sail_mask {v0 : Z} (len : Z) (v : mword v0) `{ArithFact ((len >=? 0) && (v0 >=? 0))}
: mword len :=
   if sumbool_of_bool (Z.leb len (length_mword v)) then vector_truncate v len else zero_extend v len.

Definition sail_ones (n : Z) `{ArithFact (n >=? 0)} : mword n := not_vec (zeros n).

Definition slice_mask (n : Z) (i : Z) (l : Z) `{ArithFact (n >=? 0)} : mword n :=
   if sumbool_of_bool (Z.geb l n) then shiftl (sail_ones n) i
   else
     let one : bits n := sail_mask n ('b"1"  : bits 1) in
     shiftl (sub_vec (shiftl one l) one) i.

Definition read_kind_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 11))} : read_kind :=
   let l__299 := arg_ in
   if sumbool_of_bool (Z.eqb l__299 0) then Read_plain
   else if sumbool_of_bool (Z.eqb l__299 1) then Read_reserve
   else if sumbool_of_bool (Z.eqb l__299 2) then Read_acquire
   else if sumbool_of_bool (Z.eqb l__299 3) then Read_exclusive
   else if sumbool_of_bool (Z.eqb l__299 4) then Read_exclusive_acquire
   else if sumbool_of_bool (Z.eqb l__299 5) then Read_stream
   else if sumbool_of_bool (Z.eqb l__299 6) then Read_RISCV_acquire
   else if sumbool_of_bool (Z.eqb l__299 7) then Read_RISCV_strong_acquire
   else if sumbool_of_bool (Z.eqb l__299 8) then Read_RISCV_reserved
   else if sumbool_of_bool (Z.eqb l__299 9) then Read_RISCV_reserved_acquire
   else if sumbool_of_bool (Z.eqb l__299 10) then Read_RISCV_reserved_strong_acquire
   else Read_X86_locked.

Definition num_of_read_kind (arg_ : read_kind) : {e : Z & ArithFact ((0 <=? e) && (e <=? 11))} :=
   build_ex (
      match arg_ with
      | Read_plain => 0
      | Read_reserve => 1
      | Read_acquire => 2
      | Read_exclusive => 3
      | Read_exclusive_acquire => 4
      | Read_stream => 5
      | Read_RISCV_acquire => 6
      | Read_RISCV_strong_acquire => 7
      | Read_RISCV_reserved => 8
      | Read_RISCV_reserved_acquire => 9
      | Read_RISCV_reserved_strong_acquire => 10
      | Read_X86_locked => 11
      end
   ).

Definition write_kind_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 10))} : write_kind :=
   let l__289 := arg_ in
   if sumbool_of_bool (Z.eqb l__289 0) then Write_plain
   else if sumbool_of_bool (Z.eqb l__289 1) then Write_conditional
   else if sumbool_of_bool (Z.eqb l__289 2) then Write_release
   else if sumbool_of_bool (Z.eqb l__289 3) then Write_exclusive
   else if sumbool_of_bool (Z.eqb l__289 4) then Write_exclusive_release
   else if sumbool_of_bool (Z.eqb l__289 5) then Write_RISCV_release
   else if sumbool_of_bool (Z.eqb l__289 6) then Write_RISCV_strong_release
   else if sumbool_of_bool (Z.eqb l__289 7) then Write_RISCV_conditional
   else if sumbool_of_bool (Z.eqb l__289 8) then Write_RISCV_conditional_release
   else if sumbool_of_bool (Z.eqb l__289 9) then Write_RISCV_conditional_strong_release
   else Write_X86_locked.

Definition num_of_write_kind (arg_ : write_kind) : {e : Z & ArithFact ((0 <=? e) && (e <=? 10))} :=
   build_ex (
      match arg_ with
      | Write_plain => 0
      | Write_conditional => 1
      | Write_release => 2
      | Write_exclusive => 3
      | Write_exclusive_release => 4
      | Write_RISCV_release => 5
      | Write_RISCV_strong_release => 6
      | Write_RISCV_conditional => 7
      | Write_RISCV_conditional_release => 8
      | Write_RISCV_conditional_strong_release => 9
      | Write_X86_locked => 10
      end
   ).

Definition a64_barrier_domain_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 3))}
: a64_barrier_domain :=
   let l__286 := arg_ in
   if sumbool_of_bool (Z.eqb l__286 0) then A64_FullShare
   else if sumbool_of_bool (Z.eqb l__286 1) then A64_InnerShare
   else if sumbool_of_bool (Z.eqb l__286 2) then A64_OuterShare
   else A64_NonShare.

Definition num_of_a64_barrier_domain (arg_ : a64_barrier_domain)
: {e : Z & ArithFact ((0 <=? e) && (e <=? 3))} :=
   build_ex (
      match arg_ with
      | A64_FullShare => 0
      | A64_InnerShare => 1
      | A64_OuterShare => 2
      | A64_NonShare => 3
      end
   ).

Definition a64_barrier_type_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))}
: a64_barrier_type :=
   let l__284 := arg_ in
   if sumbool_of_bool (Z.eqb l__284 0) then A64_barrier_all
   else if sumbool_of_bool (Z.eqb l__284 1) then A64_barrier_LD
   else A64_barrier_ST.

Definition num_of_a64_barrier_type (arg_ : a64_barrier_type)
: {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | A64_barrier_all => 0 | A64_barrier_LD => 1 | A64_barrier_ST => 2 end).

Definition trans_kind_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : trans_kind :=
   let l__282 := arg_ in
   if sumbool_of_bool (Z.eqb l__282 0) then Transaction_start
   else if sumbool_of_bool (Z.eqb l__282 1) then Transaction_commit
   else Transaction_abort.

Definition num_of_trans_kind (arg_ : trans_kind) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (
      match arg_ with
      | Transaction_start => 0
      | Transaction_commit => 1
      | Transaction_abort => 2
      end
   ).

Definition cache_op_kind_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 10))}
: cache_op_kind :=
   let l__272 := arg_ in
   if sumbool_of_bool (Z.eqb l__272 0) then Cache_op_D_IVAC
   else if sumbool_of_bool (Z.eqb l__272 1) then Cache_op_D_ISW
   else if sumbool_of_bool (Z.eqb l__272 2) then Cache_op_D_CSW
   else if sumbool_of_bool (Z.eqb l__272 3) then Cache_op_D_CISW
   else if sumbool_of_bool (Z.eqb l__272 4) then Cache_op_D_ZVA
   else if sumbool_of_bool (Z.eqb l__272 5) then Cache_op_D_CVAC
   else if sumbool_of_bool (Z.eqb l__272 6) then Cache_op_D_CVAU
   else if sumbool_of_bool (Z.eqb l__272 7) then Cache_op_D_CIVAC
   else if sumbool_of_bool (Z.eqb l__272 8) then Cache_op_I_IALLUIS
   else if sumbool_of_bool (Z.eqb l__272 9) then Cache_op_I_IALLU
   else Cache_op_I_IVAU.

Definition num_of_cache_op_kind (arg_ : cache_op_kind)
: {e : Z & ArithFact ((0 <=? e) && (e <=? 10))} :=
   build_ex (
      match arg_ with
      | Cache_op_D_IVAC => 0
      | Cache_op_D_ISW => 1
      | Cache_op_D_CSW => 2
      | Cache_op_D_CISW => 3
      | Cache_op_D_ZVA => 4
      | Cache_op_D_CVAC => 5
      | Cache_op_D_CVAU => 6
      | Cache_op_D_CIVAC => 7
      | Cache_op_I_IALLUIS => 8
      | Cache_op_I_IALLU => 9
      | Cache_op_I_IVAU => 10
      end
   ).

Definition not_bit (b : bitU) : bitU := if eq_bit b B1 then B0 else B1.

Definition neq_vec {n : Z} (x : mword n) (y : mword n) : bool := negb (eq_vec x y).



Definition string_of_bit (b : bitU) : M (string) :=
   (match b with | B0 => returnm "0b0" | B1 => returnm "0b1" | _ => exit tt  : M (string) end)
    : M (string).

Definition get_config_print_instr '(tt : unit) : bool := false.

Definition get_config_print_reg '(tt : unit) : bool := false.

Definition get_config_print_mem '(tt : unit) : bool := false.

Definition get_config_print_platform '(tt : unit) : bool := false.

Definition EXTS {n : Z} (m : Z) (v : mword n) `{ArithFact (m >=? n)} : mword m := sign_extend v m.

Definition EXTZ {n : Z} (m : Z) (v : mword n) `{ArithFact (m >=? n)} : mword m := zero_extend v m.

Definition zeros_implicit (n : Z) `{ArithFact (n >=? 0)} : mword n := zeros n.

Definition ones (n : Z) `{ArithFact (n >=? 0)} : mword n := sail_ones n.

Definition bool_to_bits (x : bool) : mword 1 :=
   if sumbool_of_bool x then 'b"1"  : mword 1 else 'b"0"  : mword 1.

Definition bit_to_bool (b : bitU) : M (bool) :=
   (match b with | B1 => returnm true | B0 => returnm false | _ => exit tt  : M (bool) end)
    : M (bool).

Definition to_bits (l : Z) (n : Z) `{ArithFact (l >=? 0)} : mword l := get_slice_int l n 0.

Definition zopz0zI_s {n : Z} (x : mword n) (y : mword n) `{ArithFact (n >? 0)} : bool :=
   Z.ltb (projT1 (sint x)) (projT1 (sint y)).

Definition zopz0zKzJ_s {n : Z} (x : mword n) (y : mword n) `{ArithFact (n >? 0)} : bool :=
   Z.geb (projT1 (sint x)) (projT1 (sint y)).

Definition zopz0zI_u {n : Z} (x : mword n) (y : mword n) : bool :=
   Z.ltb (projT1 (uint x)) (projT1 (uint y)).

Definition zopz0zKzJ_u {n : Z} (x : mword n) (y : mword n) : bool :=
   Z.geb (projT1 (uint x)) (projT1 (uint y)).

Definition zopz0zIzJ_u {n : Z} (x : mword n) (y : mword n) : bool :=
   Z.leb (projT1 (uint x)) (projT1 (uint y)).

Definition shift_right_arith64 (v : mword 64) (shift : mword 6) : mword 64 :=
   let v128 : bits 128 := EXTS 128 v in
   subrange_vec_dec (shift_bits_right v128 shift) 63 0.

Definition shift_right_arith32 (v : mword 32) (shift : mword 5) : mword 32 :=
   let v64 : bits 64 := EXTS 64 v in
   subrange_vec_dec (shift_bits_right v64 shift) 31 0.

Axiom spc_forwards_matches : forall  (_ : unit) , bool.

Axiom spc_backwards_matches : forall  (_ : string) , bool.

Axiom opt_spc_forwards_matches : forall  (_ : unit) , bool.

Axiom opt_spc_backwards_matches : forall  (_ : string) , bool.

Axiom def_spc_forwards_matches : forall  (_ : unit) , bool.

Axiom def_spc_backwards_matches : forall  (_ : string) , bool.

Axiom hex_bits_forwards : forall {n : Z} (_ : (Z * mword n)) , string.

Axiom hex_bits_backwards : forall {n : Z} (_ : string) , (Z * mword n).

Axiom hex_bits_forwards_matches : forall {n : Z} (_ : (Z * mword n)) , bool.

Axiom hex_bits_backwards_matches : forall  (_ : string) , bool.

Axiom hex_bits_matches_prefix : forall
{n : Z}
(_ : string)
,
option (((Z * mword n) * {n : Z & ArithFact (n >=? 0)})).

Fixpoint _rec_n_leading_spaces (s : string) (_reclimit : Z) (_acc : Acc (Zwf 0) _reclimit)
{struct _acc} : M ({n : Z & ArithFact (n >=? 0)}).
exact (
   assert_exp' (Z.geb _reclimit 0) "recursion limit reached" >>= fun _ =>
   let p0_ := s in
   (if generic_eq p0_ "" then returnm (build_ex 0)
    else
      let p0_ := string_take s 1 in
      (if generic_eq p0_ " " then
         (_rec_n_leading_spaces (string_drop s 1) (Z.sub _reclimit 1) (_limit_reduces _acc)) >>= fun '(existT _ w__0 _ : {n : Z & ArithFact (n >=?
           0)}) =>
         returnm (build_ex (Z.add 1 w__0))
       else returnm (build_ex 0))
       : M ({n : Z & ArithFact (n >=? 0)}))
    : M ({n : Z & ArithFact (n >=? 0)})
).
Defined.


Definition n_leading_spaces (s : string) : M ({n : Z & ArithFact (n >=? 0)}) :=
   (_rec_n_leading_spaces s ((projT1 (string_length s))  : Z) (Zwf_guarded _))
    : M ({n : Z & ArithFact (n >=? 0)}).

Definition spc_forwards '(tt : unit) : string := " ".

Definition spc_backwards (s : string) : unit := tt.

Definition spc_matches_prefix (s : string) : M (option ((unit * {n : Z & ArithFact (n >=? 0)}))) :=
   (n_leading_spaces s) >>= fun '(existT _ n _) =>
   let l__271 := n in
   returnm (if sumbool_of_bool (Z.eqb l__271 0) then None else Some (tt, build_ex n)).

Definition opt_spc_forwards '(tt : unit) : string := "".

Definition opt_spc_backwards (s : string) : unit := tt.

Definition opt_spc_matches_prefix (s : string) : M (option ((unit * {n : Z & ArithFact (n >=? 0)}))) :=
   (n_leading_spaces s) >>= fun '(existT _ w__0 _ : {n : Z & ArithFact (n >=? 0)}) =>
   returnm (Some (tt, build_ex w__0)).

Definition def_spc_forwards '(tt : unit) : string := " ".

Definition def_spc_backwards (s : string) : unit := tt.

Definition def_spc_matches_prefix (s : string) : M (option ((unit * {n : Z & ArithFact (n >=? 0)}))) :=
   (opt_spc_matches_prefix s)  : M (option ((unit * {n : Z & ArithFact (n >=? 0)}))).

Definition hex_bits_1_forwards_matches (bv : mword 1) : bool := true.

Definition hex_bits_1_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_1_matches_prefix s) with
         | Some (g__362, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_1_backwards (s : string) : M (mword 1) :=
   (match (hex_bits_1_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 49:2 - 51:3" >>= fun _ =>
          exit tt)
        : M (mword 1)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 49:2 - 51:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 1).

Definition hex_bits_2_forwards_matches (bv : mword 2) : bool := true.

Definition hex_bits_2_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_2_matches_prefix s) with
         | Some (g__361, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_2_backwards (s : string) : M (mword 2) :=
   (match (hex_bits_2_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 68:2 - 70:3" >>= fun _ =>
          exit tt)
        : M (mword 2)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 68:2 - 70:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 2).

Definition hex_bits_3_forwards_matches (bv : mword 3) : bool := true.

Definition hex_bits_3_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_3_matches_prefix s) with
         | Some (g__360, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_3_backwards (s : string) : M (mword 3) :=
   (match (hex_bits_3_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 87:2 - 89:3" >>= fun _ =>
          exit tt)
        : M (mword 3)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 87:2 - 89:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 3).

Definition hex_bits_4_forwards_matches (bv : mword 4) : bool := true.

Definition hex_bits_4_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_4_matches_prefix s) with
         | Some (g__359, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_4_backwards (s : string) : M (mword 4) :=
   (match (hex_bits_4_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 106:2 - 108:3" >>= fun _ =>
          exit tt)
        : M (mword 4)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 106:2 - 108:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 4).

Definition hex_bits_5_forwards_matches (bv : mword 5) : bool := true.

Definition hex_bits_5_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_5_matches_prefix s) with
         | Some (g__358, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_5_backwards (s : string) : M (mword 5) :=
   (match (hex_bits_5_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 125:2 - 127:3" >>= fun _ =>
          exit tt)
        : M (mword 5)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 125:2 - 127:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 5).

Definition hex_bits_6_forwards_matches (bv : mword 6) : bool := true.

Definition hex_bits_6_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_6_matches_prefix s) with
         | Some (g__357, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_6_backwards (s : string) : M (mword 6) :=
   (match (hex_bits_6_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 144:2 - 146:3" >>= fun _ =>
          exit tt)
        : M (mword 6)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 144:2 - 146:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 6).

Definition hex_bits_7_forwards_matches (bv : mword 7) : bool := true.

Definition hex_bits_7_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_7_matches_prefix s) with
         | Some (g__356, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_7_backwards (s : string) : M (mword 7) :=
   (match (hex_bits_7_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 163:2 - 165:3" >>= fun _ =>
          exit tt)
        : M (mword 7)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 163:2 - 165:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 7).

Definition hex_bits_8_forwards_matches (bv : mword 8) : bool := true.

Definition hex_bits_8_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_8_matches_prefix s) with
         | Some (g__355, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_8_backwards (s : string) : M (mword 8) :=
   (match (hex_bits_8_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 182:2 - 184:3" >>= fun _ =>
          exit tt)
        : M (mword 8)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 182:2 - 184:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 8).

Definition hex_bits_9_forwards_matches (bv : mword 9) : bool := true.

Definition hex_bits_9_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_9_matches_prefix s) with
         | Some (g__354, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_9_backwards (s : string) : M (mword 9) :=
   (match (hex_bits_9_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 201:2 - 203:3" >>= fun _ =>
          exit tt)
        : M (mword 9)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 201:2 - 203:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 9).

Definition hex_bits_10_forwards_matches (bv : mword 10) : bool := true.

Definition hex_bits_10_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_10_matches_prefix s) with
         | Some (g__353, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_10_backwards (s : string) : M (mword 10) :=
   (match (hex_bits_10_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 220:2 - 222:3" >>= fun _ =>
          exit tt)
        : M (mword 10)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 220:2 - 222:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 10).

Definition hex_bits_11_forwards_matches (bv : mword 11) : bool := true.

Definition hex_bits_11_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_11_matches_prefix s) with
         | Some (g__352, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_11_backwards (s : string) : M (mword 11) :=
   (match (hex_bits_11_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 239:2 - 241:3" >>= fun _ =>
          exit tt)
        : M (mword 11)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 239:2 - 241:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 11).

Definition hex_bits_12_forwards_matches (bv : mword 12) : bool := true.

Definition hex_bits_12_matches_prefix (s : string)
: option ((mword 12 * {n : Z & ArithFact (n >=? 0)})) :=
   None.

Definition hex_bits_12_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_12_matches_prefix s) with
         | Some (g__351, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_12_backwards (s : string) : M (mword 12) :=
   (match (hex_bits_12_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 262:2 - 264:3" >>= fun _ =>
          exit tt)
        : M (mword 12)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 262:2 - 264:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 12).

Definition hex_bits_13_forwards_matches (bv : mword 13) : bool := true.

Definition hex_bits_13_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_13_matches_prefix s) with
         | Some (g__350, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_13_backwards (s : string) : M (mword 13) :=
   (match (hex_bits_13_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 281:2 - 283:3" >>= fun _ =>
          exit tt)
        : M (mword 13)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 281:2 - 283:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 13).

Definition hex_bits_14_forwards_matches (bv : mword 14) : bool := true.

Definition hex_bits_14_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_14_matches_prefix s) with
         | Some (g__349, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_14_backwards (s : string) : M (mword 14) :=
   (match (hex_bits_14_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 300:2 - 302:3" >>= fun _ =>
          exit tt)
        : M (mword 14)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 300:2 - 302:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 14).

Definition hex_bits_15_forwards_matches (bv : mword 15) : bool := true.

Definition hex_bits_15_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_15_matches_prefix s) with
         | Some (g__348, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_15_backwards (s : string) : M (mword 15) :=
   (match (hex_bits_15_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 319:2 - 321:3" >>= fun _ =>
          exit tt)
        : M (mword 15)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 319:2 - 321:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 15).

Definition hex_bits_16_forwards_matches (bv : mword 16) : bool := true.

Definition hex_bits_16_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_16_matches_prefix s) with
         | Some (g__347, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_16_backwards (s : string) : M (mword 16) :=
   (match (hex_bits_16_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 338:2 - 340:3" >>= fun _ =>
          exit tt)
        : M (mword 16)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 338:2 - 340:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 16).

Definition hex_bits_17_forwards_matches (bv : mword 17) : bool := true.

Definition hex_bits_17_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_17_matches_prefix s) with
         | Some (g__346, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_17_backwards (s : string) : M (mword 17) :=
   (match (hex_bits_17_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 357:2 - 359:3" >>= fun _ =>
          exit tt)
        : M (mword 17)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 357:2 - 359:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 17).

Definition hex_bits_18_forwards_matches (bv : mword 18) : bool := true.

Definition hex_bits_18_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_18_matches_prefix s) with
         | Some (g__345, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_18_backwards (s : string) : M (mword 18) :=
   (match (hex_bits_18_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 376:2 - 378:3" >>= fun _ =>
          exit tt)
        : M (mword 18)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 376:2 - 378:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 18).

Definition hex_bits_19_forwards_matches (bv : mword 19) : bool := true.

Definition hex_bits_19_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_19_matches_prefix s) with
         | Some (g__344, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_19_backwards (s : string) : M (mword 19) :=
   (match (hex_bits_19_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 395:2 - 397:3" >>= fun _ =>
          exit tt)
        : M (mword 19)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 395:2 - 397:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 19).

Definition hex_bits_20_forwards_matches (bv : mword 20) : bool := true.

Definition hex_bits_20_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_20_matches_prefix s) with
         | Some (g__343, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_20_backwards (s : string) : M (mword 20) :=
   (match (hex_bits_20_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 414:2 - 416:3" >>= fun _ =>
          exit tt)
        : M (mword 20)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 414:2 - 416:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 20).

Definition hex_bits_21_forwards_matches (bv : mword 21) : bool := true.

Definition hex_bits_21_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_21_matches_prefix s) with
         | Some (g__342, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_21_backwards (s : string) : M (mword 21) :=
   (match (hex_bits_21_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 433:2 - 435:3" >>= fun _ =>
          exit tt)
        : M (mword 21)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 433:2 - 435:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 21).

Definition hex_bits_22_forwards_matches (bv : mword 22) : bool := true.

Definition hex_bits_22_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_22_matches_prefix s) with
         | Some (g__341, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_22_backwards (s : string) : M (mword 22) :=
   (match (hex_bits_22_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 452:2 - 454:3" >>= fun _ =>
          exit tt)
        : M (mword 22)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 452:2 - 454:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 22).

Definition hex_bits_23_forwards_matches (bv : mword 23) : bool := true.

Definition hex_bits_23_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_23_matches_prefix s) with
         | Some (g__340, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_23_backwards (s : string) : M (mword 23) :=
   (match (hex_bits_23_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 471:2 - 473:3" >>= fun _ =>
          exit tt)
        : M (mword 23)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 471:2 - 473:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 23).

Definition hex_bits_24_forwards_matches (bv : mword 24) : bool := true.

Definition hex_bits_24_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_24_matches_prefix s) with
         | Some (g__339, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_24_backwards (s : string) : M (mword 24) :=
   (match (hex_bits_24_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 490:2 - 492:3" >>= fun _ =>
          exit tt)
        : M (mword 24)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 490:2 - 492:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 24).

Definition hex_bits_25_forwards_matches (bv : mword 25) : bool := true.

Definition hex_bits_25_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_25_matches_prefix s) with
         | Some (g__338, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_25_backwards (s : string) : M (mword 25) :=
   (match (hex_bits_25_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 509:2 - 511:3" >>= fun _ =>
          exit tt)
        : M (mword 25)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 509:2 - 511:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 25).

Definition hex_bits_26_forwards_matches (bv : mword 26) : bool := true.

Definition hex_bits_26_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_26_matches_prefix s) with
         | Some (g__337, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_26_backwards (s : string) : M (mword 26) :=
   (match (hex_bits_26_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 528:2 - 530:3" >>= fun _ =>
          exit tt)
        : M (mword 26)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 528:2 - 530:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 26).

Definition hex_bits_27_forwards_matches (bv : mword 27) : bool := true.

Definition hex_bits_27_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_27_matches_prefix s) with
         | Some (g__336, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_27_backwards (s : string) : M (mword 27) :=
   (match (hex_bits_27_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 547:2 - 549:3" >>= fun _ =>
          exit tt)
        : M (mword 27)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 547:2 - 549:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 27).

Definition hex_bits_28_forwards_matches (bv : mword 28) : bool := true.

Definition hex_bits_28_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_28_matches_prefix s) with
         | Some (g__335, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_28_backwards (s : string) : M (mword 28) :=
   (match (hex_bits_28_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 566:2 - 568:3" >>= fun _ =>
          exit tt)
        : M (mword 28)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 566:2 - 568:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 28).

Definition hex_bits_29_forwards_matches (bv : mword 29) : bool := true.

Definition hex_bits_29_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_29_matches_prefix s) with
         | Some (g__334, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_29_backwards (s : string) : M (mword 29) :=
   (match (hex_bits_29_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 585:2 - 587:3" >>= fun _ =>
          exit tt)
        : M (mword 29)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 585:2 - 587:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 29).

Definition hex_bits_30_forwards_matches (bv : mword 30) : bool := true.

Definition hex_bits_30_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_30_matches_prefix s) with
         | Some (g__333, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_30_backwards (s : string) : M (mword 30) :=
   (match (hex_bits_30_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 604:2 - 606:3" >>= fun _ =>
          exit tt)
        : M (mword 30)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 604:2 - 606:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 30).

Definition hex_bits_31_forwards_matches (bv : mword 31) : bool := true.

Definition hex_bits_31_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_31_matches_prefix s) with
         | Some (g__332, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_31_backwards (s : string) : M (mword 31) :=
   (match (hex_bits_31_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 623:2 - 625:3" >>= fun _ =>
          exit tt)
        : M (mword 31)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 623:2 - 625:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 31).

Definition hex_bits_32_forwards_matches (bv : mword 32) : bool := true.

Definition hex_bits_32_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_32_matches_prefix s) with
         | Some (g__331, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_32_backwards (s : string) : M (mword 32) :=
   (match (hex_bits_32_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 642:2 - 644:3" >>= fun _ =>
          exit tt)
        : M (mword 32)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 642:2 - 644:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 32).

Definition hex_bits_33_forwards_matches (bv : mword 33) : bool := true.

Definition hex_bits_33_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_33_matches_prefix s) with
         | Some (g__330, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_33_backwards (s : string) : M (mword 33) :=
   (match (hex_bits_33_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 661:2 - 663:3" >>= fun _ =>
          exit tt)
        : M (mword 33)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 661:2 - 663:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 33).

Definition hex_bits_48_forwards_matches (bv : mword 48) : bool := true.

Definition hex_bits_48_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_48_matches_prefix s) with
         | Some (g__329, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_48_backwards (s : string) : M (mword 48) :=
   (match (hex_bits_48_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 680:2 - 682:3" >>= fun _ =>
          exit tt)
        : M (mword 48)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 680:2 - 682:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 48).

Definition hex_bits_64_forwards_matches (bv : mword 64) : bool := true.

Definition hex_bits_64_backwards_matches (s : string) : bool :=
   match s with
   | s =>
      if match (hex_bits_64_matches_prefix s) with
         | Some (g__328, existT _ n _) =>
            if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then true else false
         | _ => false
         end then
        true
      else false
   end.

Definition hex_bits_64_backwards (s : string) : M (mword 64) :=
   (match (hex_bits_64_matches_prefix s) with
    | Some (bv, existT _ n _) =>
       (if sumbool_of_bool (Z.eqb n (projT1 (string_length s))) then returnm bv
        else
          assert_exp' false "Pattern match failure at model/prelude_mapping.sail 699:2 - 701:3" >>= fun _ =>
          exit tt)
        : M (mword 64)
    | _ =>
       assert_exp' false "Pattern match failure at model/prelude_mapping.sail 699:2 - 701:3" >>= fun _ =>
       exit tt
    end)
    : M (mword 64).

Definition default_meta : mem_meta := tt.
Hint Unfold default_meta : sail.
Definition __WriteRAM_Meta (addr : mword 32) (width : Z) (meta : unit) : M (unit) := returnm tt.

Definition __ReadRAM_Meta (addr : mword 32) (width : Z) : M (unit) := returnm tt.



Definition write_ram_ea (wk : write_kind) (addr : mword 32) (width : Z)
`{ArithFact ((0 <? width) && (width <=? 16))}
: M (unit) :=
   (write_mem_ea wk 32 addr width)  : M (unit).



Axiom __TraceMemoryWrite : forall {m : Z} (n : Z) (_ : mword m) (_ : mword (8 * n)) , unit.

Axiom __TraceMemoryRead : forall {m : Z} (n : Z) (_ : mword m) (_ : mword (8 * n)) , unit.

Definition init_ext_ptw : ext_ptw := tt.
Hint Unfold init_ext_ptw : sail.
Definition ext_translate_exception (e : unit) : unit := e.

Definition ext_exc_type_to_bits (e : unit) : mword 8 := Ox"18"  : mword 8.

Definition num_of_ext_exc_type (e : unit) : {n : Z & ArithFact ((0 <=? n) && (n <? xlen))} :=
   build_ex (24).

Definition ext_exc_type_to_str (e : unit) : string := "extension-exception".

Definition xlen_val := 32.
Hint Unfold xlen_val : sail.
Definition xlen_max_unsigned := Z.sub (projT1 (pow2 32)) 1.
Hint Unfold xlen_max_unsigned : sail.
Definition xlen_max_signed := Z.sub (projT1 (pow2 (Z.sub 32 1))) 1.
Hint Unfold xlen_max_signed : sail.
Definition xlen_min_signed := Z.sub 0 (projT1 (pow2 (Z.sub 32 1))).
Hint Unfold xlen_min_signed : sail.
Definition regidx_to_regno (b : mword 5) : {n : Z & ArithFact ((0 <=? n) && (n <? 32))} :=
   build_ex (
      let r := projT1 (uint b) in
      r
   ).

Definition creg2reg_idx (creg : mword 3) : mword 5 := concat_vec ('b"01"  : mword 2) creg.

Definition zreg : regidx := 'b"00000"  : mword 5.
Hint Unfold zreg : sail.
Definition ra : regidx := 'b"00001"  : mword 5.
Hint Unfold ra : sail.
Definition sp : regidx := 'b"00010"  : mword 5.
Hint Unfold sp : sail.
Definition Architecture_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : Architecture :=
   let l__269 := arg_ in
   if sumbool_of_bool (Z.eqb l__269 0) then RV32
   else if sumbool_of_bool (Z.eqb l__269 1) then RV64
   else RV128.

Definition num_of_Architecture (arg_ : Architecture) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | RV32 => 0 | RV64 => 1 | RV128 => 2 end).

Definition architecture (a : mword 2) : option Architecture :=
   let b__0 := a in
   if eq_vec b__0 ('b"01"  : mword 2) then Some RV32
   else if eq_vec b__0 ('b"10"  : mword 2) then Some RV64
   else if eq_vec b__0 ('b"11"  : mword 2) then Some RV128
   else None.

Definition arch_to_bits (a : Architecture) : mword 2 :=
   match a with
   | RV32 => 'b"01"  : mword 2
   | RV64 => 'b"10"  : mword 2
   | RV128 => 'b"11"  : mword 2
   end.

Definition Privilege_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : Privilege :=
   let l__267 := arg_ in
   if sumbool_of_bool (Z.eqb l__267 0) then User
   else if sumbool_of_bool (Z.eqb l__267 1) then Supervisor
   else Machine.

Definition num_of_Privilege (arg_ : Privilege) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | User => 0 | Supervisor => 1 | Machine => 2 end).

Definition privLevel_to_bits (p : Privilege) : mword 2 :=
   match p with
   | User => 'b"00"  : mword 2
   | Supervisor => 'b"01"  : mword 2
   | Machine => 'b"11"  : mword 2
   end.

Definition privLevel_of_bits (p : mword 2) : M (Privilege) :=
   let b__0 := p in
   (if eq_vec b__0 ('b"00"  : mword 2) then returnm User
    else if eq_vec b__0 ('b"01"  : mword 2) then returnm Supervisor
    else if eq_vec b__0 ('b"11"  : mword 2) then returnm Machine
    else
      assert_exp' false "Pattern match failure at model/riscv_types.sail 78:2 - 82:3" >>= fun _ =>
      exit tt)
    : M (Privilege).

Definition privLevel_to_str (p : Privilege) : string :=
   match p with | User => "U" | Supervisor => "S" | Machine => "M" end.

Definition Retired_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 1))} : Retired :=
   let l__266 := arg_ in
   if sumbool_of_bool (Z.eqb l__266 0) then RETIRE_SUCCESS
   else RETIRE_FAIL.

Definition num_of_Retired (arg_ : Retired) : {e : Z & ArithFact ((0 <=? e) && (e <=? 1))} :=
   build_ex (match arg_ with | RETIRE_SUCCESS => 0 | RETIRE_FAIL => 1 end).

Definition word_width_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 3))} : word_width :=
   let l__263 := arg_ in
   if sumbool_of_bool (Z.eqb l__263 0) then BYTE
   else if sumbool_of_bool (Z.eqb l__263 1) then HALF
   else if sumbool_of_bool (Z.eqb l__263 2) then WORD
   else DOUBLE.

Definition num_of_word_width (arg_ : word_width) : {e : Z & ArithFact ((0 <=? e) && (e <=? 3))} :=
   build_ex (match arg_ with | BYTE => 0 | HALF => 1 | WORD => 2 | DOUBLE => 3 end).

Definition InterruptType_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 8))}
: InterruptType :=
   let l__255 := arg_ in
   if sumbool_of_bool (Z.eqb l__255 0) then I_U_Software
   else if sumbool_of_bool (Z.eqb l__255 1) then I_S_Software
   else if sumbool_of_bool (Z.eqb l__255 2) then I_M_Software
   else if sumbool_of_bool (Z.eqb l__255 3) then I_U_Timer
   else if sumbool_of_bool (Z.eqb l__255 4) then I_S_Timer
   else if sumbool_of_bool (Z.eqb l__255 5) then I_M_Timer
   else if sumbool_of_bool (Z.eqb l__255 6) then I_U_External
   else if sumbool_of_bool (Z.eqb l__255 7) then I_S_External
   else I_M_External.

Definition num_of_InterruptType (arg_ : InterruptType)
: {e : Z & ArithFact ((0 <=? e) && (e <=? 8))} :=
   build_ex (
      match arg_ with
      | I_U_Software => 0
      | I_S_Software => 1
      | I_M_Software => 2
      | I_U_Timer => 3
      | I_S_Timer => 4
      | I_M_Timer => 5
      | I_U_External => 6
      | I_S_External => 7
      | I_M_External => 8
      end
   ).

Definition interruptType_to_bits (i : InterruptType) : mword 8 :=
   match i with
   | I_U_Software => Ox"00"  : mword 8
   | I_S_Software => Ox"01"  : mword 8
   | I_M_Software => Ox"03"  : mword 8
   | I_U_Timer => Ox"04"  : mword 8
   | I_S_Timer => Ox"05"  : mword 8
   | I_M_Timer => Ox"07"  : mword 8
   | I_U_External => Ox"08"  : mword 8
   | I_S_External => Ox"09"  : mword 8
   | I_M_External => Ox"0B"  : mword 8
   end.

Definition exceptionType_to_bits (e : ExceptionType) : mword 8 :=
   match e with
   | E_Fetch_Addr_Align tt => Ox"00"  : mword 8
   | E_Fetch_Access_Fault tt => Ox"01"  : mword 8
   | E_Illegal_Instr tt => Ox"02"  : mword 8
   | E_Breakpoint tt => Ox"03"  : mword 8
   | E_Load_Addr_Align tt => Ox"04"  : mword 8
   | E_Load_Access_Fault tt => Ox"05"  : mword 8
   | E_SAMO_Addr_Align tt => Ox"06"  : mword 8
   | E_SAMO_Access_Fault tt => Ox"07"  : mword 8
   | E_U_EnvCall tt => Ox"08"  : mword 8
   | E_S_EnvCall tt => Ox"09"  : mword 8
   | E_Reserved_10 tt => Ox"0A"  : mword 8
   | E_M_EnvCall tt => Ox"0B"  : mword 8
   | E_Fetch_Page_Fault tt => Ox"0C"  : mword 8
   | E_Load_Page_Fault tt => Ox"0D"  : mword 8
   | E_Reserved_14 tt => Ox"0E"  : mword 8
   | E_SAMO_Page_Fault tt => Ox"0F"  : mword 8
   | E_Extension e => ext_exc_type_to_bits e
   end.

Definition num_of_ExceptionType (e : ExceptionType) : {n : Z & ArithFact ((0 <=? n) && (n <? xlen))} :=
   build_ex (
      match e with
      | E_Fetch_Addr_Align tt => 0
      | E_Fetch_Access_Fault tt => 1
      | E_Illegal_Instr tt => 2
      | E_Breakpoint tt => 3
      | E_Load_Addr_Align tt => 4
      | E_Load_Access_Fault tt => 5
      | E_SAMO_Addr_Align tt => 6
      | E_SAMO_Access_Fault tt => 7
      | E_U_EnvCall tt => 8
      | E_S_EnvCall tt => 9
      | E_Reserved_10 tt => 10
      | E_M_EnvCall tt => 11
      | E_Fetch_Page_Fault tt => 12
      | E_Load_Page_Fault tt => 13
      | E_Reserved_14 tt => 14
      | E_SAMO_Page_Fault tt => 15
      | E_Extension e => projT1 (num_of_ext_exc_type e)
      end
   ).

Definition exceptionType_to_str (e : ExceptionType) : string :=
   match e with
   | E_Fetch_Addr_Align tt => "misaligned-fetch"
   | E_Fetch_Access_Fault tt => "fetch-access-fault"
   | E_Illegal_Instr tt => "illegal-instruction"
   | E_Breakpoint tt => "breakpoint"
   | E_Load_Addr_Align tt => "misaligned-load"
   | E_Load_Access_Fault tt => "load-access-fault"
   | E_SAMO_Addr_Align tt => "misaliged-store/amo"
   | E_SAMO_Access_Fault tt => "store/amo-access-fault"
   | E_U_EnvCall tt => "u-call"
   | E_S_EnvCall tt => "s-call"
   | E_Reserved_10 tt => "reserved-0"
   | E_M_EnvCall tt => "m-call"
   | E_Fetch_Page_Fault tt => "fetch-page-fault"
   | E_Load_Page_Fault tt => "load-page-fault"
   | E_Reserved_14 tt => "reserved-1"
   | E_SAMO_Page_Fault tt => "store/amo-page-fault"
   | E_Extension e => ext_exc_type_to_str e
   end.

Definition not_implemented {a : Type} (message : string) : M (a) :=
   throw (Error_not_implemented message).

Definition internal_error {a : Type} (s : string) : M (a) :=
   assert_exp' false s >>= fun _ => exit tt.

Definition TrapVectorMode_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))}
: TrapVectorMode :=
   let l__253 := arg_ in
   if sumbool_of_bool (Z.eqb l__253 0) then TV_Direct
   else if sumbool_of_bool (Z.eqb l__253 1) then TV_Vector
   else TV_Reserved.

Definition num_of_TrapVectorMode (arg_ : TrapVectorMode)
: {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | TV_Direct => 0 | TV_Vector => 1 | TV_Reserved => 2 end).

Definition trapVectorMode_of_bits (m : mword 2) : TrapVectorMode :=
   let b__0 := m in
   if eq_vec b__0 ('b"00"  : mword 2) then TV_Direct
   else if eq_vec b__0 ('b"01"  : mword 2) then TV_Vector
   else TV_Reserved.

Definition ExtStatus_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 3))} : ExtStatus :=
   let l__250 := arg_ in
   if sumbool_of_bool (Z.eqb l__250 0) then Off
   else if sumbool_of_bool (Z.eqb l__250 1) then Initial
   else if sumbool_of_bool (Z.eqb l__250 2) then Clean
   else Dirty.

Definition num_of_ExtStatus (arg_ : ExtStatus) : {e : Z & ArithFact ((0 <=? e) && (e <=? 3))} :=
   build_ex (match arg_ with | Off => 0 | Initial => 1 | Clean => 2 | Dirty => 3 end).

Definition extStatus_to_bits (e : ExtStatus) : mword 2 :=
   match e with
   | Off => 'b"00"  : mword 2
   | Initial => 'b"01"  : mword 2
   | Clean => 'b"10"  : mword 2
   | Dirty => 'b"11"  : mword 2
   end.

Definition extStatus_of_bits (e : mword 2) : M (ExtStatus) :=
   let b__0 := e in
   (if eq_vec b__0 ('b"00"  : mword 2) then returnm Off
    else if eq_vec b__0 ('b"01"  : mword 2) then returnm Initial
    else if eq_vec b__0 ('b"10"  : mword 2) then returnm Clean
    else if eq_vec b__0 ('b"11"  : mword 2) then returnm Dirty
    else
      assert_exp' false "Pattern match failure at model/riscv_types.sail 281:2 - 286:3" >>= fun _ =>
      exit tt)
    : M (ExtStatus).

Definition SATPMode_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 3))} : SATPMode :=
   let l__247 := arg_ in
   if sumbool_of_bool (Z.eqb l__247 0) then Sbare
   else if sumbool_of_bool (Z.eqb l__247 1) then Sv32
   else if sumbool_of_bool (Z.eqb l__247 2) then Sv39
   else Sv48.

Definition num_of_SATPMode (arg_ : SATPMode) : {e : Z & ArithFact ((0 <=? e) && (e <=? 3))} :=
   build_ex (match arg_ with | Sbare => 0 | Sv32 => 1 | Sv39 => 2 | Sv48 => 3 end).

Definition satp64Mode_of_bits (a : Architecture) (m : mword 4) : option SATPMode :=
   match (a, m) with
   | (g__327, b__0) =>
      if eq_vec b__0 (Ox"0"  : mword 4) then Some Sbare
      else
        match (g__327, b__0) with
        | (RV32, b__0) =>
           if eq_vec b__0 (Ox"1"  : mword 4) then Some Sv32
           else match (RV32, b__0) with | (_, _) => None end
        | (RV64, b__0) =>
           if eq_vec b__0 (Ox"8"  : mword 4) then Some Sv39
           else if eq_vec b__0 (Ox"9"  : mword 4) then Some Sv48
           else match (RV64, b__0) with | (_, _) => None end
        | (_, _) => None
        end
   end.

Definition uop_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 1))} : uop :=
   let l__246 := arg_ in
   if sumbool_of_bool (Z.eqb l__246 0) then RISCV_LUI
   else RISCV_AUIPC.

Definition num_of_uop (arg_ : uop) : {e : Z & ArithFact ((0 <=? e) && (e <=? 1))} :=
   build_ex (match arg_ with | RISCV_LUI => 0 | RISCV_AUIPC => 1 end).

Definition bop_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 5))} : bop :=
   let l__241 := arg_ in
   if sumbool_of_bool (Z.eqb l__241 0) then RISCV_BEQ
   else if sumbool_of_bool (Z.eqb l__241 1) then RISCV_BNE
   else if sumbool_of_bool (Z.eqb l__241 2) then RISCV_BLT
   else if sumbool_of_bool (Z.eqb l__241 3) then RISCV_BGE
   else if sumbool_of_bool (Z.eqb l__241 4) then RISCV_BLTU
   else RISCV_BGEU.

Definition num_of_bop (arg_ : bop) : {e : Z & ArithFact ((0 <=? e) && (e <=? 5))} :=
   build_ex (
      match arg_ with
      | RISCV_BEQ => 0
      | RISCV_BNE => 1
      | RISCV_BLT => 2
      | RISCV_BGE => 3
      | RISCV_BLTU => 4
      | RISCV_BGEU => 5
      end
   ).

Definition iop_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 5))} : iop :=
   let l__236 := arg_ in
   if sumbool_of_bool (Z.eqb l__236 0) then RISCV_ADDI
   else if sumbool_of_bool (Z.eqb l__236 1) then RISCV_SLTI
   else if sumbool_of_bool (Z.eqb l__236 2) then RISCV_SLTIU
   else if sumbool_of_bool (Z.eqb l__236 3) then RISCV_XORI
   else if sumbool_of_bool (Z.eqb l__236 4) then RISCV_ORI
   else RISCV_ANDI.

Definition num_of_iop (arg_ : iop) : {e : Z & ArithFact ((0 <=? e) && (e <=? 5))} :=
   build_ex (
      match arg_ with
      | RISCV_ADDI => 0
      | RISCV_SLTI => 1
      | RISCV_SLTIU => 2
      | RISCV_XORI => 3
      | RISCV_ORI => 4
      | RISCV_ANDI => 5
      end
   ).

Definition sop_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : sop :=
   let l__234 := arg_ in
   if sumbool_of_bool (Z.eqb l__234 0) then RISCV_SLLI
   else if sumbool_of_bool (Z.eqb l__234 1) then RISCV_SRLI
   else RISCV_SRAI.

Definition num_of_sop (arg_ : sop) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | RISCV_SLLI => 0 | RISCV_SRLI => 1 | RISCV_SRAI => 2 end).

Definition rop_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 9))} : rop :=
   let l__225 := arg_ in
   if sumbool_of_bool (Z.eqb l__225 0) then RISCV_ADD
   else if sumbool_of_bool (Z.eqb l__225 1) then RISCV_SUB
   else if sumbool_of_bool (Z.eqb l__225 2) then RISCV_SLL
   else if sumbool_of_bool (Z.eqb l__225 3) then RISCV_SLT
   else if sumbool_of_bool (Z.eqb l__225 4) then RISCV_SLTU
   else if sumbool_of_bool (Z.eqb l__225 5) then RISCV_XOR
   else if sumbool_of_bool (Z.eqb l__225 6) then RISCV_SRL
   else if sumbool_of_bool (Z.eqb l__225 7) then RISCV_SRA
   else if sumbool_of_bool (Z.eqb l__225 8) then RISCV_OR
   else RISCV_AND.

Definition num_of_rop (arg_ : rop) : {e : Z & ArithFact ((0 <=? e) && (e <=? 9))} :=
   build_ex (
      match arg_ with
      | RISCV_ADD => 0
      | RISCV_SUB => 1
      | RISCV_SLL => 2
      | RISCV_SLT => 3
      | RISCV_SLTU => 4
      | RISCV_XOR => 5
      | RISCV_SRL => 6
      | RISCV_SRA => 7
      | RISCV_OR => 8
      | RISCV_AND => 9
      end
   ).

Definition ropw_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 4))} : ropw :=
   let l__221 := arg_ in
   if sumbool_of_bool (Z.eqb l__221 0) then RISCV_ADDW
   else if sumbool_of_bool (Z.eqb l__221 1) then RISCV_SUBW
   else if sumbool_of_bool (Z.eqb l__221 2) then RISCV_SLLW
   else if sumbool_of_bool (Z.eqb l__221 3) then RISCV_SRLW
   else RISCV_SRAW.

Definition num_of_ropw (arg_ : ropw) : {e : Z & ArithFact ((0 <=? e) && (e <=? 4))} :=
   build_ex (
      match arg_ with
      | RISCV_ADDW => 0
      | RISCV_SUBW => 1
      | RISCV_SLLW => 2
      | RISCV_SRLW => 3
      | RISCV_SRAW => 4
      end
   ).

Definition sopw_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : sopw :=
   let l__219 := arg_ in
   if sumbool_of_bool (Z.eqb l__219 0) then RISCV_SLLIW
   else if sumbool_of_bool (Z.eqb l__219 1) then RISCV_SRLIW
   else RISCV_SRAIW.

Definition num_of_sopw (arg_ : sopw) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | RISCV_SLLIW => 0 | RISCV_SRLIW => 1 | RISCV_SRAIW => 2 end).

Definition amoop_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 8))} : amoop :=
   let l__211 := arg_ in
   if sumbool_of_bool (Z.eqb l__211 0) then AMOSWAP
   else if sumbool_of_bool (Z.eqb l__211 1) then AMOADD
   else if sumbool_of_bool (Z.eqb l__211 2) then AMOXOR
   else if sumbool_of_bool (Z.eqb l__211 3) then AMOAND
   else if sumbool_of_bool (Z.eqb l__211 4) then AMOOR
   else if sumbool_of_bool (Z.eqb l__211 5) then AMOMIN
   else if sumbool_of_bool (Z.eqb l__211 6) then AMOMAX
   else if sumbool_of_bool (Z.eqb l__211 7) then AMOMINU
   else AMOMAXU.

Definition num_of_amoop (arg_ : amoop) : {e : Z & ArithFact ((0 <=? e) && (e <=? 8))} :=
   build_ex (
      match arg_ with
      | AMOSWAP => 0
      | AMOADD => 1
      | AMOXOR => 2
      | AMOAND => 3
      | AMOOR => 4
      | AMOMIN => 5
      | AMOMAX => 6
      | AMOMINU => 7
      | AMOMAXU => 8
      end
   ).

Definition csrop_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : csrop :=
   let l__209 := arg_ in
   if sumbool_of_bool (Z.eqb l__209 0) then CSRRW
   else if sumbool_of_bool (Z.eqb l__209 1) then CSRRS
   else CSRRC.

Definition num_of_csrop (arg_ : csrop) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | CSRRW => 0 | CSRRS => 1 | CSRRC => 2 end).

Definition sep_forwards (arg_ : unit) : string :=
   match arg_ with
   | tt =>
      string_append (opt_spc_forwards tt)
        (string_append "," (string_append (def_spc_forwards tt) ""))
   end.

Definition _s0_ (_s1_ : string) : M (option unit) :=
   (match _s1_ with
    | _s2_ =>
       (opt_spc_matches_prefix _s2_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
       (match w__0 with
        | Some (tt, existT _ _s3_ _) =>
           let _s4_ := string_drop _s2_ _s3_ in
           (if string_startswith _s4_ "," then
              (match (string_drop _s4_ (projT1 (string_length ","))) with
               | _s5_ =>
                  (def_spc_matches_prefix _s5_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  returnm (match w__1 with
                           | Some (tt, existT _ _s6_ _) =>
                              let p0_ := string_drop _s5_ _s6_ in
                              if generic_eq p0_ "" then Some tt
                              else None
                           | _ => None
                           end)
               end)
               : M (option unit)
            else returnm None)
            : M (option unit)
        | _ => returnm None
        end)
        : M (option unit)
    end)
    : M (option unit).

Definition sep_backwards (arg_ : string) : M (unit) :=
   let _s7_ := arg_ in
   (_s0_ _s7_) >>= fun w__0 : option unit =>
   (if match w__0 with | Some tt => true | _ => false end then
      (_s0_ _s7_) >>= fun w__1 : option unit =>
      (match w__1 with | Some tt => returnm tt | _ => exit tt  : M (unit) end)
       : M (unit)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (unit).

Definition sep_forwards_matches (arg_ : unit) : bool := match arg_ with | tt => true end.

Definition _s8_ (_s9_ : string) : M (option unit) :=
   (match _s9_ with
    | _s10_ =>
       (opt_spc_matches_prefix _s10_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
       (match w__0 with
        | Some (tt, existT _ _s11_ _) =>
           let _s12_ := string_drop _s10_ _s11_ in
           (if string_startswith _s12_ "," then
              (match (string_drop _s12_ (projT1 (string_length ","))) with
               | _s13_ =>
                  (def_spc_matches_prefix _s13_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  returnm (match w__1 with
                           | Some (tt, existT _ _s14_ _) =>
                              let p0_ := string_drop _s13_ _s14_ in
                              if generic_eq p0_ "" then Some tt
                              else None
                           | _ => None
                           end)
               end)
               : M (option unit)
            else returnm None)
            : M (option unit)
        | _ => returnm None
        end)
        : M (option unit)
    end)
    : M (option unit).

Definition sep_backwards_matches (arg_ : string) : M (bool) :=
   let _s15_ := arg_ in
   (_s8_ _s15_) >>= fun w__0 : option unit =>
   (if match w__0 with | Some tt => true | _ => false end then
      (_s8_ _s15_) >>= fun w__1 : option unit =>
      (match w__1 with | Some tt => returnm true | _ => exit tt  : M (bool) end)
       : M (bool)
    else returnm false)
    : M (bool).

Definition _s16_ (_s17_ : string) : M (option string) :=
   (match _s17_ with
    | _s18_ =>
       (opt_spc_matches_prefix _s18_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
       (match w__0 with
        | Some (tt, existT _ _s19_ _) =>
           let _s20_ := string_drop _s18_ _s19_ in
           (if string_startswith _s20_ "," then
              (match (string_drop _s20_ (projT1 (string_length ","))) with
               | _s21_ =>
                  (def_spc_matches_prefix _s21_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  returnm (match w__1 with
                           | Some (tt, existT _ _s22_ _) =>
                              match (string_drop _s21_ _s22_) with | s_ => Some s_ end
                           | _ => None
                           end)
               end)
               : M (option string)
            else returnm None)
            : M (option string)
        | _ => returnm None
        end)
        : M (option string)
    end)
    : M (option string).

Definition sep_matches_prefix (arg_ : string) : M (option ((unit * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s23_ := arg_ in
   (_s16_ _s23_) >>= fun w__0 : option string =>
   (if match w__0 with | Some s_ => true | _ => false end then
      (_s16_ _s23_) >>= fun w__1 : option string =>
      (match w__1 with
       | Some s_ =>
          returnm (Some
                     (tt, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((unit * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((unit * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((unit * {n : Z & ArithFact (n >=? 0)}))).

Definition bool_bits_forwards (arg_ : bool) : mword 1 :=
   match arg_ with | true => 'b"1"  : mword 1 | false => 'b"0"  : mword 1 end.

Definition bool_bits_backwards (arg_ : mword 1) : M (bool) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"1"  : mword 1) then returnm true
    else if eq_vec b__0 ('b"0"  : mword 1) then returnm false
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (bool).

Definition bool_bits_forwards_matches (arg_ : bool) : bool :=
   match arg_ with | true => true | false => true end.

Definition bool_bits_backwards_matches (arg_ : mword 1) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"1"  : mword 1) then true
   else if eq_vec b__0 ('b"0"  : mword 1) then true
   else false.

Definition bool_not_bits_forwards (arg_ : bool) : mword 1 :=
   match arg_ with | true => 'b"0"  : mword 1 | false => 'b"1"  : mword 1 end.

Definition bool_not_bits_backwards (arg_ : mword 1) : M (bool) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"0"  : mword 1) then returnm true
    else if eq_vec b__0 ('b"1"  : mword 1) then returnm false
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (bool).

Definition bool_not_bits_forwards_matches (arg_ : bool) : bool :=
   match arg_ with | true => true | false => true end.

Definition bool_not_bits_backwards_matches (arg_ : mword 1) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"0"  : mword 1) then true
   else if eq_vec b__0 ('b"1"  : mword 1) then true
   else false.

Definition size_bits_forwards (arg_ : word_width) : mword 2 :=
   match arg_ with
   | BYTE => 'b"00"  : mword 2
   | HALF => 'b"01"  : mword 2
   | WORD => 'b"10"  : mword 2
   | DOUBLE => 'b"11"  : mword 2
   end.

Definition size_bits_backwards (arg_ : mword 2) : M (word_width) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"00"  : mword 2) then returnm BYTE
    else if eq_vec b__0 ('b"01"  : mword 2) then returnm HALF
    else if eq_vec b__0 ('b"10"  : mword 2) then returnm WORD
    else if eq_vec b__0 ('b"11"  : mword 2) then returnm DOUBLE
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (word_width).

Definition size_bits_forwards_matches (arg_ : word_width) : bool :=
   match arg_ with | BYTE => true | HALF => true | WORD => true | DOUBLE => true end.

Definition size_bits_backwards_matches (arg_ : mword 2) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"00"  : mword 2) then true
   else if eq_vec b__0 ('b"01"  : mword 2) then true
   else if eq_vec b__0 ('b"10"  : mword 2) then true
   else if eq_vec b__0 ('b"11"  : mword 2) then true
   else false.

Definition size_mnemonic_forwards (arg_ : word_width) : string :=
   match arg_ with | BYTE => "b" | HALF => "h" | WORD => "w" | DOUBLE => "d" end.

Definition size_mnemonic_backwards (arg_ : string) : M (word_width) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "b" then returnm BYTE
    else if generic_eq p0_ "h" then returnm HALF
    else if generic_eq p0_ "w" then returnm WORD
    else if generic_eq p0_ "d" then returnm DOUBLE
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (word_width).

Definition size_mnemonic_forwards_matches (arg_ : word_width) : bool :=
   match arg_ with | BYTE => true | HALF => true | WORD => true | DOUBLE => true end.

Definition size_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "b" then true
   else if generic_eq p0_ "h" then true
   else if generic_eq p0_ "w" then true
   else if generic_eq p0_ "d" then true
   else false.

Definition _s36_ (_s37_ : string) : option string :=
   let _s38_ := _s37_ in
   if string_startswith _s38_ "d" then
     match (string_drop _s38_ (projT1 (string_length "d"))) with | s_ => Some s_ end
   else None.

Definition _s32_ (_s33_ : string) : option string :=
   let _s34_ := _s33_ in
   if string_startswith _s34_ "w" then
     match (string_drop _s34_ (projT1 (string_length "w"))) with | s_ => Some s_ end
   else None.

Definition _s28_ (_s29_ : string) : option string :=
   let _s30_ := _s29_ in
   if string_startswith _s30_ "h" then
     match (string_drop _s30_ (projT1 (string_length "h"))) with | s_ => Some s_ end
   else None.

Definition _s24_ (_s25_ : string) : option string :=
   let _s26_ := _s25_ in
   if string_startswith _s26_ "b" then
     match (string_drop _s26_ (projT1 (string_length "b"))) with | s_ => Some s_ end
   else None.

Definition size_mnemonic_matches_prefix (arg_ : string)
: M (option ((word_width * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s27_ := arg_ in
   (if match (_s24_ _s27_) with | Some s_ => true | _ => false end then
      (match (_s24_ _s27_) with
       | Some s_ =>
          returnm (Some
                     (BYTE, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((word_width * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((word_width * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s28_ _s27_) with | Some s_ => true | _ => false end then
      (match (_s28_ _s27_) with
       | Some s_ =>
          returnm (Some
                     (HALF, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((word_width * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((word_width * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s32_ _s27_) with | Some s_ => true | _ => false end then
      (match (_s32_ _s27_) with
       | Some s_ =>
          returnm (Some
                     (WORD, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((word_width * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((word_width * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s36_ _s27_) with | Some s_ => true | _ => false end then
      (match (_s36_ _s27_) with
       | Some s_ =>
          returnm (Some
                     (DOUBLE, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((word_width * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((word_width * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((word_width * {n : Z & ArithFact (n >=? 0)}))).

Definition word_width_bytes (width : word_width)
: {s : Z & ArithFact ((s =? 1) || ((s =? 2) || ((s =? 4) || (s =? 8))))} :=
   build_ex (match width with | BYTE => 1 | HALF => 2 | WORD => 4 | DOUBLE => 8 end).

Definition Data : ext_access_type := tt.
Hint Unfold Data : sail.
Definition default_write_acc : ext_access_type := Data.
Hint Unfold default_write_acc : sail.
Definition accessType_to_str (a : AccessType unit) : string :=
   match a with | Read _ => "R" | Write _ => "W" | ReadWrite (_, _) => "RW" | Execute tt => "X" end.

Definition zero_reg : regtype := EXTZ 32 (Ox"0"  : mword 4).
Hint Unfold zero_reg : sail.
Definition RegStr (r : mword 32) : string := string_of_bits r.

Definition regval_from_reg (r : mword 32) : mword 32 := r.

Definition regval_into_reg (v : mword 32) : mword 32 := v.

Definition zero_freg : fregtype := EXTZ 32 (Ox"0"  : mword 4).
Hint Unfold zero_freg : sail.
Definition FRegStr (r : mword 32) : string := string_of_bits r.

Definition fregval_from_freg (r : mword 32) : mword 32 := r.

Definition fregval_into_freg (v : mword 32) : mword 32 := v.

Definition rounding_mode_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 5))}
: rounding_mode :=
   let l__204 := arg_ in
   if sumbool_of_bool (Z.eqb l__204 0) then RM_RNE
   else if sumbool_of_bool (Z.eqb l__204 1) then RM_RTZ
   else if sumbool_of_bool (Z.eqb l__204 2) then RM_RDN
   else if sumbool_of_bool (Z.eqb l__204 3) then RM_RUP
   else if sumbool_of_bool (Z.eqb l__204 4) then RM_RMM
   else RM_DYN.

Definition num_of_rounding_mode (arg_ : rounding_mode)
: {e : Z & ArithFact ((0 <=? e) && (e <=? 5))} :=
   build_ex (
      match arg_ with
      | RM_RNE => 0
      | RM_RTZ => 1
      | RM_RDN => 2
      | RM_RUP => 3
      | RM_RMM => 4
      | RM_DYN => 5
      end
   ).

Definition f_madd_op_S_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 3))} : f_madd_op_S :=
   let l__201 := arg_ in
   if sumbool_of_bool (Z.eqb l__201 0) then FMADD_S
   else if sumbool_of_bool (Z.eqb l__201 1) then FMSUB_S
   else if sumbool_of_bool (Z.eqb l__201 2) then FNMSUB_S
   else FNMADD_S.

Definition num_of_f_madd_op_S (arg_ : f_madd_op_S) : {e : Z & ArithFact ((0 <=? e) && (e <=? 3))} :=
   build_ex (match arg_ with | FMADD_S => 0 | FMSUB_S => 1 | FNMSUB_S => 2 | FNMADD_S => 3 end).

Definition f_bin_rm_op_S_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 3))}
: f_bin_rm_op_S :=
   let l__198 := arg_ in
   if sumbool_of_bool (Z.eqb l__198 0) then FADD_S
   else if sumbool_of_bool (Z.eqb l__198 1) then FSUB_S
   else if sumbool_of_bool (Z.eqb l__198 2) then FMUL_S
   else FDIV_S.

Definition num_of_f_bin_rm_op_S (arg_ : f_bin_rm_op_S)
: {e : Z & ArithFact ((0 <=? e) && (e <=? 3))} :=
   build_ex (match arg_ with | FADD_S => 0 | FSUB_S => 1 | FMUL_S => 2 | FDIV_S => 3 end).

Definition f_un_rm_op_S_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 8))} : f_un_rm_op_S :=
   let l__190 := arg_ in
   if sumbool_of_bool (Z.eqb l__190 0) then FSQRT_S
   else if sumbool_of_bool (Z.eqb l__190 1) then FCVT_W_S
   else if sumbool_of_bool (Z.eqb l__190 2) then FCVT_WU_S
   else if sumbool_of_bool (Z.eqb l__190 3) then FCVT_S_W
   else if sumbool_of_bool (Z.eqb l__190 4) then FCVT_S_WU
   else if sumbool_of_bool (Z.eqb l__190 5) then FCVT_L_S
   else if sumbool_of_bool (Z.eqb l__190 6) then FCVT_LU_S
   else if sumbool_of_bool (Z.eqb l__190 7) then FCVT_S_L
   else FCVT_S_LU.

Definition num_of_f_un_rm_op_S (arg_ : f_un_rm_op_S) : {e : Z & ArithFact ((0 <=? e) && (e <=? 8))} :=
   build_ex (
      match arg_ with
      | FSQRT_S => 0
      | FCVT_W_S => 1
      | FCVT_WU_S => 2
      | FCVT_S_W => 3
      | FCVT_S_WU => 4
      | FCVT_L_S => 5
      | FCVT_LU_S => 6
      | FCVT_S_L => 7
      | FCVT_S_LU => 8
      end
   ).

Definition f_un_op_S_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : f_un_op_S :=
   let l__188 := arg_ in
   if sumbool_of_bool (Z.eqb l__188 0) then FCLASS_S
   else if sumbool_of_bool (Z.eqb l__188 1) then FMV_X_W
   else FMV_W_X.

Definition num_of_f_un_op_S (arg_ : f_un_op_S) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | FCLASS_S => 0 | FMV_X_W => 1 | FMV_W_X => 2 end).

Definition f_bin_op_S_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 7))} : f_bin_op_S :=
   let l__181 := arg_ in
   if sumbool_of_bool (Z.eqb l__181 0) then FSGNJ_S
   else if sumbool_of_bool (Z.eqb l__181 1) then FSGNJN_S
   else if sumbool_of_bool (Z.eqb l__181 2) then FSGNJX_S
   else if sumbool_of_bool (Z.eqb l__181 3) then FMIN_S
   else if sumbool_of_bool (Z.eqb l__181 4) then FMAX_S
   else if sumbool_of_bool (Z.eqb l__181 5) then FEQ_S
   else if sumbool_of_bool (Z.eqb l__181 6) then FLT_S
   else FLE_S.

Definition num_of_f_bin_op_S (arg_ : f_bin_op_S) : {e : Z & ArithFact ((0 <=? e) && (e <=? 7))} :=
   build_ex (
      match arg_ with
      | FSGNJ_S => 0
      | FSGNJN_S => 1
      | FSGNJX_S => 2
      | FMIN_S => 3
      | FMAX_S => 4
      | FEQ_S => 5
      | FLT_S => 6
      | FLE_S => 7
      end
   ).

Definition f_madd_op_D_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 3))} : f_madd_op_D :=
   let l__178 := arg_ in
   if sumbool_of_bool (Z.eqb l__178 0) then FMADD_D
   else if sumbool_of_bool (Z.eqb l__178 1) then FMSUB_D
   else if sumbool_of_bool (Z.eqb l__178 2) then FNMSUB_D
   else FNMADD_D.

Definition num_of_f_madd_op_D (arg_ : f_madd_op_D) : {e : Z & ArithFact ((0 <=? e) && (e <=? 3))} :=
   build_ex (match arg_ with | FMADD_D => 0 | FMSUB_D => 1 | FNMSUB_D => 2 | FNMADD_D => 3 end).

Definition f_bin_rm_op_D_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 3))}
: f_bin_rm_op_D :=
   let l__175 := arg_ in
   if sumbool_of_bool (Z.eqb l__175 0) then FADD_D
   else if sumbool_of_bool (Z.eqb l__175 1) then FSUB_D
   else if sumbool_of_bool (Z.eqb l__175 2) then FMUL_D
   else FDIV_D.

Definition num_of_f_bin_rm_op_D (arg_ : f_bin_rm_op_D)
: {e : Z & ArithFact ((0 <=? e) && (e <=? 3))} :=
   build_ex (match arg_ with | FADD_D => 0 | FSUB_D => 1 | FMUL_D => 2 | FDIV_D => 3 end).

Definition f_un_rm_op_D_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 10))}
: f_un_rm_op_D :=
   let l__165 := arg_ in
   if sumbool_of_bool (Z.eqb l__165 0) then FSQRT_D
   else if sumbool_of_bool (Z.eqb l__165 1) then FCVT_W_D
   else if sumbool_of_bool (Z.eqb l__165 2) then FCVT_WU_D
   else if sumbool_of_bool (Z.eqb l__165 3) then FCVT_D_W
   else if sumbool_of_bool (Z.eqb l__165 4) then FCVT_D_WU
   else if sumbool_of_bool (Z.eqb l__165 5) then FCVT_S_D
   else if sumbool_of_bool (Z.eqb l__165 6) then FCVT_D_S
   else if sumbool_of_bool (Z.eqb l__165 7) then FCVT_L_D
   else if sumbool_of_bool (Z.eqb l__165 8) then FCVT_LU_D
   else if sumbool_of_bool (Z.eqb l__165 9) then FCVT_D_L
   else FCVT_D_LU.

Definition num_of_f_un_rm_op_D (arg_ : f_un_rm_op_D) : {e : Z & ArithFact ((0 <=? e) && (e <=? 10))} :=
   build_ex (
      match arg_ with
      | FSQRT_D => 0
      | FCVT_W_D => 1
      | FCVT_WU_D => 2
      | FCVT_D_W => 3
      | FCVT_D_WU => 4
      | FCVT_S_D => 5
      | FCVT_D_S => 6
      | FCVT_L_D => 7
      | FCVT_LU_D => 8
      | FCVT_D_L => 9
      | FCVT_D_LU => 10
      end
   ).

Definition f_bin_op_D_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 7))} : f_bin_op_D :=
   let l__158 := arg_ in
   if sumbool_of_bool (Z.eqb l__158 0) then FSGNJ_D
   else if sumbool_of_bool (Z.eqb l__158 1) then FSGNJN_D
   else if sumbool_of_bool (Z.eqb l__158 2) then FSGNJX_D
   else if sumbool_of_bool (Z.eqb l__158 3) then FMIN_D
   else if sumbool_of_bool (Z.eqb l__158 4) then FMAX_D
   else if sumbool_of_bool (Z.eqb l__158 5) then FEQ_D
   else if sumbool_of_bool (Z.eqb l__158 6) then FLT_D
   else FLE_D.

Definition num_of_f_bin_op_D (arg_ : f_bin_op_D) : {e : Z & ArithFact ((0 <=? e) && (e <=? 7))} :=
   build_ex (
      match arg_ with
      | FSGNJ_D => 0
      | FSGNJN_D => 1
      | FSGNJX_D => 2
      | FMIN_D => 3
      | FMAX_D => 4
      | FEQ_D => 5
      | FLT_D => 6
      | FLE_D => 7
      end
   ).

Definition f_un_op_D_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : f_un_op_D :=
   let l__156 := arg_ in
   if sumbool_of_bool (Z.eqb l__156 0) then FCLASS_D
   else if sumbool_of_bool (Z.eqb l__156 1) then FMV_X_D
   else FMV_D_X.

Definition num_of_f_un_op_D (arg_ : f_un_op_D) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | FCLASS_D => 0 | FMV_X_D => 1 | FMV_D_X => 2 end).

Definition rX (r : Z) `{ArithFact ((0 <=? r) && (r <? 32))} : M (mword 32) :=
   let l__124 := r in
   (if sumbool_of_bool (Z.eqb l__124 0) then returnm zero_reg
    else if sumbool_of_bool (Z.eqb l__124 1) then
      ((read_reg x1_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 2) then
      ((read_reg x2_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 3) then
      ((read_reg x3_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 4) then
      ((read_reg x4_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 5) then
      ((read_reg x5_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 6) then
      ((read_reg x6_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 7) then
      ((read_reg x7_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 8) then
      ((read_reg x8_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 9) then
      ((read_reg x9_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 10) then
      ((read_reg x10_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 11) then
      ((read_reg x11_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 12) then
      ((read_reg x12_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 13) then
      ((read_reg x13_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 14) then
      ((read_reg x14_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 15) then
      ((read_reg x15_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 16) then
      ((read_reg x16_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 17) then
      ((read_reg x17_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 18) then
      ((read_reg x18_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 19) then
      ((read_reg x19_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 20) then
      ((read_reg x20_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 21) then
      ((read_reg x21_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 22) then
      ((read_reg x22_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 23) then
      ((read_reg x23_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 24) then
      ((read_reg x24_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 25) then
      ((read_reg x25_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 26) then
      ((read_reg x26_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 27) then
      ((read_reg x27_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 28) then
      ((read_reg x28_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 29) then
      ((read_reg x29_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 30) then
      ((read_reg x30_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__124 31) then
      ((read_reg x31_ref)  : M (mword 32))
       : M (mword 32)
    else assert_exp' false "invalid register number" >>= fun _ => exit tt) >>= fun v : regtype =>
   returnm (regval_from_reg v).

Definition rvfi_wX (r : Z) (v : mword 32) `{ArithFact ((0 <=? r) && (r <? 32))} : unit := tt.

Definition wX (r : Z) (in_v : mword 32) `{ArithFact ((0 <=? r) && (r <? 32))} : M (unit) :=
   let v := regval_into_reg in_v in
   let l__92 := r in
   (if sumbool_of_bool (Z.eqb l__92 0) then returnm tt
    else if sumbool_of_bool (Z.eqb l__92 1) then write_reg x1_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 2) then write_reg x2_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 3) then write_reg x3_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 4) then write_reg x4_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 5) then write_reg x5_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 6) then write_reg x6_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 7) then write_reg x7_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 8) then write_reg x8_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 9) then write_reg x9_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 10) then write_reg x10_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 11) then write_reg x11_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 12) then write_reg x12_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 13) then write_reg x13_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 14) then write_reg x14_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 15) then write_reg x15_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 16) then write_reg x16_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 17) then write_reg x17_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 18) then write_reg x18_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 19) then write_reg x19_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 20) then write_reg x20_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 21) then write_reg x21_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 22) then write_reg x22_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 23) then write_reg x23_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 24) then write_reg x24_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 25) then write_reg x25_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 26) then write_reg x26_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 27) then write_reg x27_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 28) then write_reg x28_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 29) then write_reg x29_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 30) then write_reg x30_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__92 31) then write_reg x31_ref v  : M (unit)
    else assert_exp' false "invalid register number" >>= fun _ => exit tt) >>
   returnm (if sumbool_of_bool (projT1 (neq_int r 0)) then
              let '_ := (rvfi_wX r in_v)  : unit in
              if get_config_print_reg tt then
                print_endline
                  (String.append "x"
                     (String.append (string_of_int r) (String.append " <- " (RegStr v))))
              else tt
            else tt).

Definition rX_bits (i : mword 5) : M (mword 32) := (rX (projT1 (uint i)))  : M (mword 32).

Definition wX_bits (i : mword 5) (data : mword 32) : M (unit) :=
   (wX (projT1 (uint i)) data)  : M (unit).

Definition reg_name_abi (r : mword 5) : M (string) :=
   let b__0 := r in
   (if eq_vec b__0 ('b"00000"  : mword 5) then returnm "zero"
    else if eq_vec b__0 ('b"00001"  : mword 5) then returnm "ra"
    else if eq_vec b__0 ('b"00010"  : mword 5) then returnm "sp"
    else if eq_vec b__0 ('b"00011"  : mword 5) then returnm "gp"
    else if eq_vec b__0 ('b"00100"  : mword 5) then returnm "tp"
    else if eq_vec b__0 ('b"00101"  : mword 5) then returnm "t0"
    else if eq_vec b__0 ('b"00110"  : mword 5) then returnm "t1"
    else if eq_vec b__0 ('b"00111"  : mword 5) then returnm "t2"
    else if eq_vec b__0 ('b"01000"  : mword 5) then returnm "fp"
    else if eq_vec b__0 ('b"01001"  : mword 5) then returnm "s1"
    else if eq_vec b__0 ('b"01010"  : mword 5) then returnm "a0"
    else if eq_vec b__0 ('b"01011"  : mword 5) then returnm "a1"
    else if eq_vec b__0 ('b"01100"  : mword 5) then returnm "a2"
    else if eq_vec b__0 ('b"01101"  : mword 5) then returnm "a3"
    else if eq_vec b__0 ('b"01110"  : mword 5) then returnm "a4"
    else if eq_vec b__0 ('b"01111"  : mword 5) then returnm "a5"
    else if eq_vec b__0 ('b"10000"  : mword 5) then returnm "a6"
    else if eq_vec b__0 ('b"10001"  : mword 5) then returnm "a7"
    else if eq_vec b__0 ('b"10010"  : mword 5) then returnm "s2"
    else if eq_vec b__0 ('b"10011"  : mword 5) then returnm "s3"
    else if eq_vec b__0 ('b"10100"  : mword 5) then returnm "s4"
    else if eq_vec b__0 ('b"10101"  : mword 5) then returnm "s5"
    else if eq_vec b__0 ('b"10110"  : mword 5) then returnm "s6"
    else if eq_vec b__0 ('b"10111"  : mword 5) then returnm "s7"
    else if eq_vec b__0 ('b"11000"  : mword 5) then returnm "s8"
    else if eq_vec b__0 ('b"11001"  : mword 5) then returnm "s9"
    else if eq_vec b__0 ('b"11010"  : mword 5) then returnm "s10"
    else if eq_vec b__0 ('b"11011"  : mword 5) then returnm "s11"
    else if eq_vec b__0 ('b"11100"  : mword 5) then returnm "t3"
    else if eq_vec b__0 ('b"11101"  : mword 5) then returnm "t4"
    else if eq_vec b__0 ('b"11110"  : mword 5) then returnm "t5"
    else if eq_vec b__0 ('b"11111"  : mword 5) then returnm "t6"
    else
      assert_exp' false "Pattern match failure at model/riscv_regs.sail 154:2 - 187:3" >>= fun _ =>
      exit tt)
    : M (string).

Definition reg_name_forwards (arg_ : mword 5) : M (string) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"00000"  : mword 5) then returnm "zero"
    else if eq_vec b__0 ('b"00001"  : mword 5) then returnm "ra"
    else if eq_vec b__0 ('b"00010"  : mword 5) then returnm "sp"
    else if eq_vec b__0 ('b"00011"  : mword 5) then returnm "gp"
    else if eq_vec b__0 ('b"00100"  : mword 5) then returnm "tp"
    else if eq_vec b__0 ('b"00101"  : mword 5) then returnm "t0"
    else if eq_vec b__0 ('b"00110"  : mword 5) then returnm "t1"
    else if eq_vec b__0 ('b"00111"  : mword 5) then returnm "t2"
    else if eq_vec b__0 ('b"01000"  : mword 5) then returnm "fp"
    else if eq_vec b__0 ('b"01001"  : mword 5) then returnm "s1"
    else if eq_vec b__0 ('b"01010"  : mword 5) then returnm "a0"
    else if eq_vec b__0 ('b"01011"  : mword 5) then returnm "a1"
    else if eq_vec b__0 ('b"01100"  : mword 5) then returnm "a2"
    else if eq_vec b__0 ('b"01101"  : mword 5) then returnm "a3"
    else if eq_vec b__0 ('b"01110"  : mword 5) then returnm "a4"
    else if eq_vec b__0 ('b"01111"  : mword 5) then returnm "a5"
    else if eq_vec b__0 ('b"10000"  : mword 5) then returnm "a6"
    else if eq_vec b__0 ('b"10001"  : mword 5) then returnm "a7"
    else if eq_vec b__0 ('b"10010"  : mword 5) then returnm "s2"
    else if eq_vec b__0 ('b"10011"  : mword 5) then returnm "s3"
    else if eq_vec b__0 ('b"10100"  : mword 5) then returnm "s4"
    else if eq_vec b__0 ('b"10101"  : mword 5) then returnm "s5"
    else if eq_vec b__0 ('b"10110"  : mword 5) then returnm "s6"
    else if eq_vec b__0 ('b"10111"  : mword 5) then returnm "s7"
    else if eq_vec b__0 ('b"11000"  : mword 5) then returnm "s8"
    else if eq_vec b__0 ('b"11001"  : mword 5) then returnm "s9"
    else if eq_vec b__0 ('b"11010"  : mword 5) then returnm "s10"
    else if eq_vec b__0 ('b"11011"  : mword 5) then returnm "s11"
    else if eq_vec b__0 ('b"11100"  : mword 5) then returnm "t3"
    else if eq_vec b__0 ('b"11101"  : mword 5) then returnm "t4"
    else if eq_vec b__0 ('b"11110"  : mword 5) then returnm "t5"
    else if eq_vec b__0 ('b"11111"  : mword 5) then returnm "t6"
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (string).

Definition reg_name_backwards (arg_ : string) : M (mword 5) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "zero" then returnm ('b"00000"  : mword 5)
    else if generic_eq p0_ "ra" then returnm ('b"00001"  : mword 5)
    else if generic_eq p0_ "sp" then returnm ('b"00010"  : mword 5)
    else if generic_eq p0_ "gp" then returnm ('b"00011"  : mword 5)
    else if generic_eq p0_ "tp" then returnm ('b"00100"  : mword 5)
    else if generic_eq p0_ "t0" then returnm ('b"00101"  : mword 5)
    else if generic_eq p0_ "t1" then returnm ('b"00110"  : mword 5)
    else if generic_eq p0_ "t2" then returnm ('b"00111"  : mword 5)
    else if generic_eq p0_ "fp" then returnm ('b"01000"  : mword 5)
    else if generic_eq p0_ "s1" then returnm ('b"01001"  : mword 5)
    else if generic_eq p0_ "a0" then returnm ('b"01010"  : mword 5)
    else if generic_eq p0_ "a1" then returnm ('b"01011"  : mword 5)
    else if generic_eq p0_ "a2" then returnm ('b"01100"  : mword 5)
    else if generic_eq p0_ "a3" then returnm ('b"01101"  : mword 5)
    else if generic_eq p0_ "a4" then returnm ('b"01110"  : mword 5)
    else if generic_eq p0_ "a5" then returnm ('b"01111"  : mword 5)
    else if generic_eq p0_ "a6" then returnm ('b"10000"  : mword 5)
    else if generic_eq p0_ "a7" then returnm ('b"10001"  : mword 5)
    else if generic_eq p0_ "s2" then returnm ('b"10010"  : mword 5)
    else if generic_eq p0_ "s3" then returnm ('b"10011"  : mword 5)
    else if generic_eq p0_ "s4" then returnm ('b"10100"  : mword 5)
    else if generic_eq p0_ "s5" then returnm ('b"10101"  : mword 5)
    else if generic_eq p0_ "s6" then returnm ('b"10110"  : mword 5)
    else if generic_eq p0_ "s7" then returnm ('b"10111"  : mword 5)
    else if generic_eq p0_ "s8" then returnm ('b"11000"  : mword 5)
    else if generic_eq p0_ "s9" then returnm ('b"11001"  : mword 5)
    else if generic_eq p0_ "s10" then returnm ('b"11010"  : mword 5)
    else if generic_eq p0_ "s11" then returnm ('b"11011"  : mword 5)
    else if generic_eq p0_ "t3" then returnm ('b"11100"  : mword 5)
    else if generic_eq p0_ "t4" then returnm ('b"11101"  : mword 5)
    else if generic_eq p0_ "t5" then returnm ('b"11110"  : mword 5)
    else if generic_eq p0_ "t6" then returnm ('b"11111"  : mword 5)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 5).

Definition reg_name_forwards_matches (arg_ : mword 5) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"00000"  : mword 5) then true
   else if eq_vec b__0 ('b"00001"  : mword 5) then true
   else if eq_vec b__0 ('b"00010"  : mword 5) then true
   else if eq_vec b__0 ('b"00011"  : mword 5) then true
   else if eq_vec b__0 ('b"00100"  : mword 5) then true
   else if eq_vec b__0 ('b"00101"  : mword 5) then true
   else if eq_vec b__0 ('b"00110"  : mword 5) then true
   else if eq_vec b__0 ('b"00111"  : mword 5) then true
   else if eq_vec b__0 ('b"01000"  : mword 5) then true
   else if eq_vec b__0 ('b"01001"  : mword 5) then true
   else if eq_vec b__0 ('b"01010"  : mword 5) then true
   else if eq_vec b__0 ('b"01011"  : mword 5) then true
   else if eq_vec b__0 ('b"01100"  : mword 5) then true
   else if eq_vec b__0 ('b"01101"  : mword 5) then true
   else if eq_vec b__0 ('b"01110"  : mword 5) then true
   else if eq_vec b__0 ('b"01111"  : mword 5) then true
   else if eq_vec b__0 ('b"10000"  : mword 5) then true
   else if eq_vec b__0 ('b"10001"  : mword 5) then true
   else if eq_vec b__0 ('b"10010"  : mword 5) then true
   else if eq_vec b__0 ('b"10011"  : mword 5) then true
   else if eq_vec b__0 ('b"10100"  : mword 5) then true
   else if eq_vec b__0 ('b"10101"  : mword 5) then true
   else if eq_vec b__0 ('b"10110"  : mword 5) then true
   else if eq_vec b__0 ('b"10111"  : mword 5) then true
   else if eq_vec b__0 ('b"11000"  : mword 5) then true
   else if eq_vec b__0 ('b"11001"  : mword 5) then true
   else if eq_vec b__0 ('b"11010"  : mword 5) then true
   else if eq_vec b__0 ('b"11011"  : mword 5) then true
   else if eq_vec b__0 ('b"11100"  : mword 5) then true
   else if eq_vec b__0 ('b"11101"  : mword 5) then true
   else if eq_vec b__0 ('b"11110"  : mword 5) then true
   else if eq_vec b__0 ('b"11111"  : mword 5) then true
   else false.

Definition reg_name_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "zero" then true
   else if generic_eq p0_ "ra" then true
   else if generic_eq p0_ "sp" then true
   else if generic_eq p0_ "gp" then true
   else if generic_eq p0_ "tp" then true
   else if generic_eq p0_ "t0" then true
   else if generic_eq p0_ "t1" then true
   else if generic_eq p0_ "t2" then true
   else if generic_eq p0_ "fp" then true
   else if generic_eq p0_ "s1" then true
   else if generic_eq p0_ "a0" then true
   else if generic_eq p0_ "a1" then true
   else if generic_eq p0_ "a2" then true
   else if generic_eq p0_ "a3" then true
   else if generic_eq p0_ "a4" then true
   else if generic_eq p0_ "a5" then true
   else if generic_eq p0_ "a6" then true
   else if generic_eq p0_ "a7" then true
   else if generic_eq p0_ "s2" then true
   else if generic_eq p0_ "s3" then true
   else if generic_eq p0_ "s4" then true
   else if generic_eq p0_ "s5" then true
   else if generic_eq p0_ "s6" then true
   else if generic_eq p0_ "s7" then true
   else if generic_eq p0_ "s8" then true
   else if generic_eq p0_ "s9" then true
   else if generic_eq p0_ "s10" then true
   else if generic_eq p0_ "s11" then true
   else if generic_eq p0_ "t3" then true
   else if generic_eq p0_ "t4" then true
   else if generic_eq p0_ "t5" then true
   else if generic_eq p0_ "t6" then true
   else false.

Definition _s164_ (_s165_ : string) : option string :=
   let _s166_ := _s165_ in
   if string_startswith _s166_ "t6" then
     match (string_drop _s166_ (projT1 (string_length "t6"))) with | s_ => Some s_ end
   else None.

Definition _s160_ (_s161_ : string) : option string :=
   let _s162_ := _s161_ in
   if string_startswith _s162_ "t5" then
     match (string_drop _s162_ (projT1 (string_length "t5"))) with | s_ => Some s_ end
   else None.

Definition _s156_ (_s157_ : string) : option string :=
   let _s158_ := _s157_ in
   if string_startswith _s158_ "t4" then
     match (string_drop _s158_ (projT1 (string_length "t4"))) with | s_ => Some s_ end
   else None.

Definition _s152_ (_s153_ : string) : option string :=
   let _s154_ := _s153_ in
   if string_startswith _s154_ "t3" then
     match (string_drop _s154_ (projT1 (string_length "t3"))) with | s_ => Some s_ end
   else None.

Definition _s148_ (_s149_ : string) : option string :=
   let _s150_ := _s149_ in
   if string_startswith _s150_ "s11" then
     match (string_drop _s150_ (projT1 (string_length "s11"))) with | s_ => Some s_ end
   else None.

Definition _s144_ (_s145_ : string) : option string :=
   let _s146_ := _s145_ in
   if string_startswith _s146_ "s10" then
     match (string_drop _s146_ (projT1 (string_length "s10"))) with | s_ => Some s_ end
   else None.

Definition _s140_ (_s141_ : string) : option string :=
   let _s142_ := _s141_ in
   if string_startswith _s142_ "s9" then
     match (string_drop _s142_ (projT1 (string_length "s9"))) with | s_ => Some s_ end
   else None.

Definition _s136_ (_s137_ : string) : option string :=
   let _s138_ := _s137_ in
   if string_startswith _s138_ "s8" then
     match (string_drop _s138_ (projT1 (string_length "s8"))) with | s_ => Some s_ end
   else None.

Definition _s132_ (_s133_ : string) : option string :=
   let _s134_ := _s133_ in
   if string_startswith _s134_ "s7" then
     match (string_drop _s134_ (projT1 (string_length "s7"))) with | s_ => Some s_ end
   else None.

Definition _s128_ (_s129_ : string) : option string :=
   let _s130_ := _s129_ in
   if string_startswith _s130_ "s6" then
     match (string_drop _s130_ (projT1 (string_length "s6"))) with | s_ => Some s_ end
   else None.

Definition _s124_ (_s125_ : string) : option string :=
   let _s126_ := _s125_ in
   if string_startswith _s126_ "s5" then
     match (string_drop _s126_ (projT1 (string_length "s5"))) with | s_ => Some s_ end
   else None.

Definition _s120_ (_s121_ : string) : option string :=
   let _s122_ := _s121_ in
   if string_startswith _s122_ "s4" then
     match (string_drop _s122_ (projT1 (string_length "s4"))) with | s_ => Some s_ end
   else None.

Definition _s116_ (_s117_ : string) : option string :=
   let _s118_ := _s117_ in
   if string_startswith _s118_ "s3" then
     match (string_drop _s118_ (projT1 (string_length "s3"))) with | s_ => Some s_ end
   else None.

Definition _s112_ (_s113_ : string) : option string :=
   let _s114_ := _s113_ in
   if string_startswith _s114_ "s2" then
     match (string_drop _s114_ (projT1 (string_length "s2"))) with | s_ => Some s_ end
   else None.

Definition _s108_ (_s109_ : string) : option string :=
   let _s110_ := _s109_ in
   if string_startswith _s110_ "a7" then
     match (string_drop _s110_ (projT1 (string_length "a7"))) with | s_ => Some s_ end
   else None.

Definition _s104_ (_s105_ : string) : option string :=
   let _s106_ := _s105_ in
   if string_startswith _s106_ "a6" then
     match (string_drop _s106_ (projT1 (string_length "a6"))) with | s_ => Some s_ end
   else None.

Definition _s100_ (_s101_ : string) : option string :=
   let _s102_ := _s101_ in
   if string_startswith _s102_ "a5" then
     match (string_drop _s102_ (projT1 (string_length "a5"))) with | s_ => Some s_ end
   else None.

Definition _s96_ (_s97_ : string) : option string :=
   let _s98_ := _s97_ in
   if string_startswith _s98_ "a4" then
     match (string_drop _s98_ (projT1 (string_length "a4"))) with | s_ => Some s_ end
   else None.

Definition _s92_ (_s93_ : string) : option string :=
   let _s94_ := _s93_ in
   if string_startswith _s94_ "a3" then
     match (string_drop _s94_ (projT1 (string_length "a3"))) with | s_ => Some s_ end
   else None.

Definition _s88_ (_s89_ : string) : option string :=
   let _s90_ := _s89_ in
   if string_startswith _s90_ "a2" then
     match (string_drop _s90_ (projT1 (string_length "a2"))) with | s_ => Some s_ end
   else None.

Definition _s84_ (_s85_ : string) : option string :=
   let _s86_ := _s85_ in
   if string_startswith _s86_ "a1" then
     match (string_drop _s86_ (projT1 (string_length "a1"))) with | s_ => Some s_ end
   else None.

Definition _s80_ (_s81_ : string) : option string :=
   let _s82_ := _s81_ in
   if string_startswith _s82_ "a0" then
     match (string_drop _s82_ (projT1 (string_length "a0"))) with | s_ => Some s_ end
   else None.

Definition _s76_ (_s77_ : string) : option string :=
   let _s78_ := _s77_ in
   if string_startswith _s78_ "s1" then
     match (string_drop _s78_ (projT1 (string_length "s1"))) with | s_ => Some s_ end
   else None.

Definition _s72_ (_s73_ : string) : option string :=
   let _s74_ := _s73_ in
   if string_startswith _s74_ "fp" then
     match (string_drop _s74_ (projT1 (string_length "fp"))) with | s_ => Some s_ end
   else None.

Definition _s68_ (_s69_ : string) : option string :=
   let _s70_ := _s69_ in
   if string_startswith _s70_ "t2" then
     match (string_drop _s70_ (projT1 (string_length "t2"))) with | s_ => Some s_ end
   else None.

Definition _s64_ (_s65_ : string) : option string :=
   let _s66_ := _s65_ in
   if string_startswith _s66_ "t1" then
     match (string_drop _s66_ (projT1 (string_length "t1"))) with | s_ => Some s_ end
   else None.

Definition _s60_ (_s61_ : string) : option string :=
   let _s62_ := _s61_ in
   if string_startswith _s62_ "t0" then
     match (string_drop _s62_ (projT1 (string_length "t0"))) with | s_ => Some s_ end
   else None.

Definition _s56_ (_s57_ : string) : option string :=
   let _s58_ := _s57_ in
   if string_startswith _s58_ "tp" then
     match (string_drop _s58_ (projT1 (string_length "tp"))) with | s_ => Some s_ end
   else None.

Definition _s52_ (_s53_ : string) : option string :=
   let _s54_ := _s53_ in
   if string_startswith _s54_ "gp" then
     match (string_drop _s54_ (projT1 (string_length "gp"))) with | s_ => Some s_ end
   else None.

Definition _s48_ (_s49_ : string) : option string :=
   let _s50_ := _s49_ in
   if string_startswith _s50_ "sp" then
     match (string_drop _s50_ (projT1 (string_length "sp"))) with | s_ => Some s_ end
   else None.

Definition _s44_ (_s45_ : string) : option string :=
   let _s46_ := _s45_ in
   if string_startswith _s46_ "ra" then
     match (string_drop _s46_ (projT1 (string_length "ra"))) with | s_ => Some s_ end
   else None.

Definition _s40_ (_s41_ : string) : option string :=
   let _s42_ := _s41_ in
   if string_startswith _s42_ "zero" then
     match (string_drop _s42_ (projT1 (string_length "zero"))) with | s_ => Some s_ end
   else None.

Definition reg_name_matches_prefix (arg_ : string)
: M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s43_ := arg_ in
   (if match (_s40_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s40_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"00000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s44_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s44_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"00001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s48_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s48_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"00010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s52_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s52_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"00011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s56_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s56_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"00100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s60_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s60_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"00101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s64_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s64_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"00110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s68_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s68_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"00111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s72_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s72_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"01000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s76_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s76_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"01001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s80_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s80_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"01010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s84_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s84_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"01011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s88_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s88_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"01100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s92_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s92_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"01101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s96_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s96_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"01110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s100_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s100_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"01111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s104_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s104_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"10000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s108_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s108_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"10001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s112_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s112_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"10010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s116_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s116_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"10011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s120_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s120_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"10100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s124_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s124_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"10101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s128_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s128_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"10110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s132_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s132_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"10111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s136_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s136_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"11000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s140_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s140_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"11001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s144_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s144_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"11010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s148_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s148_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"11011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s152_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s152_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"11100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s156_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s156_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"11101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s160_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s160_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"11110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s164_ _s43_) with | Some s_ => true | _ => false end then
      (match (_s164_ _s43_) with
       | Some s_ =>
          returnm (Some
                     ('b"11111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)}))).

Definition creg_name_forwards (arg_ : mword 3) : M (string) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"000"  : mword 3) then returnm "s0"
    else if eq_vec b__0 ('b"001"  : mword 3) then returnm "s1"
    else if eq_vec b__0 ('b"010"  : mword 3) then returnm "a0"
    else if eq_vec b__0 ('b"011"  : mword 3) then returnm "a1"
    else if eq_vec b__0 ('b"100"  : mword 3) then returnm "a2"
    else if eq_vec b__0 ('b"101"  : mword 3) then returnm "a3"
    else if eq_vec b__0 ('b"110"  : mword 3) then returnm "a4"
    else if eq_vec b__0 ('b"111"  : mword 3) then returnm "a5"
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (string).

Definition creg_name_backwards (arg_ : string) : M (mword 3) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "s0" then returnm ('b"000"  : mword 3)
    else if generic_eq p0_ "s1" then returnm ('b"001"  : mword 3)
    else if generic_eq p0_ "a0" then returnm ('b"010"  : mword 3)
    else if generic_eq p0_ "a1" then returnm ('b"011"  : mword 3)
    else if generic_eq p0_ "a2" then returnm ('b"100"  : mword 3)
    else if generic_eq p0_ "a3" then returnm ('b"101"  : mword 3)
    else if generic_eq p0_ "a4" then returnm ('b"110"  : mword 3)
    else if generic_eq p0_ "a5" then returnm ('b"111"  : mword 3)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 3).

Definition creg_name_forwards_matches (arg_ : mword 3) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"000"  : mword 3) then true
   else if eq_vec b__0 ('b"001"  : mword 3) then true
   else if eq_vec b__0 ('b"010"  : mword 3) then true
   else if eq_vec b__0 ('b"011"  : mword 3) then true
   else if eq_vec b__0 ('b"100"  : mword 3) then true
   else if eq_vec b__0 ('b"101"  : mword 3) then true
   else if eq_vec b__0 ('b"110"  : mword 3) then true
   else if eq_vec b__0 ('b"111"  : mword 3) then true
   else false.

Definition creg_name_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "s0" then true
   else if generic_eq p0_ "s1" then true
   else if generic_eq p0_ "a0" then true
   else if generic_eq p0_ "a1" then true
   else if generic_eq p0_ "a2" then true
   else if generic_eq p0_ "a3" then true
   else if generic_eq p0_ "a4" then true
   else if generic_eq p0_ "a5" then true
   else false.

Definition _s196_ (_s197_ : string) : option string :=
   let _s198_ := _s197_ in
   if string_startswith _s198_ "a5" then
     match (string_drop _s198_ (projT1 (string_length "a5"))) with | s_ => Some s_ end
   else None.

Definition _s192_ (_s193_ : string) : option string :=
   let _s194_ := _s193_ in
   if string_startswith _s194_ "a4" then
     match (string_drop _s194_ (projT1 (string_length "a4"))) with | s_ => Some s_ end
   else None.

Definition _s188_ (_s189_ : string) : option string :=
   let _s190_ := _s189_ in
   if string_startswith _s190_ "a3" then
     match (string_drop _s190_ (projT1 (string_length "a3"))) with | s_ => Some s_ end
   else None.

Definition _s184_ (_s185_ : string) : option string :=
   let _s186_ := _s185_ in
   if string_startswith _s186_ "a2" then
     match (string_drop _s186_ (projT1 (string_length "a2"))) with | s_ => Some s_ end
   else None.

Definition _s180_ (_s181_ : string) : option string :=
   let _s182_ := _s181_ in
   if string_startswith _s182_ "a1" then
     match (string_drop _s182_ (projT1 (string_length "a1"))) with | s_ => Some s_ end
   else None.

Definition _s176_ (_s177_ : string) : option string :=
   let _s178_ := _s177_ in
   if string_startswith _s178_ "a0" then
     match (string_drop _s178_ (projT1 (string_length "a0"))) with | s_ => Some s_ end
   else None.

Definition _s172_ (_s173_ : string) : option string :=
   let _s174_ := _s173_ in
   if string_startswith _s174_ "s1" then
     match (string_drop _s174_ (projT1 (string_length "s1"))) with | s_ => Some s_ end
   else None.

Definition _s168_ (_s169_ : string) : option string :=
   let _s170_ := _s169_ in
   if string_startswith _s170_ "s0" then
     match (string_drop _s170_ (projT1 (string_length "s0"))) with | s_ => Some s_ end
   else None.

Definition creg_name_matches_prefix (arg_ : string)
: M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s171_ := arg_ in
   (if match (_s168_ _s171_) with | Some s_ => true | _ => false end then
      (match (_s168_ _s171_) with
       | Some s_ =>
          returnm (Some
                     ('b"000"
                      : mword 3, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s172_ _s171_) with | Some s_ => true | _ => false end then
      (match (_s172_ _s171_) with
       | Some s_ =>
          returnm (Some
                     ('b"001"
                      : mword 3, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s176_ _s171_) with | Some s_ => true | _ => false end then
      (match (_s176_ _s171_) with
       | Some s_ =>
          returnm (Some
                     ('b"010"
                      : mword 3, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s180_ _s171_) with | Some s_ => true | _ => false end then
      (match (_s180_ _s171_) with
       | Some s_ =>
          returnm (Some
                     ('b"011"
                      : mword 3, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s184_ _s171_) with | Some s_ => true | _ => false end then
      (match (_s184_ _s171_) with
       | Some s_ =>
          returnm (Some
                     ('b"100"
                      : mword 3, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s188_ _s171_) with | Some s_ => true | _ => false end then
      (match (_s188_ _s171_) with
       | Some s_ =>
          returnm (Some
                     ('b"101"
                      : mword 3, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s192_ _s171_) with | Some s_ => true | _ => false end then
      (match (_s192_ _s171_) with
       | Some s_ =>
          returnm (Some
                     ('b"110"
                      : mword 3, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s196_ _s171_) with | Some s_ => true | _ => false end then
      (match (_s196_ _s171_) with
       | Some s_ =>
          returnm (Some
                     ('b"111"
                      : mword 3, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 3 * {n : Z & ArithFact (n >=? 0)}))).

Definition init_base_regs '(tt : unit) : M (unit) :=
   write_reg x1_ref zero_reg >>
   write_reg x2_ref zero_reg >>
   write_reg x3_ref zero_reg >>
   write_reg x4_ref zero_reg >>
   write_reg x5_ref zero_reg >>
   write_reg x6_ref zero_reg >>
   write_reg x7_ref zero_reg >>
   write_reg x8_ref zero_reg >>
   write_reg x9_ref zero_reg >>
   write_reg x10_ref zero_reg >>
   write_reg x11_ref zero_reg >>
   write_reg x12_ref zero_reg >>
   write_reg x13_ref zero_reg >>
   write_reg x14_ref zero_reg >>
   write_reg x15_ref zero_reg >>
   write_reg x16_ref zero_reg >>
   write_reg x17_ref zero_reg >>
   write_reg x18_ref zero_reg >>
   write_reg x19_ref zero_reg >>
   write_reg x20_ref zero_reg >>
   write_reg x21_ref zero_reg >>
   write_reg x22_ref zero_reg >>
   write_reg x23_ref zero_reg >>
   write_reg x24_ref zero_reg >>
   write_reg x25_ref zero_reg >>
   write_reg x26_ref zero_reg >>
   write_reg x27_ref zero_reg >>
   write_reg x28_ref zero_reg >>
   write_reg x29_ref zero_reg >>
   write_reg x30_ref zero_reg >> write_reg x31_ref zero_reg  : M (unit).

Definition get_arch_pc '(tt : unit) : M (mword 32) :=
   ((read_reg PC_ref)  : M (mword 32))  : M (mword 32).

Definition get_next_pc '(tt : unit) : M (mword 32) :=
   ((read_reg nextPC_ref)  : M (mword 32))  : M (mword 32).

Definition set_next_pc (pc : mword 32) : M (unit) := write_reg nextPC_ref pc  : M (unit).

Definition tick_pc '(tt : unit) : M (unit) :=
   ((read_reg nextPC_ref)  : M (mword 32)) >>= fun w__0 : mword 32 =>
   write_reg PC_ref w__0
    : M (unit).

Definition Mk_Misa (v : mword 32) : Misa := {| Misa_Misa_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Misa_bits (v : Misa) : mword 32 := subrange_vec_dec v.(Misa_Misa_chunk_0) 31 0.

Definition _set_Misa_bits (r_ref : register_ref regstate register_value Misa) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_bits (v : Misa) (x : mword 32) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Misa_MXL (v : Misa) : mword 2 := subrange_vec_dec v.(Misa_Misa_chunk_0) 31 30.

Definition _set_Misa_MXL (r_ref : register_ref regstate register_value Misa) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 31 30 (subrange_vec_dec v 1 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_MXL (v : Misa) (x : mword 2) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 31 30 (subrange_vec_dec x 1 0)) ]}.

Definition _get_Misa_Z (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 25 25.

Definition _set_Misa_Z (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 25 25 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_Z (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 25 25 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_Y (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 24 24.

Definition _set_Misa_Y (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 24 24 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_Y (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 24 24 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_X (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 23 23.

Definition _set_Misa_X (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 23 23 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_X (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 23 23 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_W (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 22 22.

Definition _set_Misa_W (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 22 22 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_W (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 22 22 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_V (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 21 21.

Definition _set_Misa_V (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 21 21 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_V (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 21 21 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_U (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 20 20.

Definition _set_Misa_U (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 20 20 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_U (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 20 20 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_T (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 19 19.

Definition _set_Misa_T (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 19 19 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_T (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 19 19 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_S (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 18 18.

Definition _set_Misa_S (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 18 18 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_S (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 18 18 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_R (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 17 17.

Definition _set_Misa_R (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 17 17 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_R (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 17 17 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_Q (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 16 16.

Definition _set_Misa_Q (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 16 16 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_Q (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 16 16 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_P (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 15 15.

Definition _set_Misa_P (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 15 15 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_P (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 15 15 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_O (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 14 14.

Definition _set_Misa_O (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 14 14 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_O (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 14 14 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_N (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 13 13.

Definition _set_Misa_N (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 13 13 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_N (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 13 13 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_M (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 12 12.

Definition _set_Misa_M (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 12 12 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_M (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 12 12 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_L (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 11 11.

Definition _set_Misa_L (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 11 11 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_L (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 11 11 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_K (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 10 10.

Definition _set_Misa_K (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 10 10 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_K (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 10 10 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_J (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 9 9.

Definition _set_Misa_J (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 9 9 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_J (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 9 9 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_I (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 8 8.

Definition _set_Misa_I (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_I (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_H (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 7 7.

Definition _set_Misa_H (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_H (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_G (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 6 6.

Definition _set_Misa_G (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 6 6 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_G (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 6 6 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_F (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 5 5.

Definition _set_Misa_F (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_F (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_E (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 4 4.

Definition _set_Misa_E (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_E (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_D (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 3 3.

Definition _set_Misa_D (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_D (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_C (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 2 2.

Definition _set_Misa_C (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_C (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_B (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 1 1.

Definition _set_Misa_B (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_B (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Misa_A (v : Misa) : mword 1 := subrange_vec_dec v.(Misa_Misa_chunk_0) 0 0.

Definition _set_Misa_A (r_ref : register_ref regstate register_value Misa) (v : mword 1) : M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Misa_Misa_chunk_0 :=
         (update_subrange_vec_dec r.(Misa_Misa_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Misa in
   write_reg r_ref r
    : M (unit).

Definition _update_Misa_A (v : Misa) (x : mword 1) : Misa :=
   {[ v with
     Misa_Misa_chunk_0 :=
       (update_subrange_vec_dec v.(Misa_Misa_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition ext_veto_disable_C '(tt : unit) : M (bool) := returnm false.

Definition legalize_misa (m : Misa) (v : mword 32) : M (Misa) :=
   (if sys_enable_writable_misa tt then
      let v := Mk_Misa v in
      (or_boolM
         ((and_boolM (returnm ((eq_vec (_get_Misa_C v) ('b"0"  : mword 1))  : bool))
             ((or_boolM
                 (((read_reg nextPC_ref)  : M (mword 32)) >>= fun w__0 : mword 32 =>
                  returnm ((eq_bit (access_vec_dec w__0 1) B1)  : bool))
                 ((ext_veto_disable_C tt)
                  : M (bool)))
              : M (bool)))
          : M (bool)) (returnm ((negb (sys_enable_rvc tt))  : bool))) >>= fun w__4 : bool =>
      let m := if sumbool_of_bool w__4 then m else _update_Misa_C m (_get_Misa_C v) in
      returnm (if orb (negb (sys_enable_fdext tt))
                    (andb (eq_vec (_get_Misa_D v) ('b"1"  : mword 1))
                       (eq_vec (_get_Misa_F v) ('b"0"  : mword 1))) then
                 m
               else _update_Misa_D (_update_Misa_F m (_get_Misa_F v)) (_get_Misa_D v))
    else returnm m)
    : M (Misa).

Definition haveAtomics '(tt : unit) : M (bool) :=
   read_reg misa_ref >>= fun w__0 : Misa => returnm (eq_vec (_get_Misa_A w__0) ('b"1"  : mword 1)).

Definition haveRVC '(tt : unit) : M (bool) :=
   read_reg misa_ref >>= fun w__0 : Misa => returnm (eq_vec (_get_Misa_C w__0) ('b"1"  : mword 1)).

Definition haveMulDiv '(tt : unit) : M (bool) :=
   read_reg misa_ref >>= fun w__0 : Misa => returnm (eq_vec (_get_Misa_M w__0) ('b"1"  : mword 1)).

Definition haveSupMode '(tt : unit) : M (bool) :=
   read_reg misa_ref >>= fun w__0 : Misa => returnm (eq_vec (_get_Misa_S w__0) ('b"1"  : mword 1)).

Definition haveUsrMode '(tt : unit) : M (bool) :=
   read_reg misa_ref >>= fun w__0 : Misa => returnm (eq_vec (_get_Misa_U w__0) ('b"1"  : mword 1)).

Definition haveNExt '(tt : unit) : M (bool) :=
   read_reg misa_ref >>= fun w__0 : Misa => returnm (eq_vec (_get_Misa_N w__0) ('b"1"  : mword 1)).

Definition Mk_Mstatush (v : mword 32) : Mstatush :=
   {| Mstatush_Mstatush_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Mstatush_bits (v : Mstatush) : mword 32 :=
   subrange_vec_dec v.(Mstatush_Mstatush_chunk_0) 31 0.

Definition _set_Mstatush_bits (r_ref : register_ref regstate register_value Mstatush) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatush_Mstatush_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatush_Mstatush_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Mstatush in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatush_bits (v : Mstatush) (x : mword 32) : Mstatush :=
   {[ v with
     Mstatush_Mstatush_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatush_Mstatush_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Mstatush_MBE (v : Mstatush) : mword 1 :=
   subrange_vec_dec v.(Mstatush_Mstatush_chunk_0) 5 5.

Definition _set_Mstatush_MBE (r_ref : register_ref regstate register_value Mstatush) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatush_Mstatush_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatush_Mstatush_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]}
      : Mstatush in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatush_MBE (v : Mstatush) (x : mword 1) : Mstatush :=
   {[ v with
     Mstatush_Mstatush_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatush_Mstatush_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatush_SBE (v : Mstatush) : mword 1 :=
   subrange_vec_dec v.(Mstatush_Mstatush_chunk_0) 4 4.

Definition _set_Mstatush_SBE (r_ref : register_ref regstate register_value Mstatush) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatush_Mstatush_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatush_Mstatush_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Mstatush in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatush_SBE (v : Mstatush) (x : mword 1) : Mstatush :=
   {[ v with
     Mstatush_Mstatush_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatush_Mstatush_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition Mk_Mstatus (v : mword 32) : Mstatus :=
   {| Mstatus_Mstatus_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Mstatus_bits (v : Mstatus) : mword 32 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 31 0.

Definition _set_Mstatus_bits (r_ref : register_ref regstate register_value Mstatus) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_bits (v : Mstatus) (x : mword 32) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Mstatus_SD (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 31 31.

Definition _set_Mstatus_SD (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 31 31 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_SD (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 31 31 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_TSR (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 22 22.

Definition _set_Mstatus_TSR (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 22 22 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_TSR (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 22 22 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_TW (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 21 21.

Definition _set_Mstatus_TW (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 21 21 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_TW (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 21 21 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_TVM (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 20 20.

Definition _set_Mstatus_TVM (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 20 20 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_TVM (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 20 20 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_MXR (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 19 19.

Definition _set_Mstatus_MXR (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 19 19 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_MXR (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 19 19 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_SUM (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 18 18.

Definition _set_Mstatus_SUM (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 18 18 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_SUM (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 18 18 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_MPRV (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 17 17.

Definition _set_Mstatus_MPRV (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 17 17 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_MPRV (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 17 17 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_XS (v : Mstatus) : mword 2 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 16 15.

Definition _set_Mstatus_XS (r_ref : register_ref regstate register_value Mstatus) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 16 15 (subrange_vec_dec v 1 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_XS (v : Mstatus) (x : mword 2) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 16 15 (subrange_vec_dec x 1 0)) ]}.

Definition _get_Mstatus_FS (v : Mstatus) : mword 2 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 14 13.

Definition _set_Mstatus_FS (r_ref : register_ref regstate register_value Mstatus) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 14 13 (subrange_vec_dec v 1 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_FS (v : Mstatus) (x : mword 2) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 14 13 (subrange_vec_dec x 1 0)) ]}.

Definition _get_Mstatus_MPP (v : Mstatus) : mword 2 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 12 11.

Definition _set_Mstatus_MPP (r_ref : register_ref regstate register_value Mstatus) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 12 11 (subrange_vec_dec v 1 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_MPP (v : Mstatus) (x : mword 2) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 12 11 (subrange_vec_dec x 1 0)) ]}.

Definition _get_Mstatus_SPP (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 8 8.

Definition _set_Mstatus_SPP (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_SPP (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_MPIE (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 7 7.

Definition _set_Mstatus_MPIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_MPIE (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_SPIE (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 5 5.

Definition _set_Mstatus_SPIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_SPIE (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_UPIE (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 4 4.

Definition _set_Mstatus_UPIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_UPIE (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_MIE (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 3 3.

Definition _set_Mstatus_MIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_MIE (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_SIE (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 1 1.

Definition _set_Mstatus_SIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_SIE (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mstatus_UIE (v : Mstatus) : mword 1 :=
   subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 0 0.

Definition _set_Mstatus_UIE (r_ref : register_ref regstate register_value Mstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mstatus_Mstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Mstatus_Mstatus_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Mstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Mstatus_UIE (v : Mstatus) (x : mword 1) : Mstatus :=
   {[ v with
     Mstatus_Mstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Mstatus_Mstatus_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition effectivePrivilege (t : AccessType unit) (m : Mstatus) (priv : Privilege) : M (Privilege) :=
   (if andb (generic_neq t (Execute tt)) (eq_vec (_get_Mstatus_MPRV m) ('b"1"  : mword 1)) then
      (privLevel_of_bits (_get_Mstatus_MPP m))
       : M (Privilege)
    else returnm priv)
    : M (Privilege).

Definition get_mstatus_SXL (m : Mstatus) : mword 2 := arch_to_bits RV32.

Definition set_mstatus_SXL (m : Mstatus) (a : mword 2) : Mstatus := m.

Definition get_mstatus_UXL (m : Mstatus) : mword 2 := arch_to_bits RV32.

Definition set_mstatus_UXL (m : Mstatus) (a : mword 2) : Mstatus := m.

Definition legalize_mstatus (o : Mstatus) (v : mword 32) : M (Mstatus) :=
   let m : Mstatus :=
     Mk_Mstatus
       (EXTZ 32
          (concat_vec (subrange_vec_dec v 22 11)
             (concat_vec ('b"00"  : mword 2)
                (concat_vec (subrange_vec_dec v 8 7)
                   (concat_vec ('b"0"  : mword 1)
                      (concat_vec (subrange_vec_dec v 5 3)
                         (concat_vec ('b"0"  : mword 1) (subrange_vec_dec v 1 0)))))))) in
   let m := _update_Mstatus_XS m (extStatus_to_bits Off) in
   (or_boolM
      ((extStatus_of_bits (_get_Mstatus_FS m)) >>= fun w__0 : ExtStatus =>
       returnm ((generic_eq w__0 Dirty)  : bool))
      ((extStatus_of_bits (_get_Mstatus_XS m)) >>= fun w__1 : ExtStatus =>
       returnm ((generic_eq w__1 Dirty)  : bool))) >>= fun dirty =>
   let m := _update_Mstatus_SD m (bool_to_bits dirty) in
   let m := set_mstatus_SXL m (get_mstatus_SXL o) in
   let m := set_mstatus_UXL m (get_mstatus_UXL o) in
   let m := m in
   (haveNExt tt) >>= fun w__2 : bool =>
   let m :=
     if sumbool_of_bool (negb w__2) then
       let m := _update_Mstatus_UPIE m ('b"0"  : mword 1) in
       _update_Mstatus_UIE m ('b"0"  : mword 1)
     else m in
   (haveUsrMode tt) >>= fun w__3 : bool =>
   returnm (if sumbool_of_bool (negb w__3) then _update_Mstatus_MPRV m ('b"0"  : mword 1) else m).

Definition cur_Architecture '(tt : unit) : M (Architecture) :=
   read_reg cur_privilege_ref >>= fun w__0 : Privilege =>
   (match w__0 with
    | Machine => read_reg misa_ref >>= fun w__1 : Misa => returnm (_get_Misa_MXL w__1)
    | Supervisor => read_reg mstatus_ref >>= fun w__2 : Mstatus => returnm (get_mstatus_SXL w__2)
    | User => read_reg mstatus_ref >>= fun w__3 : Mstatus => returnm (get_mstatus_UXL w__3)
    end) >>= fun a : arch_xlen =>
   (match (architecture a) with
    | Some a => returnm a
    | None => (internal_error "Invalid current architecture")  : M (Architecture)
    end)
    : M (Architecture).

Definition in32BitMode '(tt : unit) : M (bool) :=
   (cur_Architecture tt) >>= fun w__0 : Architecture => returnm (generic_eq w__0 RV32).

Definition haveFExt '(tt : unit) : M (bool) :=
   (and_boolM
      (read_reg misa_ref >>= fun w__0 : Misa =>
       returnm ((eq_vec (_get_Misa_F w__0) ('b"1"  : mword 1))  : bool))
      (read_reg mstatus_ref >>= fun w__1 : Mstatus =>
       returnm ((neq_vec (_get_Mstatus_FS w__1) ('b"00"  : mword 2))  : bool)))
    : M (bool).

Definition haveDExt '(tt : unit) : M (bool) :=
   (and_boolM
      (read_reg misa_ref >>= fun w__0 : Misa =>
       returnm ((eq_vec (_get_Misa_D w__0) ('b"1"  : mword 1))  : bool))
      (read_reg mstatus_ref >>= fun w__1 : Mstatus =>
       returnm ((neq_vec (_get_Mstatus_FS w__1) ('b"00"  : mword 2))  : bool)))
    : M (bool).

Definition Mk_Minterrupts (v : mword 32) : Minterrupts :=
   {| Minterrupts_Minterrupts_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Minterrupts_bits (v : Minterrupts) : mword 32 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 31 0.

Definition _set_Minterrupts_bits
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_bits (v : Minterrupts) (x : mword 32) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Minterrupts_MEI (v : Minterrupts) : mword 1 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 11 11.

Definition _set_Minterrupts_MEI
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 11 11 (subrange_vec_dec v 0 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_MEI (v : Minterrupts) (x : mword 1) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 11 11 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Minterrupts_SEI (v : Minterrupts) : mword 1 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 9 9.

Definition _set_Minterrupts_SEI
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 9 9 (subrange_vec_dec v 0 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_SEI (v : Minterrupts) (x : mword 1) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 9 9 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Minterrupts_UEI (v : Minterrupts) : mword 1 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 8 8.

Definition _set_Minterrupts_UEI
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_UEI (v : Minterrupts) (x : mword 1) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Minterrupts_MTI (v : Minterrupts) : mword 1 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 7 7.

Definition _set_Minterrupts_MTI
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_MTI (v : Minterrupts) (x : mword 1) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Minterrupts_STI (v : Minterrupts) : mword 1 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 5 5.

Definition _set_Minterrupts_STI
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_STI (v : Minterrupts) (x : mword 1) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Minterrupts_UTI (v : Minterrupts) : mword 1 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 4 4.

Definition _set_Minterrupts_UTI
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_UTI (v : Minterrupts) (x : mword 1) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Minterrupts_MSI (v : Minterrupts) : mword 1 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 3 3.

Definition _set_Minterrupts_MSI
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_MSI (v : Minterrupts) (x : mword 1) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Minterrupts_SSI (v : Minterrupts) : mword 1 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 1 1.

Definition _set_Minterrupts_SSI
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_SSI (v : Minterrupts) (x : mword 1) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Minterrupts_USI (v : Minterrupts) : mword 1 :=
   subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 0 0.

Definition _set_Minterrupts_USI
(r_ref : register_ref regstate register_value Minterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Minterrupts_Minterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Minterrupts_Minterrupts_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Minterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Minterrupts_USI (v : Minterrupts) (x : mword 1) : Minterrupts :=
   {[ v with
     Minterrupts_Minterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Minterrupts_Minterrupts_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition legalize_mip (o : Minterrupts) (v : mword 32) : M (Minterrupts) :=
   let v := Mk_Minterrupts v in
   let m := _update_Minterrupts_SEI o (_get_Minterrupts_SEI v) in
   let m := _update_Minterrupts_STI m (_get_Minterrupts_STI v) in
   let m := _update_Minterrupts_SSI m (_get_Minterrupts_SSI v) in
   (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool))) >>= fun w__2 : bool =>
   returnm (if sumbool_of_bool w__2 then
              let m := _update_Minterrupts_UEI m (_get_Minterrupts_UEI v) in
              let m := _update_Minterrupts_UTI m (_get_Minterrupts_UTI v) in
              _update_Minterrupts_USI m (_get_Minterrupts_USI v)
            else m).

Definition legalize_mie (o : Minterrupts) (v : mword 32) : M (Minterrupts) :=
   let v := Mk_Minterrupts v in
   let m := _update_Minterrupts_MEI o (_get_Minterrupts_MEI v) in
   let m := _update_Minterrupts_MTI m (_get_Minterrupts_MTI v) in
   let m := _update_Minterrupts_MSI m (_get_Minterrupts_MSI v) in
   let m := _update_Minterrupts_SEI m (_get_Minterrupts_SEI v) in
   let m := _update_Minterrupts_STI m (_get_Minterrupts_STI v) in
   let m := _update_Minterrupts_SSI m (_get_Minterrupts_SSI v) in
   (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool))) >>= fun w__2 : bool =>
   returnm (if sumbool_of_bool w__2 then
              let m := _update_Minterrupts_UEI m (_get_Minterrupts_UEI v) in
              let m := _update_Minterrupts_UTI m (_get_Minterrupts_UTI v) in
              _update_Minterrupts_USI m (_get_Minterrupts_USI v)
            else m).

Definition legalize_mideleg (o : Minterrupts) (v : mword 32) : Minterrupts :=
   let m := Mk_Minterrupts v in
   let m := _update_Minterrupts_MEI m ('b"0"  : mword 1) in
   let m := _update_Minterrupts_MTI m ('b"0"  : mword 1) in
   _update_Minterrupts_MSI m ('b"0"  : mword 1).

Definition Mk_Medeleg (v : mword 32) : Medeleg :=
   {| Medeleg_Medeleg_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Medeleg_bits (v : Medeleg) : mword 32 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 31 0.

Definition _set_Medeleg_bits (r_ref : register_ref regstate register_value Medeleg) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_bits (v : Medeleg) (x : mword 32) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Medeleg_SAMO_Page_Fault (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 15 15.

Definition _set_Medeleg_SAMO_Page_Fault
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 15 15 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_SAMO_Page_Fault (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 15 15 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_Load_Page_Fault (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 13 13.

Definition _set_Medeleg_Load_Page_Fault
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 13 13 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_Load_Page_Fault (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 13 13 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_Fetch_Page_Fault (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 12 12.

Definition _set_Medeleg_Fetch_Page_Fault
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 12 12 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_Fetch_Page_Fault (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 12 12 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_MEnvCall (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 10 10.

Definition _set_Medeleg_MEnvCall
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 10 10 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_MEnvCall (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 10 10 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_SEnvCall (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 9 9.

Definition _set_Medeleg_SEnvCall
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 9 9 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_SEnvCall (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 9 9 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_UEnvCall (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 8 8.

Definition _set_Medeleg_UEnvCall
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_UEnvCall (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_SAMO_Access_Fault (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 7 7.

Definition _set_Medeleg_SAMO_Access_Fault
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_SAMO_Access_Fault (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_SAMO_Addr_Align (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 6 6.

Definition _set_Medeleg_SAMO_Addr_Align
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 6 6 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_SAMO_Addr_Align (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 6 6 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_Load_Access_Fault (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 5 5.

Definition _set_Medeleg_Load_Access_Fault
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_Load_Access_Fault (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_Load_Addr_Align (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 4 4.

Definition _set_Medeleg_Load_Addr_Align
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_Load_Addr_Align (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_Breakpoint (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 3 3.

Definition _set_Medeleg_Breakpoint
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_Breakpoint (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_Illegal_Instr (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 2 2.

Definition _set_Medeleg_Illegal_Instr
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_Illegal_Instr (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_Fetch_Access_Fault (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 1 1.

Definition _set_Medeleg_Fetch_Access_Fault
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_Fetch_Access_Fault (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Medeleg_Fetch_Addr_Align (v : Medeleg) : mword 1 :=
   subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 0 0.

Definition _set_Medeleg_Fetch_Addr_Align
(r_ref : register_ref regstate register_value Medeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Medeleg_Medeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Medeleg_Medeleg_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Medeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Medeleg_Fetch_Addr_Align (v : Medeleg) (x : mword 1) : Medeleg :=
   {[ v with
     Medeleg_Medeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Medeleg_Medeleg_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition legalize_medeleg (o : Medeleg) (v : mword 32) : Medeleg :=
   let m := Mk_Medeleg v in
   _update_Medeleg_MEnvCall m ('b"0"  : mword 1).

Definition Mk_Mtvec (v : mword 32) : Mtvec :=
   {| Mtvec_Mtvec_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Mtvec_bits (v : Mtvec) : mword 32 := subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 31 0.

Definition _set_Mtvec_bits (r_ref : register_ref regstate register_value Mtvec) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mtvec_Mtvec_chunk_0 :=
         (update_subrange_vec_dec r.(Mtvec_Mtvec_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Mtvec in
   write_reg r_ref r
    : M (unit).

Definition _update_Mtvec_bits (v : Mtvec) (x : mword 32) : Mtvec :=
   {[ v with
     Mtvec_Mtvec_chunk_0 :=
       (update_subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Mtvec_Base (v : Mtvec) : mword 30 := subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 31 2.

Definition _set_Mtvec_Base (r_ref : register_ref regstate register_value Mtvec) (v : mword 30)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mtvec_Mtvec_chunk_0 :=
         (update_subrange_vec_dec r.(Mtvec_Mtvec_chunk_0) 31 2 (subrange_vec_dec v 29 0)) ]}
      : Mtvec in
   write_reg r_ref r
    : M (unit).

Definition _update_Mtvec_Base (v : Mtvec) (x : mword 30) : Mtvec :=
   {[ v with
     Mtvec_Mtvec_chunk_0 :=
       (update_subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 31 2 (subrange_vec_dec x 29 0)) ]}.

Definition _get_Mtvec_Mode (v : Mtvec) : mword 2 := subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 1 0.

Definition _set_Mtvec_Mode (r_ref : register_ref regstate register_value Mtvec) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mtvec_Mtvec_chunk_0 :=
         (update_subrange_vec_dec r.(Mtvec_Mtvec_chunk_0) 1 0 (subrange_vec_dec v 1 0)) ]}
      : Mtvec in
   write_reg r_ref r
    : M (unit).

Definition _update_Mtvec_Mode (v : Mtvec) (x : mword 2) : Mtvec :=
   {[ v with
     Mtvec_Mtvec_chunk_0 :=
       (update_subrange_vec_dec v.(Mtvec_Mtvec_chunk_0) 1 0 (subrange_vec_dec x 1 0)) ]}.

Definition legalize_tvec (o : Mtvec) (v : mword 32) : Mtvec :=
   let v := Mk_Mtvec v in
   match (trapVectorMode_of_bits (_get_Mtvec_Mode v)) with
   | TV_Direct => v
   | TV_Vector => v
   | _ => _update_Mtvec_Mode v (_get_Mtvec_Mode o)
   end.

Definition Mk_Mcause (v : mword 32) : Mcause :=
   {| Mcause_Mcause_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Mcause_bits (v : Mcause) : mword 32 :=
   subrange_vec_dec v.(Mcause_Mcause_chunk_0) 31 0.

Definition _set_Mcause_bits (r_ref : register_ref regstate register_value Mcause) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mcause_Mcause_chunk_0 :=
         (update_subrange_vec_dec r.(Mcause_Mcause_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Mcause in
   write_reg r_ref r
    : M (unit).

Definition _update_Mcause_bits (v : Mcause) (x : mword 32) : Mcause :=
   {[ v with
     Mcause_Mcause_chunk_0 :=
       (update_subrange_vec_dec v.(Mcause_Mcause_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Mcause_IsInterrupt (v : Mcause) : mword 1 :=
   subrange_vec_dec v.(Mcause_Mcause_chunk_0) 31 31.

Definition _set_Mcause_IsInterrupt
(r_ref : register_ref regstate register_value Mcause) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mcause_Mcause_chunk_0 :=
         (update_subrange_vec_dec r.(Mcause_Mcause_chunk_0) 31 31 (subrange_vec_dec v 0 0)) ]}
      : Mcause in
   write_reg r_ref r
    : M (unit).

Definition _update_Mcause_IsInterrupt (v : Mcause) (x : mword 1) : Mcause :=
   {[ v with
     Mcause_Mcause_chunk_0 :=
       (update_subrange_vec_dec v.(Mcause_Mcause_chunk_0) 31 31 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Mcause_Cause (v : Mcause) : mword 31 :=
   subrange_vec_dec v.(Mcause_Mcause_chunk_0) 30 0.

Definition _set_Mcause_Cause (r_ref : register_ref regstate register_value Mcause) (v : mword 31)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Mcause_Mcause_chunk_0 :=
         (update_subrange_vec_dec r.(Mcause_Mcause_chunk_0) 30 0 (subrange_vec_dec v 30 0)) ]}
      : Mcause in
   write_reg r_ref r
    : M (unit).

Definition _update_Mcause_Cause (v : Mcause) (x : mword 31) : Mcause :=
   {[ v with
     Mcause_Mcause_chunk_0 :=
       (update_subrange_vec_dec v.(Mcause_Mcause_chunk_0) 30 0 (subrange_vec_dec x 30 0)) ]}.

Definition tvec_addr (m : Mtvec) (c : Mcause) : option (mword 32) :=
   let base : xlenbits := concat_vec (_get_Mtvec_Base m) ('b"00"  : mword 2) in
   match (trapVectorMode_of_bits (_get_Mtvec_Mode m)) with
   | TV_Direct => Some base
   | TV_Vector =>
      if eq_vec (_get_Mcause_IsInterrupt c) ('b"1"  : mword 1) then
        Some (add_vec base (shiftl (EXTZ 32 (_get_Mcause_Cause c)) 2))
      else Some base
   | TV_Reserved => None
   end.

Definition legalize_xepc (v : mword 32) : M (mword 32) :=
   (or_boolM (returnm ((andb (sys_enable_writable_misa tt) (sys_enable_rvc tt))  : bool))
      (read_reg misa_ref >>= fun w__0 : Misa =>
       returnm ((eq_vec (_get_Misa_C w__0) ('b"1"  : mword 1))  : bool))) >>= fun w__1 : bool =>
   returnm (if sumbool_of_bool w__1 then update_vec_dec v 0 B0
            else and_vec v (EXTS 32 ('b"100"  : mword 3))).

Definition pc_alignment_mask '(tt : unit) : M (mword 32) :=
   read_reg misa_ref >>= fun w__0 : Misa =>
   returnm (not_vec
              (EXTZ 32
                 (if eq_vec (_get_Misa_C w__0) ('b"1"  : mword 1) then 'b"00"  : mword 2
                  else 'b"10"  : mword 2))).

Definition Mk_Counteren (v : mword 32) : Counteren :=
   {| Counteren_Counteren_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Counteren_bits (v : Counteren) : mword 32 :=
   subrange_vec_dec v.(Counteren_Counteren_chunk_0) 31 0.

Definition _set_Counteren_bits
(r_ref : register_ref regstate register_value Counteren) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Counteren_Counteren_chunk_0 :=
         (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Counteren in
   write_reg r_ref r
    : M (unit).

Definition _update_Counteren_bits (v : Counteren) (x : mword 32) : Counteren :=
   {[ v with
     Counteren_Counteren_chunk_0 :=
       (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Counteren_HPM (v : Counteren) : mword 29 :=
   subrange_vec_dec v.(Counteren_Counteren_chunk_0) 31 3.

Definition _set_Counteren_HPM
(r_ref : register_ref regstate register_value Counteren) (v : mword 29)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Counteren_Counteren_chunk_0 :=
         (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 31 3 (subrange_vec_dec v 28 0)) ]}
      : Counteren in
   write_reg r_ref r
    : M (unit).

Definition _update_Counteren_HPM (v : Counteren) (x : mword 29) : Counteren :=
   {[ v with
     Counteren_Counteren_chunk_0 :=
       (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 31 3 (subrange_vec_dec x 28 0)) ]}.

Definition _get_Counteren_IR (v : Counteren) : mword 1 :=
   subrange_vec_dec v.(Counteren_Counteren_chunk_0) 2 2.

Definition _set_Counteren_IR (r_ref : register_ref regstate register_value Counteren) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Counteren_Counteren_chunk_0 :=
         (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]}
      : Counteren in
   write_reg r_ref r
    : M (unit).

Definition _update_Counteren_IR (v : Counteren) (x : mword 1) : Counteren :=
   {[ v with
     Counteren_Counteren_chunk_0 :=
       (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Counteren_TM (v : Counteren) : mword 1 :=
   subrange_vec_dec v.(Counteren_Counteren_chunk_0) 1 1.

Definition _set_Counteren_TM (r_ref : register_ref regstate register_value Counteren) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Counteren_Counteren_chunk_0 :=
         (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : Counteren in
   write_reg r_ref r
    : M (unit).

Definition _update_Counteren_TM (v : Counteren) (x : mword 1) : Counteren :=
   {[ v with
     Counteren_Counteren_chunk_0 :=
       (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Counteren_CY (v : Counteren) : mword 1 :=
   subrange_vec_dec v.(Counteren_Counteren_chunk_0) 0 0.

Definition _set_Counteren_CY (r_ref : register_ref regstate register_value Counteren) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Counteren_Counteren_chunk_0 :=
         (update_subrange_vec_dec r.(Counteren_Counteren_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Counteren in
   write_reg r_ref r
    : M (unit).

Definition _update_Counteren_CY (v : Counteren) (x : mword 1) : Counteren :=
   {[ v with
     Counteren_Counteren_chunk_0 :=
       (update_subrange_vec_dec v.(Counteren_Counteren_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition legalize_mcounteren (c : Counteren) (v : mword 32) : Counteren :=
   let c := _update_Counteren_IR c (vec_of_bits [access_vec_dec v 2]  : mword 1) in
   let c := _update_Counteren_TM c (vec_of_bits [access_vec_dec v 1]  : mword 1) in
   _update_Counteren_CY c (vec_of_bits [access_vec_dec v 0]  : mword 1).

Definition legalize_scounteren (c : Counteren) (v : mword 32) : Counteren :=
   let c := _update_Counteren_IR c (vec_of_bits [access_vec_dec v 2]  : mword 1) in
   let c := _update_Counteren_TM c (vec_of_bits [access_vec_dec v 1]  : mword 1) in
   _update_Counteren_CY c (vec_of_bits [access_vec_dec v 0]  : mword 1).

Definition Mk_Counterin (v : mword 32) : Counterin :=
   {| Counterin_Counterin_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Counterin_bits (v : Counterin) : mword 32 :=
   subrange_vec_dec v.(Counterin_Counterin_chunk_0) 31 0.

Definition _set_Counterin_bits
(r_ref : register_ref regstate register_value Counterin) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Counterin_Counterin_chunk_0 :=
         (update_subrange_vec_dec r.(Counterin_Counterin_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Counterin in
   write_reg r_ref r
    : M (unit).

Definition _update_Counterin_bits (v : Counterin) (x : mword 32) : Counterin :=
   {[ v with
     Counterin_Counterin_chunk_0 :=
       (update_subrange_vec_dec v.(Counterin_Counterin_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Counterin_IR (v : Counterin) : mword 1 :=
   subrange_vec_dec v.(Counterin_Counterin_chunk_0) 2 2.

Definition _set_Counterin_IR (r_ref : register_ref regstate register_value Counterin) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Counterin_Counterin_chunk_0 :=
         (update_subrange_vec_dec r.(Counterin_Counterin_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]}
      : Counterin in
   write_reg r_ref r
    : M (unit).

Definition _update_Counterin_IR (v : Counterin) (x : mword 1) : Counterin :=
   {[ v with
     Counterin_Counterin_chunk_0 :=
       (update_subrange_vec_dec v.(Counterin_Counterin_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Counterin_CY (v : Counterin) : mword 1 :=
   subrange_vec_dec v.(Counterin_Counterin_chunk_0) 0 0.

Definition _set_Counterin_CY (r_ref : register_ref regstate register_value Counterin) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Counterin_Counterin_chunk_0 :=
         (update_subrange_vec_dec r.(Counterin_Counterin_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Counterin in
   write_reg r_ref r
    : M (unit).

Definition _update_Counterin_CY (v : Counterin) (x : mword 1) : Counterin :=
   {[ v with
     Counterin_Counterin_chunk_0 :=
       (update_subrange_vec_dec v.(Counterin_Counterin_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition legalize_mcountinhibit (c : Counterin) (v : mword 32) : Counterin :=
   let c := _update_Counterin_IR c (vec_of_bits [access_vec_dec v 2]  : mword 1) in
   _update_Counterin_CY c (vec_of_bits [access_vec_dec v 0]  : mword 1).

Definition retire_instruction '(tt : unit) : M (unit) :=
   read_reg minstret_written_ref >>= fun w__0 : bool =>
   (if Bool.eqb w__0 true then write_reg minstret_written_ref false  : M (unit)
    else
    read_reg mcountinhibit_ref >>= fun w__1 : Counterin =>
    if eq_vec (_get_Counterin_IR w__1) ('b"0"  : mword 1) then
      ((read_reg minstret_ref)  : M (mword 64)) >>= fun w__2 : mword 64 =>
      write_reg minstret_ref (add_vec_int w__2 1)
       : M (unit)
    else returnm tt)
    : M (unit).

Definition Mk_Sstatus (v : mword 32) : Sstatus :=
   {| Sstatus_Sstatus_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Sstatus_bits (v : Sstatus) : mword 32 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 31 0.

Definition _set_Sstatus_bits (r_ref : register_ref regstate register_value Sstatus) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_bits (v : Sstatus) (x : mword 32) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Sstatus_SD (v : Sstatus) : mword 1 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 31 31.

Definition _set_Sstatus_SD (r_ref : register_ref regstate register_value Sstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 31 31 (subrange_vec_dec v 0 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_SD (v : Sstatus) (x : mword 1) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 31 31 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sstatus_MXR (v : Sstatus) : mword 1 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 19 19.

Definition _set_Sstatus_MXR (r_ref : register_ref regstate register_value Sstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 19 19 (subrange_vec_dec v 0 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_MXR (v : Sstatus) (x : mword 1) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 19 19 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sstatus_SUM (v : Sstatus) : mword 1 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 18 18.

Definition _set_Sstatus_SUM (r_ref : register_ref regstate register_value Sstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 18 18 (subrange_vec_dec v 0 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_SUM (v : Sstatus) (x : mword 1) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 18 18 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sstatus_XS (v : Sstatus) : mword 2 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 16 15.

Definition _set_Sstatus_XS (r_ref : register_ref regstate register_value Sstatus) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 16 15 (subrange_vec_dec v 1 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_XS (v : Sstatus) (x : mword 2) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 16 15 (subrange_vec_dec x 1 0)) ]}.

Definition _get_Sstatus_FS (v : Sstatus) : mword 2 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 14 13.

Definition _set_Sstatus_FS (r_ref : register_ref regstate register_value Sstatus) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 14 13 (subrange_vec_dec v 1 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_FS (v : Sstatus) (x : mword 2) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 14 13 (subrange_vec_dec x 1 0)) ]}.

Definition _get_Sstatus_SPP (v : Sstatus) : mword 1 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 8 8.

Definition _set_Sstatus_SPP (r_ref : register_ref regstate register_value Sstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_SPP (v : Sstatus) (x : mword 1) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sstatus_SPIE (v : Sstatus) : mword 1 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 5 5.

Definition _set_Sstatus_SPIE (r_ref : register_ref regstate register_value Sstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_SPIE (v : Sstatus) (x : mword 1) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sstatus_UPIE (v : Sstatus) : mword 1 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 4 4.

Definition _set_Sstatus_UPIE (r_ref : register_ref regstate register_value Sstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_UPIE (v : Sstatus) (x : mword 1) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sstatus_SIE (v : Sstatus) : mword 1 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 1 1.

Definition _set_Sstatus_SIE (r_ref : register_ref regstate register_value Sstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_SIE (v : Sstatus) (x : mword 1) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sstatus_UIE (v : Sstatus) : mword 1 :=
   subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 0 0.

Definition _set_Sstatus_UIE (r_ref : register_ref regstate register_value Sstatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sstatus_Sstatus_chunk_0 :=
         (update_subrange_vec_dec r.(Sstatus_Sstatus_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Sstatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Sstatus_UIE (v : Sstatus) (x : mword 1) : Sstatus :=
   {[ v with
     Sstatus_Sstatus_chunk_0 :=
       (update_subrange_vec_dec v.(Sstatus_Sstatus_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition get_sstatus_UXL (s : Sstatus) : mword 2 :=
   let m := Mk_Mstatus (_get_Sstatus_bits s) in
   get_mstatus_UXL m.

Definition set_sstatus_UXL (s : Sstatus) (a : mword 2) : Sstatus :=
   let m := Mk_Mstatus (_get_Sstatus_bits s) in
   let m := set_mstatus_UXL m a in
   Mk_Sstatus (_get_Mstatus_bits m).

Definition lower_mstatus (m : Mstatus) : Sstatus :=
   let s := Mk_Sstatus (EXTZ 32 ('b"0"  : mword 1)) in
   let s := _update_Sstatus_SD s (_get_Mstatus_SD m) in
   let s := set_sstatus_UXL s (get_mstatus_UXL m) in
   let s := _update_Sstatus_MXR s (_get_Mstatus_MXR m) in
   let s := _update_Sstatus_SUM s (_get_Mstatus_SUM m) in
   let s := _update_Sstatus_XS s (_get_Mstatus_XS m) in
   let s := _update_Sstatus_FS s (_get_Mstatus_FS m) in
   let s := _update_Sstatus_SPP s (_get_Mstatus_SPP m) in
   let s := _update_Sstatus_SPIE s (_get_Mstatus_SPIE m) in
   let s := _update_Sstatus_UPIE s (_get_Mstatus_UPIE m) in
   let s := _update_Sstatus_SIE s (_get_Mstatus_SIE m) in
   _update_Sstatus_UIE s (_get_Mstatus_UIE m).

Definition lift_sstatus (m : Mstatus) (s : Sstatus) : M (Mstatus) :=
   let m := _update_Mstatus_MXR m (_get_Sstatus_MXR s) in
   let m := _update_Mstatus_SUM m (_get_Sstatus_SUM s) in
   let m := _update_Mstatus_XS m (_get_Sstatus_XS s) in
   let m := _update_Mstatus_FS m (_get_Sstatus_FS s) in
   (or_boolM
      ((extStatus_of_bits (_get_Mstatus_FS m)) >>= fun w__0 : ExtStatus =>
       returnm ((generic_eq w__0 Dirty)  : bool))
      ((extStatus_of_bits (_get_Mstatus_XS m)) >>= fun w__1 : ExtStatus =>
       returnm ((generic_eq w__1 Dirty)  : bool))) >>= fun dirty =>
   let m := _update_Mstatus_SD m (bool_to_bits dirty) in
   let m := _update_Mstatus_SPP m (_get_Sstatus_SPP s) in
   let m := _update_Mstatus_SPIE m (_get_Sstatus_SPIE s) in
   let m := _update_Mstatus_UPIE m (_get_Sstatus_UPIE s) in
   let m := _update_Mstatus_SIE m (_get_Sstatus_SIE s) in
   let m := _update_Mstatus_UIE m (_get_Sstatus_UIE s) in
   returnm m.

Definition legalize_sstatus (m : Mstatus) (v : mword 32) : M (Mstatus) :=
   (lift_sstatus m (Mk_Sstatus v)) >>= fun w__0 : Mstatus =>
   (legalize_mstatus m (_get_Mstatus_bits w__0))
    : M (Mstatus).

Definition Mk_Sedeleg (v : mword 32) : Sedeleg :=
   {| Sedeleg_Sedeleg_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Sedeleg_bits (v : Sedeleg) : mword 32 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 31 0.

Definition _set_Sedeleg_bits (r_ref : register_ref regstate register_value Sedeleg) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_bits (v : Sedeleg) (x : mword 32) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Sedeleg_UEnvCall (v : Sedeleg) : mword 1 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 8 8.

Definition _set_Sedeleg_UEnvCall
(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_UEnvCall (v : Sedeleg) (x : mword 1) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sedeleg_SAMO_Access_Fault (v : Sedeleg) : mword 1 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 7 7.

Definition _set_Sedeleg_SAMO_Access_Fault
(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_SAMO_Access_Fault (v : Sedeleg) (x : mword 1) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sedeleg_SAMO_Addr_Align (v : Sedeleg) : mword 1 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 6 6.

Definition _set_Sedeleg_SAMO_Addr_Align
(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 6 6 (subrange_vec_dec v 0 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_SAMO_Addr_Align (v : Sedeleg) (x : mword 1) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 6 6 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sedeleg_Load_Access_Fault (v : Sedeleg) : mword 1 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 5 5.

Definition _set_Sedeleg_Load_Access_Fault
(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_Load_Access_Fault (v : Sedeleg) (x : mword 1) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sedeleg_Load_Addr_Align (v : Sedeleg) : mword 1 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 4 4.

Definition _set_Sedeleg_Load_Addr_Align
(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_Load_Addr_Align (v : Sedeleg) (x : mword 1) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sedeleg_Breakpoint (v : Sedeleg) : mword 1 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 3 3.

Definition _set_Sedeleg_Breakpoint
(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_Breakpoint (v : Sedeleg) (x : mword 1) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sedeleg_Illegal_Instr (v : Sedeleg) : mword 1 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 2 2.

Definition _set_Sedeleg_Illegal_Instr
(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_Illegal_Instr (v : Sedeleg) (x : mword 1) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sedeleg_Fetch_Access_Fault (v : Sedeleg) : mword 1 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 1 1.

Definition _set_Sedeleg_Fetch_Access_Fault
(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_Fetch_Access_Fault (v : Sedeleg) (x : mword 1) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sedeleg_Fetch_Addr_Align (v : Sedeleg) : mword 1 :=
   subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 0 0.

Definition _set_Sedeleg_Fetch_Addr_Align
(r_ref : register_ref regstate register_value Sedeleg) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sedeleg_Sedeleg_chunk_0 :=
         (update_subrange_vec_dec r.(Sedeleg_Sedeleg_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Sedeleg in
   write_reg r_ref r
    : M (unit).

Definition _update_Sedeleg_Fetch_Addr_Align (v : Sedeleg) (x : mword 1) : Sedeleg :=
   {[ v with
     Sedeleg_Sedeleg_chunk_0 :=
       (update_subrange_vec_dec v.(Sedeleg_Sedeleg_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition legalize_sedeleg (s : Sedeleg) (v : mword 32) : Sedeleg :=
   Mk_Sedeleg (EXTZ 32 (subrange_vec_dec v 8 0)).

Definition Mk_Sinterrupts (v : mword 32) : Sinterrupts :=
   {| Sinterrupts_Sinterrupts_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Sinterrupts_bits (v : Sinterrupts) : mword 32 :=
   subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 31 0.

Definition _set_Sinterrupts_bits
(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sinterrupts_Sinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Sinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Sinterrupts_bits (v : Sinterrupts) (x : mword 32) : Sinterrupts :=
   {[ v with
     Sinterrupts_Sinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Sinterrupts_SEI (v : Sinterrupts) : mword 1 :=
   subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 9 9.

Definition _set_Sinterrupts_SEI
(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sinterrupts_Sinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 9 9 (subrange_vec_dec v 0 0)) ]}
      : Sinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Sinterrupts_SEI (v : Sinterrupts) (x : mword 1) : Sinterrupts :=
   {[ v with
     Sinterrupts_Sinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 9 9 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sinterrupts_UEI (v : Sinterrupts) : mword 1 :=
   subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 8 8.

Definition _set_Sinterrupts_UEI
(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sinterrupts_Sinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]}
      : Sinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Sinterrupts_UEI (v : Sinterrupts) (x : mword 1) : Sinterrupts :=
   {[ v with
     Sinterrupts_Sinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sinterrupts_STI (v : Sinterrupts) : mword 1 :=
   subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 5 5.

Definition _set_Sinterrupts_STI
(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sinterrupts_Sinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]}
      : Sinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Sinterrupts_STI (v : Sinterrupts) (x : mword 1) : Sinterrupts :=
   {[ v with
     Sinterrupts_Sinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sinterrupts_UTI (v : Sinterrupts) : mword 1 :=
   subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 4 4.

Definition _set_Sinterrupts_UTI
(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sinterrupts_Sinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Sinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Sinterrupts_UTI (v : Sinterrupts) (x : mword 1) : Sinterrupts :=
   {[ v with
     Sinterrupts_Sinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sinterrupts_SSI (v : Sinterrupts) : mword 1 :=
   subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 1 1.

Definition _set_Sinterrupts_SSI
(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sinterrupts_Sinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : Sinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Sinterrupts_SSI (v : Sinterrupts) (x : mword 1) : Sinterrupts :=
   {[ v with
     Sinterrupts_Sinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Sinterrupts_USI (v : Sinterrupts) : mword 1 :=
   subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 0 0.

Definition _set_Sinterrupts_USI
(r_ref : register_ref regstate register_value Sinterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Sinterrupts_Sinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Sinterrupts_Sinterrupts_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Sinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Sinterrupts_USI (v : Sinterrupts) (x : mword 1) : Sinterrupts :=
   {[ v with
     Sinterrupts_Sinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Sinterrupts_Sinterrupts_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition lower_mip (m : Minterrupts) (d : Minterrupts) : Sinterrupts :=
   let s : Sinterrupts := Mk_Sinterrupts (EXTZ 32 ('b"0"  : mword 1)) in
   let s := _update_Sinterrupts_SEI s (and_vec (_get_Minterrupts_SEI m) (_get_Minterrupts_SEI d)) in
   let s := _update_Sinterrupts_STI s (and_vec (_get_Minterrupts_STI m) (_get_Minterrupts_STI d)) in
   let s := _update_Sinterrupts_SSI s (and_vec (_get_Minterrupts_SSI m) (_get_Minterrupts_SSI d)) in
   let s := _update_Sinterrupts_UEI s (and_vec (_get_Minterrupts_UEI m) (_get_Minterrupts_UEI d)) in
   let s := _update_Sinterrupts_UTI s (and_vec (_get_Minterrupts_UTI m) (_get_Minterrupts_UTI d)) in
   _update_Sinterrupts_USI s (and_vec (_get_Minterrupts_USI m) (_get_Minterrupts_USI d)).

Definition lower_mie (m : Minterrupts) (d : Minterrupts) : Sinterrupts :=
   let s : Sinterrupts := Mk_Sinterrupts (EXTZ 32 ('b"0"  : mword 1)) in
   let s := _update_Sinterrupts_SEI s (and_vec (_get_Minterrupts_SEI m) (_get_Minterrupts_SEI d)) in
   let s := _update_Sinterrupts_STI s (and_vec (_get_Minterrupts_STI m) (_get_Minterrupts_STI d)) in
   let s := _update_Sinterrupts_SSI s (and_vec (_get_Minterrupts_SSI m) (_get_Minterrupts_SSI d)) in
   let s := _update_Sinterrupts_UEI s (and_vec (_get_Minterrupts_UEI m) (_get_Minterrupts_UEI d)) in
   let s := _update_Sinterrupts_UTI s (and_vec (_get_Minterrupts_UTI m) (_get_Minterrupts_UTI d)) in
   _update_Sinterrupts_USI s (and_vec (_get_Minterrupts_USI m) (_get_Minterrupts_USI d)).

Definition lift_sip (o : Minterrupts) (d : Minterrupts) (s : Sinterrupts) : M (Minterrupts) :=
   let m : Minterrupts := o in
   let m :=
     if eq_vec (_get_Minterrupts_SSI d) ('b"1"  : mword 1) then
       _update_Minterrupts_SSI m (_get_Sinterrupts_SSI s)
     else m in
   (haveNExt tt) >>= fun w__0 : bool =>
   returnm (if sumbool_of_bool w__0 then
              let m :=
                if eq_vec (_get_Minterrupts_UEI d) ('b"1"  : mword 1) then
                  _update_Minterrupts_UEI m (_get_Sinterrupts_UEI s)
                else m in
              if eq_vec (_get_Minterrupts_USI d) ('b"1"  : mword 1) then
                _update_Minterrupts_USI m (_get_Sinterrupts_USI s)
              else m
            else m).

Definition legalize_sip (m : Minterrupts) (d : Minterrupts) (v : mword 32) : M (Minterrupts) :=
   (lift_sip m d (Mk_Sinterrupts v))  : M (Minterrupts).

Definition lift_sie (o : Minterrupts) (d : Minterrupts) (s : Sinterrupts) : M (Minterrupts) :=
   let m : Minterrupts := o in
   let m :=
     if eq_vec (_get_Minterrupts_SEI d) ('b"1"  : mword 1) then
       _update_Minterrupts_SEI m (_get_Sinterrupts_SEI s)
     else m in
   let m :=
     if eq_vec (_get_Minterrupts_STI d) ('b"1"  : mword 1) then
       _update_Minterrupts_STI m (_get_Sinterrupts_STI s)
     else m in
   let m :=
     if eq_vec (_get_Minterrupts_SSI d) ('b"1"  : mword 1) then
       _update_Minterrupts_SSI m (_get_Sinterrupts_SSI s)
     else m in
   (haveNExt tt) >>= fun w__0 : bool =>
   returnm (if sumbool_of_bool w__0 then
              let m :=
                if eq_vec (_get_Minterrupts_UEI d) ('b"1"  : mword 1) then
                  _update_Minterrupts_UEI m (_get_Sinterrupts_UEI s)
                else m in
              let m :=
                if eq_vec (_get_Minterrupts_UTI d) ('b"1"  : mword 1) then
                  _update_Minterrupts_UTI m (_get_Sinterrupts_UTI s)
                else m in
              if eq_vec (_get_Minterrupts_USI d) ('b"1"  : mword 1) then
                _update_Minterrupts_USI m (_get_Sinterrupts_USI s)
              else m
            else m).

Definition legalize_sie (m : Minterrupts) (d : Minterrupts) (v : mword 32) : M (Minterrupts) :=
   (lift_sie m d (Mk_Sinterrupts v))  : M (Minterrupts).

Definition Mk_Satp64 (v : mword 64) : Satp64 :=
   {| Satp64_Satp64_chunk_0 := (subrange_vec_dec v 63 0) |}.

Definition _get_Satp64_bits (v : Satp64) : mword 64 :=
   subrange_vec_dec v.(Satp64_Satp64_chunk_0) 63 0.

Definition _set_Satp64_bits (r_ref : register_ref regstate register_value Satp64) (v : mword 64)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Satp64_Satp64_chunk_0 :=
         (update_subrange_vec_dec r.(Satp64_Satp64_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]}
      : Satp64 in
   write_reg r_ref r
    : M (unit).

Definition _update_Satp64_bits (v : Satp64) (x : mword 64) : Satp64 :=
   {[ v with
     Satp64_Satp64_chunk_0 :=
       (update_subrange_vec_dec v.(Satp64_Satp64_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}.

Definition _get_Satp64_Mode (v : Satp64) : mword 4 :=
   subrange_vec_dec v.(Satp64_Satp64_chunk_0) 63 60.

Definition _set_Satp64_Mode (r_ref : register_ref regstate register_value Satp64) (v : mword 4)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Satp64_Satp64_chunk_0 :=
         (update_subrange_vec_dec r.(Satp64_Satp64_chunk_0) 63 60 (subrange_vec_dec v 3 0)) ]}
      : Satp64 in
   write_reg r_ref r
    : M (unit).

Definition _update_Satp64_Mode (v : Satp64) (x : mword 4) : Satp64 :=
   {[ v with
     Satp64_Satp64_chunk_0 :=
       (update_subrange_vec_dec v.(Satp64_Satp64_chunk_0) 63 60 (subrange_vec_dec x 3 0)) ]}.

Definition _get_Satp64_Asid (v : Satp64) : mword 16 :=
   subrange_vec_dec v.(Satp64_Satp64_chunk_0) 59 44.

Definition _set_Satp64_Asid (r_ref : register_ref regstate register_value Satp64) (v : mword 16)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Satp64_Satp64_chunk_0 :=
         (update_subrange_vec_dec r.(Satp64_Satp64_chunk_0) 59 44 (subrange_vec_dec v 15 0)) ]}
      : Satp64 in
   write_reg r_ref r
    : M (unit).

Definition _update_Satp64_Asid (v : Satp64) (x : mword 16) : Satp64 :=
   {[ v with
     Satp64_Satp64_chunk_0 :=
       (update_subrange_vec_dec v.(Satp64_Satp64_chunk_0) 59 44 (subrange_vec_dec x 15 0)) ]}.

Definition _get_Satp64_PPN (v : Satp64) : mword 44 :=
   subrange_vec_dec v.(Satp64_Satp64_chunk_0) 43 0.

Definition _set_Satp64_PPN (r_ref : register_ref regstate register_value Satp64) (v : mword 44)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Satp64_Satp64_chunk_0 :=
         (update_subrange_vec_dec r.(Satp64_Satp64_chunk_0) 43 0 (subrange_vec_dec v 43 0)) ]}
      : Satp64 in
   write_reg r_ref r
    : M (unit).

Definition _update_Satp64_PPN (v : Satp64) (x : mword 44) : Satp64 :=
   {[ v with
     Satp64_Satp64_chunk_0 :=
       (update_subrange_vec_dec v.(Satp64_Satp64_chunk_0) 43 0 (subrange_vec_dec x 43 0)) ]}.

Definition legalize_satp64 (a : Architecture) (o : mword 64) (v : mword 64) : mword 64 :=
   let s := Mk_Satp64 v in
   match (satp64Mode_of_bits a (_get_Satp64_Mode s)) with
   | None => o
   | Some Sv32 => o
   | Some _ => _get_Satp64_bits s
   end.

Definition Mk_Satp32 (v : mword 32) : Satp32 :=
   {| Satp32_Satp32_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Satp32_bits (v : Satp32) : mword 32 :=
   subrange_vec_dec v.(Satp32_Satp32_chunk_0) 31 0.

Definition _set_Satp32_bits (r_ref : register_ref regstate register_value Satp32) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Satp32_Satp32_chunk_0 :=
         (update_subrange_vec_dec r.(Satp32_Satp32_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Satp32 in
   write_reg r_ref r
    : M (unit).

Definition _update_Satp32_bits (v : Satp32) (x : mword 32) : Satp32 :=
   {[ v with
     Satp32_Satp32_chunk_0 :=
       (update_subrange_vec_dec v.(Satp32_Satp32_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Satp32_Mode (v : Satp32) : mword 1 :=
   subrange_vec_dec v.(Satp32_Satp32_chunk_0) 31 31.

Definition _set_Satp32_Mode (r_ref : register_ref regstate register_value Satp32) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Satp32_Satp32_chunk_0 :=
         (update_subrange_vec_dec r.(Satp32_Satp32_chunk_0) 31 31 (subrange_vec_dec v 0 0)) ]}
      : Satp32 in
   write_reg r_ref r
    : M (unit).

Definition _update_Satp32_Mode (v : Satp32) (x : mword 1) : Satp32 :=
   {[ v with
     Satp32_Satp32_chunk_0 :=
       (update_subrange_vec_dec v.(Satp32_Satp32_chunk_0) 31 31 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Satp32_Asid (v : Satp32) : mword 9 :=
   subrange_vec_dec v.(Satp32_Satp32_chunk_0) 30 22.

Definition _set_Satp32_Asid (r_ref : register_ref regstate register_value Satp32) (v : mword 9)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Satp32_Satp32_chunk_0 :=
         (update_subrange_vec_dec r.(Satp32_Satp32_chunk_0) 30 22 (subrange_vec_dec v 8 0)) ]}
      : Satp32 in
   write_reg r_ref r
    : M (unit).

Definition _update_Satp32_Asid (v : Satp32) (x : mword 9) : Satp32 :=
   {[ v with
     Satp32_Satp32_chunk_0 :=
       (update_subrange_vec_dec v.(Satp32_Satp32_chunk_0) 30 22 (subrange_vec_dec x 8 0)) ]}.

Definition _get_Satp32_PPN (v : Satp32) : mword 22 :=
   subrange_vec_dec v.(Satp32_Satp32_chunk_0) 21 0.

Definition _set_Satp32_PPN (r_ref : register_ref regstate register_value Satp32) (v : mword 22)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Satp32_Satp32_chunk_0 :=
         (update_subrange_vec_dec r.(Satp32_Satp32_chunk_0) 21 0 (subrange_vec_dec v 21 0)) ]}
      : Satp32 in
   write_reg r_ref r
    : M (unit).

Definition _update_Satp32_PPN (v : Satp32) (x : mword 22) : Satp32 :=
   {[ v with
     Satp32_Satp32_chunk_0 :=
       (update_subrange_vec_dec v.(Satp32_Satp32_chunk_0) 21 0 (subrange_vec_dec x 21 0)) ]}.

Definition legalize_satp32 (a : Architecture) (o : mword 32) (v : mword 32) : mword 32 := v.

Definition PmpAddrMatchType_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 3))}
: PmpAddrMatchType :=
   let l__89 := arg_ in
   if sumbool_of_bool (Z.eqb l__89 0) then OFF
   else if sumbool_of_bool (Z.eqb l__89 1) then TOR
   else if sumbool_of_bool (Z.eqb l__89 2) then NA4
   else NAPOT.

Definition num_of_PmpAddrMatchType (arg_ : PmpAddrMatchType)
: {e : Z & ArithFact ((0 <=? e) && (e <=? 3))} :=
   build_ex (match arg_ with | OFF => 0 | TOR => 1 | NA4 => 2 | NAPOT => 3 end).

Definition pmpAddrMatchType_of_bits (bs : mword 2) : M (PmpAddrMatchType) :=
   let b__0 := bs in
   (if eq_vec b__0 ('b"00"  : mword 2) then returnm OFF
    else if eq_vec b__0 ('b"01"  : mword 2) then returnm TOR
    else if eq_vec b__0 ('b"10"  : mword 2) then returnm NA4
    else if eq_vec b__0 ('b"11"  : mword 2) then returnm NAPOT
    else
      assert_exp' false "Pattern match failure at model/riscv_pmp_regs.sail 7:2 - 12:3" >>= fun _ =>
      exit tt)
    : M (PmpAddrMatchType).

Definition pmpAddrMatchType_to_bits (bs : PmpAddrMatchType) : mword 2 :=
   match bs with
   | OFF => 'b"00"  : mword 2
   | TOR => 'b"01"  : mword 2
   | NA4 => 'b"10"  : mword 2
   | NAPOT => 'b"11"  : mword 2
   end.

Definition Mk_Pmpcfg_ent (v : mword 8) : Pmpcfg_ent :=
   {| Pmpcfg_ent_Pmpcfg_ent_chunk_0 := (subrange_vec_dec v 7 0) |}.

Definition _get_Pmpcfg_ent_bits (v : Pmpcfg_ent) : mword 8 :=
   subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 7 0.

Definition _set_Pmpcfg_ent_bits
(r_ref : register_ref regstate register_value Pmpcfg_ent) (v : mword 8)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         (update_subrange_vec_dec r.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 7 0 (subrange_vec_dec v 7 0)) ]}
      : Pmpcfg_ent in
   write_reg r_ref r
    : M (unit).

Definition _update_Pmpcfg_ent_bits (v : Pmpcfg_ent) (x : mword 8) : Pmpcfg_ent :=
   {[ v with
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       (update_subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 7 0 (subrange_vec_dec x 7 0)) ]}.

Definition _get_Pmpcfg_ent_L (v : Pmpcfg_ent) : mword 1 :=
   subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 7 7.

Definition _set_Pmpcfg_ent_L (r_ref : register_ref regstate register_value Pmpcfg_ent) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         (update_subrange_vec_dec r.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]}
      : Pmpcfg_ent in
   write_reg r_ref r
    : M (unit).

Definition _update_Pmpcfg_ent_L (v : Pmpcfg_ent) (x : mword 1) : Pmpcfg_ent :=
   {[ v with
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       (update_subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Pmpcfg_ent_A (v : Pmpcfg_ent) : mword 2 :=
   subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 4 3.

Definition _set_Pmpcfg_ent_A (r_ref : register_ref regstate register_value Pmpcfg_ent) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         (update_subrange_vec_dec r.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 4 3 (subrange_vec_dec v 1 0)) ]}
      : Pmpcfg_ent in
   write_reg r_ref r
    : M (unit).

Definition _update_Pmpcfg_ent_A (v : Pmpcfg_ent) (x : mword 2) : Pmpcfg_ent :=
   {[ v with
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       (update_subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 4 3 (subrange_vec_dec x 1 0)) ]}.

Definition _get_Pmpcfg_ent_X (v : Pmpcfg_ent) : mword 1 :=
   subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 2 2.

Definition _set_Pmpcfg_ent_X (r_ref : register_ref regstate register_value Pmpcfg_ent) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         (update_subrange_vec_dec r.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]}
      : Pmpcfg_ent in
   write_reg r_ref r
    : M (unit).

Definition _update_Pmpcfg_ent_X (v : Pmpcfg_ent) (x : mword 1) : Pmpcfg_ent :=
   {[ v with
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       (update_subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Pmpcfg_ent_W (v : Pmpcfg_ent) : mword 1 :=
   subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 1 1.

Definition _set_Pmpcfg_ent_W (r_ref : register_ref regstate register_value Pmpcfg_ent) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         (update_subrange_vec_dec r.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : Pmpcfg_ent in
   write_reg r_ref r
    : M (unit).

Definition _update_Pmpcfg_ent_W (v : Pmpcfg_ent) (x : mword 1) : Pmpcfg_ent :=
   {[ v with
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       (update_subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Pmpcfg_ent_R (v : Pmpcfg_ent) : mword 1 :=
   subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 0 0.

Definition _set_Pmpcfg_ent_R (r_ref : register_ref regstate register_value Pmpcfg_ent) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
         (update_subrange_vec_dec r.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Pmpcfg_ent in
   write_reg r_ref r
    : M (unit).

Definition _update_Pmpcfg_ent_R (v : Pmpcfg_ent) (x : mword 1) : Pmpcfg_ent :=
   {[ v with
     Pmpcfg_ent_Pmpcfg_ent_chunk_0 :=
       (update_subrange_vec_dec v.(Pmpcfg_ent_Pmpcfg_ent_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition pmpReadCfgReg (n : Z) `{ArithFact ((0 <=? n) && (n <? 4))} : M (mword 32) :=
   let l__85 := n in
   (if sumbool_of_bool (Z.eqb l__85 0) then
      read_reg pmp3cfg_ref >>= fun w__0 : Pmpcfg_ent =>
      read_reg pmp2cfg_ref >>= fun w__1 : Pmpcfg_ent =>
      read_reg pmp1cfg_ref >>= fun w__2 : Pmpcfg_ent =>
      read_reg pmp0cfg_ref >>= fun w__3 : Pmpcfg_ent =>
      returnm (concat_vec (_get_Pmpcfg_ent_bits w__0)
                 (concat_vec (_get_Pmpcfg_ent_bits w__1)
                    (concat_vec (_get_Pmpcfg_ent_bits w__2) (_get_Pmpcfg_ent_bits w__3))))
    else if sumbool_of_bool (Z.eqb l__85 1) then
      read_reg pmp7cfg_ref >>= fun w__4 : Pmpcfg_ent =>
      read_reg pmp6cfg_ref >>= fun w__5 : Pmpcfg_ent =>
      read_reg pmp5cfg_ref >>= fun w__6 : Pmpcfg_ent =>
      read_reg pmp4cfg_ref >>= fun w__7 : Pmpcfg_ent =>
      returnm (concat_vec (_get_Pmpcfg_ent_bits w__4)
                 (concat_vec (_get_Pmpcfg_ent_bits w__5)
                    (concat_vec (_get_Pmpcfg_ent_bits w__6) (_get_Pmpcfg_ent_bits w__7))))
    else if sumbool_of_bool (Z.eqb l__85 2) then
      read_reg pmp11cfg_ref >>= fun w__8 : Pmpcfg_ent =>
      read_reg pmp10cfg_ref >>= fun w__9 : Pmpcfg_ent =>
      read_reg pmp9cfg_ref >>= fun w__10 : Pmpcfg_ent =>
      read_reg pmp8cfg_ref >>= fun w__11 : Pmpcfg_ent =>
      returnm (concat_vec (_get_Pmpcfg_ent_bits w__8)
                 (concat_vec (_get_Pmpcfg_ent_bits w__9)
                    (concat_vec (_get_Pmpcfg_ent_bits w__10) (_get_Pmpcfg_ent_bits w__11))))
    else if sumbool_of_bool (Z.eqb l__85 3) then
      read_reg pmp15cfg_ref >>= fun w__12 : Pmpcfg_ent =>
      read_reg pmp14cfg_ref >>= fun w__13 : Pmpcfg_ent =>
      read_reg pmp13cfg_ref >>= fun w__14 : Pmpcfg_ent =>
      read_reg pmp12cfg_ref >>= fun w__15 : Pmpcfg_ent =>
      returnm (concat_vec (_get_Pmpcfg_ent_bits w__12)
                 (concat_vec (_get_Pmpcfg_ent_bits w__13)
                    (concat_vec (_get_Pmpcfg_ent_bits w__14) (_get_Pmpcfg_ent_bits w__15))))
    else
      assert_exp' false "Pattern match failure at model/riscv_pmp_regs.sail 75:2 - 85:8" >>= fun _ =>
      exit tt)
    : M (mword 32).

Definition pmpLocked (cfg : Pmpcfg_ent) : bool := eq_vec (_get_Pmpcfg_ent_L cfg) ('b"1"  : mword 1).

Definition pmpTORLocked (cfg : Pmpcfg_ent) : M (bool) :=
   (and_boolM (returnm ((eq_vec (_get_Pmpcfg_ent_L cfg) ('b"1"  : mword 1))  : bool))
      ((pmpAddrMatchType_of_bits (_get_Pmpcfg_ent_A cfg)) >>= fun w__0 : PmpAddrMatchType =>
       returnm ((generic_eq w__0 TOR)  : bool)))
    : M (bool).

Definition pmpWriteCfg (cfg : Pmpcfg_ent) (v : mword 8) : Pmpcfg_ent :=
   if pmpLocked cfg then cfg else Mk_Pmpcfg_ent (and_vec v (Ox"9F"  : mword 8)).

Definition pmpWriteCfgReg (n : Z) (v : mword 32) `{ArithFact ((0 <=? n) && (n <? 4))} : M (unit) :=
   let l__81 := n in
   (if sumbool_of_bool (Z.eqb l__81 0) then
      read_reg pmp0cfg_ref >>= fun w__0 : Pmpcfg_ent =>
      write_reg pmp0cfg_ref (pmpWriteCfg w__0 (subrange_vec_dec v 7 0)) >>
      read_reg pmp1cfg_ref >>= fun w__1 : Pmpcfg_ent =>
      write_reg pmp1cfg_ref (pmpWriteCfg w__1 (subrange_vec_dec v 15 8)) >>
      read_reg pmp2cfg_ref >>= fun w__2 : Pmpcfg_ent =>
      write_reg pmp2cfg_ref (pmpWriteCfg w__2 (subrange_vec_dec v 23 16)) >>
      read_reg pmp3cfg_ref >>= fun w__3 : Pmpcfg_ent =>
      write_reg pmp3cfg_ref (pmpWriteCfg w__3 (subrange_vec_dec v 31 24))
       : M (unit)
    else if sumbool_of_bool (Z.eqb l__81 1) then
      read_reg pmp4cfg_ref >>= fun w__4 : Pmpcfg_ent =>
      write_reg pmp4cfg_ref (pmpWriteCfg w__4 (subrange_vec_dec v 7 0)) >>
      read_reg pmp5cfg_ref >>= fun w__5 : Pmpcfg_ent =>
      write_reg pmp5cfg_ref (pmpWriteCfg w__5 (subrange_vec_dec v 15 8)) >>
      read_reg pmp6cfg_ref >>= fun w__6 : Pmpcfg_ent =>
      write_reg pmp6cfg_ref (pmpWriteCfg w__6 (subrange_vec_dec v 23 16)) >>
      read_reg pmp7cfg_ref >>= fun w__7 : Pmpcfg_ent =>
      write_reg pmp7cfg_ref (pmpWriteCfg w__7 (subrange_vec_dec v 31 24))
       : M (unit)
    else if sumbool_of_bool (Z.eqb l__81 2) then
      read_reg pmp8cfg_ref >>= fun w__8 : Pmpcfg_ent =>
      write_reg pmp8cfg_ref (pmpWriteCfg w__8 (subrange_vec_dec v 7 0)) >>
      read_reg pmp9cfg_ref >>= fun w__9 : Pmpcfg_ent =>
      write_reg pmp9cfg_ref (pmpWriteCfg w__9 (subrange_vec_dec v 15 8)) >>
      read_reg pmp10cfg_ref >>= fun w__10 : Pmpcfg_ent =>
      write_reg pmp10cfg_ref (pmpWriteCfg w__10 (subrange_vec_dec v 23 16)) >>
      read_reg pmp11cfg_ref >>= fun w__11 : Pmpcfg_ent =>
      write_reg pmp11cfg_ref (pmpWriteCfg w__11 (subrange_vec_dec v 31 24))
       : M (unit)
    else if sumbool_of_bool (Z.eqb l__81 3) then
      read_reg pmp12cfg_ref >>= fun w__12 : Pmpcfg_ent =>
      write_reg pmp12cfg_ref (pmpWriteCfg w__12 (subrange_vec_dec v 7 0)) >>
      read_reg pmp13cfg_ref >>= fun w__13 : Pmpcfg_ent =>
      write_reg pmp13cfg_ref (pmpWriteCfg w__13 (subrange_vec_dec v 15 8)) >>
      read_reg pmp14cfg_ref >>= fun w__14 : Pmpcfg_ent =>
      write_reg pmp14cfg_ref (pmpWriteCfg w__14 (subrange_vec_dec v 23 16)) >>
      read_reg pmp15cfg_ref >>= fun w__15 : Pmpcfg_ent =>
      write_reg pmp15cfg_ref (pmpWriteCfg w__15 (subrange_vec_dec v 31 24))
       : M (unit)
    else
      assert_exp' false "Pattern match failure at model/riscv_pmp_regs.sail 101:2 - 144:8" >>= fun _ =>
      exit tt)
    : M (unit).

Definition pmpWriteAddr (locked : bool) (tor_locked : bool) (reg : mword 32) (v : mword 32)
: mword 32 :=
   if sumbool_of_bool (orb locked tor_locked) then reg else v.

Definition pmpAddrRange (cfg : Pmpcfg_ent) (pmpaddr : mword 32) (prev_pmpaddr : mword 32)
: M (option ((mword 32 * mword 32))) :=
   (pmpAddrMatchType_of_bits (_get_Pmpcfg_ent_A cfg)) >>= fun w__0 : PmpAddrMatchType =>
   returnm (match w__0 with
            | OFF => None
            | TOR => Some (shiftl prev_pmpaddr 2, shiftl pmpaddr 2)
            | NA4 =>
               let lo := shiftl pmpaddr 2 in
               Some (lo, add_vec_int lo 4)
            | NAPOT =>
               let mask := xor_vec pmpaddr (add_vec_int pmpaddr 1) in
               let lo := and_vec pmpaddr (not_vec mask) in
               let len := add_vec_int mask 1 in
               Some (shiftl lo 2, shiftl (add_vec lo len) 2)
            end).

Definition pmpCheckRWX (ent : Pmpcfg_ent) (acc : AccessType unit) : bool :=
   match acc with
   | Read _ => eq_vec (_get_Pmpcfg_ent_R ent) ('b"1"  : mword 1)
   | Write _ => eq_vec (_get_Pmpcfg_ent_W ent) ('b"1"  : mword 1)
   | ReadWrite _ =>
      andb (eq_vec (_get_Pmpcfg_ent_R ent) ('b"1"  : mword 1))
        (eq_vec (_get_Pmpcfg_ent_W ent) ('b"1"  : mword 1))
   | Execute tt => eq_vec (_get_Pmpcfg_ent_X ent) ('b"1"  : mword 1)
   end.

Definition pmpCheckPerms (ent : Pmpcfg_ent) (acc : AccessType unit) (priv : Privilege) : bool :=
   match priv with
   | Machine => if pmpLocked ent then pmpCheckRWX ent acc else true
   | _ => pmpCheckRWX ent acc
   end.

Definition pmpAddrMatch_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : pmpAddrMatch :=
   let l__79 := arg_ in
   if sumbool_of_bool (Z.eqb l__79 0) then PMP_NoMatch
   else if sumbool_of_bool (Z.eqb l__79 1) then PMP_PartialMatch
   else PMP_Match.

Definition num_of_pmpAddrMatch (arg_ : pmpAddrMatch) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | PMP_NoMatch => 0 | PMP_PartialMatch => 1 | PMP_Match => 2 end).

Definition pmpMatchAddr (addr : mword 32) (width : mword 32) (rng : option ((mword 32 * mword 32)))
: pmpAddrMatch :=
   match rng with
   | None => PMP_NoMatch
   | Some (lo, hi) =>
      if zopz0zI_u hi lo then PMP_NoMatch
      else if orb (zopz0zIzJ_u (add_vec addr width) lo) (zopz0zIzJ_u hi addr) then PMP_NoMatch
      else if andb (zopz0zIzJ_u lo addr) (zopz0zIzJ_u (add_vec addr width) hi) then PMP_Match
      else PMP_PartialMatch
   end.

Definition pmpMatch_of_num (arg_ : Z) `{ArithFact ((0 <=? arg_) && (arg_ <=? 2))} : pmpMatch :=
   let l__77 := arg_ in
   if sumbool_of_bool (Z.eqb l__77 0) then PMP_Success
   else if sumbool_of_bool (Z.eqb l__77 1) then PMP_Continue
   else PMP_Fail.

Definition num_of_pmpMatch (arg_ : pmpMatch) : {e : Z & ArithFact ((0 <=? e) && (e <=? 2))} :=
   build_ex (match arg_ with | PMP_Success => 0 | PMP_Continue => 1 | PMP_Fail => 2 end).

Definition pmpMatchEntry
(addr : mword 32) (width : mword 32) (acc : AccessType unit) (priv : Privilege) (ent : Pmpcfg_ent)
(pmpaddr : mword 32) (prev_pmpaddr : mword 32)
: M (pmpMatch) :=
   (pmpAddrRange ent pmpaddr prev_pmpaddr) >>= fun rng =>
   returnm (match (pmpMatchAddr addr width rng) with
            | PMP_NoMatch => PMP_Continue
            | PMP_PartialMatch => PMP_Fail
            | PMP_Match => if pmpCheckPerms ent acc priv then PMP_Success else PMP_Fail
            end).

Definition pmpCheck (addr : mword 32) (width : Z) (acc : AccessType unit) (priv : Privilege)
`{ArithFact (width >? 0)}
: M (option ExceptionType) :=
   let width : xlenbits := to_bits 32 width in
   read_reg pmp0cfg_ref >>= fun w__0 : Pmpcfg_ent =>
   ((read_reg pmpaddr0_ref)  : M (mword 32)) >>= fun w__1 : mword 32 =>
   (pmpMatchEntry addr width acc priv w__0 w__1 (zeros_implicit 32)) >>= fun w__2 : pmpMatch =>
   (match w__2 with
    | PMP_Success => returnm true
    | PMP_Fail => returnm false
    | PMP_Continue =>
       read_reg pmp1cfg_ref >>= fun w__3 : Pmpcfg_ent =>
       ((read_reg pmpaddr1_ref)  : M (mword 32)) >>= fun w__4 : mword 32 =>
       ((read_reg pmpaddr0_ref)  : M (mword 32)) >>= fun w__5 : mword 32 =>
       (pmpMatchEntry addr width acc priv w__3 w__4 w__5) >>= fun w__6 : pmpMatch =>
       (match w__6 with
        | PMP_Success => returnm true
        | PMP_Fail => returnm false
        | PMP_Continue =>
           read_reg pmp2cfg_ref >>= fun w__7 : Pmpcfg_ent =>
           ((read_reg pmpaddr2_ref)  : M (mword 32)) >>= fun w__8 : mword 32 =>
           ((read_reg pmpaddr1_ref)  : M (mword 32)) >>= fun w__9 : mword 32 =>
           (pmpMatchEntry addr width acc priv w__7 w__8 w__9) >>= fun w__10 : pmpMatch =>
           (match w__10 with
            | PMP_Success => returnm true
            | PMP_Fail => returnm false
            | PMP_Continue =>
               read_reg pmp3cfg_ref >>= fun w__11 : Pmpcfg_ent =>
               ((read_reg pmpaddr3_ref)  : M (mword 32)) >>= fun w__12 : mword 32 =>
               ((read_reg pmpaddr2_ref)  : M (mword 32)) >>= fun w__13 : mword 32 =>
               (pmpMatchEntry addr width acc priv w__11 w__12 w__13) >>= fun w__14 : pmpMatch =>
               (match w__14 with
                | PMP_Success => returnm true
                | PMP_Fail => returnm false
                | PMP_Continue =>
                   read_reg pmp4cfg_ref >>= fun w__15 : Pmpcfg_ent =>
                   ((read_reg pmpaddr4_ref)  : M (mword 32)) >>= fun w__16 : mword 32 =>
                   ((read_reg pmpaddr3_ref)  : M (mword 32)) >>= fun w__17 : mword 32 =>
                   (pmpMatchEntry addr width acc priv w__15 w__16 w__17) >>= fun w__18 : pmpMatch =>
                   (match w__18 with
                    | PMP_Success => returnm true
                    | PMP_Fail => returnm false
                    | PMP_Continue =>
                       read_reg pmp5cfg_ref >>= fun w__19 : Pmpcfg_ent =>
                       ((read_reg pmpaddr5_ref)  : M (mword 32)) >>= fun w__20 : mword 32 =>
                       ((read_reg pmpaddr4_ref)  : M (mword 32)) >>= fun w__21 : mword 32 =>
                       (pmpMatchEntry addr width acc priv w__19 w__20 w__21) >>= fun w__22 : pmpMatch =>
                       (match w__22 with
                        | PMP_Success => returnm true
                        | PMP_Fail => returnm false
                        | PMP_Continue =>
                           read_reg pmp6cfg_ref >>= fun w__23 : Pmpcfg_ent =>
                           ((read_reg pmpaddr6_ref)  : M (mword 32)) >>= fun w__24 : mword 32 =>
                           ((read_reg pmpaddr5_ref)  : M (mword 32)) >>= fun w__25 : mword 32 =>
                           (pmpMatchEntry addr width acc priv w__23 w__24 w__25) >>= fun w__26 : pmpMatch =>
                           (match w__26 with
                            | PMP_Success => returnm true
                            | PMP_Fail => returnm false
                            | PMP_Continue =>
                               read_reg pmp7cfg_ref >>= fun w__27 : Pmpcfg_ent =>
                               ((read_reg pmpaddr7_ref)  : M (mword 32)) >>= fun w__28 : mword 32 =>
                               ((read_reg pmpaddr6_ref)  : M (mword 32)) >>= fun w__29 : mword 32 =>
                               (pmpMatchEntry addr width acc priv w__27 w__28 w__29) >>= fun w__30 : pmpMatch =>
                               (match w__30 with
                                | PMP_Success => returnm true
                                | PMP_Fail => returnm false
                                | PMP_Continue =>
                                   read_reg pmp8cfg_ref >>= fun w__31 : Pmpcfg_ent =>
                                   ((read_reg pmpaddr8_ref)  : M (mword 32)) >>= fun w__32 : mword 32 =>
                                   ((read_reg pmpaddr7_ref)  : M (mword 32)) >>= fun w__33 : mword 32 =>
                                   (pmpMatchEntry addr width acc priv w__31 w__32 w__33) >>= fun w__34 : pmpMatch =>
                                   (match w__34 with
                                    | PMP_Success => returnm true
                                    | PMP_Fail => returnm false
                                    | PMP_Continue =>
                                       read_reg pmp9cfg_ref >>= fun w__35 : Pmpcfg_ent =>
                                       ((read_reg pmpaddr9_ref)  : M (mword 32)) >>= fun w__36 : mword 32 =>
                                       ((read_reg pmpaddr8_ref)  : M (mword 32)) >>= fun w__37 : mword 32 =>
                                       (pmpMatchEntry addr width acc priv w__35 w__36 w__37) >>= fun w__38 : pmpMatch =>
                                       (match w__38 with
                                        | PMP_Success => returnm true
                                        | PMP_Fail => returnm false
                                        | PMP_Continue =>
                                           read_reg pmp10cfg_ref >>= fun w__39 : Pmpcfg_ent =>
                                           ((read_reg pmpaddr10_ref)  : M (mword 32)) >>= fun w__40 : mword 32 =>
                                           ((read_reg pmpaddr9_ref)  : M (mword 32)) >>= fun w__41 : mword 32 =>
                                           (pmpMatchEntry addr width acc priv w__39 w__40 w__41) >>= fun w__42 : pmpMatch =>
                                           (match w__42 with
                                            | PMP_Success => returnm true
                                            | PMP_Fail => returnm false
                                            | PMP_Continue =>
                                               read_reg pmp11cfg_ref >>= fun w__43 : Pmpcfg_ent =>
                                               ((read_reg pmpaddr11_ref)  : M (mword 32)) >>= fun w__44 : mword 32 =>
                                               ((read_reg pmpaddr10_ref)  : M (mword 32)) >>= fun w__45 : mword 32 =>
                                               (pmpMatchEntry addr width acc priv w__43 w__44 w__45) >>= fun w__46 : pmpMatch =>
                                               (match w__46 with
                                                | PMP_Success => returnm true
                                                | PMP_Fail => returnm false
                                                | PMP_Continue =>
                                                   read_reg pmp12cfg_ref >>= fun w__47 : Pmpcfg_ent =>
                                                   ((read_reg pmpaddr12_ref)  : M (mword 32)) >>= fun w__48 : mword 32 =>
                                                   ((read_reg pmpaddr11_ref)  : M (mword 32)) >>= fun w__49 : mword 32 =>
                                                   (pmpMatchEntry addr width acc priv w__47 w__48
                                                      w__49) >>= fun w__50 : pmpMatch =>
                                                   (match w__50 with
                                                    | PMP_Success => returnm true
                                                    | PMP_Fail => returnm false
                                                    | PMP_Continue =>
                                                       read_reg pmp13cfg_ref >>= fun w__51 : Pmpcfg_ent =>
                                                       ((read_reg pmpaddr13_ref)  : M (mword 32)) >>= fun w__52 : mword 32 =>
                                                       ((read_reg pmpaddr12_ref)  : M (mword 32)) >>= fun w__53 : mword 32 =>
                                                       (pmpMatchEntry addr width acc priv w__51
                                                          w__52 w__53) >>= fun w__54 : pmpMatch =>
                                                       (match w__54 with
                                                        | PMP_Success => returnm true
                                                        | PMP_Fail => returnm false
                                                        | PMP_Continue =>
                                                           read_reg pmp14cfg_ref >>= fun w__55 : Pmpcfg_ent =>
                                                           ((read_reg pmpaddr14_ref)  : M (mword 32)) >>= fun w__56 : mword 32 =>
                                                           ((read_reg pmpaddr13_ref)  : M (mword 32)) >>= fun w__57 : mword 32 =>
                                                           (pmpMatchEntry addr width acc priv w__55
                                                              w__56 w__57) >>= fun w__58 : pmpMatch =>
                                                           (match w__58 with
                                                            | PMP_Success => returnm true
                                                            | PMP_Fail => returnm false
                                                            | PMP_Continue =>
                                                               read_reg pmp15cfg_ref >>= fun w__59 : Pmpcfg_ent =>
                                                               ((read_reg pmpaddr15_ref)
                                                                 : M (mword 32)) >>= fun w__60 : mword 32 =>
                                                               ((read_reg pmpaddr14_ref)
                                                                 : M (mword 32)) >>= fun w__61 : mword 32 =>
                                                               (pmpMatchEntry addr width acc priv
                                                                  w__59 w__60 w__61) >>= fun w__62 : pmpMatch =>
                                                               returnm (match w__62 with
                                                                        | PMP_Success => true
                                                                        | PMP_Fail => false
                                                                        | PMP_Continue =>
                                                                           match priv with
                                                                           | Machine => true
                                                                           | _ => false
                                                                           end
                                                                        end)
                                                            end)
                                                            : M (bool)
                                                        end)
                                                        : M (bool)
                                                    end)
                                                    : M (bool)
                                                end)
                                                : M (bool)
                                            end)
                                            : M (bool)
                                        end)
                                        : M (bool)
                                    end)
                                    : M (bool)
                                end)
                                : M (bool)
                            end)
                            : M (bool)
                        end)
                        : M (bool)
                    end)
                    : M (bool)
                end)
                : M (bool)
            end)
            : M (bool)
        end)
        : M (bool)
    end) >>= fun check' : bool =>
   returnm (if sumbool_of_bool check' then None
            else
              match acc with
              | Read _ => Some (E_Load_Access_Fault tt)
              | Write _ => Some (E_SAMO_Access_Fault tt)
              | ReadWrite _ => Some (E_SAMO_Access_Fault tt)
              | Execute tt => Some (E_Fetch_Access_Fault tt)
              end).

Definition init_pmp '(tt : unit) : M (unit) :=
   read_reg pmp0cfg_ref >>= fun w__0 : Pmpcfg_ent =>
   write_reg pmp0cfg_ref (_update_Pmpcfg_ent_A w__0 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp1cfg_ref >>= fun w__1 : Pmpcfg_ent =>
   write_reg pmp1cfg_ref (_update_Pmpcfg_ent_A w__1 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp2cfg_ref >>= fun w__2 : Pmpcfg_ent =>
   write_reg pmp2cfg_ref (_update_Pmpcfg_ent_A w__2 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp3cfg_ref >>= fun w__3 : Pmpcfg_ent =>
   write_reg pmp3cfg_ref (_update_Pmpcfg_ent_A w__3 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp4cfg_ref >>= fun w__4 : Pmpcfg_ent =>
   write_reg pmp4cfg_ref (_update_Pmpcfg_ent_A w__4 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp5cfg_ref >>= fun w__5 : Pmpcfg_ent =>
   write_reg pmp5cfg_ref (_update_Pmpcfg_ent_A w__5 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp6cfg_ref >>= fun w__6 : Pmpcfg_ent =>
   write_reg pmp6cfg_ref (_update_Pmpcfg_ent_A w__6 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp7cfg_ref >>= fun w__7 : Pmpcfg_ent =>
   write_reg pmp7cfg_ref (_update_Pmpcfg_ent_A w__7 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp8cfg_ref >>= fun w__8 : Pmpcfg_ent =>
   write_reg pmp8cfg_ref (_update_Pmpcfg_ent_A w__8 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp9cfg_ref >>= fun w__9 : Pmpcfg_ent =>
   write_reg pmp9cfg_ref (_update_Pmpcfg_ent_A w__9 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp10cfg_ref >>= fun w__10 : Pmpcfg_ent =>
   write_reg pmp10cfg_ref (_update_Pmpcfg_ent_A w__10 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp11cfg_ref >>= fun w__11 : Pmpcfg_ent =>
   write_reg pmp11cfg_ref (_update_Pmpcfg_ent_A w__11 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp12cfg_ref >>= fun w__12 : Pmpcfg_ent =>
   write_reg pmp12cfg_ref (_update_Pmpcfg_ent_A w__12 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp13cfg_ref >>= fun w__13 : Pmpcfg_ent =>
   write_reg pmp13cfg_ref (_update_Pmpcfg_ent_A w__13 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp14cfg_ref >>= fun w__14 : Pmpcfg_ent =>
   write_reg pmp14cfg_ref (_update_Pmpcfg_ent_A w__14 (pmpAddrMatchType_to_bits OFF)) >>
   read_reg pmp15cfg_ref >>= fun w__15 : Pmpcfg_ent =>
   write_reg pmp15cfg_ref (_update_Pmpcfg_ent_A w__15 (pmpAddrMatchType_to_bits OFF))
    : M (unit).

Definition ext_init_regs '(tt : unit) : M (unit) := returnm tt.

Definition ext_rvfi_init '(tt : unit) : M (unit) :=
   ((read_reg x1_ref)  : M (mword 32)) >>= fun w__0 : mword 32 => write_reg x1_ref w__0  : M (unit).

Definition ext_check_CSR (csrno : mword 12) (p : Privilege) (isWrite : bool) : bool := true.

Definition ext_check_CSR_fail '(tt : unit) : unit := tt.

Definition ext_fetch_check_pc (start_pc : mword 32) (pc : mword 32) : Ext_FetchAddr_Check unit :=
   Ext_FetchAddr_OK pc.

Definition ext_handle_fetch_check_error (err : unit) : unit := tt.

Definition ext_control_check_addr (pc : mword 32) : Ext_ControlAddr_Check unit :=
   Ext_ControlAddr_OK pc.

Definition ext_control_check_pc (pc : mword 32) : Ext_ControlAddr_Check unit :=
   Ext_ControlAddr_OK pc.

Definition ext_handle_control_check_error (err : unit) : unit := tt.

Definition ext_data_get_addr
(base : mword 5) (offset : mword 32) (acc : AccessType unit) (width : word_width)
: M (Ext_DataAddr_Check unit) :=
   (rX_bits base) >>= fun w__0 : mword 32 =>
   let addr := add_vec w__0 offset in
   returnm (Ext_DataAddr_OK addr).

Definition ext_handle_data_check_error (err : unit) : unit := tt.

Definition ext_check_phys_mem_read
(access_type : AccessType unit) (paddr : mword 32) (size : Z) (aquire : bool) (release : bool)
(reserved : bool) (read_meta : bool) `{ArithFact ((0 <? size) && (size <=? 16))}
: Ext_PhysAddr_Check :=
   Ext_PhysAddr_OK tt.

Definition ext_check_phys_mem_write
(write_kind : write_kind) (paddr : mword 32) (size : Z) (data : mword (8 * size)) (metadata : unit)
`{ArithFact ((0 <? size) && (size <=? 16))}
: Ext_PhysAddr_Check :=
   Ext_PhysAddr_OK tt.

Definition Mk_Ustatus (v : mword 32) : Ustatus :=
   {| Ustatus_Ustatus_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Ustatus_bits (v : Ustatus) : mword 32 :=
   subrange_vec_dec v.(Ustatus_Ustatus_chunk_0) 31 0.

Definition _set_Ustatus_bits (r_ref : register_ref regstate register_value Ustatus) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Ustatus_Ustatus_chunk_0 :=
         (update_subrange_vec_dec r.(Ustatus_Ustatus_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Ustatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Ustatus_bits (v : Ustatus) (x : mword 32) : Ustatus :=
   {[ v with
     Ustatus_Ustatus_chunk_0 :=
       (update_subrange_vec_dec v.(Ustatus_Ustatus_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Ustatus_UPIE (v : Ustatus) : mword 1 :=
   subrange_vec_dec v.(Ustatus_Ustatus_chunk_0) 4 4.

Definition _set_Ustatus_UPIE (r_ref : register_ref regstate register_value Ustatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Ustatus_Ustatus_chunk_0 :=
         (update_subrange_vec_dec r.(Ustatus_Ustatus_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Ustatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Ustatus_UPIE (v : Ustatus) (x : mword 1) : Ustatus :=
   {[ v with
     Ustatus_Ustatus_chunk_0 :=
       (update_subrange_vec_dec v.(Ustatus_Ustatus_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Ustatus_UIE (v : Ustatus) : mword 1 :=
   subrange_vec_dec v.(Ustatus_Ustatus_chunk_0) 0 0.

Definition _set_Ustatus_UIE (r_ref : register_ref regstate register_value Ustatus) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Ustatus_Ustatus_chunk_0 :=
         (update_subrange_vec_dec r.(Ustatus_Ustatus_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Ustatus in
   write_reg r_ref r
    : M (unit).

Definition _update_Ustatus_UIE (v : Ustatus) (x : mword 1) : Ustatus :=
   {[ v with
     Ustatus_Ustatus_chunk_0 :=
       (update_subrange_vec_dec v.(Ustatus_Ustatus_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition lower_sstatus (s : Sstatus) : Ustatus :=
   let u := Mk_Ustatus (EXTZ 32 ('b"0"  : mword 1)) in
   let u := _update_Ustatus_UPIE u (_get_Sstatus_UPIE s) in
   _update_Ustatus_UIE u (_get_Sstatus_UIE s).

Definition lift_ustatus (s : Sstatus) (u : Ustatus) : Sstatus :=
   let s := _update_Sstatus_UPIE s (_get_Ustatus_UPIE u) in
   _update_Sstatus_UIE s (_get_Ustatus_UIE u).

Definition legalize_ustatus (m : Mstatus) (v : mword 32) : M (Mstatus) :=
   let u := Mk_Ustatus v in
   let s := lower_mstatus m in
   let s := lift_ustatus s u in
   lift_sstatus m s.

Definition Mk_Uinterrupts (v : mword 32) : Uinterrupts :=
   {| Uinterrupts_Uinterrupts_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Uinterrupts_bits (v : Uinterrupts) : mword 32 :=
   subrange_vec_dec v.(Uinterrupts_Uinterrupts_chunk_0) 31 0.

Definition _set_Uinterrupts_bits
(r_ref : register_ref regstate register_value Uinterrupts) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Uinterrupts_Uinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Uinterrupts_Uinterrupts_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Uinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Uinterrupts_bits (v : Uinterrupts) (x : mword 32) : Uinterrupts :=
   {[ v with
     Uinterrupts_Uinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Uinterrupts_Uinterrupts_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Uinterrupts_UEI (v : Uinterrupts) : mword 1 :=
   subrange_vec_dec v.(Uinterrupts_Uinterrupts_chunk_0) 8 8.

Definition _set_Uinterrupts_UEI
(r_ref : register_ref regstate register_value Uinterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Uinterrupts_Uinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Uinterrupts_Uinterrupts_chunk_0) 8 8 (subrange_vec_dec v 0 0)) ]}
      : Uinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Uinterrupts_UEI (v : Uinterrupts) (x : mword 1) : Uinterrupts :=
   {[ v with
     Uinterrupts_Uinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Uinterrupts_Uinterrupts_chunk_0) 8 8 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Uinterrupts_UTI (v : Uinterrupts) : mword 1 :=
   subrange_vec_dec v.(Uinterrupts_Uinterrupts_chunk_0) 4 4.

Definition _set_Uinterrupts_UTI
(r_ref : register_ref regstate register_value Uinterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Uinterrupts_Uinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Uinterrupts_Uinterrupts_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : Uinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Uinterrupts_UTI (v : Uinterrupts) (x : mword 1) : Uinterrupts :=
   {[ v with
     Uinterrupts_Uinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Uinterrupts_Uinterrupts_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_Uinterrupts_USI (v : Uinterrupts) : mword 1 :=
   subrange_vec_dec v.(Uinterrupts_Uinterrupts_chunk_0) 0 0.

Definition _set_Uinterrupts_USI
(r_ref : register_ref regstate register_value Uinterrupts) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Uinterrupts_Uinterrupts_chunk_0 :=
         (update_subrange_vec_dec r.(Uinterrupts_Uinterrupts_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : Uinterrupts in
   write_reg r_ref r
    : M (unit).

Definition _update_Uinterrupts_USI (v : Uinterrupts) (x : mword 1) : Uinterrupts :=
   {[ v with
     Uinterrupts_Uinterrupts_chunk_0 :=
       (update_subrange_vec_dec v.(Uinterrupts_Uinterrupts_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition lower_sip (s : Sinterrupts) (d : Sinterrupts) : Uinterrupts :=
   let u : Uinterrupts := Mk_Uinterrupts (EXTZ 32 ('b"0"  : mword 1)) in
   let u := _update_Uinterrupts_UEI u (and_vec (_get_Sinterrupts_UEI s) (_get_Sinterrupts_UEI d)) in
   let u := _update_Uinterrupts_UTI u (and_vec (_get_Sinterrupts_UTI s) (_get_Sinterrupts_UTI d)) in
   _update_Uinterrupts_USI u (and_vec (_get_Sinterrupts_USI s) (_get_Sinterrupts_USI d)).

Definition lower_sie (s : Sinterrupts) (d : Sinterrupts) : Uinterrupts :=
   let u : Uinterrupts := Mk_Uinterrupts (EXTZ 32 ('b"0"  : mword 1)) in
   let u := _update_Uinterrupts_UEI u (and_vec (_get_Sinterrupts_UEI s) (_get_Sinterrupts_UEI d)) in
   let u := _update_Uinterrupts_UTI u (and_vec (_get_Sinterrupts_UTI s) (_get_Sinterrupts_UTI d)) in
   _update_Uinterrupts_USI u (and_vec (_get_Sinterrupts_USI s) (_get_Sinterrupts_USI d)).

Definition lift_uip (o : Sinterrupts) (d : Sinterrupts) (u : Uinterrupts) : Sinterrupts :=
   let s : Sinterrupts := o in
   if eq_vec (_get_Sinterrupts_USI d) ('b"1"  : mword 1) then
     _update_Sinterrupts_USI s (_get_Uinterrupts_USI u)
   else s.

Definition legalize_uip (s : Sinterrupts) (d : Sinterrupts) (v : mword 32) : Sinterrupts :=
   lift_uip s d (Mk_Uinterrupts v).

Definition lift_uie (o : Sinterrupts) (d : Sinterrupts) (u : Uinterrupts) : Sinterrupts :=
   let s : Sinterrupts := o in
   let s :=
     if eq_vec (_get_Sinterrupts_UEI d) ('b"1"  : mword 1) then
       _update_Sinterrupts_UEI s (_get_Uinterrupts_UEI u)
     else s in
   let s :=
     if eq_vec (_get_Sinterrupts_UTI d) ('b"1"  : mword 1) then
       _update_Sinterrupts_UTI s (_get_Uinterrupts_UTI u)
     else s in
   if eq_vec (_get_Sinterrupts_USI d) ('b"1"  : mword 1) then
     _update_Sinterrupts_USI s (_get_Uinterrupts_USI u)
   else s.

Definition legalize_uie (s : Sinterrupts) (d : Sinterrupts) (v : mword 32) : Sinterrupts :=
   lift_uie s d (Mk_Uinterrupts v).

Definition ext_check_xret_priv (p : Privilege) : bool := true.

Definition ext_fail_xret_priv '(tt : unit) : unit := tt.

Definition handle_trap_extension (p : Privilege) (pc : mword 32) (u : option unit) : unit := tt.

Definition prepare_trap_vector (p : Privilege) (cause : Mcause) : M (mword 32) :=
   (match p with
    | Machine => read_reg mtvec_ref  : M (Mtvec)
    | Supervisor => read_reg stvec_ref  : M (Mtvec)
    | User => read_reg utvec_ref  : M (Mtvec)
    end) >>= fun tvec : Mtvec =>
   (match (tvec_addr tvec cause) with
    | Some epc => returnm epc
    | None => (internal_error "Invalid tvec mode")  : M (mword 32)
    end)
    : M (mword 32).

Definition get_xret_target (p : Privilege) : M (mword 32) :=
   (match p with
    | Machine => ((read_reg mepc_ref)  : M (mword 32))  : M (mword 32)
    | Supervisor => ((read_reg sepc_ref)  : M (mword 32))  : M (mword 32)
    | User => ((read_reg uepc_ref)  : M (mword 32))  : M (mword 32)
    end)
    : M (mword 32).

Definition set_xret_target (p : Privilege) (value : mword 32) : M (mword 32) :=
   (legalize_xepc value) >>= fun target =>
   (match p with
    | Machine => write_reg mepc_ref target  : M (unit)
    | Supervisor => write_reg sepc_ref target  : M (unit)
    | User => write_reg uepc_ref target  : M (unit)
    end) >>
   returnm target.

Definition prepare_xret_target (p : Privilege) : M (mword 32) :=
   (get_xret_target p)  : M (mword 32).

Definition get_mtvec '(tt : unit) : M (mword 32) :=
   read_reg mtvec_ref >>= fun w__0 : Mtvec => returnm (_get_Mtvec_bits w__0).

Definition get_stvec '(tt : unit) : M (mword 32) :=
   read_reg stvec_ref >>= fun w__0 : Mtvec => returnm (_get_Mtvec_bits w__0).

Definition get_utvec '(tt : unit) : M (mword 32) :=
   read_reg utvec_ref >>= fun w__0 : Mtvec => returnm (_get_Mtvec_bits w__0).

Definition set_mtvec (value : mword 32) : M (mword 32) :=
   read_reg mtvec_ref >>= fun w__0 : Mtvec =>
   write_reg mtvec_ref (legalize_tvec w__0 value) >>
   read_reg mtvec_ref >>= fun w__1 : Mtvec => returnm (_get_Mtvec_bits w__1).

Definition set_stvec (value : mword 32) : M (mword 32) :=
   read_reg stvec_ref >>= fun w__0 : Mtvec =>
   write_reg stvec_ref (legalize_tvec w__0 value) >>
   read_reg stvec_ref >>= fun w__1 : Mtvec => returnm (_get_Mtvec_bits w__1).

Definition set_utvec (value : mword 32) : M (mword 32) :=
   read_reg utvec_ref >>= fun w__0 : Mtvec =>
   write_reg utvec_ref (legalize_tvec w__0 value) >>
   read_reg utvec_ref >>= fun w__1 : Mtvec => returnm (_get_Mtvec_bits w__1).

Definition update_softfloat_fflags (flags : mword 5) : M (unit) :=
   write_reg float_fflags_ref (zero_extend flags 64)  : M (unit).

Axiom extern_f32Add : forall  (_ : mword 3) (_ : mword 32) (_ : mword 32) , unit.

Definition riscv_f32Add (rm : mword 3) (v1 : mword 32) (v2 : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32Add rm v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f32Sub : forall  (_ : mword 3) (_ : mword 32) (_ : mword 32) , unit.

Definition riscv_f32Sub (rm : mword 3) (v1 : mword 32) (v2 : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32Sub rm v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f32Mul : forall  (_ : mword 3) (_ : mword 32) (_ : mword 32) , unit.

Definition riscv_f32Mul (rm : mword 3) (v1 : mword 32) (v2 : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32Mul rm v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f32Div : forall  (_ : mword 3) (_ : mword 32) (_ : mword 32) , unit.

Definition riscv_f32Div (rm : mword 3) (v1 : mword 32) (v2 : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32Div rm v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f64Add : forall  (_ : mword 3) (_ : mword 64) (_ : mword 64) , unit.

Definition riscv_f64Add (rm : mword 3) (v1 : mword 64) (v2 : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64Add rm v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f64Sub : forall  (_ : mword 3) (_ : mword 64) (_ : mword 64) , unit.

Definition riscv_f64Sub (rm : mword 3) (v1 : mword 64) (v2 : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64Sub rm v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f64Mul : forall  (_ : mword 3) (_ : mword 64) (_ : mword 64) , unit.

Definition riscv_f64Mul (rm : mword 3) (v1 : mword 64) (v2 : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64Mul rm v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f64Div : forall  (_ : mword 3) (_ : mword 64) (_ : mword 64) , unit.

Definition riscv_f64Div (rm : mword 3) (v1 : mword 64) (v2 : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64Div rm v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f32MulAdd : forall  (_ : mword 3) (_ : mword 32) (_ : mword 32) (_ : mword 32) , unit.

Definition riscv_f32MulAdd (rm : mword 3) (v1 : mword 32) (v2 : mword 32) (v3 : mword 32)
: M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32MulAdd rm v1 v2 v3)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f64MulAdd : forall  (_ : mword 3) (_ : mword 64) (_ : mword 64) (_ : mword 64) , unit.

Definition riscv_f64MulAdd (rm : mword 3) (v1 : mword 64) (v2 : mword 64) (v3 : mword 64)
: M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64MulAdd rm v1 v2 v3)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f32Sqrt : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_f32Sqrt (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32Sqrt rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f64Sqrt : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_f64Sqrt (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64Sqrt rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f32ToI32 : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_f32ToI32 (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32ToI32 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f32ToUi32 : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_f32ToUi32 (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32ToUi32 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_i32ToF32 : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_i32ToF32 (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_i32ToF32 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_ui32ToF32 : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_ui32ToF32 (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_ui32ToF32 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f32ToI64 : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_f32ToI64 (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f32ToI64 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f32ToUi64 : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_f32ToUi64 (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f32ToUi64 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_i64ToF32 : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_i64ToF32 (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_i64ToF32 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_ui64ToF32 : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_ui64ToF32 (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_ui64ToF32 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f64ToI32 : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_f64ToI32 (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f64ToI32 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f64ToUi32 : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_f64ToUi32 (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f64ToUi32 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_i32ToF64 : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_i32ToF64 (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_i32ToF64 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_ui32ToF64 : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_ui32ToF64 (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_ui32ToF64 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f64ToI64 : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_f64ToI64 (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64ToI64 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f64ToUi64 : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_f64ToUi64 (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64ToUi64 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_i64ToF64 : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_i64ToF64 (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_i64ToF64 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_ui64ToF64 : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_ui64ToF64 (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_ui64ToF64 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f32ToF64 : forall  (_ : mword 3) (_ : mword 32) , unit.

Definition riscv_f32ToF64 (rm : mword 3) (v : mword 32) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f32ToF64 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f64ToF32 : forall  (_ : mword 3) (_ : mword 64) , unit.

Definition riscv_f64ToF32 (rm : mword 3) (v : mword 64) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f64ToF32 rm v)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f32Lt : forall  (_ : mword 32) (_ : mword 32) , unit.

Definition riscv_f32Lt (v1 : mword 32) (v2 : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32Lt v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f32Le : forall  (_ : mword 32) (_ : mword 32) , unit.

Definition riscv_f32Le (v1 : mword 32) (v2 : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32Le v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f32Eq : forall  (_ : mword 32) (_ : mword 32) , unit.

Definition riscv_f32Eq (v1 : mword 32) (v2 : mword 32) : M ((mword 5 * mword 32)) :=
   let '_ := (extern_f32Eq v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, subrange_vec_dec w__1 31 0).

Axiom extern_f64Lt : forall  (_ : mword 64) (_ : mword 64) , unit.

Definition riscv_f64Lt (v1 : mword 64) (v2 : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64Lt v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f64Le : forall  (_ : mword 64) (_ : mword 64) , unit.

Definition riscv_f64Le (v1 : mword 64) (v2 : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64Le v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Axiom extern_f64Eq : forall  (_ : mword 64) (_ : mword 64) , unit.

Definition riscv_f64Eq (v1 : mword 64) (v2 : mword 64) : M ((mword 5 * mword 64)) :=
   let '_ := (extern_f64Eq v1 v2)  : unit in
   ((read_reg float_fflags_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg float_result_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   returnm (subrange_vec_dec w__0 4 0, w__1).

Definition dirty_fd_context '(tt : unit) : M (unit) :=
   (_set_Mstatus_FS mstatus_ref (extStatus_to_bits Dirty)) >>
   (_set_Mstatus_SD mstatus_ref ('b"1"  : mword 1))
    : M (unit).

Definition rF (r : Z) `{ArithFact ((0 <=? r) && (r <? 32))} : M (mword 32) :=
   let l__45 := r in
   (if sumbool_of_bool (Z.eqb l__45 0) then ((read_reg f0_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 1) then ((read_reg f1_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 2) then ((read_reg f2_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 3) then ((read_reg f3_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 4) then ((read_reg f4_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 5) then ((read_reg f5_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 6) then ((read_reg f6_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 7) then ((read_reg f7_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 8) then ((read_reg f8_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 9) then ((read_reg f9_ref)  : M (mword 32))  : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 10) then
      ((read_reg f10_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 11) then
      ((read_reg f11_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 12) then
      ((read_reg f12_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 13) then
      ((read_reg f13_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 14) then
      ((read_reg f14_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 15) then
      ((read_reg f15_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 16) then
      ((read_reg f16_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 17) then
      ((read_reg f17_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 18) then
      ((read_reg f18_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 19) then
      ((read_reg f19_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 20) then
      ((read_reg f20_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 21) then
      ((read_reg f21_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 22) then
      ((read_reg f22_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 23) then
      ((read_reg f23_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 24) then
      ((read_reg f24_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 25) then
      ((read_reg f25_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 26) then
      ((read_reg f26_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 27) then
      ((read_reg f27_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 28) then
      ((read_reg f28_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 29) then
      ((read_reg f29_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 30) then
      ((read_reg f30_ref)  : M (mword 32))
       : M (mword 32)
    else if sumbool_of_bool (Z.eqb l__45 31) then
      ((read_reg f31_ref)  : M (mword 32))
       : M (mword 32)
    else assert_exp' false "invalid floating point register number" >>= fun _ => exit tt) >>= fun v : fregtype =>
   returnm (fregval_from_freg v).

Definition wF (r : Z) (in_v : mword 32) `{ArithFact ((0 <=? r) && (r <? 32))} : M (unit) :=
   let v := fregval_into_freg in_v in
   let l__13 := r in
   (if sumbool_of_bool (Z.eqb l__13 0) then write_reg f0_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 1) then write_reg f1_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 2) then write_reg f2_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 3) then write_reg f3_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 4) then write_reg f4_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 5) then write_reg f5_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 6) then write_reg f6_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 7) then write_reg f7_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 8) then write_reg f8_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 9) then write_reg f9_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 10) then write_reg f10_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 11) then write_reg f11_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 12) then write_reg f12_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 13) then write_reg f13_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 14) then write_reg f14_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 15) then write_reg f15_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 16) then write_reg f16_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 17) then write_reg f17_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 18) then write_reg f18_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 19) then write_reg f19_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 20) then write_reg f20_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 21) then write_reg f21_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 22) then write_reg f22_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 23) then write_reg f23_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 24) then write_reg f24_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 25) then write_reg f25_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 26) then write_reg f26_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 27) then write_reg f27_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 28) then write_reg f28_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 29) then write_reg f29_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 30) then write_reg f30_ref v  : M (unit)
    else if sumbool_of_bool (Z.eqb l__13 31) then write_reg f31_ref v  : M (unit)
    else assert_exp' false "invalid floating point register number" >>= fun _ => exit tt) >>
   (dirty_fd_context tt) >>
   returnm (if get_config_print_reg tt then
              print_endline
                (String.append "f"
                   (String.append (string_of_int r) (String.append " <- " (FRegStr v))))
            else tt).

Definition rF_bits (i : mword 5) : M (mword 32) := (rF (projT1 (uint i)))  : M (mword 32).

Definition wF_bits (i : mword 5) (data : mword 32) : M (unit) :=
   (wF (projT1 (uint i)) data)  : M (unit).

Definition freg_name_abi_forwards (arg_ : mword 5) : M (string) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"00000"  : mword 5) then returnm "ft0"
    else if eq_vec b__0 ('b"00001"  : mword 5) then returnm "ft1"
    else if eq_vec b__0 ('b"00010"  : mword 5) then returnm "ft2"
    else if eq_vec b__0 ('b"00011"  : mword 5) then returnm "ft3"
    else if eq_vec b__0 ('b"00100"  : mword 5) then returnm "ft4"
    else if eq_vec b__0 ('b"00101"  : mword 5) then returnm "ft5"
    else if eq_vec b__0 ('b"00110"  : mword 5) then returnm "ft6"
    else if eq_vec b__0 ('b"00111"  : mword 5) then returnm "ft7"
    else if eq_vec b__0 ('b"01000"  : mword 5) then returnm "fs0"
    else if eq_vec b__0 ('b"01001"  : mword 5) then returnm "fs1"
    else if eq_vec b__0 ('b"01010"  : mword 5) then returnm "fa0"
    else if eq_vec b__0 ('b"01011"  : mword 5) then returnm "fa1"
    else if eq_vec b__0 ('b"01100"  : mword 5) then returnm "fa2"
    else if eq_vec b__0 ('b"01101"  : mword 5) then returnm "fa3"
    else if eq_vec b__0 ('b"01110"  : mword 5) then returnm "fa4"
    else if eq_vec b__0 ('b"01111"  : mword 5) then returnm "fa5"
    else if eq_vec b__0 ('b"10000"  : mword 5) then returnm "fa6"
    else if eq_vec b__0 ('b"10001"  : mword 5) then returnm "fa7"
    else if eq_vec b__0 ('b"10010"  : mword 5) then returnm "fs2"
    else if eq_vec b__0 ('b"10011"  : mword 5) then returnm "fs3"
    else if eq_vec b__0 ('b"10100"  : mword 5) then returnm "fs4"
    else if eq_vec b__0 ('b"10101"  : mword 5) then returnm "fs5"
    else if eq_vec b__0 ('b"10110"  : mword 5) then returnm "fs6"
    else if eq_vec b__0 ('b"10111"  : mword 5) then returnm "fs7"
    else if eq_vec b__0 ('b"11000"  : mword 5) then returnm "fs8"
    else if eq_vec b__0 ('b"11001"  : mword 5) then returnm "fs9"
    else if eq_vec b__0 ('b"11010"  : mword 5) then returnm "fs10"
    else if eq_vec b__0 ('b"11011"  : mword 5) then returnm "fs11"
    else if eq_vec b__0 ('b"11100"  : mword 5) then returnm "ft8"
    else if eq_vec b__0 ('b"11101"  : mword 5) then returnm "ft9"
    else if eq_vec b__0 ('b"11110"  : mword 5) then returnm "ft10"
    else if eq_vec b__0 ('b"11111"  : mword 5) then returnm "ft11"
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (string).

Definition freg_name_abi_backwards (arg_ : string) : M (mword 5) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "ft0" then returnm ('b"00000"  : mword 5)
    else if generic_eq p0_ "ft1" then returnm ('b"00001"  : mword 5)
    else if generic_eq p0_ "ft2" then returnm ('b"00010"  : mword 5)
    else if generic_eq p0_ "ft3" then returnm ('b"00011"  : mword 5)
    else if generic_eq p0_ "ft4" then returnm ('b"00100"  : mword 5)
    else if generic_eq p0_ "ft5" then returnm ('b"00101"  : mword 5)
    else if generic_eq p0_ "ft6" then returnm ('b"00110"  : mword 5)
    else if generic_eq p0_ "ft7" then returnm ('b"00111"  : mword 5)
    else if generic_eq p0_ "fs0" then returnm ('b"01000"  : mword 5)
    else if generic_eq p0_ "fs1" then returnm ('b"01001"  : mword 5)
    else if generic_eq p0_ "fa0" then returnm ('b"01010"  : mword 5)
    else if generic_eq p0_ "fa1" then returnm ('b"01011"  : mword 5)
    else if generic_eq p0_ "fa2" then returnm ('b"01100"  : mword 5)
    else if generic_eq p0_ "fa3" then returnm ('b"01101"  : mword 5)
    else if generic_eq p0_ "fa4" then returnm ('b"01110"  : mword 5)
    else if generic_eq p0_ "fa5" then returnm ('b"01111"  : mword 5)
    else if generic_eq p0_ "fa6" then returnm ('b"10000"  : mword 5)
    else if generic_eq p0_ "fa7" then returnm ('b"10001"  : mword 5)
    else if generic_eq p0_ "fs2" then returnm ('b"10010"  : mword 5)
    else if generic_eq p0_ "fs3" then returnm ('b"10011"  : mword 5)
    else if generic_eq p0_ "fs4" then returnm ('b"10100"  : mword 5)
    else if generic_eq p0_ "fs5" then returnm ('b"10101"  : mword 5)
    else if generic_eq p0_ "fs6" then returnm ('b"10110"  : mword 5)
    else if generic_eq p0_ "fs7" then returnm ('b"10111"  : mword 5)
    else if generic_eq p0_ "fs8" then returnm ('b"11000"  : mword 5)
    else if generic_eq p0_ "fs9" then returnm ('b"11001"  : mword 5)
    else if generic_eq p0_ "fs10" then returnm ('b"11010"  : mword 5)
    else if generic_eq p0_ "fs11" then returnm ('b"11011"  : mword 5)
    else if generic_eq p0_ "ft8" then returnm ('b"11100"  : mword 5)
    else if generic_eq p0_ "ft9" then returnm ('b"11101"  : mword 5)
    else if generic_eq p0_ "ft10" then returnm ('b"11110"  : mword 5)
    else if generic_eq p0_ "ft11" then returnm ('b"11111"  : mword 5)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 5).

Definition freg_name_abi_forwards_matches (arg_ : mword 5) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"00000"  : mword 5) then true
   else if eq_vec b__0 ('b"00001"  : mword 5) then true
   else if eq_vec b__0 ('b"00010"  : mword 5) then true
   else if eq_vec b__0 ('b"00011"  : mword 5) then true
   else if eq_vec b__0 ('b"00100"  : mword 5) then true
   else if eq_vec b__0 ('b"00101"  : mword 5) then true
   else if eq_vec b__0 ('b"00110"  : mword 5) then true
   else if eq_vec b__0 ('b"00111"  : mword 5) then true
   else if eq_vec b__0 ('b"01000"  : mword 5) then true
   else if eq_vec b__0 ('b"01001"  : mword 5) then true
   else if eq_vec b__0 ('b"01010"  : mword 5) then true
   else if eq_vec b__0 ('b"01011"  : mword 5) then true
   else if eq_vec b__0 ('b"01100"  : mword 5) then true
   else if eq_vec b__0 ('b"01101"  : mword 5) then true
   else if eq_vec b__0 ('b"01110"  : mword 5) then true
   else if eq_vec b__0 ('b"01111"  : mword 5) then true
   else if eq_vec b__0 ('b"10000"  : mword 5) then true
   else if eq_vec b__0 ('b"10001"  : mword 5) then true
   else if eq_vec b__0 ('b"10010"  : mword 5) then true
   else if eq_vec b__0 ('b"10011"  : mword 5) then true
   else if eq_vec b__0 ('b"10100"  : mword 5) then true
   else if eq_vec b__0 ('b"10101"  : mword 5) then true
   else if eq_vec b__0 ('b"10110"  : mword 5) then true
   else if eq_vec b__0 ('b"10111"  : mword 5) then true
   else if eq_vec b__0 ('b"11000"  : mword 5) then true
   else if eq_vec b__0 ('b"11001"  : mword 5) then true
   else if eq_vec b__0 ('b"11010"  : mword 5) then true
   else if eq_vec b__0 ('b"11011"  : mword 5) then true
   else if eq_vec b__0 ('b"11100"  : mword 5) then true
   else if eq_vec b__0 ('b"11101"  : mword 5) then true
   else if eq_vec b__0 ('b"11110"  : mword 5) then true
   else if eq_vec b__0 ('b"11111"  : mword 5) then true
   else false.

Definition freg_name_abi_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "ft0" then true
   else if generic_eq p0_ "ft1" then true
   else if generic_eq p0_ "ft2" then true
   else if generic_eq p0_ "ft3" then true
   else if generic_eq p0_ "ft4" then true
   else if generic_eq p0_ "ft5" then true
   else if generic_eq p0_ "ft6" then true
   else if generic_eq p0_ "ft7" then true
   else if generic_eq p0_ "fs0" then true
   else if generic_eq p0_ "fs1" then true
   else if generic_eq p0_ "fa0" then true
   else if generic_eq p0_ "fa1" then true
   else if generic_eq p0_ "fa2" then true
   else if generic_eq p0_ "fa3" then true
   else if generic_eq p0_ "fa4" then true
   else if generic_eq p0_ "fa5" then true
   else if generic_eq p0_ "fa6" then true
   else if generic_eq p0_ "fa7" then true
   else if generic_eq p0_ "fs2" then true
   else if generic_eq p0_ "fs3" then true
   else if generic_eq p0_ "fs4" then true
   else if generic_eq p0_ "fs5" then true
   else if generic_eq p0_ "fs6" then true
   else if generic_eq p0_ "fs7" then true
   else if generic_eq p0_ "fs8" then true
   else if generic_eq p0_ "fs9" then true
   else if generic_eq p0_ "fs10" then true
   else if generic_eq p0_ "fs11" then true
   else if generic_eq p0_ "ft8" then true
   else if generic_eq p0_ "ft9" then true
   else if generic_eq p0_ "ft10" then true
   else if generic_eq p0_ "ft11" then true
   else false.

Definition _s324_ (_s325_ : string) : option string :=
   let _s326_ := _s325_ in
   if string_startswith _s326_ "ft11" then
     match (string_drop _s326_ (projT1 (string_length "ft11"))) with | s_ => Some s_ end
   else None.

Definition _s320_ (_s321_ : string) : option string :=
   let _s322_ := _s321_ in
   if string_startswith _s322_ "ft10" then
     match (string_drop _s322_ (projT1 (string_length "ft10"))) with | s_ => Some s_ end
   else None.

Definition _s316_ (_s317_ : string) : option string :=
   let _s318_ := _s317_ in
   if string_startswith _s318_ "ft9" then
     match (string_drop _s318_ (projT1 (string_length "ft9"))) with | s_ => Some s_ end
   else None.

Definition _s312_ (_s313_ : string) : option string :=
   let _s314_ := _s313_ in
   if string_startswith _s314_ "ft8" then
     match (string_drop _s314_ (projT1 (string_length "ft8"))) with | s_ => Some s_ end
   else None.

Definition _s308_ (_s309_ : string) : option string :=
   let _s310_ := _s309_ in
   if string_startswith _s310_ "fs11" then
     match (string_drop _s310_ (projT1 (string_length "fs11"))) with | s_ => Some s_ end
   else None.

Definition _s304_ (_s305_ : string) : option string :=
   let _s306_ := _s305_ in
   if string_startswith _s306_ "fs10" then
     match (string_drop _s306_ (projT1 (string_length "fs10"))) with | s_ => Some s_ end
   else None.

Definition _s300_ (_s301_ : string) : option string :=
   let _s302_ := _s301_ in
   if string_startswith _s302_ "fs9" then
     match (string_drop _s302_ (projT1 (string_length "fs9"))) with | s_ => Some s_ end
   else None.

Definition _s296_ (_s297_ : string) : option string :=
   let _s298_ := _s297_ in
   if string_startswith _s298_ "fs8" then
     match (string_drop _s298_ (projT1 (string_length "fs8"))) with | s_ => Some s_ end
   else None.

Definition _s292_ (_s293_ : string) : option string :=
   let _s294_ := _s293_ in
   if string_startswith _s294_ "fs7" then
     match (string_drop _s294_ (projT1 (string_length "fs7"))) with | s_ => Some s_ end
   else None.

Definition _s288_ (_s289_ : string) : option string :=
   let _s290_ := _s289_ in
   if string_startswith _s290_ "fs6" then
     match (string_drop _s290_ (projT1 (string_length "fs6"))) with | s_ => Some s_ end
   else None.

Definition _s284_ (_s285_ : string) : option string :=
   let _s286_ := _s285_ in
   if string_startswith _s286_ "fs5" then
     match (string_drop _s286_ (projT1 (string_length "fs5"))) with | s_ => Some s_ end
   else None.

Definition _s280_ (_s281_ : string) : option string :=
   let _s282_ := _s281_ in
   if string_startswith _s282_ "fs4" then
     match (string_drop _s282_ (projT1 (string_length "fs4"))) with | s_ => Some s_ end
   else None.

Definition _s276_ (_s277_ : string) : option string :=
   let _s278_ := _s277_ in
   if string_startswith _s278_ "fs3" then
     match (string_drop _s278_ (projT1 (string_length "fs3"))) with | s_ => Some s_ end
   else None.

Definition _s272_ (_s273_ : string) : option string :=
   let _s274_ := _s273_ in
   if string_startswith _s274_ "fs2" then
     match (string_drop _s274_ (projT1 (string_length "fs2"))) with | s_ => Some s_ end
   else None.

Definition _s268_ (_s269_ : string) : option string :=
   let _s270_ := _s269_ in
   if string_startswith _s270_ "fa7" then
     match (string_drop _s270_ (projT1 (string_length "fa7"))) with | s_ => Some s_ end
   else None.

Definition _s264_ (_s265_ : string) : option string :=
   let _s266_ := _s265_ in
   if string_startswith _s266_ "fa6" then
     match (string_drop _s266_ (projT1 (string_length "fa6"))) with | s_ => Some s_ end
   else None.

Definition _s260_ (_s261_ : string) : option string :=
   let _s262_ := _s261_ in
   if string_startswith _s262_ "fa5" then
     match (string_drop _s262_ (projT1 (string_length "fa5"))) with | s_ => Some s_ end
   else None.

Definition _s256_ (_s257_ : string) : option string :=
   let _s258_ := _s257_ in
   if string_startswith _s258_ "fa4" then
     match (string_drop _s258_ (projT1 (string_length "fa4"))) with | s_ => Some s_ end
   else None.

Definition _s252_ (_s253_ : string) : option string :=
   let _s254_ := _s253_ in
   if string_startswith _s254_ "fa3" then
     match (string_drop _s254_ (projT1 (string_length "fa3"))) with | s_ => Some s_ end
   else None.

Definition _s248_ (_s249_ : string) : option string :=
   let _s250_ := _s249_ in
   if string_startswith _s250_ "fa2" then
     match (string_drop _s250_ (projT1 (string_length "fa2"))) with | s_ => Some s_ end
   else None.

Definition _s244_ (_s245_ : string) : option string :=
   let _s246_ := _s245_ in
   if string_startswith _s246_ "fa1" then
     match (string_drop _s246_ (projT1 (string_length "fa1"))) with | s_ => Some s_ end
   else None.

Definition _s240_ (_s241_ : string) : option string :=
   let _s242_ := _s241_ in
   if string_startswith _s242_ "fa0" then
     match (string_drop _s242_ (projT1 (string_length "fa0"))) with | s_ => Some s_ end
   else None.

Definition _s236_ (_s237_ : string) : option string :=
   let _s238_ := _s237_ in
   if string_startswith _s238_ "fs1" then
     match (string_drop _s238_ (projT1 (string_length "fs1"))) with | s_ => Some s_ end
   else None.

Definition _s232_ (_s233_ : string) : option string :=
   let _s234_ := _s233_ in
   if string_startswith _s234_ "fs0" then
     match (string_drop _s234_ (projT1 (string_length "fs0"))) with | s_ => Some s_ end
   else None.

Definition _s228_ (_s229_ : string) : option string :=
   let _s230_ := _s229_ in
   if string_startswith _s230_ "ft7" then
     match (string_drop _s230_ (projT1 (string_length "ft7"))) with | s_ => Some s_ end
   else None.

Definition _s224_ (_s225_ : string) : option string :=
   let _s226_ := _s225_ in
   if string_startswith _s226_ "ft6" then
     match (string_drop _s226_ (projT1 (string_length "ft6"))) with | s_ => Some s_ end
   else None.

Definition _s220_ (_s221_ : string) : option string :=
   let _s222_ := _s221_ in
   if string_startswith _s222_ "ft5" then
     match (string_drop _s222_ (projT1 (string_length "ft5"))) with | s_ => Some s_ end
   else None.

Definition _s216_ (_s217_ : string) : option string :=
   let _s218_ := _s217_ in
   if string_startswith _s218_ "ft4" then
     match (string_drop _s218_ (projT1 (string_length "ft4"))) with | s_ => Some s_ end
   else None.

Definition _s212_ (_s213_ : string) : option string :=
   let _s214_ := _s213_ in
   if string_startswith _s214_ "ft3" then
     match (string_drop _s214_ (projT1 (string_length "ft3"))) with | s_ => Some s_ end
   else None.

Definition _s208_ (_s209_ : string) : option string :=
   let _s210_ := _s209_ in
   if string_startswith _s210_ "ft2" then
     match (string_drop _s210_ (projT1 (string_length "ft2"))) with | s_ => Some s_ end
   else None.

Definition _s204_ (_s205_ : string) : option string :=
   let _s206_ := _s205_ in
   if string_startswith _s206_ "ft1" then
     match (string_drop _s206_ (projT1 (string_length "ft1"))) with | s_ => Some s_ end
   else None.

Definition _s200_ (_s201_ : string) : option string :=
   let _s202_ := _s201_ in
   if string_startswith _s202_ "ft0" then
     match (string_drop _s202_ (projT1 (string_length "ft0"))) with | s_ => Some s_ end
   else None.

Definition freg_name_abi_matches_prefix (arg_ : string)
: M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s203_ := arg_ in
   (if match (_s200_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s200_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"00000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s204_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s204_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"00001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s208_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s208_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"00010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s212_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s212_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"00011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s216_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s216_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"00100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s220_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s220_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"00101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s224_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s224_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"00110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s228_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s228_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"00111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s232_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s232_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"01000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s236_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s236_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"01001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s240_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s240_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"01010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s244_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s244_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"01011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s248_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s248_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"01100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s252_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s252_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"01101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s256_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s256_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"01110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s260_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s260_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"01111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s264_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s264_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"10000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s268_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s268_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"10001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s272_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s272_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"10010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s276_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s276_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"10011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s280_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s280_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"10100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s284_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s284_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"10101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s288_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s288_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"10110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s292_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s292_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"10111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s296_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s296_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"11000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s300_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s300_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"11001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s304_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s304_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"11010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s308_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s308_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"11011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s312_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s312_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"11100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s316_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s316_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"11101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s320_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s320_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"11110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s324_ _s203_) with | Some s_ => true | _ => false end then
      (match (_s324_ _s203_) with
       | Some s_ =>
          returnm (Some
                     ('b"11111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)}))).

Definition freg_name_forwards (arg_ : mword 5) : M (string) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"00000"  : mword 5) then returnm "ft0"
    else if eq_vec b__0 ('b"00001"  : mword 5) then returnm "ft1"
    else if eq_vec b__0 ('b"00010"  : mword 5) then returnm "ft2"
    else if eq_vec b__0 ('b"00011"  : mword 5) then returnm "ft3"
    else if eq_vec b__0 ('b"00100"  : mword 5) then returnm "ft4"
    else if eq_vec b__0 ('b"00101"  : mword 5) then returnm "ft5"
    else if eq_vec b__0 ('b"00110"  : mword 5) then returnm "ft6"
    else if eq_vec b__0 ('b"00111"  : mword 5) then returnm "ft7"
    else if eq_vec b__0 ('b"01000"  : mword 5) then returnm "fs0"
    else if eq_vec b__0 ('b"01001"  : mword 5) then returnm "fs1"
    else if eq_vec b__0 ('b"01010"  : mword 5) then returnm "fa0"
    else if eq_vec b__0 ('b"01011"  : mword 5) then returnm "fa1"
    else if eq_vec b__0 ('b"01100"  : mword 5) then returnm "fa2"
    else if eq_vec b__0 ('b"01101"  : mword 5) then returnm "fa3"
    else if eq_vec b__0 ('b"01110"  : mword 5) then returnm "fa4"
    else if eq_vec b__0 ('b"01111"  : mword 5) then returnm "fa5"
    else if eq_vec b__0 ('b"10000"  : mword 5) then returnm "fa6"
    else if eq_vec b__0 ('b"10001"  : mword 5) then returnm "fa7"
    else if eq_vec b__0 ('b"10010"  : mword 5) then returnm "fs2"
    else if eq_vec b__0 ('b"10011"  : mword 5) then returnm "fs3"
    else if eq_vec b__0 ('b"10100"  : mword 5) then returnm "fs4"
    else if eq_vec b__0 ('b"10101"  : mword 5) then returnm "fs5"
    else if eq_vec b__0 ('b"10110"  : mword 5) then returnm "fs6"
    else if eq_vec b__0 ('b"10111"  : mword 5) then returnm "fs7"
    else if eq_vec b__0 ('b"11000"  : mword 5) then returnm "fs8"
    else if eq_vec b__0 ('b"11001"  : mword 5) then returnm "fs9"
    else if eq_vec b__0 ('b"11010"  : mword 5) then returnm "fs10"
    else if eq_vec b__0 ('b"11011"  : mword 5) then returnm "fs11"
    else if eq_vec b__0 ('b"11100"  : mword 5) then returnm "ft8"
    else if eq_vec b__0 ('b"11101"  : mword 5) then returnm "ft9"
    else if eq_vec b__0 ('b"11110"  : mword 5) then returnm "ft10"
    else if eq_vec b__0 ('b"11111"  : mword 5) then returnm "ft11"
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (string).

Definition freg_name_backwards (arg_ : string) : M (mword 5) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "ft0" then returnm ('b"00000"  : mword 5)
    else if generic_eq p0_ "ft1" then returnm ('b"00001"  : mword 5)
    else if generic_eq p0_ "ft2" then returnm ('b"00010"  : mword 5)
    else if generic_eq p0_ "ft3" then returnm ('b"00011"  : mword 5)
    else if generic_eq p0_ "ft4" then returnm ('b"00100"  : mword 5)
    else if generic_eq p0_ "ft5" then returnm ('b"00101"  : mword 5)
    else if generic_eq p0_ "ft6" then returnm ('b"00110"  : mword 5)
    else if generic_eq p0_ "ft7" then returnm ('b"00111"  : mword 5)
    else if generic_eq p0_ "fs0" then returnm ('b"01000"  : mword 5)
    else if generic_eq p0_ "fs1" then returnm ('b"01001"  : mword 5)
    else if generic_eq p0_ "fa0" then returnm ('b"01010"  : mword 5)
    else if generic_eq p0_ "fa1" then returnm ('b"01011"  : mword 5)
    else if generic_eq p0_ "fa2" then returnm ('b"01100"  : mword 5)
    else if generic_eq p0_ "fa3" then returnm ('b"01101"  : mword 5)
    else if generic_eq p0_ "fa4" then returnm ('b"01110"  : mword 5)
    else if generic_eq p0_ "fa5" then returnm ('b"01111"  : mword 5)
    else if generic_eq p0_ "fa6" then returnm ('b"10000"  : mword 5)
    else if generic_eq p0_ "fa7" then returnm ('b"10001"  : mword 5)
    else if generic_eq p0_ "fs2" then returnm ('b"10010"  : mword 5)
    else if generic_eq p0_ "fs3" then returnm ('b"10011"  : mword 5)
    else if generic_eq p0_ "fs4" then returnm ('b"10100"  : mword 5)
    else if generic_eq p0_ "fs5" then returnm ('b"10101"  : mword 5)
    else if generic_eq p0_ "fs6" then returnm ('b"10110"  : mword 5)
    else if generic_eq p0_ "fs7" then returnm ('b"10111"  : mword 5)
    else if generic_eq p0_ "fs8" then returnm ('b"11000"  : mword 5)
    else if generic_eq p0_ "fs9" then returnm ('b"11001"  : mword 5)
    else if generic_eq p0_ "fs10" then returnm ('b"11010"  : mword 5)
    else if generic_eq p0_ "fs11" then returnm ('b"11011"  : mword 5)
    else if generic_eq p0_ "ft8" then returnm ('b"11100"  : mword 5)
    else if generic_eq p0_ "ft9" then returnm ('b"11101"  : mword 5)
    else if generic_eq p0_ "ft10" then returnm ('b"11110"  : mword 5)
    else if generic_eq p0_ "ft11" then returnm ('b"11111"  : mword 5)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 5).

Definition freg_name_forwards_matches (arg_ : mword 5) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"00000"  : mword 5) then true
   else if eq_vec b__0 ('b"00001"  : mword 5) then true
   else if eq_vec b__0 ('b"00010"  : mword 5) then true
   else if eq_vec b__0 ('b"00011"  : mword 5) then true
   else if eq_vec b__0 ('b"00100"  : mword 5) then true
   else if eq_vec b__0 ('b"00101"  : mword 5) then true
   else if eq_vec b__0 ('b"00110"  : mword 5) then true
   else if eq_vec b__0 ('b"00111"  : mword 5) then true
   else if eq_vec b__0 ('b"01000"  : mword 5) then true
   else if eq_vec b__0 ('b"01001"  : mword 5) then true
   else if eq_vec b__0 ('b"01010"  : mword 5) then true
   else if eq_vec b__0 ('b"01011"  : mword 5) then true
   else if eq_vec b__0 ('b"01100"  : mword 5) then true
   else if eq_vec b__0 ('b"01101"  : mword 5) then true
   else if eq_vec b__0 ('b"01110"  : mword 5) then true
   else if eq_vec b__0 ('b"01111"  : mword 5) then true
   else if eq_vec b__0 ('b"10000"  : mword 5) then true
   else if eq_vec b__0 ('b"10001"  : mword 5) then true
   else if eq_vec b__0 ('b"10010"  : mword 5) then true
   else if eq_vec b__0 ('b"10011"  : mword 5) then true
   else if eq_vec b__0 ('b"10100"  : mword 5) then true
   else if eq_vec b__0 ('b"10101"  : mword 5) then true
   else if eq_vec b__0 ('b"10110"  : mword 5) then true
   else if eq_vec b__0 ('b"10111"  : mword 5) then true
   else if eq_vec b__0 ('b"11000"  : mword 5) then true
   else if eq_vec b__0 ('b"11001"  : mword 5) then true
   else if eq_vec b__0 ('b"11010"  : mword 5) then true
   else if eq_vec b__0 ('b"11011"  : mword 5) then true
   else if eq_vec b__0 ('b"11100"  : mword 5) then true
   else if eq_vec b__0 ('b"11101"  : mword 5) then true
   else if eq_vec b__0 ('b"11110"  : mword 5) then true
   else if eq_vec b__0 ('b"11111"  : mword 5) then true
   else false.

Definition freg_name_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "ft0" then true
   else if generic_eq p0_ "ft1" then true
   else if generic_eq p0_ "ft2" then true
   else if generic_eq p0_ "ft3" then true
   else if generic_eq p0_ "ft4" then true
   else if generic_eq p0_ "ft5" then true
   else if generic_eq p0_ "ft6" then true
   else if generic_eq p0_ "ft7" then true
   else if generic_eq p0_ "fs0" then true
   else if generic_eq p0_ "fs1" then true
   else if generic_eq p0_ "fa0" then true
   else if generic_eq p0_ "fa1" then true
   else if generic_eq p0_ "fa2" then true
   else if generic_eq p0_ "fa3" then true
   else if generic_eq p0_ "fa4" then true
   else if generic_eq p0_ "fa5" then true
   else if generic_eq p0_ "fa6" then true
   else if generic_eq p0_ "fa7" then true
   else if generic_eq p0_ "fs2" then true
   else if generic_eq p0_ "fs3" then true
   else if generic_eq p0_ "fs4" then true
   else if generic_eq p0_ "fs5" then true
   else if generic_eq p0_ "fs6" then true
   else if generic_eq p0_ "fs7" then true
   else if generic_eq p0_ "fs8" then true
   else if generic_eq p0_ "fs9" then true
   else if generic_eq p0_ "fs10" then true
   else if generic_eq p0_ "fs11" then true
   else if generic_eq p0_ "ft8" then true
   else if generic_eq p0_ "ft9" then true
   else if generic_eq p0_ "ft10" then true
   else if generic_eq p0_ "ft11" then true
   else false.

Definition _s452_ (_s453_ : string) : option string :=
   let _s454_ := _s453_ in
   if string_startswith _s454_ "ft11" then
     match (string_drop _s454_ (projT1 (string_length "ft11"))) with | s_ => Some s_ end
   else None.

Definition _s448_ (_s449_ : string) : option string :=
   let _s450_ := _s449_ in
   if string_startswith _s450_ "ft10" then
     match (string_drop _s450_ (projT1 (string_length "ft10"))) with | s_ => Some s_ end
   else None.

Definition _s444_ (_s445_ : string) : option string :=
   let _s446_ := _s445_ in
   if string_startswith _s446_ "ft9" then
     match (string_drop _s446_ (projT1 (string_length "ft9"))) with | s_ => Some s_ end
   else None.

Definition _s440_ (_s441_ : string) : option string :=
   let _s442_ := _s441_ in
   if string_startswith _s442_ "ft8" then
     match (string_drop _s442_ (projT1 (string_length "ft8"))) with | s_ => Some s_ end
   else None.

Definition _s436_ (_s437_ : string) : option string :=
   let _s438_ := _s437_ in
   if string_startswith _s438_ "fs11" then
     match (string_drop _s438_ (projT1 (string_length "fs11"))) with | s_ => Some s_ end
   else None.

Definition _s432_ (_s433_ : string) : option string :=
   let _s434_ := _s433_ in
   if string_startswith _s434_ "fs10" then
     match (string_drop _s434_ (projT1 (string_length "fs10"))) with | s_ => Some s_ end
   else None.

Definition _s428_ (_s429_ : string) : option string :=
   let _s430_ := _s429_ in
   if string_startswith _s430_ "fs9" then
     match (string_drop _s430_ (projT1 (string_length "fs9"))) with | s_ => Some s_ end
   else None.

Definition _s424_ (_s425_ : string) : option string :=
   let _s426_ := _s425_ in
   if string_startswith _s426_ "fs8" then
     match (string_drop _s426_ (projT1 (string_length "fs8"))) with | s_ => Some s_ end
   else None.

Definition _s420_ (_s421_ : string) : option string :=
   let _s422_ := _s421_ in
   if string_startswith _s422_ "fs7" then
     match (string_drop _s422_ (projT1 (string_length "fs7"))) with | s_ => Some s_ end
   else None.

Definition _s416_ (_s417_ : string) : option string :=
   let _s418_ := _s417_ in
   if string_startswith _s418_ "fs6" then
     match (string_drop _s418_ (projT1 (string_length "fs6"))) with | s_ => Some s_ end
   else None.

Definition _s412_ (_s413_ : string) : option string :=
   let _s414_ := _s413_ in
   if string_startswith _s414_ "fs5" then
     match (string_drop _s414_ (projT1 (string_length "fs5"))) with | s_ => Some s_ end
   else None.

Definition _s408_ (_s409_ : string) : option string :=
   let _s410_ := _s409_ in
   if string_startswith _s410_ "fs4" then
     match (string_drop _s410_ (projT1 (string_length "fs4"))) with | s_ => Some s_ end
   else None.

Definition _s404_ (_s405_ : string) : option string :=
   let _s406_ := _s405_ in
   if string_startswith _s406_ "fs3" then
     match (string_drop _s406_ (projT1 (string_length "fs3"))) with | s_ => Some s_ end
   else None.

Definition _s400_ (_s401_ : string) : option string :=
   let _s402_ := _s401_ in
   if string_startswith _s402_ "fs2" then
     match (string_drop _s402_ (projT1 (string_length "fs2"))) with | s_ => Some s_ end
   else None.

Definition _s396_ (_s397_ : string) : option string :=
   let _s398_ := _s397_ in
   if string_startswith _s398_ "fa7" then
     match (string_drop _s398_ (projT1 (string_length "fa7"))) with | s_ => Some s_ end
   else None.

Definition _s392_ (_s393_ : string) : option string :=
   let _s394_ := _s393_ in
   if string_startswith _s394_ "fa6" then
     match (string_drop _s394_ (projT1 (string_length "fa6"))) with | s_ => Some s_ end
   else None.

Definition _s388_ (_s389_ : string) : option string :=
   let _s390_ := _s389_ in
   if string_startswith _s390_ "fa5" then
     match (string_drop _s390_ (projT1 (string_length "fa5"))) with | s_ => Some s_ end
   else None.

Definition _s384_ (_s385_ : string) : option string :=
   let _s386_ := _s385_ in
   if string_startswith _s386_ "fa4" then
     match (string_drop _s386_ (projT1 (string_length "fa4"))) with | s_ => Some s_ end
   else None.

Definition _s380_ (_s381_ : string) : option string :=
   let _s382_ := _s381_ in
   if string_startswith _s382_ "fa3" then
     match (string_drop _s382_ (projT1 (string_length "fa3"))) with | s_ => Some s_ end
   else None.

Definition _s376_ (_s377_ : string) : option string :=
   let _s378_ := _s377_ in
   if string_startswith _s378_ "fa2" then
     match (string_drop _s378_ (projT1 (string_length "fa2"))) with | s_ => Some s_ end
   else None.

Definition _s372_ (_s373_ : string) : option string :=
   let _s374_ := _s373_ in
   if string_startswith _s374_ "fa1" then
     match (string_drop _s374_ (projT1 (string_length "fa1"))) with | s_ => Some s_ end
   else None.

Definition _s368_ (_s369_ : string) : option string :=
   let _s370_ := _s369_ in
   if string_startswith _s370_ "fa0" then
     match (string_drop _s370_ (projT1 (string_length "fa0"))) with | s_ => Some s_ end
   else None.

Definition _s364_ (_s365_ : string) : option string :=
   let _s366_ := _s365_ in
   if string_startswith _s366_ "fs1" then
     match (string_drop _s366_ (projT1 (string_length "fs1"))) with | s_ => Some s_ end
   else None.

Definition _s360_ (_s361_ : string) : option string :=
   let _s362_ := _s361_ in
   if string_startswith _s362_ "fs0" then
     match (string_drop _s362_ (projT1 (string_length "fs0"))) with | s_ => Some s_ end
   else None.

Definition _s356_ (_s357_ : string) : option string :=
   let _s358_ := _s357_ in
   if string_startswith _s358_ "ft7" then
     match (string_drop _s358_ (projT1 (string_length "ft7"))) with | s_ => Some s_ end
   else None.

Definition _s352_ (_s353_ : string) : option string :=
   let _s354_ := _s353_ in
   if string_startswith _s354_ "ft6" then
     match (string_drop _s354_ (projT1 (string_length "ft6"))) with | s_ => Some s_ end
   else None.

Definition _s348_ (_s349_ : string) : option string :=
   let _s350_ := _s349_ in
   if string_startswith _s350_ "ft5" then
     match (string_drop _s350_ (projT1 (string_length "ft5"))) with | s_ => Some s_ end
   else None.

Definition _s344_ (_s345_ : string) : option string :=
   let _s346_ := _s345_ in
   if string_startswith _s346_ "ft4" then
     match (string_drop _s346_ (projT1 (string_length "ft4"))) with | s_ => Some s_ end
   else None.

Definition _s340_ (_s341_ : string) : option string :=
   let _s342_ := _s341_ in
   if string_startswith _s342_ "ft3" then
     match (string_drop _s342_ (projT1 (string_length "ft3"))) with | s_ => Some s_ end
   else None.

Definition _s336_ (_s337_ : string) : option string :=
   let _s338_ := _s337_ in
   if string_startswith _s338_ "ft2" then
     match (string_drop _s338_ (projT1 (string_length "ft2"))) with | s_ => Some s_ end
   else None.

Definition _s332_ (_s333_ : string) : option string :=
   let _s334_ := _s333_ in
   if string_startswith _s334_ "ft1" then
     match (string_drop _s334_ (projT1 (string_length "ft1"))) with | s_ => Some s_ end
   else None.

Definition _s328_ (_s329_ : string) : option string :=
   let _s330_ := _s329_ in
   if string_startswith _s330_ "ft0" then
     match (string_drop _s330_ (projT1 (string_length "ft0"))) with | s_ => Some s_ end
   else None.

Definition freg_name_matches_prefix (arg_ : string)
: M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s331_ := arg_ in
   (if match (_s328_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s328_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"00000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s332_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s332_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"00001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s336_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s336_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"00010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s340_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s340_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"00011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s344_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s344_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"00100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s348_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s348_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"00101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s352_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s352_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"00110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s356_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s356_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"00111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s360_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s360_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"01000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s364_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s364_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"01001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s368_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s368_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"01010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s372_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s372_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"01011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s376_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s376_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"01100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s380_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s380_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"01101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s384_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s384_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"01110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s388_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s388_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"01111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s392_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s392_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"10000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s396_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s396_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"10001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s400_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s400_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"10010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s404_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s404_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"10011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s408_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s408_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"10100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s412_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s412_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"10101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s416_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s416_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"10110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s420_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s420_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"10111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s424_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s424_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"11000"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s428_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s428_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"11001"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s432_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s432_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"11010"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s436_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s436_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"11011"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s440_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s440_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"11100"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s444_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s444_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"11101"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s448_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s448_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"11110"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s452_ _s331_) with | Some s_ => true | _ => false end then
      (match (_s452_ _s331_) with
       | Some s_ =>
          returnm (Some
                     ('b"11111"
                      : mword 5, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 5 * {n : Z & ArithFact (n >=? 0)}))).

Definition init_fdext_regs '(tt : unit) : M (unit) :=
   write_reg f0_ref zero_freg >>
   write_reg f1_ref zero_freg >>
   write_reg f2_ref zero_freg >>
   write_reg f3_ref zero_freg >>
   write_reg f4_ref zero_freg >>
   write_reg f5_ref zero_freg >>
   write_reg f6_ref zero_freg >>
   write_reg f7_ref zero_freg >>
   write_reg f8_ref zero_freg >>
   write_reg f9_ref zero_freg >>
   write_reg f10_ref zero_freg >>
   write_reg f11_ref zero_freg >>
   write_reg f12_ref zero_freg >>
   write_reg f13_ref zero_freg >>
   write_reg f14_ref zero_freg >>
   write_reg f15_ref zero_freg >>
   write_reg f16_ref zero_freg >>
   write_reg f17_ref zero_freg >>
   write_reg f18_ref zero_freg >>
   write_reg f19_ref zero_freg >>
   write_reg f20_ref zero_freg >>
   write_reg f21_ref zero_freg >>
   write_reg f22_ref zero_freg >>
   write_reg f23_ref zero_freg >>
   write_reg f24_ref zero_freg >>
   write_reg f25_ref zero_freg >>
   write_reg f26_ref zero_freg >>
   write_reg f27_ref zero_freg >>
   write_reg f28_ref zero_freg >>
   write_reg f29_ref zero_freg >>
   write_reg f30_ref zero_freg >> write_reg f31_ref zero_freg  : M (unit).

Definition Mk_Fcsr (v : mword 32) : Fcsr := {| Fcsr_Fcsr_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_Fcsr_bits (v : Fcsr) : mword 32 := subrange_vec_dec v.(Fcsr_Fcsr_chunk_0) 31 0.

Definition _set_Fcsr_bits (r_ref : register_ref regstate register_value Fcsr) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Fcsr_Fcsr_chunk_0 :=
         (update_subrange_vec_dec r.(Fcsr_Fcsr_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : Fcsr in
   write_reg r_ref r
    : M (unit).

Definition _update_Fcsr_bits (v : Fcsr) (x : mword 32) : Fcsr :=
   {[ v with
     Fcsr_Fcsr_chunk_0 :=
       (update_subrange_vec_dec v.(Fcsr_Fcsr_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_Fcsr_FRM (v : Fcsr) : mword 3 := subrange_vec_dec v.(Fcsr_Fcsr_chunk_0) 7 5.

Definition _set_Fcsr_FRM (r_ref : register_ref regstate register_value Fcsr) (v : mword 3)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Fcsr_Fcsr_chunk_0 :=
         (update_subrange_vec_dec r.(Fcsr_Fcsr_chunk_0) 7 5 (subrange_vec_dec v 2 0)) ]}
      : Fcsr in
   write_reg r_ref r
    : M (unit).

Definition _update_Fcsr_FRM (v : Fcsr) (x : mword 3) : Fcsr :=
   {[ v with
     Fcsr_Fcsr_chunk_0 :=
       (update_subrange_vec_dec v.(Fcsr_Fcsr_chunk_0) 7 5 (subrange_vec_dec x 2 0)) ]}.

Definition _get_Fcsr_FFLAGS (v : Fcsr) : mword 5 := subrange_vec_dec v.(Fcsr_Fcsr_chunk_0) 4 0.

Definition _set_Fcsr_FFLAGS (r_ref : register_ref regstate register_value Fcsr) (v : mword 5)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       Fcsr_Fcsr_chunk_0 :=
         (update_subrange_vec_dec r.(Fcsr_Fcsr_chunk_0) 4 0 (subrange_vec_dec v 4 0)) ]}
      : Fcsr in
   write_reg r_ref r
    : M (unit).

Definition _update_Fcsr_FFLAGS (v : Fcsr) (x : mword 5) : Fcsr :=
   {[ v with
     Fcsr_Fcsr_chunk_0 :=
       (update_subrange_vec_dec v.(Fcsr_Fcsr_chunk_0) 4 0 (subrange_vec_dec x 4 0)) ]}.

Definition ext_write_fcsr (frm : mword 3) (fflags : mword 5) : M (unit) :=
   (_set_Fcsr_FRM fcsr_ref frm) >>
   (_set_Fcsr_FFLAGS fcsr_ref fflags) >>
   (update_softfloat_fflags fflags) >> (dirty_fd_context tt)  : M (unit).

Definition write_fflags (fflags : mword 5) : M (unit) :=
   read_reg fcsr_ref >>= fun w__0 : Fcsr =>
   (if neq_vec (_get_Fcsr_FFLAGS w__0) fflags then (dirty_fd_context tt)  : M (unit)
    else returnm tt) >>
   (_set_Fcsr_FFLAGS fcsr_ref fflags)
    : M (unit).

Definition accrue_fflags (flags : mword 5) : M (unit) :=
   read_reg fcsr_ref >>= fun w__0 : Fcsr =>
   let f := or_vec (_get_Fcsr_FFLAGS w__0) flags in
   read_reg fcsr_ref >>= fun w__1 : Fcsr =>
   (if neq_vec (_get_Fcsr_FFLAGS w__1) f then
      (_set_Fcsr_FFLAGS fcsr_ref f) >>
      (update_softfloat_fflags f) >> (dirty_fd_context tt)  : M (unit)
    else returnm tt)
    : M (unit).

Definition csr_name_map_forwards (arg_ : mword 12) : string :=
   let b__0 := arg_ in
   if eq_vec b__0 (Ox"000"  : mword 12) then "ustatus"
   else if eq_vec b__0 (Ox"004"  : mword 12) then "uie"
   else if eq_vec b__0 (Ox"005"  : mword 12) then "utvec"
   else if eq_vec b__0 (Ox"040"  : mword 12) then "uscratch"
   else if eq_vec b__0 (Ox"041"  : mword 12) then "uepc"
   else if eq_vec b__0 (Ox"042"  : mword 12) then "ucause"
   else if eq_vec b__0 (Ox"043"  : mword 12) then "utval"
   else if eq_vec b__0 (Ox"044"  : mword 12) then "uip"
   else if eq_vec b__0 (Ox"001"  : mword 12) then "fflags"
   else if eq_vec b__0 (Ox"002"  : mword 12) then "frm"
   else if eq_vec b__0 (Ox"003"  : mword 12) then "fcsr"
   else if eq_vec b__0 (Ox"C00"  : mword 12) then "cycle"
   else if eq_vec b__0 (Ox"C01"  : mword 12) then "time"
   else if eq_vec b__0 (Ox"C02"  : mword 12) then "instret"
   else if eq_vec b__0 (Ox"C80"  : mword 12) then "cycleh"
   else if eq_vec b__0 (Ox"C81"  : mword 12) then "timeh"
   else if eq_vec b__0 (Ox"C82"  : mword 12) then "instreth"
   else if eq_vec b__0 (Ox"100"  : mword 12) then "sstatus"
   else if eq_vec b__0 (Ox"102"  : mword 12) then "sedeleg"
   else if eq_vec b__0 (Ox"103"  : mword 12) then "sideleg"
   else if eq_vec b__0 (Ox"104"  : mword 12) then "sie"
   else if eq_vec b__0 (Ox"105"  : mword 12) then "stvec"
   else if eq_vec b__0 (Ox"106"  : mword 12) then "scounteren"
   else if eq_vec b__0 (Ox"140"  : mword 12) then "sscratch"
   else if eq_vec b__0 (Ox"141"  : mword 12) then "sepc"
   else if eq_vec b__0 (Ox"142"  : mword 12) then "scause"
   else if eq_vec b__0 (Ox"143"  : mword 12) then "stval"
   else if eq_vec b__0 (Ox"144"  : mword 12) then "sip"
   else if eq_vec b__0 (Ox"180"  : mword 12) then "satp"
   else if eq_vec b__0 (Ox"F11"  : mword 12) then "mvendorid"
   else if eq_vec b__0 (Ox"F12"  : mword 12) then "marchid"
   else if eq_vec b__0 (Ox"F13"  : mword 12) then "mimpid"
   else if eq_vec b__0 (Ox"F14"  : mword 12) then "mhartid"
   else if eq_vec b__0 (Ox"300"  : mword 12) then "mstatus"
   else if eq_vec b__0 (Ox"301"  : mword 12) then "misa"
   else if eq_vec b__0 (Ox"302"  : mword 12) then "medeleg"
   else if eq_vec b__0 (Ox"303"  : mword 12) then "mideleg"
   else if eq_vec b__0 (Ox"304"  : mword 12) then "mie"
   else if eq_vec b__0 (Ox"305"  : mword 12) then "mtvec"
   else if eq_vec b__0 (Ox"306"  : mword 12) then "mcounteren"
   else if eq_vec b__0 (Ox"320"  : mword 12) then "mcountinhibit"
   else if eq_vec b__0 (Ox"340"  : mword 12) then "mscratch"
   else if eq_vec b__0 (Ox"341"  : mword 12) then "mepc"
   else if eq_vec b__0 (Ox"342"  : mword 12) then "mcause"
   else if eq_vec b__0 (Ox"343"  : mword 12) then "mtval"
   else if eq_vec b__0 (Ox"344"  : mword 12) then "mip"
   else if eq_vec b__0 (Ox"3A0"  : mword 12) then "pmpcfg0"
   else if eq_vec b__0 (Ox"3A1"  : mword 12) then "pmpcfg1"
   else if eq_vec b__0 (Ox"3A2"  : mword 12) then "pmpcfg2"
   else if eq_vec b__0 (Ox"3A3"  : mword 12) then "pmpcfg3"
   else if eq_vec b__0 (Ox"3B0"  : mword 12) then "pmpaddr0"
   else if eq_vec b__0 (Ox"3B1"  : mword 12) then "pmpaddr1"
   else if eq_vec b__0 (Ox"3B2"  : mword 12) then "pmpaddr2"
   else if eq_vec b__0 (Ox"3B3"  : mword 12) then "pmpaddr3"
   else if eq_vec b__0 (Ox"3B4"  : mword 12) then "pmpaddr4"
   else if eq_vec b__0 (Ox"3B5"  : mword 12) then "pmpaddr5"
   else if eq_vec b__0 (Ox"3B6"  : mword 12) then "pmpaddr6"
   else if eq_vec b__0 (Ox"3B7"  : mword 12) then "pmpaddr7"
   else if eq_vec b__0 (Ox"3B8"  : mword 12) then "pmpaddr8"
   else if eq_vec b__0 (Ox"3B9"  : mword 12) then "pmpaddr9"
   else if eq_vec b__0 (Ox"3BA"  : mword 12) then "pmpaddr10"
   else if eq_vec b__0 (Ox"3BB"  : mword 12) then "pmpaddr11"
   else if eq_vec b__0 (Ox"3BC"  : mword 12) then "pmpaddr12"
   else if eq_vec b__0 (Ox"3BD"  : mword 12) then "pmpaddr13"
   else if eq_vec b__0 (Ox"3BE"  : mword 12) then "pmpaddr14"
   else if eq_vec b__0 (Ox"3BF"  : mword 12) then "pmpaddr15"
   else if eq_vec b__0 (Ox"B00"  : mword 12) then "mcycle"
   else if eq_vec b__0 (Ox"B02"  : mword 12) then "minstret"
   else if eq_vec b__0 (Ox"B80"  : mword 12) then "mcycleh"
   else if eq_vec b__0 (Ox"B82"  : mword 12) then "minstreth"
   else if eq_vec b__0 (Ox"7A0"  : mword 12) then "tselect"
   else if eq_vec b__0 (Ox"7A1"  : mword 12) then "tdata1"
   else if eq_vec b__0 (Ox"7A2"  : mword 12) then "tdata2"
   else if eq_vec b__0 (Ox"7A3"  : mword 12) then "tdata3"
   else decimal_string_of_bits b__0.

Definition csr_name_map_backwards (arg_ : string) : M (mword 12) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "ustatus" then returnm (Ox"000"  : mword 12)
    else if generic_eq p0_ "uie" then returnm (Ox"004"  : mword 12)
    else if generic_eq p0_ "utvec" then returnm (Ox"005"  : mword 12)
    else if generic_eq p0_ "uscratch" then returnm (Ox"040"  : mword 12)
    else if generic_eq p0_ "uepc" then returnm (Ox"041"  : mword 12)
    else if generic_eq p0_ "ucause" then returnm (Ox"042"  : mword 12)
    else if generic_eq p0_ "utval" then returnm (Ox"043"  : mword 12)
    else if generic_eq p0_ "uip" then returnm (Ox"044"  : mword 12)
    else if generic_eq p0_ "fflags" then returnm (Ox"001"  : mword 12)
    else if generic_eq p0_ "frm" then returnm (Ox"002"  : mword 12)
    else if generic_eq p0_ "fcsr" then returnm (Ox"003"  : mword 12)
    else if generic_eq p0_ "cycle" then returnm (Ox"C00"  : mword 12)
    else if generic_eq p0_ "time" then returnm (Ox"C01"  : mword 12)
    else if generic_eq p0_ "instret" then returnm (Ox"C02"  : mword 12)
    else if generic_eq p0_ "cycleh" then returnm (Ox"C80"  : mword 12)
    else if generic_eq p0_ "timeh" then returnm (Ox"C81"  : mword 12)
    else if generic_eq p0_ "instreth" then returnm (Ox"C82"  : mword 12)
    else if generic_eq p0_ "sstatus" then returnm (Ox"100"  : mword 12)
    else if generic_eq p0_ "sedeleg" then returnm (Ox"102"  : mword 12)
    else if generic_eq p0_ "sideleg" then returnm (Ox"103"  : mword 12)
    else if generic_eq p0_ "sie" then returnm (Ox"104"  : mword 12)
    else if generic_eq p0_ "stvec" then returnm (Ox"105"  : mword 12)
    else if generic_eq p0_ "scounteren" then returnm (Ox"106"  : mword 12)
    else if generic_eq p0_ "sscratch" then returnm (Ox"140"  : mword 12)
    else if generic_eq p0_ "sepc" then returnm (Ox"141"  : mword 12)
    else if generic_eq p0_ "scause" then returnm (Ox"142"  : mword 12)
    else if generic_eq p0_ "stval" then returnm (Ox"143"  : mword 12)
    else if generic_eq p0_ "sip" then returnm (Ox"144"  : mword 12)
    else if generic_eq p0_ "satp" then returnm (Ox"180"  : mword 12)
    else if generic_eq p0_ "mvendorid" then returnm (Ox"F11"  : mword 12)
    else if generic_eq p0_ "marchid" then returnm (Ox"F12"  : mword 12)
    else if generic_eq p0_ "mimpid" then returnm (Ox"F13"  : mword 12)
    else if generic_eq p0_ "mhartid" then returnm (Ox"F14"  : mword 12)
    else if generic_eq p0_ "mstatus" then returnm (Ox"300"  : mword 12)
    else if generic_eq p0_ "misa" then returnm (Ox"301"  : mword 12)
    else if generic_eq p0_ "medeleg" then returnm (Ox"302"  : mword 12)
    else if generic_eq p0_ "mideleg" then returnm (Ox"303"  : mword 12)
    else if generic_eq p0_ "mie" then returnm (Ox"304"  : mword 12)
    else if generic_eq p0_ "mtvec" then returnm (Ox"305"  : mword 12)
    else if generic_eq p0_ "mcounteren" then returnm (Ox"306"  : mword 12)
    else if generic_eq p0_ "mcountinhibit" then returnm (Ox"320"  : mword 12)
    else if generic_eq p0_ "mscratch" then returnm (Ox"340"  : mword 12)
    else if generic_eq p0_ "mepc" then returnm (Ox"341"  : mword 12)
    else if generic_eq p0_ "mcause" then returnm (Ox"342"  : mword 12)
    else if generic_eq p0_ "mtval" then returnm (Ox"343"  : mword 12)
    else if generic_eq p0_ "mip" then returnm (Ox"344"  : mword 12)
    else if generic_eq p0_ "pmpcfg0" then returnm (Ox"3A0"  : mword 12)
    else if generic_eq p0_ "pmpcfg1" then returnm (Ox"3A1"  : mword 12)
    else if generic_eq p0_ "pmpcfg2" then returnm (Ox"3A2"  : mword 12)
    else if generic_eq p0_ "pmpcfg3" then returnm (Ox"3A3"  : mword 12)
    else if generic_eq p0_ "pmpaddr0" then returnm (Ox"3B0"  : mword 12)
    else if generic_eq p0_ "pmpaddr1" then returnm (Ox"3B1"  : mword 12)
    else if generic_eq p0_ "pmpaddr2" then returnm (Ox"3B2"  : mword 12)
    else if generic_eq p0_ "pmpaddr3" then returnm (Ox"3B3"  : mword 12)
    else if generic_eq p0_ "pmpaddr4" then returnm (Ox"3B4"  : mword 12)
    else if generic_eq p0_ "pmpaddr5" then returnm (Ox"3B5"  : mword 12)
    else if generic_eq p0_ "pmpaddr6" then returnm (Ox"3B6"  : mword 12)
    else if generic_eq p0_ "pmpaddr7" then returnm (Ox"3B7"  : mword 12)
    else if generic_eq p0_ "pmpaddr8" then returnm (Ox"3B8"  : mword 12)
    else if generic_eq p0_ "pmpaddr9" then returnm (Ox"3B9"  : mword 12)
    else if generic_eq p0_ "pmpaddr10" then returnm (Ox"3BA"  : mword 12)
    else if generic_eq p0_ "pmpaddr11" then returnm (Ox"3BB"  : mword 12)
    else if generic_eq p0_ "pmpaddr12" then returnm (Ox"3BC"  : mword 12)
    else if generic_eq p0_ "pmpaddr13" then returnm (Ox"3BD"  : mword 12)
    else if generic_eq p0_ "pmpaddr14" then returnm (Ox"3BE"  : mword 12)
    else if generic_eq p0_ "pmpaddr15" then returnm (Ox"3BF"  : mword 12)
    else if generic_eq p0_ "mcycle" then returnm (Ox"B00"  : mword 12)
    else if generic_eq p0_ "minstret" then returnm (Ox"B02"  : mword 12)
    else if generic_eq p0_ "mcycleh" then returnm (Ox"B80"  : mword 12)
    else if generic_eq p0_ "minstreth" then returnm (Ox"B82"  : mword 12)
    else if generic_eq p0_ "tselect" then returnm (Ox"7A0"  : mword 12)
    else if generic_eq p0_ "tdata1" then returnm (Ox"7A1"  : mword 12)
    else if generic_eq p0_ "tdata2" then returnm (Ox"7A2"  : mword 12)
    else if generic_eq p0_ "tdata3" then returnm (Ox"7A3"  : mword 12)
    else if hex_bits_12_backwards_matches p0_ then hex_bits_12_backwards p0_
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 12).

Definition csr_name_map_forwards_matches (arg_ : mword 12) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 (Ox"000"  : mword 12) then true
   else if eq_vec b__0 (Ox"004"  : mword 12) then true
   else if eq_vec b__0 (Ox"005"  : mword 12) then true
   else if eq_vec b__0 (Ox"040"  : mword 12) then true
   else if eq_vec b__0 (Ox"041"  : mword 12) then true
   else if eq_vec b__0 (Ox"042"  : mword 12) then true
   else if eq_vec b__0 (Ox"043"  : mword 12) then true
   else if eq_vec b__0 (Ox"044"  : mword 12) then true
   else if eq_vec b__0 (Ox"001"  : mword 12) then true
   else if eq_vec b__0 (Ox"002"  : mword 12) then true
   else if eq_vec b__0 (Ox"003"  : mword 12) then true
   else if eq_vec b__0 (Ox"C00"  : mword 12) then true
   else if eq_vec b__0 (Ox"C01"  : mword 12) then true
   else if eq_vec b__0 (Ox"C02"  : mword 12) then true
   else if eq_vec b__0 (Ox"C80"  : mword 12) then true
   else if eq_vec b__0 (Ox"C81"  : mword 12) then true
   else if eq_vec b__0 (Ox"C82"  : mword 12) then true
   else if eq_vec b__0 (Ox"100"  : mword 12) then true
   else if eq_vec b__0 (Ox"102"  : mword 12) then true
   else if eq_vec b__0 (Ox"103"  : mword 12) then true
   else if eq_vec b__0 (Ox"104"  : mword 12) then true
   else if eq_vec b__0 (Ox"105"  : mword 12) then true
   else if eq_vec b__0 (Ox"106"  : mword 12) then true
   else if eq_vec b__0 (Ox"140"  : mword 12) then true
   else if eq_vec b__0 (Ox"141"  : mword 12) then true
   else if eq_vec b__0 (Ox"142"  : mword 12) then true
   else if eq_vec b__0 (Ox"143"  : mword 12) then true
   else if eq_vec b__0 (Ox"144"  : mword 12) then true
   else if eq_vec b__0 (Ox"180"  : mword 12) then true
   else if eq_vec b__0 (Ox"F11"  : mword 12) then true
   else if eq_vec b__0 (Ox"F12"  : mword 12) then true
   else if eq_vec b__0 (Ox"F13"  : mword 12) then true
   else if eq_vec b__0 (Ox"F14"  : mword 12) then true
   else if eq_vec b__0 (Ox"300"  : mword 12) then true
   else if eq_vec b__0 (Ox"301"  : mword 12) then true
   else if eq_vec b__0 (Ox"302"  : mword 12) then true
   else if eq_vec b__0 (Ox"303"  : mword 12) then true
   else if eq_vec b__0 (Ox"304"  : mword 12) then true
   else if eq_vec b__0 (Ox"305"  : mword 12) then true
   else if eq_vec b__0 (Ox"306"  : mword 12) then true
   else if eq_vec b__0 (Ox"320"  : mword 12) then true
   else if eq_vec b__0 (Ox"340"  : mword 12) then true
   else if eq_vec b__0 (Ox"341"  : mword 12) then true
   else if eq_vec b__0 (Ox"342"  : mword 12) then true
   else if eq_vec b__0 (Ox"343"  : mword 12) then true
   else if eq_vec b__0 (Ox"344"  : mword 12) then true
   else if eq_vec b__0 (Ox"3A0"  : mword 12) then true
   else if eq_vec b__0 (Ox"3A1"  : mword 12) then true
   else if eq_vec b__0 (Ox"3A2"  : mword 12) then true
   else if eq_vec b__0 (Ox"3A3"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B0"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B1"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B2"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B3"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B4"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B5"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B6"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B7"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B8"  : mword 12) then true
   else if eq_vec b__0 (Ox"3B9"  : mword 12) then true
   else if eq_vec b__0 (Ox"3BA"  : mword 12) then true
   else if eq_vec b__0 (Ox"3BB"  : mword 12) then true
   else if eq_vec b__0 (Ox"3BC"  : mword 12) then true
   else if eq_vec b__0 (Ox"3BD"  : mword 12) then true
   else if eq_vec b__0 (Ox"3BE"  : mword 12) then true
   else if eq_vec b__0 (Ox"3BF"  : mword 12) then true
   else if eq_vec b__0 (Ox"B00"  : mword 12) then true
   else if eq_vec b__0 (Ox"B02"  : mword 12) then true
   else if eq_vec b__0 (Ox"B80"  : mword 12) then true
   else if eq_vec b__0 (Ox"B82"  : mword 12) then true
   else if eq_vec b__0 (Ox"7A0"  : mword 12) then true
   else if eq_vec b__0 (Ox"7A1"  : mword 12) then true
   else if eq_vec b__0 (Ox"7A2"  : mword 12) then true
   else if eq_vec b__0 (Ox"7A3"  : mword 12) then true
   else true.

Definition csr_name_map_backwards_matches (arg_ : string) : M (bool) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "ustatus" then returnm true
    else if generic_eq p0_ "uie" then returnm true
    else if generic_eq p0_ "utvec" then returnm true
    else if generic_eq p0_ "uscratch" then returnm true
    else if generic_eq p0_ "uepc" then returnm true
    else if generic_eq p0_ "ucause" then returnm true
    else if generic_eq p0_ "utval" then returnm true
    else if generic_eq p0_ "uip" then returnm true
    else if generic_eq p0_ "fflags" then returnm true
    else if generic_eq p0_ "frm" then returnm true
    else if generic_eq p0_ "fcsr" then returnm true
    else if generic_eq p0_ "cycle" then returnm true
    else if generic_eq p0_ "time" then returnm true
    else if generic_eq p0_ "instret" then returnm true
    else if generic_eq p0_ "cycleh" then returnm true
    else if generic_eq p0_ "timeh" then returnm true
    else if generic_eq p0_ "instreth" then returnm true
    else if generic_eq p0_ "sstatus" then returnm true
    else if generic_eq p0_ "sedeleg" then returnm true
    else if generic_eq p0_ "sideleg" then returnm true
    else if generic_eq p0_ "sie" then returnm true
    else if generic_eq p0_ "stvec" then returnm true
    else if generic_eq p0_ "scounteren" then returnm true
    else if generic_eq p0_ "sscratch" then returnm true
    else if generic_eq p0_ "sepc" then returnm true
    else if generic_eq p0_ "scause" then returnm true
    else if generic_eq p0_ "stval" then returnm true
    else if generic_eq p0_ "sip" then returnm true
    else if generic_eq p0_ "satp" then returnm true
    else if generic_eq p0_ "mvendorid" then returnm true
    else if generic_eq p0_ "marchid" then returnm true
    else if generic_eq p0_ "mimpid" then returnm true
    else if generic_eq p0_ "mhartid" then returnm true
    else if generic_eq p0_ "mstatus" then returnm true
    else if generic_eq p0_ "misa" then returnm true
    else if generic_eq p0_ "medeleg" then returnm true
    else if generic_eq p0_ "mideleg" then returnm true
    else if generic_eq p0_ "mie" then returnm true
    else if generic_eq p0_ "mtvec" then returnm true
    else if generic_eq p0_ "mcounteren" then returnm true
    else if generic_eq p0_ "mcountinhibit" then returnm true
    else if generic_eq p0_ "mscratch" then returnm true
    else if generic_eq p0_ "mepc" then returnm true
    else if generic_eq p0_ "mcause" then returnm true
    else if generic_eq p0_ "mtval" then returnm true
    else if generic_eq p0_ "mip" then returnm true
    else if generic_eq p0_ "pmpcfg0" then returnm true
    else if generic_eq p0_ "pmpcfg1" then returnm true
    else if generic_eq p0_ "pmpcfg2" then returnm true
    else if generic_eq p0_ "pmpcfg3" then returnm true
    else if generic_eq p0_ "pmpaddr0" then returnm true
    else if generic_eq p0_ "pmpaddr1" then returnm true
    else if generic_eq p0_ "pmpaddr2" then returnm true
    else if generic_eq p0_ "pmpaddr3" then returnm true
    else if generic_eq p0_ "pmpaddr4" then returnm true
    else if generic_eq p0_ "pmpaddr5" then returnm true
    else if generic_eq p0_ "pmpaddr6" then returnm true
    else if generic_eq p0_ "pmpaddr7" then returnm true
    else if generic_eq p0_ "pmpaddr8" then returnm true
    else if generic_eq p0_ "pmpaddr9" then returnm true
    else if generic_eq p0_ "pmpaddr10" then returnm true
    else if generic_eq p0_ "pmpaddr11" then returnm true
    else if generic_eq p0_ "pmpaddr12" then returnm true
    else if generic_eq p0_ "pmpaddr13" then returnm true
    else if generic_eq p0_ "pmpaddr14" then returnm true
    else if generic_eq p0_ "pmpaddr15" then returnm true
    else if generic_eq p0_ "mcycle" then returnm true
    else if generic_eq p0_ "minstret" then returnm true
    else if generic_eq p0_ "mcycleh" then returnm true
    else if generic_eq p0_ "minstreth" then returnm true
    else if generic_eq p0_ "tselect" then returnm true
    else if generic_eq p0_ "tdata1" then returnm true
    else if generic_eq p0_ "tdata2" then returnm true
    else if generic_eq p0_ "tdata3" then returnm true
    else if hex_bits_12_backwards_matches p0_ then
      (hex_bits_12_backwards p0_) >>= fun reg => returnm true
    else returnm false)
    : M (bool).

Definition _s752_ (_s753_ : string) : option ((mword 12 * string)) :=
   match _s753_ with
   | _s754_ =>
      match (hex_bits_12_matches_prefix _s754_) with
      | Some (reg, existT _ _s755_ _) =>
         match (string_drop _s754_ _s755_) with | s_ => Some (reg, s_) end
      | _ => None
      end
   end.

Definition _s748_ (_s749_ : string) : option string :=
   let _s750_ := _s749_ in
   if string_startswith _s750_ "tdata3" then
     match (string_drop _s750_ (projT1 (string_length "tdata3"))) with | s_ => Some s_ end
   else None.

Definition _s744_ (_s745_ : string) : option string :=
   let _s746_ := _s745_ in
   if string_startswith _s746_ "tdata2" then
     match (string_drop _s746_ (projT1 (string_length "tdata2"))) with | s_ => Some s_ end
   else None.

Definition _s740_ (_s741_ : string) : option string :=
   let _s742_ := _s741_ in
   if string_startswith _s742_ "tdata1" then
     match (string_drop _s742_ (projT1 (string_length "tdata1"))) with | s_ => Some s_ end
   else None.

Definition _s736_ (_s737_ : string) : option string :=
   let _s738_ := _s737_ in
   if string_startswith _s738_ "tselect" then
     match (string_drop _s738_ (projT1 (string_length "tselect"))) with | s_ => Some s_ end
   else None.

Definition _s732_ (_s733_ : string) : option string :=
   let _s734_ := _s733_ in
   if string_startswith _s734_ "minstreth" then
     match (string_drop _s734_ (projT1 (string_length "minstreth"))) with | s_ => Some s_ end
   else None.

Definition _s728_ (_s729_ : string) : option string :=
   let _s730_ := _s729_ in
   if string_startswith _s730_ "mcycleh" then
     match (string_drop _s730_ (projT1 (string_length "mcycleh"))) with | s_ => Some s_ end
   else None.

Definition _s724_ (_s725_ : string) : option string :=
   let _s726_ := _s725_ in
   if string_startswith _s726_ "minstret" then
     match (string_drop _s726_ (projT1 (string_length "minstret"))) with | s_ => Some s_ end
   else None.

Definition _s720_ (_s721_ : string) : option string :=
   let _s722_ := _s721_ in
   if string_startswith _s722_ "mcycle" then
     match (string_drop _s722_ (projT1 (string_length "mcycle"))) with | s_ => Some s_ end
   else None.

Definition _s716_ (_s717_ : string) : option string :=
   let _s718_ := _s717_ in
   if string_startswith _s718_ "pmpaddr15" then
     match (string_drop _s718_ (projT1 (string_length "pmpaddr15"))) with | s_ => Some s_ end
   else None.

Definition _s712_ (_s713_ : string) : option string :=
   let _s714_ := _s713_ in
   if string_startswith _s714_ "pmpaddr14" then
     match (string_drop _s714_ (projT1 (string_length "pmpaddr14"))) with | s_ => Some s_ end
   else None.

Definition _s708_ (_s709_ : string) : option string :=
   let _s710_ := _s709_ in
   if string_startswith _s710_ "pmpaddr13" then
     match (string_drop _s710_ (projT1 (string_length "pmpaddr13"))) with | s_ => Some s_ end
   else None.

Definition _s704_ (_s705_ : string) : option string :=
   let _s706_ := _s705_ in
   if string_startswith _s706_ "pmpaddr12" then
     match (string_drop _s706_ (projT1 (string_length "pmpaddr12"))) with | s_ => Some s_ end
   else None.

Definition _s700_ (_s701_ : string) : option string :=
   let _s702_ := _s701_ in
   if string_startswith _s702_ "pmpaddr11" then
     match (string_drop _s702_ (projT1 (string_length "pmpaddr11"))) with | s_ => Some s_ end
   else None.

Definition _s696_ (_s697_ : string) : option string :=
   let _s698_ := _s697_ in
   if string_startswith _s698_ "pmpaddr10" then
     match (string_drop _s698_ (projT1 (string_length "pmpaddr10"))) with | s_ => Some s_ end
   else None.

Definition _s692_ (_s693_ : string) : option string :=
   let _s694_ := _s693_ in
   if string_startswith _s694_ "pmpaddr9" then
     match (string_drop _s694_ (projT1 (string_length "pmpaddr9"))) with | s_ => Some s_ end
   else None.

Definition _s688_ (_s689_ : string) : option string :=
   let _s690_ := _s689_ in
   if string_startswith _s690_ "pmpaddr8" then
     match (string_drop _s690_ (projT1 (string_length "pmpaddr8"))) with | s_ => Some s_ end
   else None.

Definition _s684_ (_s685_ : string) : option string :=
   let _s686_ := _s685_ in
   if string_startswith _s686_ "pmpaddr7" then
     match (string_drop _s686_ (projT1 (string_length "pmpaddr7"))) with | s_ => Some s_ end
   else None.

Definition _s680_ (_s681_ : string) : option string :=
   let _s682_ := _s681_ in
   if string_startswith _s682_ "pmpaddr6" then
     match (string_drop _s682_ (projT1 (string_length "pmpaddr6"))) with | s_ => Some s_ end
   else None.

Definition _s676_ (_s677_ : string) : option string :=
   let _s678_ := _s677_ in
   if string_startswith _s678_ "pmpaddr5" then
     match (string_drop _s678_ (projT1 (string_length "pmpaddr5"))) with | s_ => Some s_ end
   else None.

Definition _s672_ (_s673_ : string) : option string :=
   let _s674_ := _s673_ in
   if string_startswith _s674_ "pmpaddr4" then
     match (string_drop _s674_ (projT1 (string_length "pmpaddr4"))) with | s_ => Some s_ end
   else None.

Definition _s668_ (_s669_ : string) : option string :=
   let _s670_ := _s669_ in
   if string_startswith _s670_ "pmpaddr3" then
     match (string_drop _s670_ (projT1 (string_length "pmpaddr3"))) with | s_ => Some s_ end
   else None.

Definition _s664_ (_s665_ : string) : option string :=
   let _s666_ := _s665_ in
   if string_startswith _s666_ "pmpaddr2" then
     match (string_drop _s666_ (projT1 (string_length "pmpaddr2"))) with | s_ => Some s_ end
   else None.

Definition _s660_ (_s661_ : string) : option string :=
   let _s662_ := _s661_ in
   if string_startswith _s662_ "pmpaddr1" then
     match (string_drop _s662_ (projT1 (string_length "pmpaddr1"))) with | s_ => Some s_ end
   else None.

Definition _s656_ (_s657_ : string) : option string :=
   let _s658_ := _s657_ in
   if string_startswith _s658_ "pmpaddr0" then
     match (string_drop _s658_ (projT1 (string_length "pmpaddr0"))) with | s_ => Some s_ end
   else None.

Definition _s652_ (_s653_ : string) : option string :=
   let _s654_ := _s653_ in
   if string_startswith _s654_ "pmpcfg3" then
     match (string_drop _s654_ (projT1 (string_length "pmpcfg3"))) with | s_ => Some s_ end
   else None.

Definition _s648_ (_s649_ : string) : option string :=
   let _s650_ := _s649_ in
   if string_startswith _s650_ "pmpcfg2" then
     match (string_drop _s650_ (projT1 (string_length "pmpcfg2"))) with | s_ => Some s_ end
   else None.

Definition _s644_ (_s645_ : string) : option string :=
   let _s646_ := _s645_ in
   if string_startswith _s646_ "pmpcfg1" then
     match (string_drop _s646_ (projT1 (string_length "pmpcfg1"))) with | s_ => Some s_ end
   else None.

Definition _s640_ (_s641_ : string) : option string :=
   let _s642_ := _s641_ in
   if string_startswith _s642_ "pmpcfg0" then
     match (string_drop _s642_ (projT1 (string_length "pmpcfg0"))) with | s_ => Some s_ end
   else None.

Definition _s636_ (_s637_ : string) : option string :=
   let _s638_ := _s637_ in
   if string_startswith _s638_ "mip" then
     match (string_drop _s638_ (projT1 (string_length "mip"))) with | s_ => Some s_ end
   else None.

Definition _s632_ (_s633_ : string) : option string :=
   let _s634_ := _s633_ in
   if string_startswith _s634_ "mtval" then
     match (string_drop _s634_ (projT1 (string_length "mtval"))) with | s_ => Some s_ end
   else None.

Definition _s628_ (_s629_ : string) : option string :=
   let _s630_ := _s629_ in
   if string_startswith _s630_ "mcause" then
     match (string_drop _s630_ (projT1 (string_length "mcause"))) with | s_ => Some s_ end
   else None.

Definition _s624_ (_s625_ : string) : option string :=
   let _s626_ := _s625_ in
   if string_startswith _s626_ "mepc" then
     match (string_drop _s626_ (projT1 (string_length "mepc"))) with | s_ => Some s_ end
   else None.

Definition _s620_ (_s621_ : string) : option string :=
   let _s622_ := _s621_ in
   if string_startswith _s622_ "mscratch" then
     match (string_drop _s622_ (projT1 (string_length "mscratch"))) with | s_ => Some s_ end
   else None.

Definition _s616_ (_s617_ : string) : option string :=
   let _s618_ := _s617_ in
   if string_startswith _s618_ "mcountinhibit" then
     match (string_drop _s618_ (projT1 (string_length "mcountinhibit"))) with | s_ => Some s_ end
   else None.

Definition _s612_ (_s613_ : string) : option string :=
   let _s614_ := _s613_ in
   if string_startswith _s614_ "mcounteren" then
     match (string_drop _s614_ (projT1 (string_length "mcounteren"))) with | s_ => Some s_ end
   else None.

Definition _s608_ (_s609_ : string) : option string :=
   let _s610_ := _s609_ in
   if string_startswith _s610_ "mtvec" then
     match (string_drop _s610_ (projT1 (string_length "mtvec"))) with | s_ => Some s_ end
   else None.

Definition _s604_ (_s605_ : string) : option string :=
   let _s606_ := _s605_ in
   if string_startswith _s606_ "mie" then
     match (string_drop _s606_ (projT1 (string_length "mie"))) with | s_ => Some s_ end
   else None.

Definition _s600_ (_s601_ : string) : option string :=
   let _s602_ := _s601_ in
   if string_startswith _s602_ "mideleg" then
     match (string_drop _s602_ (projT1 (string_length "mideleg"))) with | s_ => Some s_ end
   else None.

Definition _s596_ (_s597_ : string) : option string :=
   let _s598_ := _s597_ in
   if string_startswith _s598_ "medeleg" then
     match (string_drop _s598_ (projT1 (string_length "medeleg"))) with | s_ => Some s_ end
   else None.

Definition _s592_ (_s593_ : string) : option string :=
   let _s594_ := _s593_ in
   if string_startswith _s594_ "misa" then
     match (string_drop _s594_ (projT1 (string_length "misa"))) with | s_ => Some s_ end
   else None.

Definition _s588_ (_s589_ : string) : option string :=
   let _s590_ := _s589_ in
   if string_startswith _s590_ "mstatus" then
     match (string_drop _s590_ (projT1 (string_length "mstatus"))) with | s_ => Some s_ end
   else None.

Definition _s584_ (_s585_ : string) : option string :=
   let _s586_ := _s585_ in
   if string_startswith _s586_ "mhartid" then
     match (string_drop _s586_ (projT1 (string_length "mhartid"))) with | s_ => Some s_ end
   else None.

Definition _s580_ (_s581_ : string) : option string :=
   let _s582_ := _s581_ in
   if string_startswith _s582_ "mimpid" then
     match (string_drop _s582_ (projT1 (string_length "mimpid"))) with | s_ => Some s_ end
   else None.

Definition _s576_ (_s577_ : string) : option string :=
   let _s578_ := _s577_ in
   if string_startswith _s578_ "marchid" then
     match (string_drop _s578_ (projT1 (string_length "marchid"))) with | s_ => Some s_ end
   else None.

Definition _s572_ (_s573_ : string) : option string :=
   let _s574_ := _s573_ in
   if string_startswith _s574_ "mvendorid" then
     match (string_drop _s574_ (projT1 (string_length "mvendorid"))) with | s_ => Some s_ end
   else None.

Definition _s568_ (_s569_ : string) : option string :=
   let _s570_ := _s569_ in
   if string_startswith _s570_ "satp" then
     match (string_drop _s570_ (projT1 (string_length "satp"))) with | s_ => Some s_ end
   else None.

Definition _s564_ (_s565_ : string) : option string :=
   let _s566_ := _s565_ in
   if string_startswith _s566_ "sip" then
     match (string_drop _s566_ (projT1 (string_length "sip"))) with | s_ => Some s_ end
   else None.

Definition _s560_ (_s561_ : string) : option string :=
   let _s562_ := _s561_ in
   if string_startswith _s562_ "stval" then
     match (string_drop _s562_ (projT1 (string_length "stval"))) with | s_ => Some s_ end
   else None.

Definition _s556_ (_s557_ : string) : option string :=
   let _s558_ := _s557_ in
   if string_startswith _s558_ "scause" then
     match (string_drop _s558_ (projT1 (string_length "scause"))) with | s_ => Some s_ end
   else None.

Definition _s552_ (_s553_ : string) : option string :=
   let _s554_ := _s553_ in
   if string_startswith _s554_ "sepc" then
     match (string_drop _s554_ (projT1 (string_length "sepc"))) with | s_ => Some s_ end
   else None.

Definition _s548_ (_s549_ : string) : option string :=
   let _s550_ := _s549_ in
   if string_startswith _s550_ "sscratch" then
     match (string_drop _s550_ (projT1 (string_length "sscratch"))) with | s_ => Some s_ end
   else None.

Definition _s544_ (_s545_ : string) : option string :=
   let _s546_ := _s545_ in
   if string_startswith _s546_ "scounteren" then
     match (string_drop _s546_ (projT1 (string_length "scounteren"))) with | s_ => Some s_ end
   else None.

Definition _s540_ (_s541_ : string) : option string :=
   let _s542_ := _s541_ in
   if string_startswith _s542_ "stvec" then
     match (string_drop _s542_ (projT1 (string_length "stvec"))) with | s_ => Some s_ end
   else None.

Definition _s536_ (_s537_ : string) : option string :=
   let _s538_ := _s537_ in
   if string_startswith _s538_ "sie" then
     match (string_drop _s538_ (projT1 (string_length "sie"))) with | s_ => Some s_ end
   else None.

Definition _s532_ (_s533_ : string) : option string :=
   let _s534_ := _s533_ in
   if string_startswith _s534_ "sideleg" then
     match (string_drop _s534_ (projT1 (string_length "sideleg"))) with | s_ => Some s_ end
   else None.

Definition _s528_ (_s529_ : string) : option string :=
   let _s530_ := _s529_ in
   if string_startswith _s530_ "sedeleg" then
     match (string_drop _s530_ (projT1 (string_length "sedeleg"))) with | s_ => Some s_ end
   else None.

Definition _s524_ (_s525_ : string) : option string :=
   let _s526_ := _s525_ in
   if string_startswith _s526_ "sstatus" then
     match (string_drop _s526_ (projT1 (string_length "sstatus"))) with | s_ => Some s_ end
   else None.

Definition _s520_ (_s521_ : string) : option string :=
   let _s522_ := _s521_ in
   if string_startswith _s522_ "instreth" then
     match (string_drop _s522_ (projT1 (string_length "instreth"))) with | s_ => Some s_ end
   else None.

Definition _s516_ (_s517_ : string) : option string :=
   let _s518_ := _s517_ in
   if string_startswith _s518_ "timeh" then
     match (string_drop _s518_ (projT1 (string_length "timeh"))) with | s_ => Some s_ end
   else None.

Definition _s512_ (_s513_ : string) : option string :=
   let _s514_ := _s513_ in
   if string_startswith _s514_ "cycleh" then
     match (string_drop _s514_ (projT1 (string_length "cycleh"))) with | s_ => Some s_ end
   else None.

Definition _s508_ (_s509_ : string) : option string :=
   let _s510_ := _s509_ in
   if string_startswith _s510_ "instret" then
     match (string_drop _s510_ (projT1 (string_length "instret"))) with | s_ => Some s_ end
   else None.

Definition _s504_ (_s505_ : string) : option string :=
   let _s506_ := _s505_ in
   if string_startswith _s506_ "time" then
     match (string_drop _s506_ (projT1 (string_length "time"))) with | s_ => Some s_ end
   else None.

Definition _s500_ (_s501_ : string) : option string :=
   let _s502_ := _s501_ in
   if string_startswith _s502_ "cycle" then
     match (string_drop _s502_ (projT1 (string_length "cycle"))) with | s_ => Some s_ end
   else None.

Definition _s496_ (_s497_ : string) : option string :=
   let _s498_ := _s497_ in
   if string_startswith _s498_ "fcsr" then
     match (string_drop _s498_ (projT1 (string_length "fcsr"))) with | s_ => Some s_ end
   else None.

Definition _s492_ (_s493_ : string) : option string :=
   let _s494_ := _s493_ in
   if string_startswith _s494_ "frm" then
     match (string_drop _s494_ (projT1 (string_length "frm"))) with | s_ => Some s_ end
   else None.

Definition _s488_ (_s489_ : string) : option string :=
   let _s490_ := _s489_ in
   if string_startswith _s490_ "fflags" then
     match (string_drop _s490_ (projT1 (string_length "fflags"))) with | s_ => Some s_ end
   else None.

Definition _s484_ (_s485_ : string) : option string :=
   let _s486_ := _s485_ in
   if string_startswith _s486_ "uip" then
     match (string_drop _s486_ (projT1 (string_length "uip"))) with | s_ => Some s_ end
   else None.

Definition _s480_ (_s481_ : string) : option string :=
   let _s482_ := _s481_ in
   if string_startswith _s482_ "utval" then
     match (string_drop _s482_ (projT1 (string_length "utval"))) with | s_ => Some s_ end
   else None.

Definition _s476_ (_s477_ : string) : option string :=
   let _s478_ := _s477_ in
   if string_startswith _s478_ "ucause" then
     match (string_drop _s478_ (projT1 (string_length "ucause"))) with | s_ => Some s_ end
   else None.

Definition _s472_ (_s473_ : string) : option string :=
   let _s474_ := _s473_ in
   if string_startswith _s474_ "uepc" then
     match (string_drop _s474_ (projT1 (string_length "uepc"))) with | s_ => Some s_ end
   else None.

Definition _s468_ (_s469_ : string) : option string :=
   let _s470_ := _s469_ in
   if string_startswith _s470_ "uscratch" then
     match (string_drop _s470_ (projT1 (string_length "uscratch"))) with | s_ => Some s_ end
   else None.

Definition _s464_ (_s465_ : string) : option string :=
   let _s466_ := _s465_ in
   if string_startswith _s466_ "utvec" then
     match (string_drop _s466_ (projT1 (string_length "utvec"))) with | s_ => Some s_ end
   else None.

Definition _s460_ (_s461_ : string) : option string :=
   let _s462_ := _s461_ in
   if string_startswith _s462_ "uie" then
     match (string_drop _s462_ (projT1 (string_length "uie"))) with | s_ => Some s_ end
   else None.

Definition _s456_ (_s457_ : string) : option string :=
   let _s458_ := _s457_ in
   if string_startswith _s458_ "ustatus" then
     match (string_drop _s458_ (projT1 (string_length "ustatus"))) with | s_ => Some s_ end
   else None.

Definition csr_name_map_matches_prefix (arg_ : string)
: M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s459_ := arg_ in
   (if match (_s456_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s456_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"000"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s460_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s460_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"004"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s464_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s464_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"005"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s468_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s468_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"040"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s472_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s472_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"041"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s476_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s476_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"042"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s480_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s480_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"043"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s484_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s484_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"044"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s488_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s488_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"001"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s492_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s492_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"002"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s496_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s496_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"003"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s500_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s500_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"C00"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s504_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s504_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"C01"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s508_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s508_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"C02"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s512_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s512_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"C80"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s516_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s516_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"C81"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s520_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s520_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"C82"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s524_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s524_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"100"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s528_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s528_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"102"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s532_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s532_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"103"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s536_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s536_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"104"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s540_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s540_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"105"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s544_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s544_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"106"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s548_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s548_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"140"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s552_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s552_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"141"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s556_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s556_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"142"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s560_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s560_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"143"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s564_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s564_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"144"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s568_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s568_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"180"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s572_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s572_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"F11"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s576_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s576_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"F12"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s580_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s580_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"F13"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s584_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s584_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"F14"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s588_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s588_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"300"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s592_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s592_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"301"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s596_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s596_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"302"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s600_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s600_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"303"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s604_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s604_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"304"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s608_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s608_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"305"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s612_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s612_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"306"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s616_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s616_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"320"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s620_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s620_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"340"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s624_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s624_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"341"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s628_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s628_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"342"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s632_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s632_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"343"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s636_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s636_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"344"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s640_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s640_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3A0"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s644_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s644_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3A1"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s648_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s648_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3A2"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s652_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s652_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3A3"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s656_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s656_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B0"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s660_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s660_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B1"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s664_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s664_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B2"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s668_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s668_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B3"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s672_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s672_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B4"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s676_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s676_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B5"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s680_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s680_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B6"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s684_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s684_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B7"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s688_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s688_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B8"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s692_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s692_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3B9"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s696_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s696_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3BA"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s700_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s700_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3BB"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s704_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s704_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3BC"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s708_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s708_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3BD"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s712_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s712_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3BE"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s716_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s716_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"3BF"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s720_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s720_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"B00"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s724_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s724_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"B02"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s728_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s728_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"B80"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s732_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s732_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"B82"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s736_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s736_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"7A0"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s740_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s740_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"7A1"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s744_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s744_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"7A2"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s748_ _s459_) with | Some s_ => true | _ => false end then
      (match (_s748_ _s459_) with
       | Some s_ =>
          returnm (Some
                     (Ox"7A3"
                      : mword 12, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s752_ _s459_) with | Some (reg, s_) => true | _ => false end then
      (match (_s752_ _s459_) with
       | Some (reg, s_) =>
          returnm (Some
                     (reg, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 12 * {n : Z & ArithFact (n >=? 0)}))).

Definition csr_name (csr : mword 12) : string := csr_name_map_forwards csr.

Definition ext_is_CSR_defined (b__0 : mword 12) (g__326 : Privilege) : M (bool) :=
   (if eq_vec b__0 (Ox"000"  : mword 12) then
      (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"004"  : mword 12) then
      (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"005"  : mword 12) then
      (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"040"  : mword 12) then
      (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"041"  : mword 12) then
      (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"042"  : mword 12) then
      (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"043"  : mword 12) then
      (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"044"  : mword 12) then
      (and_boolM ((haveUsrMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"001"  : mword 12) then
      (or_boolM ((haveFExt tt)  : M (bool)) ((haveDExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"002"  : mword 12) then
      (or_boolM ((haveFExt tt)  : M (bool)) ((haveDExt tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"003"  : mword 12) then
      (or_boolM ((haveFExt tt)  : M (bool)) ((haveDExt tt)  : M (bool)))
       : M (bool)
    else returnm false)
    : M (bool).

Definition ext_read_CSR (b__0 : mword 12) : M (option (mword 32)) :=
   (if eq_vec b__0 (Ox"000"  : mword 12) then
      read_reg mstatus_ref >>= fun w__0 : Mstatus =>
      returnm (Some (_get_Ustatus_bits (lower_sstatus (lower_mstatus w__0))))
    else if eq_vec b__0 (Ox"004"  : mword 12) then
      read_reg mie_ref >>= fun w__1 : Minterrupts =>
      read_reg mideleg_ref >>= fun w__2 : Minterrupts =>
      read_reg sideleg_ref >>= fun w__3 : Sinterrupts =>
      returnm (Some (_get_Uinterrupts_bits (lower_sie (lower_mie w__1 w__2) w__3)))
    else if eq_vec b__0 (Ox"005"  : mword 12) then
      (get_utvec tt) >>= fun w__4 : mword 32 => returnm (Some w__4)
    else if eq_vec b__0 (Ox"040"  : mword 12) then
      ((read_reg uscratch_ref)  : M (mword 32)) >>= fun w__5 : mword 32 => returnm (Some w__5)
    else if eq_vec b__0 (Ox"041"  : mword 12) then
      (get_xret_target User) >>= fun w__6 : mword 32 =>
      (pc_alignment_mask tt) >>= fun w__7 : mword 32 => returnm (Some (and_vec w__6 w__7))
    else if eq_vec b__0 (Ox"042"  : mword 12) then
      read_reg ucause_ref >>= fun w__8 : Mcause => returnm (Some (_get_Mcause_bits w__8))
    else if eq_vec b__0 (Ox"043"  : mword 12) then
      ((read_reg utval_ref)  : M (mword 32)) >>= fun w__9 : mword 32 => returnm (Some w__9)
    else if eq_vec b__0 (Ox"044"  : mword 12) then
      read_reg mip_ref >>= fun w__10 : Minterrupts =>
      read_reg mideleg_ref >>= fun w__11 : Minterrupts =>
      read_reg sideleg_ref >>= fun w__12 : Sinterrupts =>
      returnm (Some (_get_Uinterrupts_bits (lower_sip (lower_mip w__10 w__11) w__12)))
    else if eq_vec b__0 (Ox"001"  : mword 12) then
      read_reg fcsr_ref >>= fun w__13 : Fcsr => returnm (Some (EXTZ 32 (_get_Fcsr_FFLAGS w__13)))
    else if eq_vec b__0 (Ox"002"  : mword 12) then
      read_reg fcsr_ref >>= fun w__14 : Fcsr => returnm (Some (EXTZ 32 (_get_Fcsr_FRM w__14)))
    else if eq_vec b__0 (Ox"003"  : mword 12) then
      read_reg fcsr_ref >>= fun w__15 : Fcsr => returnm (Some (EXTZ 32 (_get_Fcsr_bits w__15)))
    else returnm None)
    : M (option (mword 32)).

Definition ext_write_CSR (b__0 : mword 12) (value : mword 32) : M (option (mword 32)) :=
   (if eq_vec b__0 (Ox"000"  : mword 12) then
      read_reg mstatus_ref >>= fun w__0 : Mstatus =>
      (legalize_ustatus w__0 value) >>= fun w__1 : Mstatus =>
      write_reg mstatus_ref w__1 >>
      read_reg mstatus_ref >>= fun w__2 : Mstatus => returnm (Some (_get_Mstatus_bits w__2))
    else if eq_vec b__0 (Ox"004"  : mword 12) then
      read_reg mie_ref >>= fun w__3 : Minterrupts =>
      read_reg mideleg_ref >>= fun w__4 : Minterrupts =>
      read_reg sideleg_ref >>= fun w__5 : Sinterrupts =>
      let sie := legalize_uie (lower_mie w__3 w__4) w__5 value in
      read_reg mie_ref >>= fun w__6 : Minterrupts =>
      read_reg mideleg_ref >>= fun w__7 : Minterrupts =>
      (lift_sie w__6 w__7 sie) >>= fun w__8 : Minterrupts =>
      write_reg mie_ref w__8 >>
      read_reg mie_ref >>= fun w__9 : Minterrupts => returnm (Some (_get_Minterrupts_bits w__9))
    else if eq_vec b__0 (Ox"005"  : mword 12) then
      (set_utvec value) >>= fun w__10 : mword 32 => returnm (Some w__10)
    else if eq_vec b__0 (Ox"040"  : mword 12) then
      write_reg uscratch_ref value >>
      ((read_reg uscratch_ref)  : M (mword 32)) >>= fun w__11 : mword 32 => returnm (Some w__11)
    else if eq_vec b__0 (Ox"041"  : mword 12) then
      (set_xret_target User value) >>= fun w__12 : mword 32 => returnm (Some w__12)
    else if eq_vec b__0 (Ox"042"  : mword 12) then
      (_set_Mcause_bits ucause_ref value) >>
      read_reg ucause_ref >>= fun w__13 : Mcause => returnm (Some (_get_Mcause_bits w__13))
    else if eq_vec b__0 (Ox"043"  : mword 12) then
      write_reg utval_ref value >>
      ((read_reg utval_ref)  : M (mword 32)) >>= fun w__14 : mword 32 => returnm (Some w__14)
    else if eq_vec b__0 (Ox"044"  : mword 12) then
      read_reg mip_ref >>= fun w__15 : Minterrupts =>
      read_reg mideleg_ref >>= fun w__16 : Minterrupts =>
      read_reg sideleg_ref >>= fun w__17 : Sinterrupts =>
      let sip := legalize_uip (lower_mip w__15 w__16) w__17 value in
      read_reg mip_ref >>= fun w__18 : Minterrupts =>
      read_reg mideleg_ref >>= fun w__19 : Minterrupts =>
      (lift_sip w__18 w__19 sip) >>= fun w__20 : Minterrupts =>
      write_reg mip_ref w__20 >>
      read_reg mip_ref >>= fun w__21 : Minterrupts => returnm (Some (_get_Minterrupts_bits w__21))
    else if eq_vec b__0 (Ox"001"  : mword 12) then
      read_reg fcsr_ref >>= fun w__22 : Fcsr =>
      (ext_write_fcsr (_get_Fcsr_FRM w__22) (subrange_vec_dec value 4 0)) >>
      read_reg fcsr_ref >>= fun w__23 : Fcsr => returnm (Some (EXTZ 32 (_get_Fcsr_FFLAGS w__23)))
    else if eq_vec b__0 (Ox"002"  : mword 12) then
      read_reg fcsr_ref >>= fun w__24 : Fcsr =>
      (ext_write_fcsr (subrange_vec_dec value 2 0) (_get_Fcsr_FFLAGS w__24)) >>
      read_reg fcsr_ref >>= fun w__25 : Fcsr => returnm (Some (EXTZ 32 (_get_Fcsr_FRM w__25)))
    else if eq_vec b__0 (Ox"003"  : mword 12) then
      (ext_write_fcsr (subrange_vec_dec value 7 5) (subrange_vec_dec value 4 0)) >>
      read_reg fcsr_ref >>= fun w__26 : Fcsr => returnm (Some (EXTZ 32 (_get_Fcsr_bits w__26)))
    else returnm None)
    : M (option (mword 32)).

Definition csrAccess (csr : mword 12) : mword 2 := subrange_vec_dec csr 11 10.

Definition csrPriv (csr : mword 12) : mword 2 := subrange_vec_dec csr 9 8.

Definition is_CSR_defined (csr : mword 12) (p : Privilege) : M (bool) :=
   let b__0 := csr in
   (if eq_vec b__0 (Ox"F11"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"F12"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"F13"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"F14"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"300"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"301"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"302"  : mword 12) then
      (and_boolM (returnm ((generic_eq p Machine)  : bool))
         ((or_boolM ((haveSupMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
          : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"303"  : mword 12) then
      (and_boolM (returnm ((generic_eq p Machine)  : bool))
         ((or_boolM ((haveSupMode tt)  : M (bool)) ((haveNExt tt)  : M (bool)))
          : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"304"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"305"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"306"  : mword 12) then
      (and_boolM (returnm ((generic_eq p Machine)  : bool)) ((haveUsrMode tt)  : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"310"  : mword 12) then
      returnm (andb (generic_eq p Machine) (Z.eqb 32 32))
    else if eq_vec b__0 (Ox"320"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"340"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"341"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"342"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"343"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"344"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3A0"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3A1"  : mword 12) then
      returnm (andb (generic_eq p Machine) (Z.eqb 32 32))
    else if eq_vec b__0 (Ox"3A2"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3A3"  : mword 12) then
      returnm (andb (generic_eq p Machine) (Z.eqb 32 32))
    else if eq_vec b__0 (Ox"3B0"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3B1"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3B2"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3B3"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3B4"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3B5"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3B6"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3B7"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3B8"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3B9"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3BA"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3BB"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3BC"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3BD"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3BE"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"3BF"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"B00"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"B02"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"B80"  : mword 12) then
      returnm (andb (generic_eq p Machine) (Z.eqb 32 32))
    else if eq_vec b__0 (Ox"B82"  : mword 12) then
      returnm (andb (generic_eq p Machine) (Z.eqb 32 32))
    else if eq_vec b__0 (Ox"7A0"  : mword 12) then returnm (generic_eq p Machine)
    else if eq_vec b__0 (Ox"100"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"102"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         ((and_boolM ((haveNExt tt)  : M (bool))
             (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
          : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"103"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         ((and_boolM ((haveNExt tt)  : M (bool))
             (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
          : M (bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"104"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"105"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"106"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"140"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"141"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"142"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"143"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"144"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"180"  : mword 12) then
      (and_boolM ((haveSupMode tt)  : M (bool))
         (returnm ((orb (generic_eq p Machine) (generic_eq p Supervisor))  : bool)))
       : M (bool)
    else if eq_vec b__0 (Ox"C00"  : mword 12) then (haveUsrMode tt)  : M (bool)
    else if eq_vec b__0 (Ox"C01"  : mword 12) then (haveUsrMode tt)  : M (bool)
    else if eq_vec b__0 (Ox"C02"  : mword 12) then (haveUsrMode tt)  : M (bool)
    else if eq_vec b__0 (Ox"C80"  : mword 12) then
      projT1_m
      ((and_boolMP (build_trivial_ex ((haveUsrMode tt)  : M (bool)))
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
        (32 =? 32)) _bool = true)}))
       : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)}))
    else if eq_vec b__0 (Ox"C81"  : mword 12) then
      projT1_m
      ((and_boolMP (build_trivial_ex ((haveUsrMode tt)  : M (bool)))
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
        (32 =? 32)) _bool = true)}))
       : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)}))
    else if eq_vec b__0 (Ox"C82"  : mword 12) then
      projT1_m
      ((and_boolMP (build_trivial_ex ((haveUsrMode tt)  : M (bool)))
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
        (32 =? 32)) _bool = true)}))
       : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)}))
    else (ext_is_CSR_defined csr p)  : M (bool))
    : M (bool).

Definition check_CSR_access (csrrw : mword 2) (csrpr : mword 2) (p : Privilege) (isWrite : bool)
: bool :=
   andb (negb (andb (Bool.eqb isWrite true) (eq_vec csrrw ('b"11"  : mword 2))))
     (zopz0zKzJ_u (privLevel_to_bits p) csrpr).

Definition check_TVM_SATP (csr : mword 12) (p : Privilege) : M (bool) :=
   (and_boolM (returnm ((eq_vec csr (Ox"180"  : mword 12))  : bool))
      ((and_boolM (returnm ((generic_eq p Supervisor)  : bool))
          (read_reg mstatus_ref >>= fun w__0 : Mstatus =>
           returnm ((eq_vec (_get_Mstatus_TVM w__0) ('b"1"  : mword 1))  : bool)))
       : M (bool))) >>= fun w__2 : bool =>
   returnm (negb w__2).

Definition check_Counteren (csr : mword 12) (p : Privilege) : M (bool) :=
   (match (csr, p) with
    | (b__0, Supervisor) =>
       (if eq_vec b__0 (Ox"C00"  : mword 12) then
          read_reg mcounteren_ref >>= fun w__0 : Counteren =>
          returnm (eq_vec (_get_Counteren_CY w__0) ('b"1"  : mword 1))
        else if eq_vec b__0 (Ox"C01"  : mword 12) then
          read_reg mcounteren_ref >>= fun w__1 : Counteren =>
          returnm (eq_vec (_get_Counteren_TM w__1) ('b"1"  : mword 1))
        else if eq_vec b__0 (Ox"C02"  : mword 12) then
          read_reg mcounteren_ref >>= fun w__2 : Counteren =>
          returnm (eq_vec (_get_Counteren_IR w__2) ('b"1"  : mword 1))
        else
          returnm (match (b__0, Supervisor) with
                   | (_, _) =>
                      if andb (zopz0zIzJ_u (Ox"C03"  : mword 12) csr)
                           (zopz0zIzJ_u csr (Ox"C1F"  : mword 12)) then
                        false
                      else true
                   end))
        : M (bool)
    | (b__3, User) =>
       (if eq_vec b__3 (Ox"C00"  : mword 12) then
          (and_boolM
             (read_reg mcounteren_ref >>= fun w__6 : Counteren =>
              returnm ((eq_vec (_get_Counteren_CY w__6) ('b"1"  : mword 1))  : bool))
             ((or_boolM ((haveSupMode tt) >>= fun w__7 : bool => returnm ((negb w__7)  : bool))
                 (read_reg scounteren_ref >>= fun w__8 : Counteren =>
                  returnm ((eq_vec (_get_Counteren_CY w__8) ('b"1"  : mword 1))  : bool)))
              : M (bool)))
           : M (bool)
        else if eq_vec b__3 (Ox"C01"  : mword 12) then
          (and_boolM
             (read_reg mcounteren_ref >>= fun w__11 : Counteren =>
              returnm ((eq_vec (_get_Counteren_TM w__11) ('b"1"  : mword 1))  : bool))
             ((or_boolM ((haveSupMode tt) >>= fun w__12 : bool => returnm ((negb w__12)  : bool))
                 (read_reg scounteren_ref >>= fun w__13 : Counteren =>
                  returnm ((eq_vec (_get_Counteren_TM w__13) ('b"1"  : mword 1))  : bool)))
              : M (bool)))
           : M (bool)
        else if eq_vec b__3 (Ox"C02"  : mword 12) then
          (and_boolM
             (read_reg mcounteren_ref >>= fun w__16 : Counteren =>
              returnm ((eq_vec (_get_Counteren_IR w__16) ('b"1"  : mword 1))  : bool))
             ((or_boolM ((haveSupMode tt) >>= fun w__17 : bool => returnm ((negb w__17)  : bool))
                 (read_reg scounteren_ref >>= fun w__18 : Counteren =>
                  returnm ((eq_vec (_get_Counteren_IR w__18) ('b"1"  : mword 1))  : bool)))
              : M (bool)))
           : M (bool)
        else
          returnm (match (b__3, User) with
                   | (_, _) =>
                      if andb (zopz0zIzJ_u (Ox"C03"  : mword 12) csr)
                           (zopz0zIzJ_u csr (Ox"C1F"  : mword 12)) then
                        false
                      else true
                   end))
        : M (bool)
    | (_, _) =>
       returnm (if andb (zopz0zIzJ_u (Ox"C03"  : mword 12) csr)
                     (zopz0zIzJ_u csr (Ox"C1F"  : mword 12)) then
                  false
                else true)
    end)
    : M (bool).

Definition check_CSR (csr : mword 12) (p : Privilege) (isWrite : bool) : M (bool) :=
   (and_boolM ((is_CSR_defined csr p)  : M (bool))
      ((and_boolM (returnm ((check_CSR_access (csrAccess csr) (csrPriv csr) p isWrite)  : bool))
          ((and_boolM ((check_TVM_SATP csr p)  : M (bool)) ((check_Counteren csr p)  : M (bool)))
           : M (bool)))
       : M (bool)))
    : M (bool).

Axiom speculate_conditional : forall  (_ : unit) , M (bool).

Axiom load_reservation : forall  (_ : mword 32) , unit.

Axiom match_reservation : forall  (_ : mword 32) , bool.

Axiom cancel_reservation : forall  (_ : unit) , unit.

Definition exception_delegatee (e : ExceptionType) (p : Privilege) : M (Privilege) :=
   let idx := projT1 (num_of_ExceptionType e) in
   read_reg medeleg_ref >>= fun w__0 : Medeleg =>
   (bit_to_bool (access_vec_dec (_get_Medeleg_bits w__0) idx)) >>= fun super =>
   (haveSupMode tt) >>= fun w__1 : bool =>
   (if sumbool_of_bool w__1 then
      and_boolMP
        ((returnm (build_ex super)) : M ({_bool : bool & ArithFact (Bool.eqb super _bool)}))
        (build_trivial_ex
        ((and_boolM ((haveNExt tt)  : M (bool))
            (read_reg sedeleg_ref >>= fun w__3 : Sedeleg =>
             (bit_to_bool (access_vec_dec (_get_Sedeleg_bits w__3) idx))
              : M (bool)))
         : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (super && simp_0) _bool = true)})
    else
      and_boolMP
        ((returnm (build_ex super)) : M ({_bool : bool & ArithFact (Bool.eqb super _bool)}))
        (build_trivial_ex
        ((haveNExt tt)
         : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (super && simp_0) _bool = true)})) >>= fun '(existT _ user _) =>
   (and_boolMP (build_trivial_ex ((haveUsrMode tt)  : M (bool)))
      ((returnm (build_ex user)) : M ({_bool : bool & ArithFact (Bool.eqb user _bool)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (user &&
     simp_0) _bool = true)})) >>= fun '(existT _ w__10 _) =>
   (if sumbool_of_bool w__10 then returnm User
    else
      (and_boolMP (build_trivial_ex ((haveSupMode tt)  : M (bool)))
         ((returnm (build_ex super)) : M ({_bool : bool & ArithFact (Bool.eqb super _bool)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (super &&
        simp_0) _bool = true)})) >>= fun '(existT _ w__12 _) =>
      returnm (if sumbool_of_bool w__12 then Supervisor else Machine)) >>= fun deleg =>
   returnm (if zopz0zI_u (privLevel_to_bits deleg) (privLevel_to_bits p) then p else deleg).

Definition findPendingInterrupt (ip : mword 32) : option InterruptType :=
   let ip := Mk_Minterrupts ip in
   if eq_vec (_get_Minterrupts_MEI ip) ('b"1"  : mword 1) then Some I_M_External
   else if eq_vec (_get_Minterrupts_MSI ip) ('b"1"  : mword 1) then Some I_M_Software
   else if eq_vec (_get_Minterrupts_MTI ip) ('b"1"  : mword 1) then Some I_M_Timer
   else if eq_vec (_get_Minterrupts_SEI ip) ('b"1"  : mword 1) then Some I_S_External
   else if eq_vec (_get_Minterrupts_SSI ip) ('b"1"  : mword 1) then Some I_S_Software
   else if eq_vec (_get_Minterrupts_STI ip) ('b"1"  : mword 1) then Some I_S_Timer
   else if eq_vec (_get_Minterrupts_UEI ip) ('b"1"  : mword 1) then Some I_U_External
   else if eq_vec (_get_Minterrupts_USI ip) ('b"1"  : mword 1) then Some I_U_Software
   else if eq_vec (_get_Minterrupts_UTI ip) ('b"1"  : mword 1) then Some I_U_Timer
   else None.

Definition processPending
(xip : Minterrupts) (xie : Minterrupts) (xideleg : mword 32) (priv_enabled : bool)
: interrupt_set :=
   let effective_pend :=
     and_vec (_get_Minterrupts_bits xip) (and_vec (_get_Minterrupts_bits xie) (not_vec xideleg)) in
   let effective_delg := and_vec (_get_Minterrupts_bits xip) xideleg in
   if sumbool_of_bool (andb priv_enabled (neq_vec effective_pend (EXTZ 32 ('b"0"  : mword 1)))) then
     Ints_Pending effective_pend
   else if neq_vec effective_delg (EXTZ 32 ('b"0"  : mword 1)) then Ints_Delegated effective_delg
   else Ints_Empty tt.

Definition getPendingSet (priv : Privilege) : M (option ((mword 32 * Privilege))) :=
   (haveUsrMode tt) >>= fun w__0 : bool =>
   assert_exp' w__0 "no user mode: M/U or M/S/U system required" >>= fun _ =>
   read_reg mip_ref >>= fun w__1 : Minterrupts =>
   read_reg mie_ref >>= fun w__2 : Minterrupts =>
   let effective_pending := and_vec (_get_Minterrupts_bits w__1) (_get_Minterrupts_bits w__2) in
   (if eq_vec effective_pending (EXTZ 32 ('b"0"  : mword 1)) then returnm None
    else
      (or_boolM (returnm ((generic_neq priv Machine)  : bool))
         ((and_boolM (returnm ((generic_eq priv Machine)  : bool))
             (read_reg mstatus_ref >>= fun w__3 : Mstatus =>
              returnm ((eq_vec (_get_Mstatus_MIE w__3) ('b"1"  : mword 1))  : bool)))
          : M (bool))) >>= fun mIE =>
      (and_boolM ((haveSupMode tt)  : M (bool))
         ((or_boolM (returnm ((generic_eq priv User)  : bool))
             ((and_boolM (returnm ((generic_eq priv Supervisor)  : bool))
                 (read_reg mstatus_ref >>= fun w__6 : Mstatus =>
                  returnm ((eq_vec (_get_Mstatus_SIE w__6) ('b"1"  : mword 1))  : bool)))
              : M (bool)))
          : M (bool))) >>= fun sIE =>
      (and_boolM ((haveNExt tt)  : M (bool))
         ((and_boolM (returnm ((generic_eq priv User)  : bool))
             (read_reg mstatus_ref >>= fun w__10 : Mstatus =>
              returnm ((eq_vec (_get_Mstatus_UIE w__10) ('b"1"  : mword 1))  : bool)))
          : M (bool))) >>= fun uIE =>
      read_reg mip_ref >>= fun w__12 : Minterrupts =>
      read_reg mie_ref >>= fun w__13 : Minterrupts =>
      read_reg mideleg_ref >>= fun w__14 : Minterrupts =>
      (match (processPending w__12 w__13 (_get_Minterrupts_bits w__14) mIE) with
       | Ints_Empty tt => returnm None
       | Ints_Pending p =>
          let r := (p, Machine) in
          returnm (Some r)
       | Ints_Delegated d =>
          (haveSupMode tt) >>= fun w__15 : bool =>
          (if sumbool_of_bool (negb w__15) then
             returnm (if sumbool_of_bool uIE then
                        let r := (d, User) in
                        Some r
                      else None)
           else
             read_reg mie_ref >>= fun w__16 : Minterrupts =>
             read_reg sideleg_ref >>= fun w__17 : Sinterrupts =>
             returnm (match (processPending (Mk_Minterrupts d) w__16 (_get_Sinterrupts_bits w__17)
                               sIE) with
                      | Ints_Empty tt => None
                      | Ints_Pending p =>
                         let r := (p, Supervisor) in
                         Some r
                      | Ints_Delegated d =>
                         if sumbool_of_bool uIE then
                           let r := (d, User) in
                           Some r
                         else None
                      end))
           : M (option ((mword 32 * Privilege)))
       end)
       : M (option ((mword 32 * Privilege))))
    : M (option ((mword 32 * Privilege))).

Definition dispatchInterrupt (priv : Privilege) : M (option ((InterruptType * Privilege))) :=
   (or_boolM ((haveUsrMode tt) >>= fun w__0 : bool => returnm ((negb w__0)  : bool))
      ((and_boolM ((haveSupMode tt) >>= fun w__1 : bool => returnm ((negb w__1)  : bool))
          ((haveNExt tt) >>= fun w__2 : bool => returnm ((negb w__2)  : bool)))
       : M (bool))) >>= fun w__4 : bool =>
   (if sumbool_of_bool w__4 then
      assert_exp (generic_eq priv Machine) "invalid current privilege" >>
      read_reg mip_ref >>= fun w__5 : Minterrupts =>
      read_reg mie_ref >>= fun w__6 : Minterrupts =>
      let enabled_pending := and_vec (_get_Minterrupts_bits w__5) (_get_Minterrupts_bits w__6) in
      returnm (match (findPendingInterrupt enabled_pending) with
               | Some i =>
                  let r := (i, Machine) in
                  Some r
               | None => None
               end)
    else
      (getPendingSet priv) >>= fun w__7 : option ((mword 32 * Privilege)) =>
      returnm (match w__7 with
               | None => None
               | Some (ip, p) =>
                  match (findPendingInterrupt ip) with
                  | None => None
                  | Some i =>
                     let r := (i, p) in
                     Some r
                  end
               end))
    : M (option ((InterruptType * Privilege))).

Definition tval (excinfo : option (mword 32)) : mword 32 :=
   match excinfo with | Some e => e | None => EXTZ 32 ('b"0"  : mword 1) end.

Definition rvfi_trap '(tt : unit) : unit := tt.

Definition trap_handler
(del_priv : Privilege) (intr : bool) (c : mword 8) (pc : mword 32) (info : option (mword 32))
(ext : option unit)
: M (mword 32) :=
   let '_ := (rvfi_trap tt)  : unit in
   let '_ :=
     (if get_config_print_platform tt then
        print_endline
          (String.append "handling "
             (String.append (if sumbool_of_bool intr then "int#" else "exc#")
                (String.append (string_of_bits c)
                   (String.append " at priv "
                      (String.append (privLevel_to_str del_priv)
                         (String.append " with tval " (string_of_bits (tval info))))))))
      else tt)
      : unit in
   let '_ := (cancel_reservation tt)  : unit in
   (match del_priv with
    | Machine =>
       (_set_Mcause_IsInterrupt mcause_ref (bool_to_bits intr)) >>
       (_set_Mcause_Cause mcause_ref (EXTZ 31 c)) >>
       read_reg mstatus_ref >>= fun w__0 : Mstatus =>
       (_set_Mstatus_MPIE mstatus_ref (_get_Mstatus_MIE w__0)) >>
       (_set_Mstatus_MIE mstatus_ref ('b"0"  : mword 1)) >>
       read_reg cur_privilege_ref >>= fun w__1 : Privilege =>
       (_set_Mstatus_MPP mstatus_ref (privLevel_to_bits w__1)) >>
       write_reg mtval_ref (tval info) >>
       write_reg mepc_ref pc >>
       write_reg cur_privilege_ref del_priv >>
       let '_ := (handle_trap_extension del_priv pc ext)  : unit in
       (if get_config_print_reg tt then
          read_reg mstatus_ref >>= fun w__2 : Mstatus =>
          returnm (print_endline
                     (String.append "CSR mstatus <- " (string_of_bits (_get_Mstatus_bits w__2))))
        else returnm tt) >>
       read_reg mcause_ref >>= fun w__3 : Mcause =>
       (prepare_trap_vector del_priv w__3)
        : M (mword 32)
    | Supervisor =>
       (haveSupMode tt) >>= fun w__5 : bool =>
       assert_exp' w__5 "no supervisor mode present for delegation" >>= fun _ =>
       (_set_Mcause_IsInterrupt scause_ref (bool_to_bits intr)) >>
       (_set_Mcause_Cause scause_ref (EXTZ 31 c)) >>
       read_reg mstatus_ref >>= fun w__6 : Mstatus =>
       (_set_Mstatus_SPIE mstatus_ref (_get_Mstatus_SIE w__6)) >>
       (_set_Mstatus_SIE mstatus_ref ('b"0"  : mword 1)) >>
       read_reg cur_privilege_ref >>= fun w__7 : Privilege =>
       (match w__7 with
        | User => returnm ('b"0"  : mword 1)
        | Supervisor => returnm ('b"1"  : mword 1)
        | Machine => (internal_error "invalid privilege for s-mode trap")  : M (mword 1)
        end) >>= fun w__9 : mword 1 =>
       (_set_Mstatus_SPP mstatus_ref w__9) >>
       write_reg stval_ref (tval info) >>
       write_reg sepc_ref pc >>
       write_reg cur_privilege_ref del_priv >>
       let '_ := (handle_trap_extension del_priv pc ext)  : unit in
       (if get_config_print_reg tt then
          read_reg mstatus_ref >>= fun w__10 : Mstatus =>
          returnm (print_endline
                     (String.append "CSR mstatus <- " (string_of_bits (_get_Mstatus_bits w__10))))
        else returnm tt) >>
       read_reg scause_ref >>= fun w__11 : Mcause =>
       (prepare_trap_vector del_priv w__11)
        : M (mword 32)
    | User =>
       (haveUsrMode tt) >>= fun w__13 : bool =>
       assert_exp' w__13 "no user mode present for delegation" >>= fun _ =>
       (_set_Mcause_IsInterrupt ucause_ref (bool_to_bits intr)) >>
       (_set_Mcause_Cause ucause_ref (EXTZ 31 c)) >>
       read_reg mstatus_ref >>= fun w__14 : Mstatus =>
       (_set_Mstatus_UPIE mstatus_ref (_get_Mstatus_UIE w__14)) >>
       (_set_Mstatus_UIE mstatus_ref ('b"0"  : mword 1)) >>
       write_reg utval_ref (tval info) >>
       write_reg uepc_ref pc >>
       write_reg cur_privilege_ref del_priv >>
       let '_ := (handle_trap_extension del_priv pc ext)  : unit in
       (if get_config_print_reg tt then
          read_reg mstatus_ref >>= fun w__15 : Mstatus =>
          returnm (print_endline
                     (String.append "CSR mstatus <- " (string_of_bits (_get_Mstatus_bits w__15))))
        else returnm tt) >>
       read_reg ucause_ref >>= fun w__16 : Mcause =>
       (prepare_trap_vector del_priv w__16)
        : M (mword 32)
    end)
    : M (mword 32).

Definition exception_handler (cur_priv : Privilege) (ctl : ctl_result) (pc : mword 32)
: M (mword 32) :=
   (match (cur_priv, ctl) with
    | (_, CTL_TRAP e) =>
       (exception_delegatee e.(sync_exception_trap) cur_priv) >>= fun del_priv =>
       let '_ :=
         (if get_config_print_platform tt then
            print_endline
              (String.append "trapping from "
                 (String.append (privLevel_to_str cur_priv)
                    (String.append " to "
                       (String.append (privLevel_to_str del_priv)
                          (String.append " to handle "
                             (exceptionType_to_str e.(sync_exception_trap)))))))
          else tt)
          : unit in
       (trap_handler del_priv false (exceptionType_to_bits e.(sync_exception_trap)) pc
          e.(sync_exception_excinfo) e.(sync_exception_ext))
        : M (mword 32)
    | (_, CTL_MRET tt) =>
       read_reg cur_privilege_ref >>= fun prev_priv =>
       read_reg mstatus_ref >>= fun w__1 : Mstatus =>
       (_set_Mstatus_MIE mstatus_ref (_get_Mstatus_MPIE w__1)) >>
       (_set_Mstatus_MPIE mstatus_ref ('b"1"  : mword 1)) >>
       read_reg mstatus_ref >>= fun w__2 : Mstatus =>
       (privLevel_of_bits (_get_Mstatus_MPP w__2)) >>= fun w__3 : Privilege =>
       write_reg cur_privilege_ref w__3 >>
       (haveUsrMode tt) >>= fun w__4 : bool =>
       (_set_Mstatus_MPP mstatus_ref
          (privLevel_to_bits (if sumbool_of_bool w__4 then User else Machine))) >>
       read_reg cur_privilege_ref >>= fun w__5 : Privilege =>
       (if generic_neq w__5 Machine then
          (_set_Mstatus_MPRV mstatus_ref ('b"0"  : mword 1))
           : M (unit)
        else returnm tt) >>
       (if get_config_print_reg tt then
          read_reg mstatus_ref >>= fun w__6 : Mstatus =>
          returnm (print_endline
                     (String.append "CSR mstatus <- " (string_of_bits (_get_Mstatus_bits w__6))))
        else returnm tt) >>
       (if get_config_print_platform tt then
          read_reg cur_privilege_ref >>= fun w__7 : Privilege =>
          returnm (print_endline
                     (String.append "ret-ing from "
                        (String.append (privLevel_to_str prev_priv)
                           (String.append " to " (privLevel_to_str w__7)))))
        else returnm tt) >>
       let '_ := (cancel_reservation tt)  : unit in
       (prepare_xret_target Machine) >>= fun w__8 : mword 32 =>
       (pc_alignment_mask tt) >>= fun w__9 : mword 32 => returnm (and_vec w__8 w__9)
    | (_, CTL_SRET tt) =>
       read_reg cur_privilege_ref >>= fun prev_priv =>
       read_reg mstatus_ref >>= fun w__10 : Mstatus =>
       (_set_Mstatus_SIE mstatus_ref (_get_Mstatus_SPIE w__10)) >>
       (_set_Mstatus_SPIE mstatus_ref ('b"1"  : mword 1)) >>
       read_reg mstatus_ref >>= fun w__11 : Mstatus =>
       write_reg
         cur_privilege_ref
         (if eq_vec (_get_Mstatus_SPP w__11) ('b"1"  : mword 1) then Supervisor
          else User) >>
       (_set_Mstatus_SPP mstatus_ref ('b"0"  : mword 1)) >>
       read_reg cur_privilege_ref >>= fun w__12 : Privilege =>
       (if generic_neq w__12 Machine then
          (_set_Mstatus_MPRV mstatus_ref ('b"0"  : mword 1))
           : M (unit)
        else returnm tt) >>
       (if get_config_print_reg tt then
          read_reg mstatus_ref >>= fun w__13 : Mstatus =>
          returnm (print_endline
                     (String.append "CSR mstatus <- " (string_of_bits (_get_Mstatus_bits w__13))))
        else returnm tt) >>
       (if get_config_print_platform tt then
          read_reg cur_privilege_ref >>= fun w__14 : Privilege =>
          returnm (print_endline
                     (String.append "ret-ing from "
                        (String.append (privLevel_to_str prev_priv)
                           (String.append " to " (privLevel_to_str w__14)))))
        else returnm tt) >>
       let '_ := (cancel_reservation tt)  : unit in
       (prepare_xret_target Supervisor) >>= fun w__15 : mword 32 =>
       (pc_alignment_mask tt) >>= fun w__16 : mword 32 => returnm (and_vec w__15 w__16)
    | (_, CTL_URET tt) =>
       read_reg cur_privilege_ref >>= fun prev_priv =>
       read_reg mstatus_ref >>= fun w__17 : Mstatus =>
       (_set_Mstatus_UIE mstatus_ref (_get_Mstatus_UPIE w__17)) >>
       (_set_Mstatus_UPIE mstatus_ref ('b"1"  : mword 1)) >>
       write_reg cur_privilege_ref User >>
       (if get_config_print_reg tt then
          read_reg mstatus_ref >>= fun w__18 : Mstatus =>
          returnm (print_endline
                     (String.append "CSR mstatus <- " (string_of_bits (_get_Mstatus_bits w__18))))
        else returnm tt) >>
       (if get_config_print_platform tt then
          read_reg cur_privilege_ref >>= fun w__19 : Privilege =>
          returnm (print_endline
                     (String.append "ret-ing from "
                        (String.append (privLevel_to_str prev_priv)
                           (String.append " to " (privLevel_to_str w__19)))))
        else returnm tt) >>
       let '_ := (cancel_reservation tt)  : unit in
       (prepare_xret_target User) >>= fun w__20 : mword 32 =>
       (pc_alignment_mask tt) >>= fun w__21 : mword 32 => returnm (and_vec w__20 w__21)
    end)
    : M (mword 32).

Definition handle_mem_exception (addr : mword 32) (e : ExceptionType) : M (unit) :=
   let t : sync_exception :=
     {| sync_exception_trap := e; 
        sync_exception_excinfo := (Some addr); 
        sync_exception_ext := None |} in
   read_reg cur_privilege_ref >>= fun w__0 : Privilege =>
   ((read_reg PC_ref)  : M (mword 32)) >>= fun w__1 : mword 32 =>
   (exception_handler w__0 (CTL_TRAP t) w__1) >>= fun w__2 : mword 32 =>
   (set_next_pc w__2)
    : M (unit).

Definition handle_exception (e : ExceptionType) : M (unit) :=
   let t : sync_exception :=
     {| sync_exception_trap := e; 
        sync_exception_excinfo := None; 
        sync_exception_ext := None |} in
   read_reg cur_privilege_ref >>= fun w__0 : Privilege =>
   ((read_reg PC_ref)  : M (mword 32)) >>= fun w__1 : mword 32 =>
   (exception_handler w__0 (CTL_TRAP t) w__1) >>= fun w__2 : mword 32 =>
   (set_next_pc w__2)
    : M (unit).

Definition handle_interrupt (i : InterruptType) (del_priv : Privilege) : M (unit) :=
   ((read_reg PC_ref)  : M (mword 32)) >>= fun w__0 : mword 32 =>
   (trap_handler del_priv true (interruptType_to_bits i) w__0 None None) >>= fun w__1 : mword 32 =>
   (set_next_pc w__1)
    : M (unit).

Definition init_sys '(tt : unit) : M (unit) :=
   write_reg cur_privilege_ref Machine >>
   write_reg mhartid_ref (EXTZ 32 ('b"0"  : mword 1)) >>
   (_set_Misa_MXL misa_ref (arch_to_bits RV32)) >>
   (_set_Misa_A misa_ref ('b"1"  : mword 1)) >>
   (_set_Misa_C misa_ref (bool_to_bits (sys_enable_rvc tt))) >>
   (_set_Misa_I misa_ref ('b"1"  : mword 1)) >>
   (_set_Misa_M misa_ref ('b"1"  : mword 1)) >>
   (_set_Misa_U misa_ref ('b"1"  : mword 1)) >>
   (_set_Misa_S misa_ref ('b"1"  : mword 1)) >>
   (_set_Misa_F misa_ref (bool_to_bits (sys_enable_fdext tt))) >>
   (_set_Misa_D misa_ref ('b"0"  : mword 1)) >>
   read_reg mstatus_ref >>= fun w__0 : Mstatus =>
   read_reg misa_ref >>= fun w__1 : Misa =>
   write_reg mstatus_ref (set_mstatus_SXL w__0 (_get_Misa_MXL w__1)) >>
   read_reg mstatus_ref >>= fun w__2 : Mstatus =>
   read_reg misa_ref >>= fun w__3 : Misa =>
   write_reg mstatus_ref (set_mstatus_UXL w__2 (_get_Misa_MXL w__3)) >>
   (_set_Mstatus_SD mstatus_ref ('b"0"  : mword 1)) >>
   (_set_Mstatush_bits mstatush_ref (EXTZ 32 ('b"0"  : mword 1))) >>
   (_set_Minterrupts_bits mip_ref (EXTZ 32 ('b"0"  : mword 1))) >>
   (_set_Minterrupts_bits mie_ref (EXTZ 32 ('b"0"  : mword 1))) >>
   (_set_Minterrupts_bits mideleg_ref (EXTZ 32 ('b"0"  : mword 1))) >>
   (_set_Medeleg_bits medeleg_ref (EXTZ 32 ('b"0"  : mword 1))) >>
   (_set_Mtvec_bits mtvec_ref (EXTZ 32 ('b"0"  : mword 1))) >>
   (_set_Mcause_bits mcause_ref (EXTZ 32 ('b"0"  : mword 1))) >>
   write_reg mepc_ref (EXTZ 32 ('b"0"  : mword 1)) >>
   write_reg mtval_ref (EXTZ 32 ('b"0"  : mword 1)) >>
   write_reg mscratch_ref (EXTZ 32 ('b"0"  : mword 1)) >>
   write_reg mcycle_ref (EXTZ 64 ('b"0"  : mword 1)) >>
   write_reg mtime_ref (EXTZ 64 ('b"0"  : mword 1)) >>
   (_set_Counteren_bits mcounteren_ref (EXTZ 32 ('b"0"  : mword 1))) >>
   write_reg minstret_ref (EXTZ 64 ('b"0"  : mword 1)) >>
   write_reg minstret_written_ref false >>
   (init_pmp tt) >>
   (if get_config_print_reg tt then
      read_reg mstatus_ref >>= fun w__4 : Mstatus =>
      returnm (print_endline
                 (String.append "CSR mstatus <- "
                    (String.append (string_of_bits (_get_Mstatus_bits w__4))
                       (String.append " (input: "
                          (String.append (string_of_bits ((EXTZ 32 ('b"0"  : mword 1))  : xlenbits))
                             ")")))))
    else returnm tt)
    : M (unit).

Definition MemoryOpResult_add_meta {t : Type} (r : MemoryOpResult t) (m : unit)
: MemoryOpResult ((t * unit)) :=
   match r with | MemValue v => MemValue (v, m) | MemException e => MemException e end.

Definition MemoryOpResult_drop_meta {t : Type} (r : MemoryOpResult ((t * unit))) : MemoryOpResult t :=
   match r with | MemValue (v, m) => MemValue v | MemException e => MemException e end.

Axiom elf_tohost : forall  (_ : unit) , Z.

Axiom elf_entry : forall  (_ : unit) , Z.

Axiom plat_ram_base : forall  (_ : unit) , mword 32.

Axiom plat_ram_size : forall  (_ : unit) , mword 32.

Axiom plat_enable_pmp : forall  (_ : unit) , bool.

Axiom plat_enable_dirty_update : forall  (_ : unit) , bool.

Axiom plat_enable_misaligned_access : forall  (_ : unit) , bool.

Axiom plat_mtval_has_illegal_inst_bits : forall  (_ : unit) , bool.

Axiom plat_rom_base : forall  (_ : unit) , mword 32.

Axiom plat_rom_size : forall  (_ : unit) , mword 32.

Axiom plat_clint_base : forall  (_ : unit) , mword 32.

Axiom plat_clint_size : forall  (_ : unit) , mword 32.

Definition plat_htif_tohost '(tt : unit) : mword 32 := to_bits 32 (elf_tohost tt).

Definition phys_mem_segments '(tt : unit) : list ((mword 32 * mword 32)) :=
   (plat_rom_base tt, plat_rom_size tt) :: (plat_ram_base tt, plat_ram_size tt) :: [].

Definition within_phys_mem (addr : mword 32) (width : Z) `{ArithFact (width <=? 16)} : bool :=
   let addr_int := projT1 (uint addr) in
   let ram_base_int := projT1 (uint (plat_ram_base tt)) in
   let rom_base_int := projT1 (uint (plat_rom_base tt)) in
   let ram_size_int := projT1 (uint (plat_ram_size tt)) in
   let rom_size_int := projT1 (uint (plat_rom_size tt)) in
   if sumbool_of_bool
     (andb (Z.leb ram_base_int addr_int)
        (Z.leb (Z.add addr_int (projT1 (__id width))) (Z.add ram_base_int ram_size_int))) then
     true
   else if sumbool_of_bool
     (andb (Z.leb rom_base_int addr_int)
        (Z.leb (Z.add addr_int (projT1 (__id width))) (Z.add rom_base_int rom_size_int))) then
     true
   else
     let '_ :=
       (print_endline
          (String.append "within_phys_mem: "
             (String.append (string_of_bits addr) " not within phys-mem:")))
        : unit in
     let '_ :=
       (print_endline (String.append "  plat_rom_base: " (string_of_bits (plat_rom_base tt))))
        : unit in
     let '_ :=
       (print_endline (String.append "  plat_rom_size: " (string_of_bits (plat_rom_size tt))))
        : unit in
     let '_ :=
       (print_endline (String.append "  plat_ram_base: " (string_of_bits (plat_ram_base tt))))
        : unit in
     let '_ :=
       (print_endline (String.append "  plat_ram_size: " (string_of_bits (plat_ram_size tt))))
        : unit in
     false.

Definition within_clint (addr : mword 32) (width : Z) `{ArithFact ((0 <? width) && (width <=? 16))}
: bool :=
   let addr_int := projT1 (uint addr) in
   let clint_base_int := projT1 (uint (plat_clint_base tt)) in
   let clint_size_int := projT1 (uint (plat_clint_size tt)) in
   andb (Z.leb clint_base_int addr_int)
     (Z.leb (Z.add addr_int (projT1 (__id width))) (Z.add clint_base_int clint_size_int)).

Definition within_htif_writable (addr : mword 32) (width : Z)
`{ArithFact ((0 <? width) && (width <=? 16))}
: bool :=
   orb (eq_vec (plat_htif_tohost tt) addr)
     (andb (eq_vec (add_vec_int (plat_htif_tohost tt) 4) addr) (Z.eqb width 4)).

Definition within_htif_readable (addr : mword 32) (width : Z)
`{ArithFact ((0 <? width) && (width <=? 16))}
: bool :=
   orb (eq_vec (plat_htif_tohost tt) addr)
     (andb (eq_vec (add_vec_int (plat_htif_tohost tt) 4) addr) (Z.eqb width 4)).

Axiom plat_insns_per_tick : forall  (_ : unit) , Z.

Definition MSIP_BASE : xlenbits := EXTZ 32 (Ox"00000"  : mword 20).
Hint Unfold MSIP_BASE : sail.
Definition MTIMECMP_BASE : xlenbits := EXTZ 32 (Ox"04000"  : mword 20).
Hint Unfold MTIMECMP_BASE : sail.
Definition MTIMECMP_BASE_HI : xlenbits := EXTZ 32 (Ox"04004"  : mword 20).
Hint Unfold MTIMECMP_BASE_HI : sail.
Definition MTIME_BASE : xlenbits := EXTZ 32 (Ox"0BFF8"  : mword 20).
Hint Unfold MTIME_BASE : sail.
Definition MTIME_BASE_HI : xlenbits := EXTZ 32 (Ox"0BFFC"  : mword 20).
Hint Unfold MTIME_BASE_HI : sail.
Definition clint_load (t : AccessType unit) (addr : mword 32) (width : Z) `{ArithFact (width >? 0)}
: M (MemoryOpResult (mword (8 * width))) :=
   let addr := sub_vec addr (plat_clint_base tt) in
   (if sumbool_of_bool
      (andb (eq_vec addr MSIP_BASE)
         (orb (Z.eqb (projT1 (__id width)) 8) (Z.eqb (projT1 (__id width)) 4))) then
      (if get_config_print_platform tt then
         read_reg mip_ref >>= fun w__0 : Minterrupts =>
         returnm (print_endline
                    (String.append "clint["
                       (String.append (string_of_bits addr)
                          (String.append "] -> " (string_of_bits (_get_Minterrupts_MSI w__0))))))
       else returnm tt) >>
      read_reg mip_ref >>= fun w__1 : Minterrupts =>
      returnm (MemValue (zero_extend (_get_Minterrupts_MSI w__1) (Z.mul 8 (projT1 (__id width)))))
    else if sumbool_of_bool (andb (eq_vec addr MTIMECMP_BASE) (Z.eqb (projT1 (__id width)) 4)) then
      (if get_config_print_platform tt then
         ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__2 : mword 64 =>
         returnm (print_endline
                    (String.append "clint<4>["
                       (String.append (string_of_bits addr)
                          (String.append "] -> " (string_of_bits (subrange_vec_dec w__2 31 0))))))
       else returnm tt) >>
      ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__3 : mword 64 =>
      returnm (MemValue (zero_extend (subrange_vec_dec w__3 31 0) _))
    else if sumbool_of_bool (andb (eq_vec addr MTIMECMP_BASE) (Z.eqb (projT1 (__id width)) 8)) then
      (if get_config_print_platform tt then
         ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__4 : mword 64 =>
         returnm (print_endline
                    (String.append "clint<8>["
                       (String.append (string_of_bits addr)
                          (String.append "] -> " (string_of_bits w__4)))))
       else returnm tt) >>
      ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__5 : mword 64 =>
      returnm (MemValue (zero_extend w__5 _))
    else if sumbool_of_bool
      (andb (eq_vec addr MTIMECMP_BASE_HI) (Z.eqb (projT1 (__id width)) 4)) then
      (if get_config_print_platform tt then
         ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__6 : mword 64 =>
         returnm (print_endline
                    (String.append "clint-hi<4>["
                       (String.append (string_of_bits addr)
                          (String.append "] -> " (string_of_bits (subrange_vec_dec w__6 63 32))))))
       else returnm tt) >>
      ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__7 : mword 64 =>
      returnm (MemValue (zero_extend (subrange_vec_dec w__7 63 32) _))
    else if sumbool_of_bool (andb (eq_vec addr MTIME_BASE) (Z.eqb (projT1 (__id width)) 4)) then
      (if get_config_print_platform tt then
         ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__8 : mword 64 =>
         returnm (print_endline
                    (String.append "clint["
                       (String.append (string_of_bits addr)
                          (String.append "] -> " (string_of_bits w__8)))))
       else returnm tt) >>
      ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__9 : mword 64 =>
      returnm (MemValue (zero_extend (subrange_vec_dec w__9 31 0) _))
    else if sumbool_of_bool (andb (eq_vec addr MTIME_BASE) (Z.eqb (projT1 (__id width)) 8)) then
      (if get_config_print_platform tt then
         ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__10 : mword 64 =>
         returnm (print_endline
                    (String.append "clint["
                       (String.append (string_of_bits addr)
                          (String.append "] -> " (string_of_bits w__10)))))
       else returnm tt) >>
      ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__11 : mword 64 =>
      returnm (MemValue (zero_extend w__11 _))
    else if sumbool_of_bool (andb (eq_vec addr MTIME_BASE_HI) (Z.eqb (projT1 (__id width)) 4)) then
      (if get_config_print_platform tt then
         ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__12 : mword 64 =>
         returnm (print_endline
                    (String.append "clint["
                       (String.append (string_of_bits addr)
                          (String.append "] -> " (string_of_bits w__12)))))
       else returnm tt) >>
      ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__13 : mword 64 =>
      returnm (MemValue (zero_extend (subrange_vec_dec w__13 63 32) _))
    else
      let '_ :=
        (if get_config_print_platform tt then
           print_endline
             (String.append "clint[" (String.append (string_of_bits addr) "] -> <not-mapped>"))
         else tt)
         : unit in
      returnm (match t with
               | Execute tt => MemException (E_Fetch_Access_Fault tt)
               | Read Data => MemException (E_Load_Access_Fault tt)
               | _ => MemException (E_SAMO_Access_Fault tt)
               end))
    : M (MemoryOpResult (mword (8 * width))).

Definition clint_dispatch '(tt : unit) : M (unit) :=
   (if get_config_print_platform tt then
      ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
      returnm (print_endline (String.append "clint::tick mtime <- " (string_of_bits w__0)))
    else returnm tt) >>
   (_set_Minterrupts_MTI mip_ref ('b"0"  : mword 1)) >>
   ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__2 : mword 64 =>
   (if zopz0zIzJ_u w__1 w__2 then
      (if get_config_print_platform tt then
         ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__3 : mword 64 =>
         returnm (print_endline
                    (String.append " clint timer pending at mtime " (string_of_bits w__3)))
       else returnm tt) >>
      (_set_Minterrupts_MTI mip_ref ('b"1"  : mword 1))
       : M (unit)
    else returnm tt)
    : M (unit).

Definition clint_store (addr : mword 32) (width : Z) (data : mword (8 * width))
`{ArithFact (width >? 0)}
: M (MemoryOpResult bool) :=
   let addr := sub_vec addr (plat_clint_base tt) in
   (if sumbool_of_bool
      (andb (eq_vec addr MSIP_BASE)
         (orb (Z.eqb (projT1 (__id width)) 8) (Z.eqb (projT1 (__id width)) 4))) then
      (if get_config_print_platform tt then
         (string_of_bit (access_vec_dec data 0)) >>= fun w__0 : string =>
         returnm (print_endline
                    (String.append "clint["
                       (String.append (string_of_bits addr)
                          (String.append "] <- "
                             (String.append (string_of_bits data)
                                (String.append " (mip.MSI <- " (String.append w__0 ")")))))))
       else returnm tt) >>
      (_set_Minterrupts_MSI mip_ref (vec_of_bits [access_vec_dec data 0]  : mword 1)) >>
      (clint_dispatch tt) >> returnm (MemValue true)
    else if sumbool_of_bool (andb (eq_vec addr MTIMECMP_BASE) (Z.eqb (projT1 (__id width)) 8)) then
      let '_ :=
        (if get_config_print_platform tt then
           print_endline
             (String.append "clint<8>["
                (String.append (string_of_bits addr)
                   (String.append "] <- " (String.append (string_of_bits data) " (mtimecmp)"))))
         else tt)
         : unit in
      write_reg mtimecmp_ref (zero_extend data 64) >> (clint_dispatch tt) >> returnm (MemValue true)
    else if sumbool_of_bool (andb (eq_vec addr MTIMECMP_BASE) (Z.eqb (projT1 (__id width)) 4)) then
      let '_ :=
        (if get_config_print_platform tt then
           print_endline
             (String.append "clint<4>["
                (String.append (string_of_bits addr)
                   (String.append "] <- " (String.append (string_of_bits data) " (mtimecmp)"))))
         else tt)
         : unit in
      ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
      write_reg mtimecmp_ref (update_subrange_vec_dec w__1 31 0 (zero_extend data 32)) >>
      (clint_dispatch tt) >> returnm (MemValue true)
    else if sumbool_of_bool
      (andb (eq_vec addr MTIMECMP_BASE_HI) (Z.eqb (projT1 (__id width)) 4)) then
      let '_ :=
        (if get_config_print_platform tt then
           print_endline
             (String.append "clint<4>["
                (String.append (string_of_bits addr)
                   (String.append "] <- " (String.append (string_of_bits data) " (mtimecmp)"))))
         else tt)
         : unit in
      ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__2 : mword 64 =>
      write_reg mtimecmp_ref (update_subrange_vec_dec w__2 63 32 (zero_extend data 32)) >>
      (clint_dispatch tt) >> returnm (MemValue true)
    else
      let '_ :=
        (if get_config_print_platform tt then
           print_endline
             (String.append "clint["
                (String.append (string_of_bits addr)
                   (String.append "] <- " (String.append (string_of_bits data) " (<unmapped>)"))))
         else tt)
         : unit in
      returnm (MemException (E_SAMO_Access_Fault tt)))
    : M (MemoryOpResult bool).

Definition tick_clock '(tt : unit) : M (unit) :=
   read_reg mcountinhibit_ref >>= fun w__0 : Counterin =>
   (if eq_vec (_get_Counterin_CY w__0) ('b"0"  : mword 1) then
      ((read_reg mcycle_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
      write_reg mcycle_ref (add_vec_int w__1 1)
       : M (unit)
    else returnm tt) >>
   ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__2 : mword 64 =>
   write_reg mtime_ref (add_vec_int w__2 1) >> (clint_dispatch tt)  : M (unit).

Axiom plat_term_write : forall  (_ : mword 8) , unit.

Axiom plat_term_read : forall  (_ : unit) , mword 8.

Definition Mk_htif_cmd (v : mword 64) : htif_cmd :=
   {| htif_cmd_htif_cmd_chunk_0 := (subrange_vec_dec v 63 0) |}.

Definition _get_htif_cmd_bits (v : htif_cmd) : mword 64 :=
   subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 63 0.

Definition _set_htif_cmd_bits (r_ref : register_ref regstate register_value htif_cmd) (v : mword 64)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       htif_cmd_htif_cmd_chunk_0 :=
         (update_subrange_vec_dec r.(htif_cmd_htif_cmd_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]}
      : htif_cmd in
   write_reg r_ref r
    : M (unit).

Definition _update_htif_cmd_bits (v : htif_cmd) (x : mword 64) : htif_cmd :=
   {[ v with
     htif_cmd_htif_cmd_chunk_0 :=
       (update_subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}.

Definition _get_htif_cmd_device (v : htif_cmd) : mword 8 :=
   subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 63 56.

Definition _set_htif_cmd_device
(r_ref : register_ref regstate register_value htif_cmd) (v : mword 8)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       htif_cmd_htif_cmd_chunk_0 :=
         (update_subrange_vec_dec r.(htif_cmd_htif_cmd_chunk_0) 63 56 (subrange_vec_dec v 7 0)) ]}
      : htif_cmd in
   write_reg r_ref r
    : M (unit).

Definition _update_htif_cmd_device (v : htif_cmd) (x : mword 8) : htif_cmd :=
   {[ v with
     htif_cmd_htif_cmd_chunk_0 :=
       (update_subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 63 56 (subrange_vec_dec x 7 0)) ]}.

Definition _get_htif_cmd_cmd (v : htif_cmd) : mword 8 :=
   subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 55 48.

Definition _set_htif_cmd_cmd (r_ref : register_ref regstate register_value htif_cmd) (v : mword 8)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       htif_cmd_htif_cmd_chunk_0 :=
         (update_subrange_vec_dec r.(htif_cmd_htif_cmd_chunk_0) 55 48 (subrange_vec_dec v 7 0)) ]}
      : htif_cmd in
   write_reg r_ref r
    : M (unit).

Definition _update_htif_cmd_cmd (v : htif_cmd) (x : mword 8) : htif_cmd :=
   {[ v with
     htif_cmd_htif_cmd_chunk_0 :=
       (update_subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 55 48 (subrange_vec_dec x 7 0)) ]}.

Definition _get_htif_cmd_payload (v : htif_cmd) : mword 48 :=
   subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 47 0.

Definition _set_htif_cmd_payload
(r_ref : register_ref regstate register_value htif_cmd) (v : mword 48)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       htif_cmd_htif_cmd_chunk_0 :=
         (update_subrange_vec_dec r.(htif_cmd_htif_cmd_chunk_0) 47 0 (subrange_vec_dec v 47 0)) ]}
      : htif_cmd in
   write_reg r_ref r
    : M (unit).

Definition _update_htif_cmd_payload (v : htif_cmd) (x : mword 48) : htif_cmd :=
   {[ v with
     htif_cmd_htif_cmd_chunk_0 :=
       (update_subrange_vec_dec v.(htif_cmd_htif_cmd_chunk_0) 47 0 (subrange_vec_dec x 47 0)) ]}.

Definition reset_htif '(tt : unit) : M (unit) :=
   write_reg htif_cmd_write_ref B0 >>
   write_reg htif_payload_writes_ref (Ox"0"  : mword 4) >>
   write_reg htif_tohost_ref (EXTZ 64 ('b"0"  : mword 1))
    : M (unit).

Definition htif_load (t : AccessType unit) (paddr : mword 32) (width : Z) `{ArithFact (width >? 0)}
: M (MemoryOpResult (mword (8 * width))) :=
   (if get_config_print_platform tt then
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
      returnm (print_endline
                 (String.append "htif["
                    (String.append (string_of_bits paddr)
                       (String.append "] -> " (string_of_bits w__0)))))
    else returnm tt) >>
   (if sumbool_of_bool (andb (Z.eqb width 8) (eq_vec paddr (plat_htif_tohost tt))) then
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
      returnm (MemValue (zero_extend w__1 _))
    else if sumbool_of_bool (andb (Z.eqb width 4) (eq_vec paddr (plat_htif_tohost tt))) then
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__2 : mword 64 =>
      returnm (MemValue (zero_extend (subrange_vec_dec w__2 31 0) _))
    else if sumbool_of_bool
      (andb (Z.eqb width 4) (eq_vec paddr (add_vec_int (plat_htif_tohost tt) 4))) then
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__3 : mword 64 =>
      returnm (MemValue (zero_extend (subrange_vec_dec w__3 63 32) _))
    else
      returnm (match t with
               | Execute tt => MemException (E_Fetch_Access_Fault tt)
               | Read Data => MemException (E_Load_Access_Fault tt)
               | _ => MemException (E_SAMO_Access_Fault tt)
               end))
    : M (MemoryOpResult (mword (8 * width))).

Definition htif_store (paddr : mword 32) (width : Z) (data : mword (8 * width))
`{ArithFact ((0 <? width) && (width <=? 8))}
: M (MemoryOpResult bool) :=
   let '_ :=
     (if get_config_print_platform tt then
        print_endline
          (String.append "htif["
             (String.append (string_of_bits paddr) (String.append "] <- " (string_of_bits data))))
      else tt)
      : unit in
   (if sumbool_of_bool (Z.eqb width 8) then
      write_reg htif_cmd_write_ref B1 >>
      ((read_reg htif_payload_writes_ref)  : M (mword 4)) >>= fun w__0 : mword 4 =>
      write_reg htif_payload_writes_ref (add_vec_int w__0 1) >>
      write_reg htif_tohost_ref (EXTZ 64 data)
       : M (unit)
    else if sumbool_of_bool (andb (Z.eqb width 4) (eq_vec paddr (plat_htif_tohost tt))) then
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
      (if eq_vec data (autocast (autocast (subrange_vec_dec w__1 31 0))) then
         ((read_reg htif_payload_writes_ref)  : M (mword 4)) >>= fun w__2 : mword 4 =>
         write_reg htif_payload_writes_ref (add_vec_int w__2 1)
          : M (unit)
       else write_reg htif_payload_writes_ref (Ox"1"  : mword 4)  : M (unit)) >>
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__3 : mword 64 =>
      write_reg htif_tohost_ref (update_subrange_vec_dec w__3 31 0 (autocast (autocast data)))
       : M (unit)
    else if sumbool_of_bool
      (andb (Z.eqb width 4) (eq_vec paddr (add_vec_int (plat_htif_tohost tt) 4))) then
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__4 : mword 64 =>
      (if eq_vec (subrange_vec_dec data 15 0) (subrange_vec_dec w__4 47 32) then
         ((read_reg htif_payload_writes_ref)  : M (mword 4)) >>= fun w__5 : mword 4 =>
         write_reg htif_payload_writes_ref (add_vec_int w__5 1)
          : M (unit)
       else write_reg htif_payload_writes_ref (Ox"1"  : mword 4)  : M (unit)) >>
      write_reg htif_cmd_write_ref B1 >>
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__6 : mword 64 =>
      write_reg htif_tohost_ref (update_subrange_vec_dec w__6 63 32 (autocast (autocast data)))
       : M (unit)
    else write_reg htif_tohost_ref (EXTZ 64 data)  : M (unit)) >>
   (or_boolM
      ((and_boolM
          (read_reg htif_cmd_write_ref >>= fun w__7 : bitU => returnm ((eq_bit w__7 B1)  : bool))
          (((read_reg htif_payload_writes_ref)  : M (mword 4)) >>= fun w__8 : mword 4 =>
           returnm ((Z.gtb (projT1 (uint w__8)) 0)  : bool)))
       : M (bool))
      (((read_reg htif_payload_writes_ref)  : M (mword 4)) >>= fun w__10 : mword 4 =>
       returnm ((Z.gtb (projT1 (uint w__10)) 2)  : bool))) >>= fun w__11 : bool =>
   (if sumbool_of_bool w__11 then
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__12 : mword 64 =>
      let cmd := Mk_htif_cmd w__12 in
      let b__0 := _get_htif_cmd_device cmd in
      (if eq_vec b__0 (Ox"00"  : mword 8) then
         let '_ :=
           (if get_config_print_platform tt then
              print_endline
                (String.append "htif-syscall-proxy cmd: "
                   (string_of_bits (_get_htif_cmd_payload cmd)))
            else tt)
            : unit in
         (if eq_bit (access_vec_dec (_get_htif_cmd_payload cmd) 0) B1 then
            write_reg htif_done_ref true >>
            write_reg htif_exit_code_ref (shiftr (zero_extend (_get_htif_cmd_payload cmd) 64) 1)
             : M (unit)
          else returnm tt)
          : M (unit)
       else if eq_vec b__0 (Ox"01"  : mword 8) then
         let '_ :=
           (if get_config_print_platform tt then
              print_endline
                (String.append "htif-term cmd: " (string_of_bits (_get_htif_cmd_payload cmd)))
            else tt)
            : unit in
         let b__2 := _get_htif_cmd_cmd cmd in
         let '_ :=
           (if eq_vec b__2 (Ox"00"  : mword 8) then tt
            else if eq_vec b__2 (Ox"01"  : mword 8) then
              plat_term_write (subrange_vec_dec (_get_htif_cmd_payload cmd) 7 0)
            else print_endline (String.append "Unknown term cmd: " (string_of_bits b__2)))
            : unit in
         (reset_htif tt)
          : M (unit)
       else returnm (print_endline (String.append "htif-???? cmd: " (string_of_bits data))))
       : M (unit)
    else returnm tt) >>
   returnm (MemValue true).

Definition htif_tick '(tt : unit) : M (unit) :=
   (if get_config_print_platform tt then
      ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
      returnm (print_endline (String.append "htif::tick " (string_of_bits w__0)))
    else returnm tt) >>
   ((read_reg htif_tohost_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   write_reg htif_tohost_ref w__1
    : M (unit).

Definition within_mmio_readable (addr : mword 32) (width : Z)
`{ArithFact ((0 <? width) && (width <=? 16))}
: bool :=
   orb (within_clint addr width)
     (andb (within_htif_readable addr width) (Z.leb 1 (projT1 (__id width)))).

Definition within_mmio_writable (addr : mword 32) (width : Z)
`{ArithFact ((0 <? width) && (width <=? 16))}
: bool :=
   orb (within_clint addr width)
     (andb (within_htif_writable addr width) (Z.leb (projT1 (__id width)) 8)).

Definition mmio_read (t : AccessType unit) (paddr : mword 32) (width : Z)
`{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult (mword (8 * width))) :=
   (if within_clint paddr width then
      (clint_load t paddr width)
       : M (MemoryOpResult (mword (8 * width)))
    else if sumbool_of_bool
      (andb (within_htif_readable paddr width) (Z.leb 1 (projT1 (__id width)))) then
      (htif_load t paddr width)
       : M (MemoryOpResult (mword (8 * width)))
    else
      returnm (match t with
               | Execute tt => MemException (E_Fetch_Access_Fault tt)
               | Read Data => MemException (E_Load_Access_Fault tt)
               | _ => MemException (E_SAMO_Access_Fault tt)
               end))
    : M (MemoryOpResult (mword (8 * width))).

Definition mmio_write (paddr : mword 32) (width : Z) (data : mword (8 * width))
`{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult bool) :=
   (if within_clint paddr width then (clint_store paddr width data)  : M (MemoryOpResult bool)
    else if sumbool_of_bool
      (andb (within_htif_writable paddr width) (Z.leb (projT1 (__id width)) 8)) then
      (htif_store paddr width data)
       : M (MemoryOpResult bool)
    else returnm (MemException (E_SAMO_Access_Fault tt)))
    : M (MemoryOpResult bool).

Definition init_platform '(tt : unit) : M (unit) :=
   write_reg htif_tohost_ref (EXTZ 64 ('b"0"  : mword 1)) >>
   write_reg htif_done_ref false >>
   write_reg htif_exit_code_ref (EXTZ 64 ('b"0"  : mword 1)) >>
   write_reg htif_cmd_write_ref B0 >>
   write_reg htif_payload_writes_ref (EXTZ 4 ('b"0"  : mword 1))
    : M (unit).

Definition tick_platform '(tt : unit) : M (unit) := (htif_tick tt)  : M (unit).

Definition handle_illegal '(tt : unit) : M (unit) :=
   (if plat_mtval_has_illegal_inst_bits tt then
      ((read_reg instbits_ref)  : M (mword 32)) >>= fun w__0 : mword 32 => returnm (Some w__0)
    else returnm None) >>= fun info =>
   let t : sync_exception :=
     {| sync_exception_trap := (E_Illegal_Instr tt); 
        sync_exception_excinfo := info; 
        sync_exception_ext := None |} in
   read_reg cur_privilege_ref >>= fun w__1 : Privilege =>
   ((read_reg PC_ref)  : M (mword 32)) >>= fun w__2 : mword 32 =>
   (exception_handler w__1 (CTL_TRAP t) w__2) >>= fun w__3 : mword 32 =>
   (set_next_pc w__3)
    : M (unit).

Definition platform_wfi '(tt : unit) : M (unit) :=
   let '_ := (cancel_reservation tt)  : unit in
   ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__1 : mword 64 =>
   (if zopz0zI_u w__0 w__1 then
      ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__2 : mword 64 =>
      write_reg mtime_ref w__2 >>
      ((read_reg mtimecmp_ref)  : M (mword 64)) >>= fun w__3 : mword 64 =>
      write_reg mcycle_ref w__3
       : M (unit)
    else returnm tt)
    : M (unit).

Definition is_aligned_addr (addr : mword 32) (width : Z) : bool :=
   Z.eqb (projT1 (emod_with_eq (projT1 (uint addr)) width)) 0.

Definition read_kind_of_flags (aq : bool) (rl : bool) (res : bool) : option read_kind :=
   match (aq, rl, res) with
   | (false, false, false) => Some Read_plain
   | (true, false, false) => Some Read_RISCV_acquire
   | (true, true, false) => Some Read_RISCV_strong_acquire
   | (false, false, true) => Some Read_RISCV_reserved
   | (true, false, true) => Some Read_RISCV_reserved_acquire
   | (true, true, true) => Some Read_RISCV_reserved_strong_acquire
   | (false, true, false) => None
   | (false, true, true) => None
   end.

Definition phys_mem_read
(t : AccessType unit) (paddr : mword 32) (width : Z) (aq : bool) (rl : bool) (res : bool)
(meta : bool) `{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult ((mword (8 * width) * unit))) :=
   (match (read_kind_of_flags aq rl res) with
    | Some rk =>
       (read_ram rk paddr width meta) >>= fun w__0 : (mword (8 * width) * unit) =>
       returnm (Some w__0)
    | None => returnm None
    end) >>= fun w__1 : option ((mword (8 * width) * unit)) =>
   let result := w__1  : option ((bits (8 * width) * mem_meta)) in
   returnm (match (t, result) with
            | (Execute tt, None) => MemException (E_Fetch_Access_Fault tt)
            | (Read Data, None) => MemException (E_Load_Access_Fault tt)
            | (_, None) => MemException (E_SAMO_Access_Fault tt)
            | (_, Some (v, m)) =>
               let '_ :=
                 (if get_config_print_mem tt then
                    print_endline
                      (String.append "mem["
                         (String.append (accessType_to_str t)
                            (String.append ","
                               (String.append (string_of_bits paddr)
                                  (String.append "] -> " (string_of_bits v))))))
                  else tt)
                  : unit in
               MemValue (v, m)
            end).

Definition checked_mem_read
(t : AccessType unit) (paddr : mword 32) (width : Z) (aq : bool) (rl : bool) (res : bool)
(meta : bool) `{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult ((mword (8 * width) * unit))) :=
   (if within_mmio_readable paddr width then
      (mmio_read t paddr width) >>= fun w__0 : MemoryOpResult (mword (8 * width)) =>
      returnm (MemoryOpResult_add_meta w__0 default_meta)
    else if within_phys_mem paddr width then
      (match (ext_check_phys_mem_read t paddr width aq rl res meta) with
       | Ext_PhysAddr_OK tt =>
          (phys_mem_read t paddr width aq rl res meta)
           : M (MemoryOpResult ((mword (8 * width) * unit)))
       | Ext_PhysAddr_Error e => returnm (MemException e)
       end)
       : M (MemoryOpResult ((mword (8 * width) * unit)))
    else
      returnm (match t with
               | Execute tt => MemException (E_Fetch_Access_Fault tt)
               | Read Data => MemException (E_Load_Access_Fault tt)
               | _ => MemException (E_SAMO_Access_Fault tt)
               end))
    : M (MemoryOpResult ((mword (8 * width) * unit))).

Definition pmp_mem_read
(t : AccessType unit) (p : Privilege) (paddr : mword 32) (width : Z) (aq : bool) (rl : bool)
(res : bool) (meta : bool) `{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult ((mword (8 * width) * unit))) :=
   (if negb (plat_enable_pmp tt) then
      (checked_mem_read t paddr width aq rl res meta)
       : M (MemoryOpResult ((mword (8 * width) * unit)))
    else
      (pmpCheck paddr width t p) >>= fun w__1 : option ExceptionType =>
      (match w__1 with
       | None =>
          (checked_mem_read t paddr width aq rl res meta)
           : M (MemoryOpResult ((mword (8 * width) * unit)))
       | Some e => returnm (MemException e)
       end)
       : M (MemoryOpResult ((mword (8 * width) * unit))))
    : M (MemoryOpResult ((mword (8 * width) * unit))).

Definition rvfi_read
(addr : mword 32) (width : Z) (result : MemoryOpResult ((mword (8 * width) * unit)))
`{ArithFact (width >? 0)}
: unit :=
   tt.

Definition mem_read_priv_meta
(typ : AccessType unit) (priv : Privilege) (paddr : mword 32) (width : Z) (aq : bool) (rl : bool)
(res : bool) (meta : bool) `{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult ((mword (8 * width) * unit))) :=
   (if sumbool_of_bool (andb (orb aq res) (negb (is_aligned_addr paddr width))) then
      returnm (MemException (E_Load_Addr_Align tt))
    else
      (match (aq, rl, res) with
       | (false, true, false) => throw (Error_not_implemented "load.rl")
       | (false, true, true) => throw (Error_not_implemented "lr.rl")
       | (_, _, _) =>
          (pmp_mem_read typ priv paddr width aq rl res meta)
           : M (MemoryOpResult ((mword (8 * width) * unit)))
       end)
       : M (MemoryOpResult ((mword (8 * width) * unit)))) >>= fun result : MemoryOpResult ((bits (8 * width) * mem_meta)) =>
   let '_ := (rvfi_read paddr width result)  : unit in
   returnm result.

Definition mem_read_meta
(typ : AccessType unit) (paddr : mword 32) (width : Z) (aq : bool) (rl : bool) (res : bool)
(meta : bool) `{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult ((mword (8 * width) * unit))) :=
   read_reg mstatus_ref >>= fun w__0 : Mstatus =>
   read_reg cur_privilege_ref >>= fun w__1 : Privilege =>
   (effectivePrivilege typ w__0 w__1) >>= fun w__2 : Privilege =>
   (mem_read_priv_meta typ w__2 paddr width aq rl res meta)
    : M (MemoryOpResult ((mword (8 * width) * unit))).

Definition mem_read_priv
(typ : AccessType unit) (priv : Privilege) (paddr : mword 32) (width : Z) (aq : bool) (rl : bool)
(res : bool) `{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult (mword (8 * width))) :=
   (mem_read_priv_meta typ priv paddr width aq rl res false) >>= fun w__0 : MemoryOpResult ((mword (8 * width) * unit)) =>
   returnm (MemoryOpResult_drop_meta w__0).

Definition mem_read
(typ : AccessType unit) (paddr : mword 32) (width : Z) (aq : bool) (rel : bool) (res : bool)
`{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult (mword (8 * width))) :=
   read_reg mstatus_ref >>= fun w__0 : Mstatus =>
   read_reg cur_privilege_ref >>= fun w__1 : Privilege =>
   (effectivePrivilege typ w__0 w__1) >>= fun w__2 : Privilege =>
   (mem_read_priv typ w__2 paddr width aq rel res)
    : M (MemoryOpResult (mword (8 * width))).

Definition mem_write_ea (addr : mword 32) (width : Z) (aq : bool) (rl : bool) (con : bool)
`{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult unit) :=
   (if sumbool_of_bool (andb (orb rl con) (negb (is_aligned_addr addr width))) then
      returnm (MemException (E_SAMO_Addr_Align tt))
    else
      (match (aq, rl, con) with
       | (false, false, false) => (write_ram_ea Write_plain addr width) >> returnm (MemValue tt)
       | (false, true, false) =>
          (write_ram_ea Write_RISCV_release addr width) >> returnm (MemValue tt)
       | (false, false, true) =>
          (write_ram_ea Write_RISCV_conditional addr width) >> returnm (MemValue tt)
       | (false, true, true) =>
          (write_ram_ea Write_RISCV_conditional_release addr width) >> returnm (MemValue tt)
       | (true, false, false) => throw (Error_not_implemented "store.aq")
       | (true, true, false) =>
          (write_ram_ea Write_RISCV_strong_release addr width) >> returnm (MemValue tt)
       | (true, false, true) => throw (Error_not_implemented "sc.aq")
       | (true, true, true) =>
          (write_ram_ea Write_RISCV_conditional_strong_release addr width) >> returnm (MemValue tt)
       end)
       : M (MemoryOpResult unit))
    : M (MemoryOpResult unit).

Definition rvfi_write (addr : mword 32) (width : Z) (value : mword (8 * width)) (meta : unit)
`{ArithFact (width >? 0)}
: unit :=
   tt.

Definition phys_mem_write
(wk : write_kind) (paddr : mword 32) (width : Z) (data : mword (8 * width)) (meta : unit)
`{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult bool) :=
   let '_ := (rvfi_write paddr width data meta)  : unit in
   (write_ram wk paddr width data meta) >>= fun w__0 : bool =>
   let result := MemValue w__0 in
   let '_ :=
     (if get_config_print_mem tt then
        print_endline
          (String.append "mem["
             (String.append (string_of_bits paddr) (String.append "] <- " (string_of_bits data))))
      else tt)
      : unit in
   returnm result.

Definition checked_mem_write
(wk : write_kind) (paddr : mword 32) (width : Z) (data : mword (8 * width)) (meta : unit)
`{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult bool) :=
   (if within_mmio_writable paddr width then
      (mmio_write paddr width data)
       : M (MemoryOpResult bool)
    else if within_phys_mem paddr width then
      (match (ext_check_phys_mem_write wk paddr width data meta) with
       | Ext_PhysAddr_OK tt => (phys_mem_write wk paddr width data meta)  : M (MemoryOpResult bool)
       | Ext_PhysAddr_Error e => returnm (MemException e)
       end)
       : M (MemoryOpResult bool)
    else returnm (MemException (E_SAMO_Access_Fault tt)))
    : M (MemoryOpResult bool).

Definition pmp_mem_write
(wk : write_kind) (paddr : mword 32) (width : Z) (data : mword (8 * width)) (typ : AccessType unit)
(priv : Privilege) (meta : unit) `{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult bool) :=
   (if negb (plat_enable_pmp tt) then
      (checked_mem_write wk paddr width data meta)
       : M (MemoryOpResult bool)
    else
      (pmpCheck paddr width typ priv) >>= fun w__1 : option ExceptionType =>
      (match w__1 with
       | None => (checked_mem_write wk paddr width data meta)  : M (MemoryOpResult bool)
       | Some e => returnm (MemException e)
       end)
       : M (MemoryOpResult bool))
    : M (MemoryOpResult bool).

Definition mem_write_value_priv_meta
(paddr : mword 32) (width : Z) (value : mword (8 * width)) (typ : AccessType unit)
(priv : Privilege) (meta : unit) (aq : bool) (rl : bool) (con : bool)
`{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult bool) :=
   let '_ := (rvfi_write paddr width value meta)  : unit in
   (if sumbool_of_bool (andb (orb rl con) (negb (is_aligned_addr paddr width))) then
      returnm (MemException (E_SAMO_Addr_Align tt))
    else
      (match (aq, rl, con) with
       | (false, false, false) => returnm Write_plain
       | (false, true, false) => returnm Write_RISCV_release
       | (false, false, true) => returnm Write_RISCV_conditional
       | (false, true, true) => returnm Write_RISCV_conditional_release
       | (true, true, false) => returnm Write_RISCV_strong_release
       | (true, true, true) => returnm Write_RISCV_conditional_strong_release
       | (true, false, false) => throw (Error_not_implemented "store.aq")
       | (true, false, true) => throw (Error_not_implemented "sc.aq")
       end) >>= fun wk : write_kind =>
      (pmp_mem_write wk paddr width value typ priv meta)
       : M (MemoryOpResult bool))
    : M (MemoryOpResult bool).

Definition mem_write_value_priv
(paddr : mword 32) (width : Z) (value : mword (8 * width)) (priv : Privilege) (aq : bool)
(rl : bool) (con : bool) `{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult bool) :=
   (mem_write_value_priv_meta paddr width value (Write default_write_acc) priv default_meta aq rl
      con)
    : M (MemoryOpResult bool).

Definition mem_write_value_meta
(paddr : mword 32) (width : Z) (value : mword (8 * width)) (ext_acc : unit) (meta : unit)
(aq : bool) (rl : bool) (con : bool) `{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult bool) :=
   let typ := Write ext_acc in
   read_reg mstatus_ref >>= fun w__0 : Mstatus =>
   read_reg cur_privilege_ref >>= fun w__1 : Privilege =>
   (effectivePrivilege typ w__0 w__1) >>= fun ep =>
   (mem_write_value_priv_meta paddr width value typ ep meta aq rl con)
    : M (MemoryOpResult bool).

Definition mem_write_value
(paddr : mword 32) (width : Z) (value : mword (8 * width)) (aq : bool) (rl : bool) (con : bool)
`{ArithFact ((0 <? width) && (width <=? 16))}
: M (MemoryOpResult bool) :=
   (mem_write_value_meta paddr width value default_write_acc default_meta aq rl con)
    : M (MemoryOpResult bool).

Definition default_sv32_ext_pte : extPte := zeros_implicit 10.
Hint Unfold default_sv32_ext_pte : sail.
Definition Mk_PTE_Bits (v : mword 8) : PTE_Bits :=
   {| PTE_Bits_PTE_Bits_chunk_0 := (subrange_vec_dec v 7 0) |}.

Definition _get_PTE_Bits_bits (v : PTE_Bits) : mword 8 :=
   subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 7 0.

Definition _set_PTE_Bits_bits (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 8)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       PTE_Bits_PTE_Bits_chunk_0 :=
         (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 7 0 (subrange_vec_dec v 7 0)) ]}
      : PTE_Bits in
   write_reg r_ref r
    : M (unit).

Definition _update_PTE_Bits_bits (v : PTE_Bits) (x : mword 8) : PTE_Bits :=
   {[ v with
     PTE_Bits_PTE_Bits_chunk_0 :=
       (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 7 0 (subrange_vec_dec x 7 0)) ]}.

Definition _get_PTE_Bits_D (v : PTE_Bits) : mword 1 :=
   subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 7 7.

Definition _set_PTE_Bits_D (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       PTE_Bits_PTE_Bits_chunk_0 :=
         (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 7 7 (subrange_vec_dec v 0 0)) ]}
      : PTE_Bits in
   write_reg r_ref r
    : M (unit).

Definition _update_PTE_Bits_D (v : PTE_Bits) (x : mword 1) : PTE_Bits :=
   {[ v with
     PTE_Bits_PTE_Bits_chunk_0 :=
       (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 7 7 (subrange_vec_dec x 0 0)) ]}.

Definition _get_PTE_Bits_A (v : PTE_Bits) : mword 1 :=
   subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 6 6.

Definition _set_PTE_Bits_A (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       PTE_Bits_PTE_Bits_chunk_0 :=
         (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 6 6 (subrange_vec_dec v 0 0)) ]}
      : PTE_Bits in
   write_reg r_ref r
    : M (unit).

Definition _update_PTE_Bits_A (v : PTE_Bits) (x : mword 1) : PTE_Bits :=
   {[ v with
     PTE_Bits_PTE_Bits_chunk_0 :=
       (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 6 6 (subrange_vec_dec x 0 0)) ]}.

Definition _get_PTE_Bits_G (v : PTE_Bits) : mword 1 :=
   subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 5 5.

Definition _set_PTE_Bits_G (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       PTE_Bits_PTE_Bits_chunk_0 :=
         (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 5 5 (subrange_vec_dec v 0 0)) ]}
      : PTE_Bits in
   write_reg r_ref r
    : M (unit).

Definition _update_PTE_Bits_G (v : PTE_Bits) (x : mword 1) : PTE_Bits :=
   {[ v with
     PTE_Bits_PTE_Bits_chunk_0 :=
       (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 5 5 (subrange_vec_dec x 0 0)) ]}.

Definition _get_PTE_Bits_U (v : PTE_Bits) : mword 1 :=
   subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 4 4.

Definition _set_PTE_Bits_U (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       PTE_Bits_PTE_Bits_chunk_0 :=
         (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 4 4 (subrange_vec_dec v 0 0)) ]}
      : PTE_Bits in
   write_reg r_ref r
    : M (unit).

Definition _update_PTE_Bits_U (v : PTE_Bits) (x : mword 1) : PTE_Bits :=
   {[ v with
     PTE_Bits_PTE_Bits_chunk_0 :=
       (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 4 4 (subrange_vec_dec x 0 0)) ]}.

Definition _get_PTE_Bits_X (v : PTE_Bits) : mword 1 :=
   subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 3 3.

Definition _set_PTE_Bits_X (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       PTE_Bits_PTE_Bits_chunk_0 :=
         (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 3 3 (subrange_vec_dec v 0 0)) ]}
      : PTE_Bits in
   write_reg r_ref r
    : M (unit).

Definition _update_PTE_Bits_X (v : PTE_Bits) (x : mword 1) : PTE_Bits :=
   {[ v with
     PTE_Bits_PTE_Bits_chunk_0 :=
       (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 3 3 (subrange_vec_dec x 0 0)) ]}.

Definition _get_PTE_Bits_W (v : PTE_Bits) : mword 1 :=
   subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 2 2.

Definition _set_PTE_Bits_W (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       PTE_Bits_PTE_Bits_chunk_0 :=
         (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 2 2 (subrange_vec_dec v 0 0)) ]}
      : PTE_Bits in
   write_reg r_ref r
    : M (unit).

Definition _update_PTE_Bits_W (v : PTE_Bits) (x : mword 1) : PTE_Bits :=
   {[ v with
     PTE_Bits_PTE_Bits_chunk_0 :=
       (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 2 2 (subrange_vec_dec x 0 0)) ]}.

Definition _get_PTE_Bits_R (v : PTE_Bits) : mword 1 :=
   subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 1 1.

Definition _set_PTE_Bits_R (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       PTE_Bits_PTE_Bits_chunk_0 :=
         (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 1 1 (subrange_vec_dec v 0 0)) ]}
      : PTE_Bits in
   write_reg r_ref r
    : M (unit).

Definition _update_PTE_Bits_R (v : PTE_Bits) (x : mword 1) : PTE_Bits :=
   {[ v with
     PTE_Bits_PTE_Bits_chunk_0 :=
       (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 1 1 (subrange_vec_dec x 0 0)) ]}.

Definition _get_PTE_Bits_V (v : PTE_Bits) : mword 1 :=
   subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 0 0.

Definition _set_PTE_Bits_V (r_ref : register_ref regstate register_value PTE_Bits) (v : mword 1)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       PTE_Bits_PTE_Bits_chunk_0 :=
         (update_subrange_vec_dec r.(PTE_Bits_PTE_Bits_chunk_0) 0 0 (subrange_vec_dec v 0 0)) ]}
      : PTE_Bits in
   write_reg r_ref r
    : M (unit).

Definition _update_PTE_Bits_V (v : PTE_Bits) (x : mword 1) : PTE_Bits :=
   {[ v with
     PTE_Bits_PTE_Bits_chunk_0 :=
       (update_subrange_vec_dec v.(PTE_Bits_PTE_Bits_chunk_0) 0 0 (subrange_vec_dec x 0 0)) ]}.

Definition isPTEPtr (p : mword 8) (ext : mword 10) : bool :=
   let a := Mk_PTE_Bits p in
   andb (eq_vec (_get_PTE_Bits_R a) ('b"0"  : mword 1))
     (andb (eq_vec (_get_PTE_Bits_W a) ('b"0"  : mword 1))
        (eq_vec (_get_PTE_Bits_X a) ('b"0"  : mword 1))).

Definition isInvalidPTE (p : mword 8) (ext : mword 10) : bool :=
   let a := Mk_PTE_Bits p in
   orb (eq_vec (_get_PTE_Bits_V a) ('b"0"  : mword 1))
     (andb (eq_vec (_get_PTE_Bits_W a) ('b"1"  : mword 1))
        (eq_vec (_get_PTE_Bits_R a) ('b"0"  : mword 1))).

Definition to_pte_check (b : bool) : PTE_Check :=
   if sumbool_of_bool b then PTE_Check_Success tt else PTE_Check_Failure (tt, tt).

Definition checkPTEPermission
(ac : AccessType unit) (priv : Privilege) (mxr : bool) (do_sum : bool) (p : PTE_Bits)
(ext : mword 10) (ext_ptw : unit)
: M (PTE_Check) :=
   (match (ac, priv) with
    | (Read _, User) =>
       returnm (to_pte_check
                  (andb (eq_vec (_get_PTE_Bits_U p) ('b"1"  : mword 1))
                     (orb (eq_vec (_get_PTE_Bits_R p) ('b"1"  : mword 1))
                        (andb (eq_vec (_get_PTE_Bits_X p) ('b"1"  : mword 1)) mxr))))
    | (Write _, User) =>
       returnm (to_pte_check
                  (andb (eq_vec (_get_PTE_Bits_U p) ('b"1"  : mword 1))
                     (eq_vec (_get_PTE_Bits_W p) ('b"1"  : mword 1))))
    | (ReadWrite (_, _), User) =>
       returnm (to_pte_check
                  (andb (eq_vec (_get_PTE_Bits_U p) ('b"1"  : mword 1))
                     (andb (eq_vec (_get_PTE_Bits_W p) ('b"1"  : mword 1))
                        (orb (eq_vec (_get_PTE_Bits_R p) ('b"1"  : mword 1))
                           (andb (eq_vec (_get_PTE_Bits_X p) ('b"1"  : mword 1)) mxr)))))
    | (Execute tt, User) =>
       returnm (to_pte_check
                  (andb (eq_vec (_get_PTE_Bits_U p) ('b"1"  : mword 1))
                     (eq_vec (_get_PTE_Bits_X p) ('b"1"  : mword 1))))
    | (Read _, Supervisor) =>
       returnm (to_pte_check
                  (andb (orb (eq_vec (_get_PTE_Bits_U p) ('b"0"  : mword 1)) do_sum)
                     (orb (eq_vec (_get_PTE_Bits_R p) ('b"1"  : mword 1))
                        (andb (eq_vec (_get_PTE_Bits_X p) ('b"1"  : mword 1)) mxr))))
    | (Write _, Supervisor) =>
       returnm (to_pte_check
                  (andb (orb (eq_vec (_get_PTE_Bits_U p) ('b"0"  : mword 1)) do_sum)
                     (eq_vec (_get_PTE_Bits_W p) ('b"1"  : mword 1))))
    | (ReadWrite (_, _), Supervisor) =>
       returnm (to_pte_check
                  (andb (orb (eq_vec (_get_PTE_Bits_U p) ('b"0"  : mword 1)) do_sum)
                     (andb (eq_vec (_get_PTE_Bits_W p) ('b"1"  : mword 1))
                        (orb (eq_vec (_get_PTE_Bits_R p) ('b"1"  : mword 1))
                           (andb (eq_vec (_get_PTE_Bits_X p) ('b"1"  : mword 1)) mxr)))))
    | (Execute tt, Supervisor) =>
       returnm (to_pte_check
                  (andb (eq_vec (_get_PTE_Bits_U p) ('b"0"  : mword 1))
                     (eq_vec (_get_PTE_Bits_X p) ('b"1"  : mword 1))))
    | (_, Machine) => (internal_error "m-mode mem perm check")  : M (PTE_Check)
    end)
    : M (PTE_Check).

Definition update_PTE_Bits (p : PTE_Bits) (a : AccessType unit) (ext : mword 10)
: option ((PTE_Bits * mword 10)) :=
   let update_d :=
     andb (eq_vec (_get_PTE_Bits_D p) ('b"0"  : mword 1))
       ((match a with
         | Execute tt => false
         | Read tt => false
         | Write _ => true
         | ReadWrite (_, _) => true
         end)
        : bool) in
   let update_a := eq_vec (_get_PTE_Bits_A p) ('b"0"  : mword 1) in
   if sumbool_of_bool (orb update_d update_a) then
     let np := _update_PTE_Bits_A p ('b"1"  : mword 1) in
     let np := if sumbool_of_bool update_d then _update_PTE_Bits_D np ('b"1"  : mword 1) else np in
     Some (np, ext)
   else None.

Definition ptw_error_to_str (e : PTW_Error) : string :=
   match e with
   | PTW_Invalid_Addr tt => "invalid-source-addr"
   | PTW_Access tt => "mem-access-error"
   | PTW_Invalid_PTE tt => "invalid-pte"
   | PTW_No_Permission tt => "no-permission"
   | PTW_Misaligned tt => "misaligned-superpage"
   | PTW_PTE_Update tt => "pte-update-needed"
   | PTW_Ext_Error e => "extension-error"
   end.

Definition ext_get_ptw_error (eptwf : unit) : PTW_Error := PTW_No_Permission tt.

Definition translationException (a : AccessType unit) (f : PTW_Error) : ExceptionType :=
   match (a, f) with
   | (_, PTW_Ext_Error e) => E_Extension (ext_translate_exception e)
   | (ReadWrite _, PTW_Access tt) => E_SAMO_Access_Fault tt
   | (ReadWrite _, _) => E_SAMO_Page_Fault tt
   | (Read _, PTW_Access tt) => E_Load_Access_Fault tt
   | (Read _, _) => E_Load_Page_Fault tt
   | (Write _, PTW_Access tt) => E_SAMO_Access_Fault tt
   | (Write _, _) => E_SAMO_Page_Fault tt
   | (Execute tt, PTW_Access tt) => E_Fetch_Access_Fault tt
   | (Execute tt, _) => E_Fetch_Page_Fault tt
   end.

Definition PAGESIZE_BITS := 12.
Hint Unfold PAGESIZE_BITS : sail.
Definition curAsid32 (satp : mword 32) : mword 9 :=
   let s := Mk_Satp32 satp in
   _get_Satp32_Asid s.

Definition curPTB32 (satp : mword 32) : mword 34 :=
   let s : Satp32 := Mk_Satp32 satp in
   shiftl (EXTZ 34 (_get_Satp32_PPN s)) PAGESIZE_BITS.

Definition SV32_LEVEL_BITS := 10.
Hint Unfold SV32_LEVEL_BITS : sail.
Definition SV32_LEVELS := 2.
Hint Unfold SV32_LEVELS : sail.
Definition PTE32_LOG_SIZE := 2.
Hint Unfold PTE32_LOG_SIZE : sail.
Definition PTE32_SIZE := 4.
Hint Unfold PTE32_SIZE : sail.
Definition Mk_SV32_Vaddr (v : mword 32) : SV32_Vaddr :=
   {| SV32_Vaddr_SV32_Vaddr_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_SV32_Vaddr_bits (v : SV32_Vaddr) : mword 32 :=
   subrange_vec_dec v.(SV32_Vaddr_SV32_Vaddr_chunk_0) 31 0.

Definition _set_SV32_Vaddr_bits
(r_ref : register_ref regstate register_value SV32_Vaddr) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_Vaddr_SV32_Vaddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_Vaddr_SV32_Vaddr_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : SV32_Vaddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_Vaddr_bits (v : SV32_Vaddr) (x : mword 32) : SV32_Vaddr :=
   {[ v with
     SV32_Vaddr_SV32_Vaddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_Vaddr_SV32_Vaddr_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_SV32_Vaddr_VPNi (v : SV32_Vaddr) : mword 20 :=
   subrange_vec_dec v.(SV32_Vaddr_SV32_Vaddr_chunk_0) 31 12.

Definition _set_SV32_Vaddr_VPNi
(r_ref : register_ref regstate register_value SV32_Vaddr) (v : mword 20)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_Vaddr_SV32_Vaddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_Vaddr_SV32_Vaddr_chunk_0) 31 12 (subrange_vec_dec v 19 0)) ]}
      : SV32_Vaddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_Vaddr_VPNi (v : SV32_Vaddr) (x : mword 20) : SV32_Vaddr :=
   {[ v with
     SV32_Vaddr_SV32_Vaddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_Vaddr_SV32_Vaddr_chunk_0) 31 12 (subrange_vec_dec x 19 0)) ]}.

Definition _get_SV32_Vaddr_PgOfs (v : SV32_Vaddr) : mword 12 :=
   subrange_vec_dec v.(SV32_Vaddr_SV32_Vaddr_chunk_0) 11 0.

Definition _set_SV32_Vaddr_PgOfs
(r_ref : register_ref regstate register_value SV32_Vaddr) (v : mword 12)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_Vaddr_SV32_Vaddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_Vaddr_SV32_Vaddr_chunk_0) 11 0 (subrange_vec_dec v 11 0)) ]}
      : SV32_Vaddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_Vaddr_PgOfs (v : SV32_Vaddr) (x : mword 12) : SV32_Vaddr :=
   {[ v with
     SV32_Vaddr_SV32_Vaddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_Vaddr_SV32_Vaddr_chunk_0) 11 0 (subrange_vec_dec x 11 0)) ]}.

Definition Mk_SV32_Paddr (v : mword 34) : SV32_Paddr :=
   {| SV32_Paddr_SV32_Paddr_chunk_0 := (subrange_vec_dec v 33 0) |}.

Definition _get_SV32_Paddr_bits (v : SV32_Paddr) : mword 34 :=
   subrange_vec_dec v.(SV32_Paddr_SV32_Paddr_chunk_0) 33 0.

Definition _set_SV32_Paddr_bits
(r_ref : register_ref regstate register_value SV32_Paddr) (v : mword 34)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_Paddr_SV32_Paddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_Paddr_SV32_Paddr_chunk_0) 33 0 (subrange_vec_dec v 33 0)) ]}
      : SV32_Paddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_Paddr_bits (v : SV32_Paddr) (x : mword 34) : SV32_Paddr :=
   {[ v with
     SV32_Paddr_SV32_Paddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_Paddr_SV32_Paddr_chunk_0) 33 0 (subrange_vec_dec x 33 0)) ]}.

Definition _get_SV32_Paddr_PPNi (v : SV32_Paddr) : mword 22 :=
   subrange_vec_dec v.(SV32_Paddr_SV32_Paddr_chunk_0) 33 12.

Definition _set_SV32_Paddr_PPNi
(r_ref : register_ref regstate register_value SV32_Paddr) (v : mword 22)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_Paddr_SV32_Paddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_Paddr_SV32_Paddr_chunk_0) 33 12 (subrange_vec_dec v 21 0)) ]}
      : SV32_Paddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_Paddr_PPNi (v : SV32_Paddr) (x : mword 22) : SV32_Paddr :=
   {[ v with
     SV32_Paddr_SV32_Paddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_Paddr_SV32_Paddr_chunk_0) 33 12 (subrange_vec_dec x 21 0)) ]}.

Definition _get_SV32_Paddr_PgOfs (v : SV32_Paddr) : mword 12 :=
   subrange_vec_dec v.(SV32_Paddr_SV32_Paddr_chunk_0) 11 0.

Definition _set_SV32_Paddr_PgOfs
(r_ref : register_ref regstate register_value SV32_Paddr) (v : mword 12)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_Paddr_SV32_Paddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_Paddr_SV32_Paddr_chunk_0) 11 0 (subrange_vec_dec v 11 0)) ]}
      : SV32_Paddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_Paddr_PgOfs (v : SV32_Paddr) (x : mword 12) : SV32_Paddr :=
   {[ v with
     SV32_Paddr_SV32_Paddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_Paddr_SV32_Paddr_chunk_0) 11 0 (subrange_vec_dec x 11 0)) ]}.

Definition Mk_SV32_PTE (v : mword 32) : SV32_PTE :=
   {| SV32_PTE_SV32_PTE_chunk_0 := (subrange_vec_dec v 31 0) |}.

Definition _get_SV32_PTE_bits (v : SV32_PTE) : mword 32 :=
   subrange_vec_dec v.(SV32_PTE_SV32_PTE_chunk_0) 31 0.

Definition _set_SV32_PTE_bits (r_ref : register_ref regstate register_value SV32_PTE) (v : mword 32)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_PTE_SV32_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_PTE_SV32_PTE_chunk_0) 31 0 (subrange_vec_dec v 31 0)) ]}
      : SV32_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_PTE_bits (v : SV32_PTE) (x : mword 32) : SV32_PTE :=
   {[ v with
     SV32_PTE_SV32_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_PTE_SV32_PTE_chunk_0) 31 0 (subrange_vec_dec x 31 0)) ]}.

Definition _get_SV32_PTE_PPNi (v : SV32_PTE) : mword 22 :=
   subrange_vec_dec v.(SV32_PTE_SV32_PTE_chunk_0) 31 10.

Definition _set_SV32_PTE_PPNi (r_ref : register_ref regstate register_value SV32_PTE) (v : mword 22)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_PTE_SV32_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_PTE_SV32_PTE_chunk_0) 31 10 (subrange_vec_dec v 21 0)) ]}
      : SV32_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_PTE_PPNi (v : SV32_PTE) (x : mword 22) : SV32_PTE :=
   {[ v with
     SV32_PTE_SV32_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_PTE_SV32_PTE_chunk_0) 31 10 (subrange_vec_dec x 21 0)) ]}.

Definition _get_SV32_PTE_RSW (v : SV32_PTE) : mword 2 :=
   subrange_vec_dec v.(SV32_PTE_SV32_PTE_chunk_0) 9 8.

Definition _set_SV32_PTE_RSW (r_ref : register_ref regstate register_value SV32_PTE) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_PTE_SV32_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_PTE_SV32_PTE_chunk_0) 9 8 (subrange_vec_dec v 1 0)) ]}
      : SV32_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_PTE_RSW (v : SV32_PTE) (x : mword 2) : SV32_PTE :=
   {[ v with
     SV32_PTE_SV32_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_PTE_SV32_PTE_chunk_0) 9 8 (subrange_vec_dec x 1 0)) ]}.

Definition _get_SV32_PTE_BITS (v : SV32_PTE) : mword 8 :=
   subrange_vec_dec v.(SV32_PTE_SV32_PTE_chunk_0) 7 0.

Definition _set_SV32_PTE_BITS (r_ref : register_ref regstate register_value SV32_PTE) (v : mword 8)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV32_PTE_SV32_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV32_PTE_SV32_PTE_chunk_0) 7 0 (subrange_vec_dec v 7 0)) ]}
      : SV32_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV32_PTE_BITS (v : SV32_PTE) (x : mword 8) : SV32_PTE :=
   {[ v with
     SV32_PTE_SV32_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV32_PTE_SV32_PTE_chunk_0) 7 0 (subrange_vec_dec x 7 0)) ]}.

Definition curAsid64 (satp : mword 64) : mword 16 :=
   let s := Mk_Satp64 satp in
   _get_Satp64_Asid s.

Definition curPTB64 (satp : mword 64) : mword 56 :=
   let s := Mk_Satp64 satp in
   shiftl (EXTZ 56 (_get_Satp64_PPN s)) PAGESIZE_BITS.

Definition SV39_LEVEL_BITS := 9.
Hint Unfold SV39_LEVEL_BITS : sail.
Definition SV39_LEVELS := 3.
Hint Unfold SV39_LEVELS : sail.
Definition PTE39_LOG_SIZE := 3.
Hint Unfold PTE39_LOG_SIZE : sail.
Definition PTE39_SIZE := 8.
Hint Unfold PTE39_SIZE : sail.
Definition Mk_SV39_Vaddr (v : mword 39) : SV39_Vaddr :=
   {| SV39_Vaddr_SV39_Vaddr_chunk_0 := (subrange_vec_dec v 38 0) |}.

Definition _get_SV39_Vaddr_bits (v : SV39_Vaddr) : mword 39 :=
   subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 0.

Definition _set_SV39_Vaddr_bits
(r_ref : register_ref regstate register_value SV39_Vaddr) (v : mword 39)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_Vaddr_SV39_Vaddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 0 (subrange_vec_dec v 38 0)) ]}
      : SV39_Vaddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_Vaddr_bits (v : SV39_Vaddr) (x : mword 39) : SV39_Vaddr :=
   {[ v with
     SV39_Vaddr_SV39_Vaddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 0 (subrange_vec_dec x 38 0)) ]}.

Definition _get_SV39_Vaddr_VPNi (v : SV39_Vaddr) : mword 27 :=
   subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 12.

Definition _set_SV39_Vaddr_VPNi
(r_ref : register_ref regstate register_value SV39_Vaddr) (v : mword 27)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_Vaddr_SV39_Vaddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 12 (subrange_vec_dec v 26 0)) ]}
      : SV39_Vaddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_Vaddr_VPNi (v : SV39_Vaddr) (x : mword 27) : SV39_Vaddr :=
   {[ v with
     SV39_Vaddr_SV39_Vaddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 38 12 (subrange_vec_dec x 26 0)) ]}.

Definition _get_SV39_Vaddr_PgOfs (v : SV39_Vaddr) : mword 12 :=
   subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 11 0.

Definition _set_SV39_Vaddr_PgOfs
(r_ref : register_ref regstate register_value SV39_Vaddr) (v : mword 12)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_Vaddr_SV39_Vaddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_Vaddr_SV39_Vaddr_chunk_0) 11 0 (subrange_vec_dec v 11 0)) ]}
      : SV39_Vaddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_Vaddr_PgOfs (v : SV39_Vaddr) (x : mword 12) : SV39_Vaddr :=
   {[ v with
     SV39_Vaddr_SV39_Vaddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_Vaddr_SV39_Vaddr_chunk_0) 11 0 (subrange_vec_dec x 11 0)) ]}.

Definition Mk_SV39_Paddr (v : mword 56) : SV39_Paddr :=
   {| SV39_Paddr_SV39_Paddr_chunk_0 := (subrange_vec_dec v 55 0) |}.

Definition _get_SV39_Paddr_bits (v : SV39_Paddr) : mword 56 :=
   subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 55 0.

Definition _set_SV39_Paddr_bits
(r_ref : register_ref regstate register_value SV39_Paddr) (v : mword 56)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_Paddr_SV39_Paddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_Paddr_SV39_Paddr_chunk_0) 55 0 (subrange_vec_dec v 55 0)) ]}
      : SV39_Paddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_Paddr_bits (v : SV39_Paddr) (x : mword 56) : SV39_Paddr :=
   {[ v with
     SV39_Paddr_SV39_Paddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 55 0 (subrange_vec_dec x 55 0)) ]}.

Definition _get_SV39_Paddr_PPNi (v : SV39_Paddr) : mword 44 :=
   subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 55 12.

Definition _set_SV39_Paddr_PPNi
(r_ref : register_ref regstate register_value SV39_Paddr) (v : mword 44)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_Paddr_SV39_Paddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_Paddr_SV39_Paddr_chunk_0) 55 12 (subrange_vec_dec v 43 0)) ]}
      : SV39_Paddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_Paddr_PPNi (v : SV39_Paddr) (x : mword 44) : SV39_Paddr :=
   {[ v with
     SV39_Paddr_SV39_Paddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 55 12 (subrange_vec_dec x 43 0)) ]}.

Definition _get_SV39_Paddr_PgOfs (v : SV39_Paddr) : mword 12 :=
   subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 11 0.

Definition _set_SV39_Paddr_PgOfs
(r_ref : register_ref regstate register_value SV39_Paddr) (v : mword 12)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_Paddr_SV39_Paddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_Paddr_SV39_Paddr_chunk_0) 11 0 (subrange_vec_dec v 11 0)) ]}
      : SV39_Paddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_Paddr_PgOfs (v : SV39_Paddr) (x : mword 12) : SV39_Paddr :=
   {[ v with
     SV39_Paddr_SV39_Paddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_Paddr_SV39_Paddr_chunk_0) 11 0 (subrange_vec_dec x 11 0)) ]}.

Definition Mk_SV39_PTE (v : mword 64) : SV39_PTE :=
   {| SV39_PTE_SV39_PTE_chunk_0 := (subrange_vec_dec v 63 0) |}.

Definition _get_SV39_PTE_bits (v : SV39_PTE) : mword 64 :=
   subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 63 0.

Definition _set_SV39_PTE_bits (r_ref : register_ref regstate register_value SV39_PTE) (v : mword 64)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_PTE_SV39_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_PTE_SV39_PTE_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]}
      : SV39_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_PTE_bits (v : SV39_PTE) (x : mword 64) : SV39_PTE :=
   {[ v with
     SV39_PTE_SV39_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}.

Definition _get_SV39_PTE_Ext (v : SV39_PTE) : mword 10 :=
   subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 63 54.

Definition _set_SV39_PTE_Ext (r_ref : register_ref regstate register_value SV39_PTE) (v : mword 10)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_PTE_SV39_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_PTE_SV39_PTE_chunk_0) 63 54 (subrange_vec_dec v 9 0)) ]}
      : SV39_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_PTE_Ext (v : SV39_PTE) (x : mword 10) : SV39_PTE :=
   {[ v with
     SV39_PTE_SV39_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 63 54 (subrange_vec_dec x 9 0)) ]}.

Definition _get_SV39_PTE_PPNi (v : SV39_PTE) : mword 44 :=
   subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 53 10.

Definition _set_SV39_PTE_PPNi (r_ref : register_ref regstate register_value SV39_PTE) (v : mword 44)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_PTE_SV39_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_PTE_SV39_PTE_chunk_0) 53 10 (subrange_vec_dec v 43 0)) ]}
      : SV39_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_PTE_PPNi (v : SV39_PTE) (x : mword 44) : SV39_PTE :=
   {[ v with
     SV39_PTE_SV39_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 53 10 (subrange_vec_dec x 43 0)) ]}.

Definition _get_SV39_PTE_RSW (v : SV39_PTE) : mword 2 :=
   subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 9 8.

Definition _set_SV39_PTE_RSW (r_ref : register_ref regstate register_value SV39_PTE) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_PTE_SV39_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_PTE_SV39_PTE_chunk_0) 9 8 (subrange_vec_dec v 1 0)) ]}
      : SV39_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_PTE_RSW (v : SV39_PTE) (x : mword 2) : SV39_PTE :=
   {[ v with
     SV39_PTE_SV39_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 9 8 (subrange_vec_dec x 1 0)) ]}.

Definition _get_SV39_PTE_BITS (v : SV39_PTE) : mword 8 :=
   subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 7 0.

Definition _set_SV39_PTE_BITS (r_ref : register_ref regstate register_value SV39_PTE) (v : mword 8)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV39_PTE_SV39_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV39_PTE_SV39_PTE_chunk_0) 7 0 (subrange_vec_dec v 7 0)) ]}
      : SV39_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV39_PTE_BITS (v : SV39_PTE) (x : mword 8) : SV39_PTE :=
   {[ v with
     SV39_PTE_SV39_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV39_PTE_SV39_PTE_chunk_0) 7 0 (subrange_vec_dec x 7 0)) ]}.

Definition SV48_LEVEL_BITS := 9.
Hint Unfold SV48_LEVEL_BITS : sail.
Definition SV48_LEVELS := 4.
Hint Unfold SV48_LEVELS : sail.
Definition PTE48_LOG_SIZE := 3.
Hint Unfold PTE48_LOG_SIZE : sail.
Definition PTE48_SIZE := 8.
Hint Unfold PTE48_SIZE : sail.
Definition Mk_SV48_Vaddr (v : mword 48) : SV48_Vaddr :=
   {| SV48_Vaddr_SV48_Vaddr_chunk_0 := (subrange_vec_dec v 47 0) |}.

Definition _get_SV48_Vaddr_bits (v : SV48_Vaddr) : mword 48 :=
   subrange_vec_dec v.(SV48_Vaddr_SV48_Vaddr_chunk_0) 47 0.

Definition _set_SV48_Vaddr_bits
(r_ref : register_ref regstate register_value SV48_Vaddr) (v : mword 48)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_Vaddr_SV48_Vaddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_Vaddr_SV48_Vaddr_chunk_0) 47 0 (subrange_vec_dec v 47 0)) ]}
      : SV48_Vaddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_Vaddr_bits (v : SV48_Vaddr) (x : mword 48) : SV48_Vaddr :=
   {[ v with
     SV48_Vaddr_SV48_Vaddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_Vaddr_SV48_Vaddr_chunk_0) 47 0 (subrange_vec_dec x 47 0)) ]}.

Definition _get_SV48_Vaddr_VPNi (v : SV48_Vaddr) : mword 27 :=
   subrange_vec_dec v.(SV48_Vaddr_SV48_Vaddr_chunk_0) 38 12.

Definition _set_SV48_Vaddr_VPNi
(r_ref : register_ref regstate register_value SV48_Vaddr) (v : mword 27)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_Vaddr_SV48_Vaddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_Vaddr_SV48_Vaddr_chunk_0) 38 12 (subrange_vec_dec v 26 0)) ]}
      : SV48_Vaddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_Vaddr_VPNi (v : SV48_Vaddr) (x : mword 27) : SV48_Vaddr :=
   {[ v with
     SV48_Vaddr_SV48_Vaddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_Vaddr_SV48_Vaddr_chunk_0) 38 12 (subrange_vec_dec x 26 0)) ]}.

Definition _get_SV48_Vaddr_PgOfs (v : SV48_Vaddr) : mword 12 :=
   subrange_vec_dec v.(SV48_Vaddr_SV48_Vaddr_chunk_0) 11 0.

Definition _set_SV48_Vaddr_PgOfs
(r_ref : register_ref regstate register_value SV48_Vaddr) (v : mword 12)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_Vaddr_SV48_Vaddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_Vaddr_SV48_Vaddr_chunk_0) 11 0 (subrange_vec_dec v 11 0)) ]}
      : SV48_Vaddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_Vaddr_PgOfs (v : SV48_Vaddr) (x : mword 12) : SV48_Vaddr :=
   {[ v with
     SV48_Vaddr_SV48_Vaddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_Vaddr_SV48_Vaddr_chunk_0) 11 0 (subrange_vec_dec x 11 0)) ]}.

Definition Mk_SV48_Paddr (v : mword 56) : SV48_Paddr :=
   {| SV48_Paddr_SV48_Paddr_chunk_0 := (subrange_vec_dec v 55 0) |}.

Definition _get_SV48_Paddr_bits (v : SV48_Paddr) : mword 56 :=
   subrange_vec_dec v.(SV48_Paddr_SV48_Paddr_chunk_0) 55 0.

Definition _set_SV48_Paddr_bits
(r_ref : register_ref regstate register_value SV48_Paddr) (v : mword 56)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_Paddr_SV48_Paddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_Paddr_SV48_Paddr_chunk_0) 55 0 (subrange_vec_dec v 55 0)) ]}
      : SV48_Paddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_Paddr_bits (v : SV48_Paddr) (x : mword 56) : SV48_Paddr :=
   {[ v with
     SV48_Paddr_SV48_Paddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_Paddr_SV48_Paddr_chunk_0) 55 0 (subrange_vec_dec x 55 0)) ]}.

Definition _get_SV48_Paddr_PPNi (v : SV48_Paddr) : mword 44 :=
   subrange_vec_dec v.(SV48_Paddr_SV48_Paddr_chunk_0) 55 12.

Definition _set_SV48_Paddr_PPNi
(r_ref : register_ref regstate register_value SV48_Paddr) (v : mword 44)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_Paddr_SV48_Paddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_Paddr_SV48_Paddr_chunk_0) 55 12 (subrange_vec_dec v 43 0)) ]}
      : SV48_Paddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_Paddr_PPNi (v : SV48_Paddr) (x : mword 44) : SV48_Paddr :=
   {[ v with
     SV48_Paddr_SV48_Paddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_Paddr_SV48_Paddr_chunk_0) 55 12 (subrange_vec_dec x 43 0)) ]}.

Definition _get_SV48_Paddr_PgOfs (v : SV48_Paddr) : mword 12 :=
   subrange_vec_dec v.(SV48_Paddr_SV48_Paddr_chunk_0) 11 0.

Definition _set_SV48_Paddr_PgOfs
(r_ref : register_ref regstate register_value SV48_Paddr) (v : mword 12)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_Paddr_SV48_Paddr_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_Paddr_SV48_Paddr_chunk_0) 11 0 (subrange_vec_dec v 11 0)) ]}
      : SV48_Paddr in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_Paddr_PgOfs (v : SV48_Paddr) (x : mword 12) : SV48_Paddr :=
   {[ v with
     SV48_Paddr_SV48_Paddr_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_Paddr_SV48_Paddr_chunk_0) 11 0 (subrange_vec_dec x 11 0)) ]}.

Definition Mk_SV48_PTE (v : mword 64) : SV48_PTE :=
   {| SV48_PTE_SV48_PTE_chunk_0 := (subrange_vec_dec v 63 0) |}.

Definition _get_SV48_PTE_bits (v : SV48_PTE) : mword 64 :=
   subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 63 0.

Definition _set_SV48_PTE_bits (r_ref : register_ref regstate register_value SV48_PTE) (v : mword 64)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_PTE_SV48_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_PTE_SV48_PTE_chunk_0) 63 0 (subrange_vec_dec v 63 0)) ]}
      : SV48_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_PTE_bits (v : SV48_PTE) (x : mword 64) : SV48_PTE :=
   {[ v with
     SV48_PTE_SV48_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 63 0 (subrange_vec_dec x 63 0)) ]}.

Definition _get_SV48_PTE_Ext (v : SV48_PTE) : mword 10 :=
   subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 63 54.

Definition _set_SV48_PTE_Ext (r_ref : register_ref regstate register_value SV48_PTE) (v : mword 10)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_PTE_SV48_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_PTE_SV48_PTE_chunk_0) 63 54 (subrange_vec_dec v 9 0)) ]}
      : SV48_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_PTE_Ext (v : SV48_PTE) (x : mword 10) : SV48_PTE :=
   {[ v with
     SV48_PTE_SV48_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 63 54 (subrange_vec_dec x 9 0)) ]}.

Definition _get_SV48_PTE_PPNi (v : SV48_PTE) : mword 44 :=
   subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 53 10.

Definition _set_SV48_PTE_PPNi (r_ref : register_ref regstate register_value SV48_PTE) (v : mword 44)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_PTE_SV48_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_PTE_SV48_PTE_chunk_0) 53 10 (subrange_vec_dec v 43 0)) ]}
      : SV48_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_PTE_PPNi (v : SV48_PTE) (x : mword 44) : SV48_PTE :=
   {[ v with
     SV48_PTE_SV48_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 53 10 (subrange_vec_dec x 43 0)) ]}.

Definition _get_SV48_PTE_RSW (v : SV48_PTE) : mword 2 :=
   subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 9 8.

Definition _set_SV48_PTE_RSW (r_ref : register_ref regstate register_value SV48_PTE) (v : mword 2)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_PTE_SV48_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_PTE_SV48_PTE_chunk_0) 9 8 (subrange_vec_dec v 1 0)) ]}
      : SV48_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_PTE_RSW (v : SV48_PTE) (x : mword 2) : SV48_PTE :=
   {[ v with
     SV48_PTE_SV48_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 9 8 (subrange_vec_dec x 1 0)) ]}.

Definition _get_SV48_PTE_BITS (v : SV48_PTE) : mword 8 :=
   subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 7 0.

Definition _set_SV48_PTE_BITS (r_ref : register_ref regstate register_value SV48_PTE) (v : mword 8)
: M (unit) :=
   (reg_deref r_ref) >>= fun r =>
   let r :=
     {[ r with
       SV48_PTE_SV48_PTE_chunk_0 :=
         (update_subrange_vec_dec r.(SV48_PTE_SV48_PTE_chunk_0) 7 0 (subrange_vec_dec v 7 0)) ]}
      : SV48_PTE in
   write_reg r_ref r
    : M (unit).

Definition _update_SV48_PTE_BITS (v : SV48_PTE) (x : mword 8) : SV48_PTE :=
   {[ v with
     SV48_PTE_SV48_PTE_chunk_0 :=
       (update_subrange_vec_dec v.(SV48_PTE_SV48_PTE_chunk_0) 7 0 (subrange_vec_dec x 7 0)) ]}.

Definition make_TLB_Entry {asidlen : Z} {valen : Z} {palen : Z} {ptelen : Z}
(asid : mword asidlen) (global : bool) (vAddr : mword valen) (pAddr : mword palen)
(pte : mword ptelen) (level : Z) (pteAddr : mword palen) (levelBitSize : Z)
`{ArithFact (valen >? 0)} `{ArithFact (0 <=? level)} `{ArithFact (0 <=? levelBitSize)}
: M (TLB_Entry asidlen valen palen ptelen) :=
   let shift := Z.add PAGESIZE_BITS (Z.mul level levelBitSize) in
   let vAddrMask : bits valen :=
     sub_vec_int
       (shiftl (xor_vec vAddr (xor_vec vAddr (EXTZ (length_mword vAddr) ('b"1"  : mword 1)))) shift)
       1 in
   let vMatchMask : bits valen := not_vec vAddrMask in
   ((read_reg mcycle_ref)  : M (mword 64)) >>= fun w__0 : mword 64 =>
   returnm ({| TLB_Entry_asid := asid; 
               TLB_Entry_global := global; 
               TLB_Entry_pte := pte; 
               TLB_Entry_pteAddr := pteAddr; 
               TLB_Entry_vAddrMask := vAddrMask; 
               TLB_Entry_vMatchMask := vMatchMask; 
               TLB_Entry_vAddr := (and_vec vAddr vMatchMask); 
               TLB_Entry_pAddr := (shiftl (shiftr pAddr shift) shift); 
               TLB_Entry_age := w__0 |}).

Definition match_TLB_Entry {asidlen : Z} {valen : Z} {palen : Z} {ptelen : Z}
(ent : TLB_Entry asidlen valen palen ptelen) (asid : mword asidlen) (vaddr : mword valen)
: bool :=
   andb (orb ent.(TLB_Entry_global) (eq_vec ent.(TLB_Entry_asid) asid))
     (eq_vec ent.(TLB_Entry_vAddr) (and_vec ent.(TLB_Entry_vMatchMask) vaddr)).

Definition flush_TLB_Entry {asidlen : Z} {valen : Z} {palen : Z} {ptelen : Z}
(e : TLB_Entry asidlen valen palen ptelen) (asid : option (mword asidlen))
(addr : option (mword valen))
: bool :=
   match (asid, addr) with
   | (None, None) => true
   | (None, Some a) => eq_vec e.(TLB_Entry_vAddr) (and_vec e.(TLB_Entry_vMatchMask) a)
   | (Some i, None) => andb (eq_vec e.(TLB_Entry_asid) i) (negb e.(TLB_Entry_global))
   | (Some i, Some a) =>
      andb (eq_vec e.(TLB_Entry_asid) i)
        (andb (eq_vec e.(TLB_Entry_vAddr) (and_vec a e.(TLB_Entry_vMatchMask)))
           (negb e.(TLB_Entry_global)))
   end.

Definition to_phys_addr (a : mword 34) : mword 32 := subrange_vec_dec a 31 0.

Fixpoint _rec_walk32
(vaddr : mword 32) (ac : AccessType unit) (priv : Privilege) (mxr : bool) (do_sum : bool)
(ptb : mword 34) (level : Z) (global : bool) (ext_ptw : unit) (_reclimit : Z)
`{ArithFact (0 <=? level)} (_acc : Acc (Zwf 0) _reclimit)
{struct _acc} : M (PTW_Result (mword 34) SV32_PTE).
exact (
   assert_exp' (Z.geb _reclimit 0) "recursion limit reached" >>= fun _ =>
   let va := Mk_SV32_Vaddr vaddr in
   let pt_ofs : paddr32 :=
     shiftl
       (EXTZ 34
          (subrange_vec_dec (shiftr (_get_SV32_Vaddr_VPNi va) (Z.mul level SV32_LEVEL_BITS))
             (Z.sub SV32_LEVEL_BITS 1) 0)) PTE32_LOG_SIZE in
   let pte_addr := add_vec ptb pt_ofs in
   (mem_read_priv (Read Data) Supervisor (to_phys_addr pte_addr) 4 false false false) >>= fun w__0 : MemoryOpResult (mword (8 * 4)) =>
   (match w__0 with
    | MemException _ => returnm (PTW_Failure (PTW_Access tt, ext_ptw))
    | MemValue v =>
       let pte := Mk_SV32_PTE v in
       let pbits := _get_SV32_PTE_BITS pte in
       let ext_pte : extPte := default_sv32_ext_pte in
       let pattr := Mk_PTE_Bits pbits in
       let is_global := orb global (eq_vec (_get_PTE_Bits_G pattr) ('b"1"  : mword 1)) in
       (if isInvalidPTE pbits ext_pte then returnm (PTW_Failure (PTW_Invalid_PTE tt, ext_ptw))
        else if isPTEPtr pbits ext_pte then
          (if sumbool_of_bool (Z.gtb level 0) then
             (_rec_walk32 vaddr ac priv mxr do_sum
                (shiftl (EXTZ 34 (_get_SV32_PTE_PPNi pte)) PAGESIZE_BITS) (Z.sub level 1) is_global
                ext_ptw (Z.sub _reclimit 1) _ (_limit_reduces _acc))
              : M (PTW_Result (mword 34) SV32_PTE)
           else returnm (PTW_Failure (PTW_Invalid_PTE tt, ext_ptw)))
           : M (PTW_Result (mword 34) SV32_PTE)
        else
          (checkPTEPermission ac priv mxr do_sum pattr ext_pte ext_ptw) >>= fun w__3 : PTE_Check =>
          returnm (match w__3 with
                   | PTE_Check_Failure (ext_ptw, ext_ptw_fail) =>
                      PTW_Failure (ext_get_ptw_error ext_ptw_fail, ext_ptw)
                   | PTE_Check_Success ext_ptw =>
                      if sumbool_of_bool (Z.gtb level 0) then
                        let mask :=
                          sub_vec_int
                            (shiftl
                               (xor_vec (_get_SV32_PTE_PPNi pte)
                                  (xor_vec (_get_SV32_PTE_PPNi pte) (EXTZ 22 ('b"1"  : mword 1))))
                               (Z.mul level SV32_LEVEL_BITS)) 1 in
                        if neq_vec (and_vec (_get_SV32_PTE_PPNi pte) mask)
                             (EXTZ 22 ('b"0"  : mword 1)) then
                          PTW_Failure (PTW_Misaligned tt, ext_ptw)
                        else
                          let ppn :=
                            or_vec (_get_SV32_PTE_PPNi pte)
                              (and_vec (EXTZ 22 (_get_SV32_Vaddr_VPNi va)) mask) in
                          PTW_Success
                            (concat_vec ppn (_get_SV32_Vaddr_PgOfs va), pte, pte_addr, build_ex
                            level, is_global, ext_ptw)
                      else
                        PTW_Success
                          (concat_vec (_get_SV32_PTE_PPNi pte) (_get_SV32_Vaddr_PgOfs va), pte, pte_addr, build_ex
                          level, is_global, ext_ptw)
                   end))
        : M (PTW_Result (mword 34) SV32_PTE)
    end)
    : M (PTW_Result (mword 34) SV32_PTE)
).
Defined.


Definition walk32
(_arg0 : mword 32) (_arg1 : AccessType unit) (_arg2 : Privilege) (_arg3 : bool) (_arg4 : bool)
(_arg5 : mword 34) (level : Z) (_arg7 : bool) (_arg8 : unit) `{ArithFact (0 <=? level)}
: M (PTW_Result (mword 34) SV32_PTE) :=
   (_rec_walk32 _arg0 _arg1 _arg2 _arg3 _arg4 _arg5 level _arg7 _arg8 (level  : Z) (Zwf_guarded _))
    : M (PTW_Result (mword 34) SV32_PTE).

Definition lookup_TLB32 (asid : mword 9) (vaddr : mword 32)
: M (option (({n : Z & ArithFact (n >=? 0)} * TLB_Entry 9 32 34 32))) :=
   read_reg tlb32_ref >>= fun w__0 : option (TLB_Entry 9 32 34 32) =>
   returnm (match w__0 with
            | None => None
            | Some e => if match_TLB_Entry e asid vaddr then Some (build_ex 0, e) else None
            end).

Definition add_to_TLB32
(asid : mword 9) (vAddr : mword 32) (pAddr : mword 34) (pte : SV32_PTE) (pteAddr : mword 34)
(level : Z) (global : bool) `{ArithFact (0 <=? level)}
: M (unit) :=
   (make_TLB_Entry asid global vAddr pAddr (_get_SV32_PTE_bits pte) level pteAddr SV32_LEVEL_BITS) >>= fun ent : TLB32_Entry =>
   write_reg tlb32_ref (Some ent)
    : M (unit).

Definition write_TLB32 (idx : Z) (ent : TLB_Entry 9 32 34 32) `{ArithFact (0 <=? idx)} : M (unit) :=
   write_reg tlb32_ref (Some ent)  : M (unit).

Definition flush_TLB32 (asid : option (mword 9)) (addr : option (mword 32)) : M (unit) :=
   read_reg tlb32_ref >>= fun w__0 : option (TLB_Entry 9 32 34 32) =>
   (match w__0 with
    | None => returnm tt
    | Some e =>
       (if flush_TLB_Entry e asid addr then write_reg tlb32_ref None  : M (unit)
        else returnm tt)
        : M (unit)
    end)
    : M (unit).

Definition translate32
(asid : mword 9) (ptb : mword 34) (vAddr : mword 32) (ac : AccessType unit) (priv : Privilege)
(mxr : bool) (do_sum : bool) (level : Z) (ext_ptw : unit) `{ArithFact (0 <=? level)}
: M (TR_Result (mword 34) PTW_Error) :=
   (lookup_TLB32 asid vAddr) >>= fun w__0 : option (({n : Z & ArithFact (n >=? 0)} * TLB_Entry 9 32 34 32)) =>
   (match w__0 with
    | Some (existT _ idx _, ent) =>
       let pte := Mk_SV32_PTE ent.(TLB_Entry_pte) in
       let ext_pte : extPte := zeros_implicit 10 in
       let pteBits := Mk_PTE_Bits (_get_SV32_PTE_BITS pte) in
       (checkPTEPermission ac priv mxr do_sum pteBits ext_pte ext_ptw) >>= fun w__1 : PTE_Check =>
       (match w__1 with
        | PTE_Check_Failure (ext_ptw, ext_ptw_fail) =>
           returnm (TR_Failure (ext_get_ptw_error ext_ptw_fail, ext_ptw))
        | PTE_Check_Success ext_ptw =>
           (match (update_PTE_Bits pteBits ac ext_pte) with
            | None =>
               returnm (TR_Address
                          (or_vec ent.(TLB_Entry_pAddr)
                             (EXTZ 34 (and_vec vAddr ent.(TLB_Entry_vAddrMask))), ext_ptw))
            | Some (pbits, ext) =>
               (if negb (plat_enable_dirty_update tt) then
                  returnm (TR_Failure (PTW_PTE_Update tt, ext_ptw))
                else
                  let n_pte := _update_SV32_PTE_BITS pte (_get_PTE_Bits_bits pbits) in
                  let n_ent : TLB32_Entry := ent in
                  let n_ent :=
                    {[ n_ent with TLB_Entry_pte := (_get_SV32_PTE_bits n_pte) ]}
                     : TLB_Entry 9 32 34 32 in
                  (write_TLB32 idx n_ent) >>
                  (mem_write_value_priv (to_phys_addr (EXTZ 34 ent.(TLB_Entry_pteAddr))) 4
                     (_get_SV32_PTE_bits n_pte) Supervisor false false false) >>= fun w__2 : MemoryOpResult bool =>
                  (match w__2 with
                   | MemValue _ => returnm tt
                   | MemException e =>
                      (internal_error "invalid physical address in TLB")  : M (unit)
                   end) >>
                  returnm (TR_Address
                             (or_vec ent.(TLB_Entry_pAddr)
                                (EXTZ 34 (and_vec vAddr ent.(TLB_Entry_vAddrMask))), ext_ptw)))
                : M (TR_Result (mword 34) PTW_Error)
            end)
            : M (TR_Result (mword 34) PTW_Error)
        end)
        : M (TR_Result (mword 34) PTW_Error)
    | None =>
       (walk32 vAddr ac priv mxr do_sum ptb level false ext_ptw) >>= fun w__6 : PTW_Result (mword 34) SV32_PTE =>
       (match w__6 with
        | PTW_Failure (f, ext_ptw) => returnm (TR_Failure (f, ext_ptw))
        | PTW_Success (pAddr, pte, pteAddr, existT _ level _, global, ext_ptw) =>
           (match (update_PTE_Bits (Mk_PTE_Bits (_get_SV32_PTE_BITS pte)) ac (zeros_implicit 10)) with
            | None =>
               (add_to_TLB32 asid vAddr pAddr pte pteAddr level global) >>
               returnm (TR_Address (pAddr, ext_ptw))
            | Some (pbits, ext) =>
               (if negb (plat_enable_dirty_update tt) then
                  returnm (TR_Failure (PTW_PTE_Update tt, ext_ptw))
                else
                  let w_pte : SV32_PTE := _update_SV32_PTE_BITS pte (_get_PTE_Bits_bits pbits) in
                  (mem_write_value_priv (to_phys_addr pteAddr) 4 (_get_SV32_PTE_bits w_pte)
                     Supervisor false false false) >>= fun w__7 : MemoryOpResult bool =>
                  (match w__7 with
                   | MemValue _ =>
                      (add_to_TLB32 asid vAddr pAddr w_pte pteAddr level global) >>
                      returnm (TR_Address (pAddr, ext_ptw))
                   | MemException e => returnm (TR_Failure (PTW_Access tt, ext_ptw))
                   end)
                   : M (TR_Result (mword 34) PTW_Error))
                : M (TR_Result (mword 34) PTW_Error)
            end)
            : M (TR_Result (mword 34) PTW_Error)
        end)
        : M (TR_Result (mword 34) PTW_Error)
    end)
    : M (TR_Result (mword 34) PTW_Error).

Definition init_vmem_sv32 '(tt : unit) : M (unit) := write_reg tlb32_ref None  : M (unit).

Definition legalize_satp (a : Architecture) (o : mword 32) (v : mword 32) : mword 32 :=
   legalize_satp32 a o v.

Definition translationMode (priv : Privilege) : M (SATPMode) :=
   (if generic_eq priv Machine then returnm Sbare
    else
      read_reg mstatus_ref >>= fun w__0 : Mstatus =>
      let arch := architecture (get_mstatus_SXL w__0) in
      (match arch with
       | Some RV32 =>
          ((read_reg satp_ref)  : M (mword 32)) >>= fun w__1 : mword 32 =>
          let s := Mk_Satp32 (subrange_vec_dec w__1 31 0) in
          returnm (if eq_vec (_get_Satp32_Mode s) ('b"0"  : mword 1) then Sbare else Sv32)
       | _ => (internal_error "unsupported address translation arch")  : M (SATPMode)
       end)
       : M (SATPMode))
    : M (SATPMode).

Definition translateAddr_priv (vAddr : mword 32) (ac : AccessType unit) (effPriv : Privilege)
: M (TR_Result (mword 32) ExceptionType) :=
   read_reg mstatus_ref >>= fun w__0 : Mstatus =>
   let mxr : bool := eq_vec (_get_Mstatus_MXR w__0) ('b"1"  : mword 1) in
   read_reg mstatus_ref >>= fun w__1 : Mstatus =>
   let do_sum : bool := eq_vec (_get_Mstatus_SUM w__1) ('b"1"  : mword 1) in
   (translationMode effPriv) >>= fun mode : SATPMode =>
   ((read_reg satp_ref)  : M (mword 32)) >>= fun w__2 : mword 32 =>
   let asid := curAsid32 w__2 in
   ((read_reg satp_ref)  : M (mword 32)) >>= fun w__3 : mword 32 =>
   let ptb := curPTB32 w__3 in
   let ext_ptw : ext_ptw := init_ext_ptw in
   (match mode with
    | Sbare => returnm (TR_Address (vAddr, ext_ptw))
    | Sv32 =>
       (translate32 asid ptb vAddr ac effPriv mxr do_sum (Z.sub SV32_LEVELS 1) ext_ptw) >>= fun w__4 : TR_Result (mword 34) PTW_Error =>
       returnm (match w__4 with
                | TR_Address (pa, ext_ptw) => TR_Address (to_phys_addr pa, ext_ptw)
                | TR_Failure (f, ext_ptw) => TR_Failure (translationException ac f, ext_ptw)
                end)
    | _ =>
       (internal_error "unsupported address translation scheme")
        : M (TR_Result (mword 32) ExceptionType)
    end)
    : M (TR_Result (mword 32) ExceptionType).

Definition translateAddr (vAddr : mword 32) (ac : AccessType unit)
: M (TR_Result (mword 32) ExceptionType) :=
   read_reg mstatus_ref >>= fun w__0 : Mstatus =>
   read_reg cur_privilege_ref >>= fun w__1 : Privilege =>
   (effectivePrivilege ac w__0 w__1) >>= fun w__2 : Privilege =>
   (translateAddr_priv vAddr ac w__2)
    : M (TR_Result (mword 32) ExceptionType).

Definition flush_TLB (asid_xlen : option (mword 32)) (addr_xlen : option (mword 32)) : M (unit) :=
   let asid : option asid32 :=
     match asid_xlen with | None => None | Some a => Some (subrange_vec_dec a 8 0) end in
   (flush_TLB32 asid addr_xlen)
    : M (unit).

Definition init_vmem '(tt : unit) : M (unit) := (init_vmem_sv32 tt)  : M (unit).

Definition encdec_uop_forwards (arg_ : uop) : mword 7 :=
   match arg_ with | RISCV_LUI => 'b"0110111"  : mword 7 | RISCV_AUIPC => 'b"0010111"  : mword 7 end.

Definition encdec_uop_backwards (arg_ : mword 7) : M (uop) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"0110111"  : mword 7) then returnm RISCV_LUI
    else if eq_vec b__0 ('b"0010111"  : mword 7) then returnm RISCV_AUIPC
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (uop).

Definition encdec_uop_forwards_matches (arg_ : uop) : bool :=
   match arg_ with | RISCV_LUI => true | RISCV_AUIPC => true end.

Definition encdec_uop_backwards_matches (arg_ : mword 7) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"0110111"  : mword 7) then true
   else if eq_vec b__0 ('b"0010111"  : mword 7) then true
   else false.

Definition utype_mnemonic_forwards (arg_ : uop) : string :=
   match arg_ with | RISCV_LUI => "lui" | RISCV_AUIPC => "auipc" end.

Definition utype_mnemonic_backwards (arg_ : string) : M (uop) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "lui" then returnm RISCV_LUI
    else if generic_eq p0_ "auipc" then returnm RISCV_AUIPC
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (uop).

Definition utype_mnemonic_forwards_matches (arg_ : uop) : bool :=
   match arg_ with | RISCV_LUI => true | RISCV_AUIPC => true end.

Definition utype_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "lui" then true
   else if generic_eq p0_ "auipc" then true
   else false.

Definition _s761_ (_s762_ : string) : option string :=
   let _s763_ := _s762_ in
   if string_startswith _s763_ "auipc" then
     match (string_drop _s763_ (projT1 (string_length "auipc"))) with | s_ => Some s_ end
   else None.

Definition _s757_ (_s758_ : string) : option string :=
   let _s759_ := _s758_ in
   if string_startswith _s759_ "lui" then
     match (string_drop _s759_ (projT1 (string_length "lui"))) with | s_ => Some s_ end
   else None.

Definition utype_mnemonic_matches_prefix (arg_ : string)
: M (option ((uop * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s760_ := arg_ in
   (if match (_s757_ _s760_) with | Some s_ => true | _ => false end then
      (match (_s757_ _s760_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_LUI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((uop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((uop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s761_ _s760_) with | Some s_ => true | _ => false end then
      (match (_s761_ _s760_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_AUIPC, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((uop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((uop * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((uop * {n : Z & ArithFact (n >=? 0)}))).

Definition encdec_bop_forwards (arg_ : bop) : mword 3 :=
   match arg_ with
   | RISCV_BEQ => 'b"000"  : mword 3
   | RISCV_BNE => 'b"001"  : mword 3
   | RISCV_BLT => 'b"100"  : mword 3
   | RISCV_BGE => 'b"101"  : mword 3
   | RISCV_BLTU => 'b"110"  : mword 3
   | RISCV_BGEU => 'b"111"  : mword 3
   end.

Definition encdec_bop_backwards (arg_ : mword 3) : M (bop) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"000"  : mword 3) then returnm RISCV_BEQ
    else if eq_vec b__0 ('b"001"  : mword 3) then returnm RISCV_BNE
    else if eq_vec b__0 ('b"100"  : mword 3) then returnm RISCV_BLT
    else if eq_vec b__0 ('b"101"  : mword 3) then returnm RISCV_BGE
    else if eq_vec b__0 ('b"110"  : mword 3) then returnm RISCV_BLTU
    else if eq_vec b__0 ('b"111"  : mword 3) then returnm RISCV_BGEU
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (bop).

Definition encdec_bop_forwards_matches (arg_ : bop) : bool :=
   match arg_ with
   | RISCV_BEQ => true
   | RISCV_BNE => true
   | RISCV_BLT => true
   | RISCV_BGE => true
   | RISCV_BLTU => true
   | RISCV_BGEU => true
   end.

Definition encdec_bop_backwards_matches (arg_ : mword 3) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"000"  : mword 3) then true
   else if eq_vec b__0 ('b"001"  : mword 3) then true
   else if eq_vec b__0 ('b"100"  : mword 3) then true
   else if eq_vec b__0 ('b"101"  : mword 3) then true
   else if eq_vec b__0 ('b"110"  : mword 3) then true
   else if eq_vec b__0 ('b"111"  : mword 3) then true
   else false.

Definition btype_mnemonic_forwards (arg_ : bop) : string :=
   match arg_ with
   | RISCV_BEQ => "beq"
   | RISCV_BNE => "bne"
   | RISCV_BLT => "blt"
   | RISCV_BGE => "bge"
   | RISCV_BLTU => "bltu"
   | RISCV_BGEU => "bgeu"
   end.

Definition btype_mnemonic_backwards (arg_ : string) : M (bop) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "beq" then returnm RISCV_BEQ
    else if generic_eq p0_ "bne" then returnm RISCV_BNE
    else if generic_eq p0_ "blt" then returnm RISCV_BLT
    else if generic_eq p0_ "bge" then returnm RISCV_BGE
    else if generic_eq p0_ "bltu" then returnm RISCV_BLTU
    else if generic_eq p0_ "bgeu" then returnm RISCV_BGEU
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (bop).

Definition btype_mnemonic_forwards_matches (arg_ : bop) : bool :=
   match arg_ with
   | RISCV_BEQ => true
   | RISCV_BNE => true
   | RISCV_BLT => true
   | RISCV_BGE => true
   | RISCV_BLTU => true
   | RISCV_BGEU => true
   end.

Definition btype_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "beq" then true
   else if generic_eq p0_ "bne" then true
   else if generic_eq p0_ "blt" then true
   else if generic_eq p0_ "bge" then true
   else if generic_eq p0_ "bltu" then true
   else if generic_eq p0_ "bgeu" then true
   else false.

Definition _s785_ (_s786_ : string) : option string :=
   let _s787_ := _s786_ in
   if string_startswith _s787_ "bgeu" then
     match (string_drop _s787_ (projT1 (string_length "bgeu"))) with | s_ => Some s_ end
   else None.

Definition _s781_ (_s782_ : string) : option string :=
   let _s783_ := _s782_ in
   if string_startswith _s783_ "bltu" then
     match (string_drop _s783_ (projT1 (string_length "bltu"))) with | s_ => Some s_ end
   else None.

Definition _s777_ (_s778_ : string) : option string :=
   let _s779_ := _s778_ in
   if string_startswith _s779_ "bge" then
     match (string_drop _s779_ (projT1 (string_length "bge"))) with | s_ => Some s_ end
   else None.

Definition _s773_ (_s774_ : string) : option string :=
   let _s775_ := _s774_ in
   if string_startswith _s775_ "blt" then
     match (string_drop _s775_ (projT1 (string_length "blt"))) with | s_ => Some s_ end
   else None.

Definition _s769_ (_s770_ : string) : option string :=
   let _s771_ := _s770_ in
   if string_startswith _s771_ "bne" then
     match (string_drop _s771_ (projT1 (string_length "bne"))) with | s_ => Some s_ end
   else None.

Definition _s765_ (_s766_ : string) : option string :=
   let _s767_ := _s766_ in
   if string_startswith _s767_ "beq" then
     match (string_drop _s767_ (projT1 (string_length "beq"))) with | s_ => Some s_ end
   else None.

Definition btype_mnemonic_matches_prefix (arg_ : string)
: M (option ((bop * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s768_ := arg_ in
   (if match (_s765_ _s768_) with | Some s_ => true | _ => false end then
      (match (_s765_ _s768_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_BEQ, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s769_ _s768_) with | Some s_ => true | _ => false end then
      (match (_s769_ _s768_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_BNE, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s773_ _s768_) with | Some s_ => true | _ => false end then
      (match (_s773_ _s768_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_BLT, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s777_ _s768_) with | Some s_ => true | _ => false end then
      (match (_s777_ _s768_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_BGE, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s781_ _s768_) with | Some s_ => true | _ => false end then
      (match (_s781_ _s768_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_BLTU, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s785_ _s768_) with | Some s_ => true | _ => false end then
      (match (_s785_ _s768_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_BGEU, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bop * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((bop * {n : Z & ArithFact (n >=? 0)}))).

Definition encdec_iop_forwards (arg_ : iop) : mword 3 :=
   match arg_ with
   | RISCV_ADDI => 'b"000"  : mword 3
   | RISCV_SLTI => 'b"010"  : mword 3
   | RISCV_SLTIU => 'b"011"  : mword 3
   | RISCV_ANDI => 'b"111"  : mword 3
   | RISCV_ORI => 'b"110"  : mword 3
   | RISCV_XORI => 'b"100"  : mword 3
   end.

Definition encdec_iop_backwards (arg_ : mword 3) : M (iop) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"000"  : mword 3) then returnm RISCV_ADDI
    else if eq_vec b__0 ('b"010"  : mword 3) then returnm RISCV_SLTI
    else if eq_vec b__0 ('b"011"  : mword 3) then returnm RISCV_SLTIU
    else if eq_vec b__0 ('b"111"  : mword 3) then returnm RISCV_ANDI
    else if eq_vec b__0 ('b"110"  : mword 3) then returnm RISCV_ORI
    else if eq_vec b__0 ('b"100"  : mword 3) then returnm RISCV_XORI
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (iop).

Definition encdec_iop_forwards_matches (arg_ : iop) : bool :=
   match arg_ with
   | RISCV_ADDI => true
   | RISCV_SLTI => true
   | RISCV_SLTIU => true
   | RISCV_ANDI => true
   | RISCV_ORI => true
   | RISCV_XORI => true
   end.

Definition encdec_iop_backwards_matches (arg_ : mword 3) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"000"  : mword 3) then true
   else if eq_vec b__0 ('b"010"  : mword 3) then true
   else if eq_vec b__0 ('b"011"  : mword 3) then true
   else if eq_vec b__0 ('b"111"  : mword 3) then true
   else if eq_vec b__0 ('b"110"  : mword 3) then true
   else if eq_vec b__0 ('b"100"  : mword 3) then true
   else false.

Definition itype_mnemonic_forwards (arg_ : iop) : string :=
   match arg_ with
   | RISCV_ADDI => "addi"
   | RISCV_SLTI => "slti"
   | RISCV_SLTIU => "sltiu"
   | RISCV_XORI => "xori"
   | RISCV_ORI => "ori"
   | RISCV_ANDI => "andi"
   end.

Definition itype_mnemonic_backwards (arg_ : string) : M (iop) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "addi" then returnm RISCV_ADDI
    else if generic_eq p0_ "slti" then returnm RISCV_SLTI
    else if generic_eq p0_ "sltiu" then returnm RISCV_SLTIU
    else if generic_eq p0_ "xori" then returnm RISCV_XORI
    else if generic_eq p0_ "ori" then returnm RISCV_ORI
    else if generic_eq p0_ "andi" then returnm RISCV_ANDI
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (iop).

Definition itype_mnemonic_forwards_matches (arg_ : iop) : bool :=
   match arg_ with
   | RISCV_ADDI => true
   | RISCV_SLTI => true
   | RISCV_SLTIU => true
   | RISCV_XORI => true
   | RISCV_ORI => true
   | RISCV_ANDI => true
   end.

Definition itype_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "addi" then true
   else if generic_eq p0_ "slti" then true
   else if generic_eq p0_ "sltiu" then true
   else if generic_eq p0_ "xori" then true
   else if generic_eq p0_ "ori" then true
   else if generic_eq p0_ "andi" then true
   else false.

Definition _s809_ (_s810_ : string) : option string :=
   let _s811_ := _s810_ in
   if string_startswith _s811_ "andi" then
     match (string_drop _s811_ (projT1 (string_length "andi"))) with | s_ => Some s_ end
   else None.

Definition _s805_ (_s806_ : string) : option string :=
   let _s807_ := _s806_ in
   if string_startswith _s807_ "ori" then
     match (string_drop _s807_ (projT1 (string_length "ori"))) with | s_ => Some s_ end
   else None.

Definition _s801_ (_s802_ : string) : option string :=
   let _s803_ := _s802_ in
   if string_startswith _s803_ "xori" then
     match (string_drop _s803_ (projT1 (string_length "xori"))) with | s_ => Some s_ end
   else None.

Definition _s797_ (_s798_ : string) : option string :=
   let _s799_ := _s798_ in
   if string_startswith _s799_ "sltiu" then
     match (string_drop _s799_ (projT1 (string_length "sltiu"))) with | s_ => Some s_ end
   else None.

Definition _s793_ (_s794_ : string) : option string :=
   let _s795_ := _s794_ in
   if string_startswith _s795_ "slti" then
     match (string_drop _s795_ (projT1 (string_length "slti"))) with | s_ => Some s_ end
   else None.

Definition _s789_ (_s790_ : string) : option string :=
   let _s791_ := _s790_ in
   if string_startswith _s791_ "addi" then
     match (string_drop _s791_ (projT1 (string_length "addi"))) with | s_ => Some s_ end
   else None.

Definition itype_mnemonic_matches_prefix (arg_ : string)
: M (option ((iop * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s792_ := arg_ in
   (if match (_s789_ _s792_) with | Some s_ => true | _ => false end then
      (match (_s789_ _s792_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_ADDI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s793_ _s792_) with | Some s_ => true | _ => false end then
      (match (_s793_ _s792_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SLTI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s797_ _s792_) with | Some s_ => true | _ => false end then
      (match (_s797_ _s792_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SLTIU, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s801_ _s792_) with | Some s_ => true | _ => false end then
      (match (_s801_ _s792_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_XORI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s805_ _s792_) with | Some s_ => true | _ => false end then
      (match (_s805_ _s792_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_ORI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s809_ _s792_) with | Some s_ => true | _ => false end then
      (match (_s809_ _s792_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_ANDI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((iop * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((iop * {n : Z & ArithFact (n >=? 0)}))).

Definition encdec_sop_forwards (arg_ : sop) : mword 3 :=
   match arg_ with
   | RISCV_SLLI => 'b"001"  : mword 3
   | RISCV_SRLI => 'b"101"  : mword 3
   | RISCV_SRAI => 'b"101"  : mword 3
   end.

Definition encdec_sop_backwards (arg_ : mword 3) : M (sop) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"001"  : mword 3) then returnm RISCV_SLLI
    else if eq_vec b__0 ('b"101"  : mword 3) then returnm RISCV_SRLI
    else if eq_vec b__0 ('b"101"  : mword 3) then returnm RISCV_SRAI
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (sop).

Definition encdec_sop_forwards_matches (arg_ : sop) : bool :=
   match arg_ with | RISCV_SLLI => true | RISCV_SRLI => true | RISCV_SRAI => true end.

Definition encdec_sop_backwards_matches (arg_ : mword 3) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"001"  : mword 3) then true
   else if eq_vec b__0 ('b"101"  : mword 3) then true
   else if eq_vec b__0 ('b"101"  : mword 3) then true
   else false.

Definition shiftiop_mnemonic_forwards (arg_ : sop) : string :=
   match arg_ with | RISCV_SLLI => "slli" | RISCV_SRLI => "srli" | RISCV_SRAI => "srai" end.

Definition shiftiop_mnemonic_backwards (arg_ : string) : M (sop) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "slli" then returnm RISCV_SLLI
    else if generic_eq p0_ "srli" then returnm RISCV_SRLI
    else if generic_eq p0_ "srai" then returnm RISCV_SRAI
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (sop).

Definition shiftiop_mnemonic_forwards_matches (arg_ : sop) : bool :=
   match arg_ with | RISCV_SLLI => true | RISCV_SRLI => true | RISCV_SRAI => true end.

Definition shiftiop_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "slli" then true
   else if generic_eq p0_ "srli" then true
   else if generic_eq p0_ "srai" then true
   else false.

Definition _s821_ (_s822_ : string) : option string :=
   let _s823_ := _s822_ in
   if string_startswith _s823_ "srai" then
     match (string_drop _s823_ (projT1 (string_length "srai"))) with | s_ => Some s_ end
   else None.

Definition _s817_ (_s818_ : string) : option string :=
   let _s819_ := _s818_ in
   if string_startswith _s819_ "srli" then
     match (string_drop _s819_ (projT1 (string_length "srli"))) with | s_ => Some s_ end
   else None.

Definition _s813_ (_s814_ : string) : option string :=
   let _s815_ := _s814_ in
   if string_startswith _s815_ "slli" then
     match (string_drop _s815_ (projT1 (string_length "slli"))) with | s_ => Some s_ end
   else None.

Definition shiftiop_mnemonic_matches_prefix (arg_ : string)
: M (option ((sop * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s816_ := arg_ in
   (if match (_s813_ _s816_) with | Some s_ => true | _ => false end then
      (match (_s813_ _s816_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SLLI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s817_ _s816_) with | Some s_ => true | _ => false end then
      (match (_s817_ _s816_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRLI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s821_ _s816_) with | Some s_ => true | _ => false end then
      (match (_s821_ _s816_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRAI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((sop * {n : Z & ArithFact (n >=? 0)}))).

Definition rtype_mnemonic_forwards (arg_ : rop) : string :=
   match arg_ with
   | RISCV_ADD => "add"
   | RISCV_SLT => "slt"
   | RISCV_SLTU => "sltu"
   | RISCV_AND => "and"
   | RISCV_OR => "or"
   | RISCV_XOR => "xor"
   | RISCV_SLL => "sll"
   | RISCV_SRL => "srl"
   | RISCV_SUB => "sub"
   | RISCV_SRA => "sra"
   end.

Definition rtype_mnemonic_backwards (arg_ : string) : M (rop) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "add" then returnm RISCV_ADD
    else if generic_eq p0_ "slt" then returnm RISCV_SLT
    else if generic_eq p0_ "sltu" then returnm RISCV_SLTU
    else if generic_eq p0_ "and" then returnm RISCV_AND
    else if generic_eq p0_ "or" then returnm RISCV_OR
    else if generic_eq p0_ "xor" then returnm RISCV_XOR
    else if generic_eq p0_ "sll" then returnm RISCV_SLL
    else if generic_eq p0_ "srl" then returnm RISCV_SRL
    else if generic_eq p0_ "sub" then returnm RISCV_SUB
    else if generic_eq p0_ "sra" then returnm RISCV_SRA
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (rop).

Definition rtype_mnemonic_forwards_matches (arg_ : rop) : bool :=
   match arg_ with
   | RISCV_ADD => true
   | RISCV_SLT => true
   | RISCV_SLTU => true
   | RISCV_AND => true
   | RISCV_OR => true
   | RISCV_XOR => true
   | RISCV_SLL => true
   | RISCV_SRL => true
   | RISCV_SUB => true
   | RISCV_SRA => true
   end.

Definition rtype_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "add" then true
   else if generic_eq p0_ "slt" then true
   else if generic_eq p0_ "sltu" then true
   else if generic_eq p0_ "and" then true
   else if generic_eq p0_ "or" then true
   else if generic_eq p0_ "xor" then true
   else if generic_eq p0_ "sll" then true
   else if generic_eq p0_ "srl" then true
   else if generic_eq p0_ "sub" then true
   else if generic_eq p0_ "sra" then true
   else false.

Definition _s861_ (_s862_ : string) : option string :=
   let _s863_ := _s862_ in
   if string_startswith _s863_ "sra" then
     match (string_drop _s863_ (projT1 (string_length "sra"))) with | s_ => Some s_ end
   else None.

Definition _s857_ (_s858_ : string) : option string :=
   let _s859_ := _s858_ in
   if string_startswith _s859_ "sub" then
     match (string_drop _s859_ (projT1 (string_length "sub"))) with | s_ => Some s_ end
   else None.

Definition _s853_ (_s854_ : string) : option string :=
   let _s855_ := _s854_ in
   if string_startswith _s855_ "srl" then
     match (string_drop _s855_ (projT1 (string_length "srl"))) with | s_ => Some s_ end
   else None.

Definition _s849_ (_s850_ : string) : option string :=
   let _s851_ := _s850_ in
   if string_startswith _s851_ "sll" then
     match (string_drop _s851_ (projT1 (string_length "sll"))) with | s_ => Some s_ end
   else None.

Definition _s845_ (_s846_ : string) : option string :=
   let _s847_ := _s846_ in
   if string_startswith _s847_ "xor" then
     match (string_drop _s847_ (projT1 (string_length "xor"))) with | s_ => Some s_ end
   else None.

Definition _s841_ (_s842_ : string) : option string :=
   let _s843_ := _s842_ in
   if string_startswith _s843_ "or" then
     match (string_drop _s843_ (projT1 (string_length "or"))) with | s_ => Some s_ end
   else None.

Definition _s837_ (_s838_ : string) : option string :=
   let _s839_ := _s838_ in
   if string_startswith _s839_ "and" then
     match (string_drop _s839_ (projT1 (string_length "and"))) with | s_ => Some s_ end
   else None.

Definition _s833_ (_s834_ : string) : option string :=
   let _s835_ := _s834_ in
   if string_startswith _s835_ "sltu" then
     match (string_drop _s835_ (projT1 (string_length "sltu"))) with | s_ => Some s_ end
   else None.

Definition _s829_ (_s830_ : string) : option string :=
   let _s831_ := _s830_ in
   if string_startswith _s831_ "slt" then
     match (string_drop _s831_ (projT1 (string_length "slt"))) with | s_ => Some s_ end
   else None.

Definition _s825_ (_s826_ : string) : option string :=
   let _s827_ := _s826_ in
   if string_startswith _s827_ "add" then
     match (string_drop _s827_ (projT1 (string_length "add"))) with | s_ => Some s_ end
   else None.

Definition rtype_mnemonic_matches_prefix (arg_ : string)
: M (option ((rop * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s828_ := arg_ in
   (if match (_s825_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s825_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_ADD, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s829_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s829_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SLT, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s833_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s833_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SLTU, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s837_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s837_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_AND, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s841_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s841_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_OR, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s845_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s845_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_XOR, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s849_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s849_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SLL, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s853_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s853_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRL, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s857_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s857_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SUB, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s861_ _s828_) with | Some s_ => true | _ => false end then
      (match (_s861_ _s828_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRA, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rop * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((rop * {n : Z & ArithFact (n >=? 0)}))).

Definition extend_value {n : Z} (is_unsigned : bool) (value : MemoryOpResult (mword (8 * n)))
`{ArithFact ((0 <? n) && (n <=? 4))}
: MemoryOpResult (mword 32) :=
   match value with
   | MemValue v =>
      MemValue (if sumbool_of_bool is_unsigned then EXTZ 32 v else (EXTS 32 v)  : xlenbits)
   | MemException e => MemException e
   end.

Definition process_load {n : Z}
(rd : mword 5) (vaddr : mword 32) (value : MemoryOpResult (mword (8 * n))) (is_unsigned : bool)
`{ArithFact ((0 <? n) && (n <=? 4))}
: M (Retired) :=
   (match (extend_value is_unsigned value) with
    | MemValue result => (wX_bits rd result) >> returnm RETIRE_SUCCESS
    | MemException e => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
    end)
    : M (Retired).

Definition check_misaligned (vaddr : mword 32) (width : word_width) : bool :=
   if plat_enable_misaligned_access tt then false
   else
     match width with
     | BYTE => false
     | HALF => eq_bit (access_vec_dec vaddr 0) B1
     | WORD => orb (eq_bit (access_vec_dec vaddr 0) B1) (eq_bit (access_vec_dec vaddr 1) B1)
     | DOUBLE =>
        orb (eq_bit (access_vec_dec vaddr 0) B1)
          (orb (eq_bit (access_vec_dec vaddr 1) B1) (eq_bit (access_vec_dec vaddr 2) B1))
     end.

Definition maybe_aq_forwards (arg_ : bool) : string :=
   match arg_ with | true => ".aq" | false => "" end.

Definition maybe_aq_backwards (arg_ : string) : M (bool) :=
   let p0_ := arg_ in
   (if generic_eq p0_ ".aq" then returnm true
    else if generic_eq p0_ "" then returnm false
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (bool).

Definition maybe_aq_forwards_matches (arg_ : bool) : bool :=
   match arg_ with | true => true | false => true end.

Definition maybe_aq_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ ".aq" then true
   else if generic_eq p0_ "" then true
   else false.

Definition _s869_ (_s870_ : string) : option string :=
   let _s871_ := _s870_ in
   if string_startswith _s871_ "" then
     match (string_drop _s871_ (projT1 (string_length ""))) with | s_ => Some s_ end
   else None.

Definition _s865_ (_s866_ : string) : option string :=
   let _s867_ := _s866_ in
   if string_startswith _s867_ ".aq" then
     match (string_drop _s867_ (projT1 (string_length ".aq"))) with | s_ => Some s_ end
   else None.

Definition maybe_aq_matches_prefix (arg_ : string)
: M (option ((bool * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s868_ := arg_ in
   (if match (_s865_ _s868_) with | Some s_ => true | _ => false end then
      (match (_s865_ _s868_) with
       | Some s_ =>
          returnm (Some
                     (true, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s869_ _s868_) with | Some s_ => true | _ => false end then
      (match (_s869_ _s868_) with
       | Some s_ =>
          returnm (Some
                     (false, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((bool * {n : Z & ArithFact (n >=? 0)}))).

Definition maybe_rl_forwards (arg_ : bool) : string :=
   match arg_ with | true => ".rl" | false => "" end.

Definition maybe_rl_backwards (arg_ : string) : M (bool) :=
   let p0_ := arg_ in
   (if generic_eq p0_ ".rl" then returnm true
    else if generic_eq p0_ "" then returnm false
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (bool).

Definition maybe_rl_forwards_matches (arg_ : bool) : bool :=
   match arg_ with | true => true | false => true end.

Definition maybe_rl_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ ".rl" then true
   else if generic_eq p0_ "" then true
   else false.

Definition _s877_ (_s878_ : string) : option string :=
   let _s879_ := _s878_ in
   if string_startswith _s879_ "" then
     match (string_drop _s879_ (projT1 (string_length ""))) with | s_ => Some s_ end
   else None.

Definition _s873_ (_s874_ : string) : option string :=
   let _s875_ := _s874_ in
   if string_startswith _s875_ ".rl" then
     match (string_drop _s875_ (projT1 (string_length ".rl"))) with | s_ => Some s_ end
   else None.

Definition maybe_rl_matches_prefix (arg_ : string)
: M (option ((bool * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s876_ := arg_ in
   (if match (_s873_ _s876_) with | Some s_ => true | _ => false end then
      (match (_s873_ _s876_) with
       | Some s_ =>
          returnm (Some
                     (true, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s877_ _s876_) with | Some s_ => true | _ => false end then
      (match (_s877_ _s876_) with
       | Some s_ =>
          returnm (Some
                     (false, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((bool * {n : Z & ArithFact (n >=? 0)}))).

Definition maybe_u_forwards (arg_ : bool) : string :=
   match arg_ with | true => "u" | false => "" end.

Definition maybe_u_backwards (arg_ : string) : M (bool) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "u" then returnm true
    else if generic_eq p0_ "" then returnm false
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (bool).

Definition maybe_u_forwards_matches (arg_ : bool) : bool :=
   match arg_ with | true => true | false => true end.

Definition maybe_u_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "u" then true
   else if generic_eq p0_ "" then true
   else false.

Definition _s885_ (_s886_ : string) : option string :=
   let _s887_ := _s886_ in
   if string_startswith _s887_ "" then
     match (string_drop _s887_ (projT1 (string_length ""))) with | s_ => Some s_ end
   else None.

Definition _s881_ (_s882_ : string) : option string :=
   let _s883_ := _s882_ in
   if string_startswith _s883_ "u" then
     match (string_drop _s883_ (projT1 (string_length "u"))) with | s_ => Some s_ end
   else None.

Definition maybe_u_matches_prefix (arg_ : string)
: M (option ((bool * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s884_ := arg_ in
   (if match (_s881_ _s884_) with | Some s_ => true | _ => false end then
      (match (_s881_ _s884_) with
       | Some s_ =>
          returnm (Some
                     (true, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s885_ _s884_) with | Some s_ => true | _ => false end then
      (match (_s885_ _s884_) with
       | Some s_ =>
          returnm (Some
                     (false, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((bool * {n : Z & ArithFact (n >=? 0)}))).

Definition shiftw_mnemonic_forwards (arg_ : sop) : string :=
   match arg_ with | RISCV_SLLI => "slli" | RISCV_SRLI => "srli" | RISCV_SRAI => "srai" end.

Definition shiftw_mnemonic_backwards (arg_ : string) : M (sop) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "slli" then returnm RISCV_SLLI
    else if generic_eq p0_ "srli" then returnm RISCV_SRLI
    else if generic_eq p0_ "srai" then returnm RISCV_SRAI
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (sop).

Definition shiftw_mnemonic_forwards_matches (arg_ : sop) : bool :=
   match arg_ with | RISCV_SLLI => true | RISCV_SRLI => true | RISCV_SRAI => true end.

Definition shiftw_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "slli" then true
   else if generic_eq p0_ "srli" then true
   else if generic_eq p0_ "srai" then true
   else false.

Definition _s897_ (_s898_ : string) : option string :=
   let _s899_ := _s898_ in
   if string_startswith _s899_ "srai" then
     match (string_drop _s899_ (projT1 (string_length "srai"))) with | s_ => Some s_ end
   else None.

Definition _s893_ (_s894_ : string) : option string :=
   let _s895_ := _s894_ in
   if string_startswith _s895_ "srli" then
     match (string_drop _s895_ (projT1 (string_length "srli"))) with | s_ => Some s_ end
   else None.

Definition _s889_ (_s890_ : string) : option string :=
   let _s891_ := _s890_ in
   if string_startswith _s891_ "slli" then
     match (string_drop _s891_ (projT1 (string_length "slli"))) with | s_ => Some s_ end
   else None.

Definition shiftw_mnemonic_matches_prefix (arg_ : string)
: M (option ((sop * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s892_ := arg_ in
   (if match (_s889_ _s892_) with | Some s_ => true | _ => false end then
      (match (_s889_ _s892_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SLLI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s893_ _s892_) with | Some s_ => true | _ => false end then
      (match (_s893_ _s892_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRLI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s897_ _s892_) with | Some s_ => true | _ => false end then
      (match (_s897_ _s892_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRAI, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((sop * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((sop * {n : Z & ArithFact (n >=? 0)}))).

Definition rtypew_mnemonic_forwards (arg_ : ropw) : string :=
   match arg_ with
   | RISCV_ADDW => "addw"
   | RISCV_SUBW => "subw"
   | RISCV_SLLW => "sllw"
   | RISCV_SRLW => "srlw"
   | RISCV_SRAW => "sraw"
   end.

Definition rtypew_mnemonic_backwards (arg_ : string) : M (ropw) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "addw" then returnm RISCV_ADDW
    else if generic_eq p0_ "subw" then returnm RISCV_SUBW
    else if generic_eq p0_ "sllw" then returnm RISCV_SLLW
    else if generic_eq p0_ "srlw" then returnm RISCV_SRLW
    else if generic_eq p0_ "sraw" then returnm RISCV_SRAW
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (ropw).

Definition rtypew_mnemonic_forwards_matches (arg_ : ropw) : bool :=
   match arg_ with
   | RISCV_ADDW => true
   | RISCV_SUBW => true
   | RISCV_SLLW => true
   | RISCV_SRLW => true
   | RISCV_SRAW => true
   end.

Definition rtypew_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "addw" then true
   else if generic_eq p0_ "subw" then true
   else if generic_eq p0_ "sllw" then true
   else if generic_eq p0_ "srlw" then true
   else if generic_eq p0_ "sraw" then true
   else false.

Definition _s917_ (_s918_ : string) : option string :=
   let _s919_ := _s918_ in
   if string_startswith _s919_ "sraw" then
     match (string_drop _s919_ (projT1 (string_length "sraw"))) with | s_ => Some s_ end
   else None.

Definition _s913_ (_s914_ : string) : option string :=
   let _s915_ := _s914_ in
   if string_startswith _s915_ "srlw" then
     match (string_drop _s915_ (projT1 (string_length "srlw"))) with | s_ => Some s_ end
   else None.

Definition _s909_ (_s910_ : string) : option string :=
   let _s911_ := _s910_ in
   if string_startswith _s911_ "sllw" then
     match (string_drop _s911_ (projT1 (string_length "sllw"))) with | s_ => Some s_ end
   else None.

Definition _s905_ (_s906_ : string) : option string :=
   let _s907_ := _s906_ in
   if string_startswith _s907_ "subw" then
     match (string_drop _s907_ (projT1 (string_length "subw"))) with | s_ => Some s_ end
   else None.

Definition _s901_ (_s902_ : string) : option string :=
   let _s903_ := _s902_ in
   if string_startswith _s903_ "addw" then
     match (string_drop _s903_ (projT1 (string_length "addw"))) with | s_ => Some s_ end
   else None.

Definition rtypew_mnemonic_matches_prefix (arg_ : string)
: M (option ((ropw * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s904_ := arg_ in
   (if match (_s901_ _s904_) with | Some s_ => true | _ => false end then
      (match (_s901_ _s904_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_ADDW, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s905_ _s904_) with | Some s_ => true | _ => false end then
      (match (_s905_ _s904_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SUBW, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s909_ _s904_) with | Some s_ => true | _ => false end then
      (match (_s909_ _s904_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SLLW, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s913_ _s904_) with | Some s_ => true | _ => false end then
      (match (_s913_ _s904_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRLW, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s917_ _s904_) with | Some s_ => true | _ => false end then
      (match (_s917_ _s904_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRAW, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((ropw * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((ropw * {n : Z & ArithFact (n >=? 0)}))).

Definition shiftiwop_mnemonic_forwards (arg_ : sopw) : string :=
   match arg_ with | RISCV_SLLIW => "slliw" | RISCV_SRLIW => "srliw" | RISCV_SRAIW => "sraiw" end.

Definition shiftiwop_mnemonic_backwards (arg_ : string) : M (sopw) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "slliw" then returnm RISCV_SLLIW
    else if generic_eq p0_ "srliw" then returnm RISCV_SRLIW
    else if generic_eq p0_ "sraiw" then returnm RISCV_SRAIW
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (sopw).

Definition shiftiwop_mnemonic_forwards_matches (arg_ : sopw) : bool :=
   match arg_ with | RISCV_SLLIW => true | RISCV_SRLIW => true | RISCV_SRAIW => true end.

Definition shiftiwop_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "slliw" then true
   else if generic_eq p0_ "srliw" then true
   else if generic_eq p0_ "sraiw" then true
   else false.

Definition _s929_ (_s930_ : string) : option string :=
   let _s931_ := _s930_ in
   if string_startswith _s931_ "sraiw" then
     match (string_drop _s931_ (projT1 (string_length "sraiw"))) with | s_ => Some s_ end
   else None.

Definition _s925_ (_s926_ : string) : option string :=
   let _s927_ := _s926_ in
   if string_startswith _s927_ "srliw" then
     match (string_drop _s927_ (projT1 (string_length "srliw"))) with | s_ => Some s_ end
   else None.

Definition _s921_ (_s922_ : string) : option string :=
   let _s923_ := _s922_ in
   if string_startswith _s923_ "slliw" then
     match (string_drop _s923_ (projT1 (string_length "slliw"))) with | s_ => Some s_ end
   else None.

Definition shiftiwop_mnemonic_matches_prefix (arg_ : string)
: M (option ((sopw * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s924_ := arg_ in
   (if match (_s921_ _s924_) with | Some s_ => true | _ => false end then
      (match (_s921_ _s924_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SLLIW, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((sopw * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((sopw * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s925_ _s924_) with | Some s_ => true | _ => false end then
      (match (_s925_ _s924_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRLIW, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((sopw * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((sopw * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s929_ _s924_) with | Some s_ => true | _ => false end then
      (match (_s929_ _s924_) with
       | Some s_ =>
          returnm (Some
                     (RISCV_SRAIW, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((sopw * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((sopw * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((sopw * {n : Z & ArithFact (n >=? 0)}))).

Definition bit_maybe_r_forwards (arg_ : mword 1) : M (string) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"1"  : mword 1) then returnm "r"
    else if eq_vec b__0 ('b"0"  : mword 1) then returnm ""
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (string).

Definition bit_maybe_r_backwards (arg_ : string) : M (mword 1) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "r" then returnm ('b"1"  : mword 1)
    else if generic_eq p0_ "" then returnm ('b"0"  : mword 1)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 1).

Definition bit_maybe_r_forwards_matches (arg_ : mword 1) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"1"  : mword 1) then true
   else if eq_vec b__0 ('b"0"  : mword 1) then true
   else false.

Definition bit_maybe_r_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "r" then true
   else if generic_eq p0_ "" then true
   else false.

Definition _s937_ (_s938_ : string) : option string :=
   let _s939_ := _s938_ in
   if string_startswith _s939_ "" then
     match (string_drop _s939_ (projT1 (string_length ""))) with | s_ => Some s_ end
   else None.

Definition _s933_ (_s934_ : string) : option string :=
   let _s935_ := _s934_ in
   if string_startswith _s935_ "r" then
     match (string_drop _s935_ (projT1 (string_length "r"))) with | s_ => Some s_ end
   else None.

Definition bit_maybe_r_matches_prefix (arg_ : string)
: M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s936_ := arg_ in
   (if match (_s933_ _s936_) with | Some s_ => true | _ => false end then
      (match (_s933_ _s936_) with
       | Some s_ =>
          returnm (Some
                     ('b"1"
                      : mword 1, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s937_ _s936_) with | Some s_ => true | _ => false end then
      (match (_s937_ _s936_) with
       | Some s_ =>
          returnm (Some
                     ('b"0"
                      : mword 1, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)}))).

Definition bit_maybe_w_forwards (arg_ : mword 1) : M (string) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"1"  : mword 1) then returnm "w"
    else if eq_vec b__0 ('b"0"  : mword 1) then returnm ""
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (string).

Definition bit_maybe_w_backwards (arg_ : string) : M (mword 1) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "w" then returnm ('b"1"  : mword 1)
    else if generic_eq p0_ "" then returnm ('b"0"  : mword 1)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 1).

Definition bit_maybe_w_forwards_matches (arg_ : mword 1) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"1"  : mword 1) then true
   else if eq_vec b__0 ('b"0"  : mword 1) then true
   else false.

Definition bit_maybe_w_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "w" then true
   else if generic_eq p0_ "" then true
   else false.

Definition _s945_ (_s946_ : string) : option string :=
   let _s947_ := _s946_ in
   if string_startswith _s947_ "" then
     match (string_drop _s947_ (projT1 (string_length ""))) with | s_ => Some s_ end
   else None.

Definition _s941_ (_s942_ : string) : option string :=
   let _s943_ := _s942_ in
   if string_startswith _s943_ "w" then
     match (string_drop _s943_ (projT1 (string_length "w"))) with | s_ => Some s_ end
   else None.

Definition bit_maybe_w_matches_prefix (arg_ : string)
: M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s944_ := arg_ in
   (if match (_s941_ _s944_) with | Some s_ => true | _ => false end then
      (match (_s941_ _s944_) with
       | Some s_ =>
          returnm (Some
                     ('b"1"
                      : mword 1, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s945_ _s944_) with | Some s_ => true | _ => false end then
      (match (_s945_ _s944_) with
       | Some s_ =>
          returnm (Some
                     ('b"0"
                      : mword 1, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)}))).

Definition bit_maybe_i_forwards (arg_ : mword 1) : M (string) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"1"  : mword 1) then returnm "i"
    else if eq_vec b__0 ('b"0"  : mword 1) then returnm ""
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (string).

Definition bit_maybe_i_backwards (arg_ : string) : M (mword 1) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "i" then returnm ('b"1"  : mword 1)
    else if generic_eq p0_ "" then returnm ('b"0"  : mword 1)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 1).

Definition bit_maybe_i_forwards_matches (arg_ : mword 1) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"1"  : mword 1) then true
   else if eq_vec b__0 ('b"0"  : mword 1) then true
   else false.

Definition bit_maybe_i_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "i" then true
   else if generic_eq p0_ "" then true
   else false.

Definition _s953_ (_s954_ : string) : option string :=
   let _s955_ := _s954_ in
   if string_startswith _s955_ "" then
     match (string_drop _s955_ (projT1 (string_length ""))) with | s_ => Some s_ end
   else None.

Definition _s949_ (_s950_ : string) : option string :=
   let _s951_ := _s950_ in
   if string_startswith _s951_ "i" then
     match (string_drop _s951_ (projT1 (string_length "i"))) with | s_ => Some s_ end
   else None.

Definition bit_maybe_i_matches_prefix (arg_ : string)
: M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s952_ := arg_ in
   (if match (_s949_ _s952_) with | Some s_ => true | _ => false end then
      (match (_s949_ _s952_) with
       | Some s_ =>
          returnm (Some
                     ('b"1"
                      : mword 1, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s953_ _s952_) with | Some s_ => true | _ => false end then
      (match (_s953_ _s952_) with
       | Some s_ =>
          returnm (Some
                     ('b"0"
                      : mword 1, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)}))).

Definition bit_maybe_o_forwards (arg_ : mword 1) : M (string) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"1"  : mword 1) then returnm "o"
    else if eq_vec b__0 ('b"0"  : mword 1) then returnm ""
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (string).

Definition bit_maybe_o_backwards (arg_ : string) : M (mword 1) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "o" then returnm ('b"1"  : mword 1)
    else if generic_eq p0_ "" then returnm ('b"0"  : mword 1)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 1).

Definition bit_maybe_o_forwards_matches (arg_ : mword 1) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"1"  : mword 1) then true
   else if eq_vec b__0 ('b"0"  : mword 1) then true
   else false.

Definition bit_maybe_o_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "o" then true
   else if generic_eq p0_ "" then true
   else false.

Definition _s961_ (_s962_ : string) : option string :=
   let _s963_ := _s962_ in
   if string_startswith _s963_ "" then
     match (string_drop _s963_ (projT1 (string_length ""))) with | s_ => Some s_ end
   else None.

Definition _s957_ (_s958_ : string) : option string :=
   let _s959_ := _s958_ in
   if string_startswith _s959_ "o" then
     match (string_drop _s959_ (projT1 (string_length "o"))) with | s_ => Some s_ end
   else None.

Definition bit_maybe_o_matches_prefix (arg_ : string)
: M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s960_ := arg_ in
   (if match (_s957_ _s960_) with | Some s_ => true | _ => false end then
      (match (_s957_ _s960_) with
       | Some s_ =>
          returnm (Some
                     ('b"1"
                      : mword 1, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s961_ _s960_) with | Some s_ => true | _ => false end then
      (match (_s961_ _s960_) with
       | Some s_ =>
          returnm (Some
                     ('b"0"
                      : mword 1, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 1 * {n : Z & ArithFact (n >=? 0)}))).

Definition fence_bits_forwards (arg_ : mword 4) : M (string) :=
   (match arg_ with
    | v__0 =>
       let i : bits 1 := subrange_vec_dec v__0 3 3 in
       let w : bits 1 := subrange_vec_dec v__0 0 0 in
       let r : bits 1 := subrange_vec_dec v__0 1 1 in
       let o : bits 1 := subrange_vec_dec v__0 2 2 in
       let i : bits 1 := subrange_vec_dec v__0 3 3 in
       (bit_maybe_i_forwards i) >>= fun w__0 : string =>
       (bit_maybe_o_forwards o) >>= fun w__1 : string =>
       (bit_maybe_r_forwards r) >>= fun w__2 : string =>
       (bit_maybe_w_forwards w) >>= fun w__3 : string =>
       returnm (string_append w__0 (string_append w__1 (string_append w__2 (string_append w__3 ""))))
    end)
    : M (string).

Definition _s965_ (_s966_ : string) : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) :=
   (match _s966_ with
    | _s967_ =>
       (bit_maybe_i_matches_prefix _s967_) >>= fun w__0 : option ((mword 1 * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (i, existT _ _s968_ _) =>
           (match (string_drop _s967_ _s968_) with
            | _s969_ =>
               (bit_maybe_o_matches_prefix _s969_) >>= fun w__1 : option ((mword 1 * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (o, existT _ _s970_ _) =>
                   (match (string_drop _s969_ _s970_) with
                    | _s971_ =>
                       (bit_maybe_r_matches_prefix _s971_) >>= fun w__2 : option ((mword 1 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (r, existT _ _s972_ _) =>
                           (match (string_drop _s971_ _s972_) with
                            | _s973_ =>
                               (bit_maybe_w_matches_prefix _s973_) >>= fun w__3 : option ((mword 1 * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               returnm (match w__3 with
                                        | Some (w, existT _ _s974_ _) =>
                                           let p0_ := string_drop _s973_ _s974_ in
                                           if generic_eq p0_ "" then Some (i, o, r, w)
                                           else None
                                        | _ => None
                                        end)
                            end)
                            : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
                        | _ => returnm None
                        end)
                        : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
                    end)
                    : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
                | _ => returnm None
                end)
                : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
            end)
            : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
        | _ => returnm None
        end)
        : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
    end)
    : M (option ((mword 1 * mword 1 * mword 1 * mword 1))).

Definition fence_bits_backwards (arg_ : string) : M (mword 4) :=
   let _s975_ := arg_ in
   (_s965_ _s975_) >>= fun w__0 : option ((mword 1 * mword 1 * mword 1 * mword 1)) =>
   (if match w__0 with | Some (i, o, r, w) => true | _ => false end then
      (_s965_ _s975_) >>= fun w__1 : option ((mword 1 * mword 1 * mword 1 * mword 1)) =>
      (match w__1 with
       | Some (i, o, r, w) =>
          returnm (concat_vec (i  : bits 1)
                     (concat_vec (o  : bits 1) (concat_vec (r  : bits 1) (w  : bits 1))))
       | _ => exit tt  : M (mword 4)
       end)
       : M (mword 4)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (mword 4).

Definition fence_bits_forwards_matches (arg_ : mword 4) : bool :=
   match arg_ with | v__1 => true end.

Definition _s976_ (_s977_ : string) : M (option ((mword 1 * mword 1 * mword 1 * mword 1))) :=
   (match _s977_ with
    | _s978_ =>
       (bit_maybe_i_matches_prefix _s978_) >>= fun w__0 : option ((mword 1 * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (i, existT _ _s979_ _) =>
           (match (string_drop _s978_ _s979_) with
            | _s980_ =>
               (bit_maybe_o_matches_prefix _s980_) >>= fun w__1 : option ((mword 1 * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (o, existT _ _s981_ _) =>
                   (match (string_drop _s980_ _s981_) with
                    | _s982_ =>
                       (bit_maybe_r_matches_prefix _s982_) >>= fun w__2 : option ((mword 1 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (r, existT _ _s983_ _) =>
                           (match (string_drop _s982_ _s983_) with
                            | _s984_ =>
                               (bit_maybe_w_matches_prefix _s984_) >>= fun w__3 : option ((mword 1 * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               returnm (match w__3 with
                                        | Some (w, existT _ _s985_ _) =>
                                           let p0_ := string_drop _s984_ _s985_ in
                                           if generic_eq p0_ "" then Some (i, o, r, w)
                                           else None
                                        | _ => None
                                        end)
                            end)
                            : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
                        | _ => returnm None
                        end)
                        : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
                    end)
                    : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
                | _ => returnm None
                end)
                : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
            end)
            : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
        | _ => returnm None
        end)
        : M (option ((mword 1 * mword 1 * mword 1 * mword 1)))
    end)
    : M (option ((mword 1 * mword 1 * mword 1 * mword 1))).

Definition fence_bits_backwards_matches (arg_ : string) : M (bool) :=
   let _s986_ := arg_ in
   (_s976_ _s986_) >>= fun w__0 : option ((mword 1 * mword 1 * mword 1 * mword 1)) =>
   (if match w__0 with | Some (i, o, r, w) => true | _ => false end then
      (_s976_ _s986_) >>= fun w__1 : option ((mword 1 * mword 1 * mword 1 * mword 1)) =>
      (match w__1 with | Some (i, o, r, w) => returnm true | _ => exit tt  : M (bool) end)
       : M (bool)
    else returnm false)
    : M (bool).

Definition _s987_ (_s988_ : string) : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))) :=
   (match _s988_ with
    | _s989_ =>
       (bit_maybe_i_matches_prefix _s989_) >>= fun w__0 : option ((mword 1 * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (i, existT _ _s990_ _) =>
           (match (string_drop _s989_ _s990_) with
            | _s991_ =>
               (bit_maybe_o_matches_prefix _s991_) >>= fun w__1 : option ((mword 1 * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (o, existT _ _s992_ _) =>
                   (match (string_drop _s991_ _s992_) with
                    | _s993_ =>
                       (bit_maybe_r_matches_prefix _s993_) >>= fun w__2 : option ((mword 1 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (r, existT _ _s994_ _) =>
                           (match (string_drop _s993_ _s994_) with
                            | _s995_ =>
                               (bit_maybe_w_matches_prefix _s995_) >>= fun w__3 : option ((mword 1 * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               returnm (match w__3 with
                                        | Some (w, existT _ _s996_ _) =>
                                           match (string_drop _s995_ _s996_) with
                                           | s_ => Some (i, o, r, w, s_)
                                           end
                                        | _ => None
                                        end)
                            end)
                            : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string)))
                    end)
                    : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string)))
                | _ => returnm None
                end)
                : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string)))
            end)
            : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string)))
        | _ => returnm None
        end)
        : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string)))
    end)
    : M (option ((mword 1 * mword 1 * mword 1 * mword 1 * string))).

Definition fence_bits_matches_prefix (arg_ : string)
: M (option ((mword 4 * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s997_ := arg_ in
   (_s987_ _s997_) >>= fun w__0 : option ((mword 1 * mword 1 * mword 1 * mword 1 * string)) =>
   (if match w__0 with | Some (i, o, r, w, s_) => true | _ => false end then
      (_s987_ _s997_) >>= fun w__1 : option ((mword 1 * mword 1 * mword 1 * mword 1 * string)) =>
      (match w__1 with
       | Some (i, o, r, w, s_) =>
          returnm (Some
                     (concat_vec (i  : bits 1)
                        (concat_vec (o  : bits 1) (concat_vec (r  : bits 1) (w  : bits 1))), build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((mword 4 * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((mword 4 * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((mword 4 * {n : Z & ArithFact (n >=? 0)}))).

Definition aqrl_str (aq : bool) (rl : bool) : string :=
   match (aq, rl) with
   | (false, false) => ""
   | (false, true) => ".rl"
   | (true, false) => ".aq"
   | (true, true) => ".aqrl"
   end.

Definition lrsc_width_str (width : word_width) : string :=
   match width with | BYTE => ".b" | HALF => ".h" | WORD => ".w" | DOUBLE => ".d" end.

Definition amo_width_valid (size : word_width) : bool :=
   match size with | WORD => true | DOUBLE => Z.geb 32 64 | _ => false end.

Definition process_loadres {n : Z}
(rd : mword 5) (addr : mword 32) (value : MemoryOpResult (mword (8 * n))) (is_unsigned : bool)
`{ArithFact ((0 <? n) && (n <=? 4))}
: M (Retired) :=
   (match (extend_value is_unsigned value) with
    | MemValue result =>
       let '_ := (load_reservation addr)  : unit in
       (wX_bits rd result) >> returnm RETIRE_SUCCESS
    | MemException e => (handle_mem_exception addr e) >> returnm RETIRE_FAIL
    end)
    : M (Retired).

Definition encdec_amoop_forwards (arg_ : amoop) : mword 5 :=
   match arg_ with
   | AMOSWAP => 'b"00001"  : mword 5
   | AMOADD => 'b"00000"  : mword 5
   | AMOXOR => 'b"00100"  : mword 5
   | AMOAND => 'b"01100"  : mword 5
   | AMOOR => 'b"01000"  : mword 5
   | AMOMIN => 'b"10000"  : mword 5
   | AMOMAX => 'b"10100"  : mword 5
   | AMOMINU => 'b"11000"  : mword 5
   | AMOMAXU => 'b"11100"  : mword 5
   end.

Definition encdec_amoop_backwards (arg_ : mword 5) : M (amoop) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"00001"  : mword 5) then returnm AMOSWAP
    else if eq_vec b__0 ('b"00000"  : mword 5) then returnm AMOADD
    else if eq_vec b__0 ('b"00100"  : mword 5) then returnm AMOXOR
    else if eq_vec b__0 ('b"01100"  : mword 5) then returnm AMOAND
    else if eq_vec b__0 ('b"01000"  : mword 5) then returnm AMOOR
    else if eq_vec b__0 ('b"10000"  : mword 5) then returnm AMOMIN
    else if eq_vec b__0 ('b"10100"  : mword 5) then returnm AMOMAX
    else if eq_vec b__0 ('b"11000"  : mword 5) then returnm AMOMINU
    else if eq_vec b__0 ('b"11100"  : mword 5) then returnm AMOMAXU
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (amoop).

Definition encdec_amoop_forwards_matches (arg_ : amoop) : bool :=
   match arg_ with
   | AMOSWAP => true
   | AMOADD => true
   | AMOXOR => true
   | AMOAND => true
   | AMOOR => true
   | AMOMIN => true
   | AMOMAX => true
   | AMOMINU => true
   | AMOMAXU => true
   end.

Definition encdec_amoop_backwards_matches (arg_ : mword 5) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"00001"  : mword 5) then true
   else if eq_vec b__0 ('b"00000"  : mword 5) then true
   else if eq_vec b__0 ('b"00100"  : mword 5) then true
   else if eq_vec b__0 ('b"01100"  : mword 5) then true
   else if eq_vec b__0 ('b"01000"  : mword 5) then true
   else if eq_vec b__0 ('b"10000"  : mword 5) then true
   else if eq_vec b__0 ('b"10100"  : mword 5) then true
   else if eq_vec b__0 ('b"11000"  : mword 5) then true
   else if eq_vec b__0 ('b"11100"  : mword 5) then true
   else false.

Definition amo_mnemonic_forwards (arg_ : amoop) : string :=
   match arg_ with
   | AMOSWAP => "amoswap"
   | AMOADD => "amoadd"
   | AMOXOR => "amoxor"
   | AMOAND => "amoand"
   | AMOOR => "amoor"
   | AMOMIN => "amomin"
   | AMOMAX => "amomax"
   | AMOMINU => "amominu"
   | AMOMAXU => "amomaxu"
   end.

Definition amo_mnemonic_backwards (arg_ : string) : M (amoop) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "amoswap" then returnm AMOSWAP
    else if generic_eq p0_ "amoadd" then returnm AMOADD
    else if generic_eq p0_ "amoxor" then returnm AMOXOR
    else if generic_eq p0_ "amoand" then returnm AMOAND
    else if generic_eq p0_ "amoor" then returnm AMOOR
    else if generic_eq p0_ "amomin" then returnm AMOMIN
    else if generic_eq p0_ "amomax" then returnm AMOMAX
    else if generic_eq p0_ "amominu" then returnm AMOMINU
    else if generic_eq p0_ "amomaxu" then returnm AMOMAXU
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (amoop).

Definition amo_mnemonic_forwards_matches (arg_ : amoop) : bool :=
   match arg_ with
   | AMOSWAP => true
   | AMOADD => true
   | AMOXOR => true
   | AMOAND => true
   | AMOOR => true
   | AMOMIN => true
   | AMOMAX => true
   | AMOMINU => true
   | AMOMAXU => true
   end.

Definition amo_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "amoswap" then true
   else if generic_eq p0_ "amoadd" then true
   else if generic_eq p0_ "amoxor" then true
   else if generic_eq p0_ "amoand" then true
   else if generic_eq p0_ "amoor" then true
   else if generic_eq p0_ "amomin" then true
   else if generic_eq p0_ "amomax" then true
   else if generic_eq p0_ "amominu" then true
   else if generic_eq p0_ "amomaxu" then true
   else false.

Definition _s1030_ (_s1031_ : string) : option string :=
   let _s1032_ := _s1031_ in
   if string_startswith _s1032_ "amomaxu" then
     match (string_drop _s1032_ (projT1 (string_length "amomaxu"))) with | s_ => Some s_ end
   else None.

Definition _s1026_ (_s1027_ : string) : option string :=
   let _s1028_ := _s1027_ in
   if string_startswith _s1028_ "amominu" then
     match (string_drop _s1028_ (projT1 (string_length "amominu"))) with | s_ => Some s_ end
   else None.

Definition _s1022_ (_s1023_ : string) : option string :=
   let _s1024_ := _s1023_ in
   if string_startswith _s1024_ "amomax" then
     match (string_drop _s1024_ (projT1 (string_length "amomax"))) with | s_ => Some s_ end
   else None.

Definition _s1018_ (_s1019_ : string) : option string :=
   let _s1020_ := _s1019_ in
   if string_startswith _s1020_ "amomin" then
     match (string_drop _s1020_ (projT1 (string_length "amomin"))) with | s_ => Some s_ end
   else None.

Definition _s1014_ (_s1015_ : string) : option string :=
   let _s1016_ := _s1015_ in
   if string_startswith _s1016_ "amoor" then
     match (string_drop _s1016_ (projT1 (string_length "amoor"))) with | s_ => Some s_ end
   else None.

Definition _s1010_ (_s1011_ : string) : option string :=
   let _s1012_ := _s1011_ in
   if string_startswith _s1012_ "amoand" then
     match (string_drop _s1012_ (projT1 (string_length "amoand"))) with | s_ => Some s_ end
   else None.

Definition _s1006_ (_s1007_ : string) : option string :=
   let _s1008_ := _s1007_ in
   if string_startswith _s1008_ "amoxor" then
     match (string_drop _s1008_ (projT1 (string_length "amoxor"))) with | s_ => Some s_ end
   else None.

Definition _s1002_ (_s1003_ : string) : option string :=
   let _s1004_ := _s1003_ in
   if string_startswith _s1004_ "amoadd" then
     match (string_drop _s1004_ (projT1 (string_length "amoadd"))) with | s_ => Some s_ end
   else None.

Definition _s998_ (_s999_ : string) : option string :=
   let _s1000_ := _s999_ in
   if string_startswith _s1000_ "amoswap" then
     match (string_drop _s1000_ (projT1 (string_length "amoswap"))) with | s_ => Some s_ end
   else None.

Definition amo_mnemonic_matches_prefix (arg_ : string)
: M (option ((amoop * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1001_ := arg_ in
   (if match (_s998_ _s1001_) with | Some s_ => true | _ => false end then
      (match (_s998_ _s1001_) with
       | Some s_ =>
          returnm (Some
                     (AMOSWAP, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1002_ _s1001_) with | Some s_ => true | _ => false end then
      (match (_s1002_ _s1001_) with
       | Some s_ =>
          returnm (Some
                     (AMOADD, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1006_ _s1001_) with | Some s_ => true | _ => false end then
      (match (_s1006_ _s1001_) with
       | Some s_ =>
          returnm (Some
                     (AMOXOR, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1010_ _s1001_) with | Some s_ => true | _ => false end then
      (match (_s1010_ _s1001_) with
       | Some s_ =>
          returnm (Some
                     (AMOAND, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1014_ _s1001_) with | Some s_ => true | _ => false end then
      (match (_s1014_ _s1001_) with
       | Some s_ =>
          returnm (Some
                     (AMOOR, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1018_ _s1001_) with | Some s_ => true | _ => false end then
      (match (_s1018_ _s1001_) with
       | Some s_ =>
          returnm (Some
                     (AMOMIN, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1022_ _s1001_) with | Some s_ => true | _ => false end then
      (match (_s1022_ _s1001_) with
       | Some s_ =>
          returnm (Some
                     (AMOMAX, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1026_ _s1001_) with | Some s_ => true | _ => false end then
      (match (_s1026_ _s1001_) with
       | Some s_ =>
          returnm (Some
                     (AMOMINU, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1030_ _s1001_) with | Some s_ => true | _ => false end then
      (match (_s1030_ _s1001_) with
       | Some s_ =>
          returnm (Some
                     (AMOMAXU, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((amoop * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((amoop * {n : Z & ArithFact (n >=? 0)}))).

Definition encdec_mul_op_forwards (arg_ : (bool * bool * bool)) : M (mword 3) :=
   (match arg_ with
    | (false, true, true) => returnm ('b"000"  : mword 3)
    | (true, true, true) => returnm ('b"001"  : mword 3)
    | (true, true, false) => returnm ('b"010"  : mword 3)
    | (true, false, false) => returnm ('b"011"  : mword 3)
    | _ => exit tt  : M (mword 3)
    end)
    : M (mword 3).

Definition encdec_mul_op_backwards (arg_ : mword 3) : M ((bool * bool * bool)) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"000"  : mword 3) then returnm (false, true, true)
    else if eq_vec b__0 ('b"001"  : mword 3) then returnm (true, true, true)
    else if eq_vec b__0 ('b"010"  : mword 3) then returnm (true, true, false)
    else if eq_vec b__0 ('b"011"  : mword 3) then returnm (true, false, false)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M ((bool * bool * bool)).

Definition encdec_mul_op_forwards_matches (arg_ : (bool * bool * bool)) : bool :=
   match arg_ with
   | (false, true, true) => true
   | (true, true, true) => true
   | (true, true, false) => true
   | (true, false, false) => true
   | _ => false
   end.

Definition encdec_mul_op_backwards_matches (arg_ : mword 3) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"000"  : mword 3) then true
   else if eq_vec b__0 ('b"001"  : mword 3) then true
   else if eq_vec b__0 ('b"010"  : mword 3) then true
   else if eq_vec b__0 ('b"011"  : mword 3) then true
   else false.

Definition mul_mnemonic_forwards (arg_ : (bool * bool * bool)) : M (string) :=
   (match arg_ with
    | (false, true, true) => returnm "mul"
    | (true, true, true) => returnm "mulh"
    | (true, true, false) => returnm "mulhsu"
    | (true, false, false) => returnm "mulhu"
    | _ => exit tt  : M (string)
    end)
    : M (string).

Definition mul_mnemonic_backwards (arg_ : string) : M ((bool * bool * bool)) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "mul" then returnm (false, true, true)
    else if generic_eq p0_ "mulh" then returnm (true, true, true)
    else if generic_eq p0_ "mulhsu" then returnm (true, true, false)
    else if generic_eq p0_ "mulhu" then returnm (true, false, false)
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M ((bool * bool * bool)).

Definition mul_mnemonic_forwards_matches (arg_ : (bool * bool * bool)) : bool :=
   match arg_ with
   | (false, true, true) => true
   | (true, true, true) => true
   | (true, true, false) => true
   | (true, false, false) => true
   | _ => false
   end.

Definition mul_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "mul" then true
   else if generic_eq p0_ "mulh" then true
   else if generic_eq p0_ "mulhsu" then true
   else if generic_eq p0_ "mulhu" then true
   else false.

Definition _s1046_ (_s1047_ : string) : option string :=
   let _s1048_ := _s1047_ in
   if string_startswith _s1048_ "mulhu" then
     match (string_drop _s1048_ (projT1 (string_length "mulhu"))) with | s_ => Some s_ end
   else None.

Definition _s1042_ (_s1043_ : string) : option string :=
   let _s1044_ := _s1043_ in
   if string_startswith _s1044_ "mulhsu" then
     match (string_drop _s1044_ (projT1 (string_length "mulhsu"))) with | s_ => Some s_ end
   else None.

Definition _s1038_ (_s1039_ : string) : option string :=
   let _s1040_ := _s1039_ in
   if string_startswith _s1040_ "mulh" then
     match (string_drop _s1040_ (projT1 (string_length "mulh"))) with | s_ => Some s_ end
   else None.

Definition _s1034_ (_s1035_ : string) : option string :=
   let _s1036_ := _s1035_ in
   if string_startswith _s1036_ "mul" then
     match (string_drop _s1036_ (projT1 (string_length "mul"))) with | s_ => Some s_ end
   else None.

Definition mul_mnemonic_matches_prefix (arg_ : string)
: M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1037_ := arg_ in
   (if match (_s1034_ _s1037_) with | Some s_ => true | _ => false end then
      (match (_s1034_ _s1037_) with
       | Some s_ =>
          returnm (Some
                     ((false, true, true), build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1038_ _s1037_) with | Some s_ => true | _ => false end then
      (match (_s1038_ _s1037_) with
       | Some s_ =>
          returnm (Some
                     ((true, true, true), build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1042_ _s1037_) with | Some s_ => true | _ => false end then
      (match (_s1042_ _s1037_) with
       | Some s_ =>
          returnm (Some
                     ((true, true, false), build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1046_ _s1037_) with | Some s_ => true | _ => false end then
      (match (_s1046_ _s1037_) with
       | Some s_ =>
          returnm (Some
                     ((true, false, false), build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option (((bool * bool * bool) * {n : Z & ArithFact (n >=? 0)}))).

Definition maybe_not_u_forwards (arg_ : bool) : string :=
   match arg_ with | false => "u" | true => "" end.

Definition maybe_not_u_backwards (arg_ : string) : M (bool) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "u" then returnm false
    else if generic_eq p0_ "" then returnm true
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (bool).

Definition maybe_not_u_forwards_matches (arg_ : bool) : bool :=
   match arg_ with | false => true | true => true end.

Definition maybe_not_u_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "u" then true
   else if generic_eq p0_ "" then true
   else false.

Definition _s1054_ (_s1055_ : string) : option string :=
   let _s1056_ := _s1055_ in
   if string_startswith _s1056_ "" then
     match (string_drop _s1056_ (projT1 (string_length ""))) with | s_ => Some s_ end
   else None.

Definition _s1050_ (_s1051_ : string) : option string :=
   let _s1052_ := _s1051_ in
   if string_startswith _s1052_ "u" then
     match (string_drop _s1052_ (projT1 (string_length "u"))) with | s_ => Some s_ end
   else None.

Definition maybe_not_u_matches_prefix (arg_ : string)
: M (option ((bool * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1053_ := arg_ in
   (if match (_s1050_ _s1053_) with | Some s_ => true | _ => false end then
      (match (_s1050_ _s1053_) with
       | Some s_ =>
          returnm (Some
                     (false, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1054_ _s1053_) with | Some s_ => true | _ => false end then
      (match (_s1054_ _s1053_) with
       | Some s_ =>
          returnm (Some
                     (true, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((bool * {n : Z & ArithFact (n >=? 0)}))).

Definition encdec_csrop_forwards (arg_ : csrop) : mword 2 :=
   match arg_ with
   | CSRRW => 'b"01"  : mword 2
   | CSRRS => 'b"10"  : mword 2
   | CSRRC => 'b"11"  : mword 2
   end.

Definition encdec_csrop_backwards (arg_ : mword 2) : M (csrop) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"01"  : mword 2) then returnm CSRRW
    else if eq_vec b__0 ('b"10"  : mword 2) then returnm CSRRS
    else if eq_vec b__0 ('b"11"  : mword 2) then returnm CSRRC
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (csrop).

Definition encdec_csrop_forwards_matches (arg_ : csrop) : bool :=
   match arg_ with | CSRRW => true | CSRRS => true | CSRRC => true end.

Definition encdec_csrop_backwards_matches (arg_ : mword 2) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"01"  : mword 2) then true
   else if eq_vec b__0 ('b"10"  : mword 2) then true
   else if eq_vec b__0 ('b"11"  : mword 2) then true
   else false.

Definition readCSR (csr : mword 12) : M (mword 32) :=
   (match (csr, 32) with
    | (b__0, g__325) =>
       (if eq_vec b__0 (Ox"F11"  : mword 12) then
          ((read_reg mvendorid_ref)  : M (mword 32)) >>= fun w__0 : mword 32 =>
          returnm (EXTZ 32 w__0)
        else if eq_vec b__0 (Ox"F12"  : mword 12) then
          ((read_reg marchid_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"F13"  : mword 12) then
          ((read_reg mimpid_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"F14"  : mword 12) then
          ((read_reg mhartid_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"300"  : mword 12) then
          read_reg mstatus_ref >>= fun w__4 : Mstatus => returnm (_get_Mstatus_bits w__4)
        else if eq_vec b__0 (Ox"301"  : mword 12) then
          read_reg misa_ref >>= fun w__5 : Misa => returnm (_get_Misa_bits w__5)
        else if eq_vec b__0 (Ox"302"  : mword 12) then
          read_reg medeleg_ref >>= fun w__6 : Medeleg => returnm (_get_Medeleg_bits w__6)
        else if eq_vec b__0 (Ox"303"  : mword 12) then
          read_reg mideleg_ref >>= fun w__7 : Minterrupts => returnm (_get_Minterrupts_bits w__7)
        else if eq_vec b__0 (Ox"304"  : mword 12) then
          read_reg mie_ref >>= fun w__8 : Minterrupts => returnm (_get_Minterrupts_bits w__8)
        else if eq_vec b__0 (Ox"305"  : mword 12) then (get_mtvec tt)  : M (mword 32)
        else if eq_vec b__0 (Ox"306"  : mword 12) then
          read_reg mcounteren_ref >>= fun w__10 : Counteren =>
          returnm (EXTZ 32 (_get_Counteren_bits w__10))
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"310"  : mword 12)) (Z.eqb g__325 32)) then
          read_reg mstatush_ref >>= fun w__11 : Mstatush => returnm (_get_Mstatush_bits w__11)
        else if eq_vec b__0 (Ox"320"  : mword 12) then
          read_reg mcountinhibit_ref >>= fun w__12 : Counterin =>
          returnm (EXTZ 32 (_get_Counterin_bits w__12))
        else if eq_vec b__0 (Ox"340"  : mword 12) then
          ((read_reg mscratch_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"341"  : mword 12) then
          (get_xret_target Machine) >>= fun w__14 : mword 32 =>
          (pc_alignment_mask tt) >>= fun w__15 : mword 32 => returnm (and_vec w__14 w__15)
        else if eq_vec b__0 (Ox"342"  : mword 12) then
          read_reg mcause_ref >>= fun w__16 : Mcause => returnm (_get_Mcause_bits w__16)
        else if eq_vec b__0 (Ox"343"  : mword 12) then
          ((read_reg mtval_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"344"  : mword 12) then
          read_reg mip_ref >>= fun w__18 : Minterrupts => returnm (_get_Minterrupts_bits w__18)
        else if eq_vec b__0 (Ox"3A0"  : mword 12) then (pmpReadCfgReg 0)  : M (mword 32)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"3A1"  : mword 12)) (Z.eqb g__325 32)) then
          (pmpReadCfgReg 1)
           : M (mword 32)
        else if eq_vec b__0 (Ox"3A2"  : mword 12) then (pmpReadCfgReg 2)  : M (mword 32)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"3A3"  : mword 12)) (Z.eqb g__325 32)) then
          (pmpReadCfgReg 3)
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B0"  : mword 12) then
          ((read_reg pmpaddr0_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B1"  : mword 12) then
          ((read_reg pmpaddr1_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B2"  : mword 12) then
          ((read_reg pmpaddr2_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B3"  : mword 12) then
          ((read_reg pmpaddr3_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B4"  : mword 12) then
          ((read_reg pmpaddr4_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B5"  : mword 12) then
          ((read_reg pmpaddr5_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B6"  : mword 12) then
          ((read_reg pmpaddr6_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B7"  : mword 12) then
          ((read_reg pmpaddr7_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B8"  : mword 12) then
          ((read_reg pmpaddr8_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3B9"  : mword 12) then
          ((read_reg pmpaddr9_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3BA"  : mword 12) then
          ((read_reg pmpaddr10_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3BB"  : mword 12) then
          ((read_reg pmpaddr11_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3BC"  : mword 12) then
          ((read_reg pmpaddr12_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3BD"  : mword 12) then
          ((read_reg pmpaddr13_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3BE"  : mword 12) then
          ((read_reg pmpaddr14_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"3BF"  : mword 12) then
          ((read_reg pmpaddr15_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"B00"  : mword 12) then
          ((read_reg mcycle_ref)  : M (mword 64)) >>= fun w__39 : mword 64 =>
          returnm (subrange_vec_dec w__39 (Z.sub 32 1) 0)
        else if eq_vec b__0 (Ox"B02"  : mword 12) then
          ((read_reg minstret_ref)  : M (mword 64)) >>= fun w__40 : mword 64 =>
          returnm (subrange_vec_dec w__40 (Z.sub 32 1) 0)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"B80"  : mword 12)) (Z.eqb g__325 32)) then
          ((read_reg mcycle_ref)  : M (mword 64)) >>= fun w__41 : mword 64 =>
          returnm (subrange_vec_dec w__41 63 32)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"B82"  : mword 12)) (Z.eqb g__325 32)) then
          ((read_reg minstret_ref)  : M (mword 64)) >>= fun w__42 : mword 64 =>
          returnm (subrange_vec_dec w__42 63 32)
        else if eq_vec b__0 (Ox"7A0"  : mword 12) then
          ((read_reg tselect_ref)  : M (mword 32)) >>= fun w__43 : mword 32 =>
          returnm (not_vec w__43)
        else if eq_vec b__0 (Ox"100"  : mword 12) then
          read_reg mstatus_ref >>= fun w__44 : Mstatus =>
          returnm (_get_Sstatus_bits (lower_mstatus w__44))
        else if eq_vec b__0 (Ox"102"  : mword 12) then
          read_reg sedeleg_ref >>= fun w__45 : Sedeleg => returnm (_get_Sedeleg_bits w__45)
        else if eq_vec b__0 (Ox"103"  : mword 12) then
          read_reg sideleg_ref >>= fun w__46 : Sinterrupts => returnm (_get_Sinterrupts_bits w__46)
        else if eq_vec b__0 (Ox"104"  : mword 12) then
          read_reg mie_ref >>= fun w__47 : Minterrupts =>
          read_reg mideleg_ref >>= fun w__48 : Minterrupts =>
          returnm (_get_Sinterrupts_bits (lower_mie w__47 w__48))
        else if eq_vec b__0 (Ox"105"  : mword 12) then (get_stvec tt)  : M (mword 32)
        else if eq_vec b__0 (Ox"106"  : mword 12) then
          read_reg scounteren_ref >>= fun w__50 : Counteren =>
          returnm (EXTZ 32 (_get_Counteren_bits w__50))
        else if eq_vec b__0 (Ox"140"  : mword 12) then
          ((read_reg sscratch_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"141"  : mword 12) then
          (get_xret_target Supervisor) >>= fun w__52 : mword 32 =>
          (pc_alignment_mask tt) >>= fun w__53 : mword 32 => returnm (and_vec w__52 w__53)
        else if eq_vec b__0 (Ox"142"  : mword 12) then
          read_reg scause_ref >>= fun w__54 : Mcause => returnm (_get_Mcause_bits w__54)
        else if eq_vec b__0 (Ox"143"  : mword 12) then
          ((read_reg stval_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"144"  : mword 12) then
          read_reg mip_ref >>= fun w__56 : Minterrupts =>
          read_reg mideleg_ref >>= fun w__57 : Minterrupts =>
          returnm (_get_Sinterrupts_bits (lower_mip w__56 w__57))
        else if eq_vec b__0 (Ox"180"  : mword 12) then
          ((read_reg satp_ref)  : M (mword 32))
           : M (mword 32)
        else if eq_vec b__0 (Ox"C00"  : mword 12) then
          ((read_reg mcycle_ref)  : M (mword 64)) >>= fun w__59 : mword 64 =>
          returnm (subrange_vec_dec w__59 (Z.sub 32 1) 0)
        else if eq_vec b__0 (Ox"C01"  : mword 12) then
          ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__60 : mword 64 =>
          returnm (subrange_vec_dec w__60 (Z.sub 32 1) 0)
        else if eq_vec b__0 (Ox"C02"  : mword 12) then
          ((read_reg minstret_ref)  : M (mword 64)) >>= fun w__61 : mword 64 =>
          returnm (subrange_vec_dec w__61 (Z.sub 32 1) 0)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"C80"  : mword 12)) (Z.eqb g__325 32)) then
          ((read_reg mcycle_ref)  : M (mword 64)) >>= fun w__62 : mword 64 =>
          returnm (subrange_vec_dec w__62 63 32)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"C81"  : mword 12)) (Z.eqb g__325 32)) then
          ((read_reg mtime_ref)  : M (mword 64)) >>= fun w__63 : mword 64 =>
          returnm (subrange_vec_dec w__63 63 32)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"C82"  : mword 12)) (Z.eqb g__325 32)) then
          ((read_reg minstret_ref)  : M (mword 64)) >>= fun w__64 : mword 64 =>
          returnm (subrange_vec_dec w__64 63 32)
        else
          (ext_read_CSR csr) >>= fun w__65 : option (mword 32) =>
          returnm (match w__65 with
                   | Some res => res
                   | None =>
                      let '_ := (print_bits "unhandled read to CSR " csr)  : unit in
                      EXTZ 32 (Ox"0"  : mword 4)
                   end))
        : M (mword 32)
    end) >>= fun res : xlenbits =>
   let '_ :=
     (if get_config_print_reg tt then
        print_endline
          (String.append "CSR "
             (String.append (csr_name csr) (String.append " -> " (string_of_bits res))))
      else tt)
      : unit in
   returnm res.

Definition writeCSR (csr : mword 12) (value : mword 32) : M (unit) :=
   (match (csr, 32) with
    | (b__0, g__324) =>
       (if eq_vec b__0 (Ox"300"  : mword 12) then
          read_reg mstatus_ref >>= fun w__0 : Mstatus =>
          (legalize_mstatus w__0 value) >>= fun w__1 : Mstatus =>
          write_reg mstatus_ref w__1 >>
          read_reg mstatus_ref >>= fun w__2 : Mstatus => returnm (Some (_get_Mstatus_bits w__2))
        else if eq_vec b__0 (Ox"301"  : mword 12) then
          read_reg misa_ref >>= fun w__3 : Misa =>
          (legalize_misa w__3 value) >>= fun w__4 : Misa =>
          write_reg misa_ref w__4 >>
          read_reg misa_ref >>= fun w__5 : Misa => returnm (Some (_get_Misa_bits w__5))
        else if eq_vec b__0 (Ox"302"  : mword 12) then
          read_reg medeleg_ref >>= fun w__6 : Medeleg =>
          write_reg medeleg_ref (legalize_medeleg w__6 value) >>
          read_reg medeleg_ref >>= fun w__7 : Medeleg => returnm (Some (_get_Medeleg_bits w__7))
        else if eq_vec b__0 (Ox"303"  : mword 12) then
          read_reg mideleg_ref >>= fun w__8 : Minterrupts =>
          write_reg mideleg_ref (legalize_mideleg w__8 value) >>
          read_reg mideleg_ref >>= fun w__9 : Minterrupts =>
          returnm (Some (_get_Minterrupts_bits w__9))
        else if eq_vec b__0 (Ox"304"  : mword 12) then
          read_reg mie_ref >>= fun w__10 : Minterrupts =>
          (legalize_mie w__10 value) >>= fun w__11 : Minterrupts =>
          write_reg mie_ref w__11 >>
          read_reg mie_ref >>= fun w__12 : Minterrupts =>
          returnm (Some (_get_Minterrupts_bits w__12))
        else if eq_vec b__0 (Ox"305"  : mword 12) then
          (set_mtvec value) >>= fun w__13 : mword 32 => returnm (Some w__13)
        else if eq_vec b__0 (Ox"306"  : mword 12) then
          read_reg mcounteren_ref >>= fun w__14 : Counteren =>
          write_reg mcounteren_ref (legalize_mcounteren w__14 value) >>
          read_reg mcounteren_ref >>= fun w__15 : Counteren =>
          returnm (Some (EXTZ 32 (_get_Counteren_bits w__15)))
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"310"  : mword 12)) (Z.eqb g__324 32)) then
          read_reg mstatush_ref >>= fun w__16 : Mstatush =>
          returnm (Some (_get_Mstatush_bits w__16))
        else if eq_vec b__0 (Ox"320"  : mword 12) then
          read_reg mcountinhibit_ref >>= fun w__17 : Counterin =>
          write_reg mcountinhibit_ref (legalize_mcountinhibit w__17 value) >>
          read_reg mcountinhibit_ref >>= fun w__18 : Counterin =>
          returnm (Some (EXTZ 32 (_get_Counterin_bits w__18)))
        else if eq_vec b__0 (Ox"340"  : mword 12) then
          write_reg mscratch_ref value >>
          ((read_reg mscratch_ref)  : M (mword 32)) >>= fun w__19 : mword 32 => returnm (Some w__19)
        else if eq_vec b__0 (Ox"341"  : mword 12) then
          (set_xret_target Machine value) >>= fun w__20 : mword 32 => returnm (Some w__20)
        else if eq_vec b__0 (Ox"342"  : mword 12) then
          (_set_Mcause_bits mcause_ref value) >>
          read_reg mcause_ref >>= fun w__21 : Mcause => returnm (Some (_get_Mcause_bits w__21))
        else if eq_vec b__0 (Ox"343"  : mword 12) then
          write_reg mtval_ref value >>
          ((read_reg mtval_ref)  : M (mword 32)) >>= fun w__22 : mword 32 => returnm (Some w__22)
        else if eq_vec b__0 (Ox"344"  : mword 12) then
          read_reg mip_ref >>= fun w__23 : Minterrupts =>
          (legalize_mip w__23 value) >>= fun w__24 : Minterrupts =>
          write_reg mip_ref w__24 >>
          read_reg mip_ref >>= fun w__25 : Minterrupts =>
          returnm (Some (_get_Minterrupts_bits w__25))
        else if eq_vec b__0 (Ox"3A0"  : mword 12) then
          (pmpWriteCfgReg 0 value) >>
          (pmpReadCfgReg 0) >>= fun w__26 : mword 32 => returnm (Some w__26)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"3A1"  : mword 12)) (Z.eqb g__324 32)) then
          (pmpWriteCfgReg 1 value) >>
          (pmpReadCfgReg 1) >>= fun w__27 : mword 32 => returnm (Some w__27)
        else if eq_vec b__0 (Ox"3A2"  : mword 12) then
          (pmpWriteCfgReg 2 value) >>
          (pmpReadCfgReg 2) >>= fun w__28 : mword 32 => returnm (Some w__28)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"3A3"  : mword 12)) (Z.eqb g__324 32)) then
          (pmpWriteCfgReg 3 value) >>
          (pmpReadCfgReg 3) >>= fun w__29 : mword 32 => returnm (Some w__29)
        else if eq_vec b__0 (Ox"3B0"  : mword 12) then
          read_reg pmp0cfg_ref >>= fun w__30 : Pmpcfg_ent =>
          read_reg pmp1cfg_ref >>= fun w__31 : Pmpcfg_ent =>
          (pmpTORLocked w__31) >>= fun w__32 : bool =>
          ((read_reg pmpaddr0_ref)  : M (mword 32)) >>= fun w__33 : mword 32 =>
          write_reg pmpaddr0_ref (pmpWriteAddr (pmpLocked w__30) w__32 w__33 value) >>
          ((read_reg pmpaddr0_ref)  : M (mword 32)) >>= fun w__34 : mword 32 => returnm (Some w__34)
        else if eq_vec b__0 (Ox"3B1"  : mword 12) then
          read_reg pmp1cfg_ref >>= fun w__35 : Pmpcfg_ent =>
          read_reg pmp2cfg_ref >>= fun w__36 : Pmpcfg_ent =>
          (pmpTORLocked w__36) >>= fun w__37 : bool =>
          ((read_reg pmpaddr1_ref)  : M (mword 32)) >>= fun w__38 : mword 32 =>
          write_reg pmpaddr1_ref (pmpWriteAddr (pmpLocked w__35) w__37 w__38 value) >>
          ((read_reg pmpaddr1_ref)  : M (mword 32)) >>= fun w__39 : mword 32 => returnm (Some w__39)
        else if eq_vec b__0 (Ox"3B2"  : mword 12) then
          read_reg pmp2cfg_ref >>= fun w__40 : Pmpcfg_ent =>
          read_reg pmp3cfg_ref >>= fun w__41 : Pmpcfg_ent =>
          (pmpTORLocked w__41) >>= fun w__42 : bool =>
          ((read_reg pmpaddr2_ref)  : M (mword 32)) >>= fun w__43 : mword 32 =>
          write_reg pmpaddr2_ref (pmpWriteAddr (pmpLocked w__40) w__42 w__43 value) >>
          ((read_reg pmpaddr2_ref)  : M (mword 32)) >>= fun w__44 : mword 32 => returnm (Some w__44)
        else if eq_vec b__0 (Ox"3B3"  : mword 12) then
          read_reg pmp3cfg_ref >>= fun w__45 : Pmpcfg_ent =>
          read_reg pmp4cfg_ref >>= fun w__46 : Pmpcfg_ent =>
          (pmpTORLocked w__46) >>= fun w__47 : bool =>
          ((read_reg pmpaddr3_ref)  : M (mword 32)) >>= fun w__48 : mword 32 =>
          write_reg pmpaddr3_ref (pmpWriteAddr (pmpLocked w__45) w__47 w__48 value) >>
          ((read_reg pmpaddr3_ref)  : M (mword 32)) >>= fun w__49 : mword 32 => returnm (Some w__49)
        else if eq_vec b__0 (Ox"3B4"  : mword 12) then
          read_reg pmp4cfg_ref >>= fun w__50 : Pmpcfg_ent =>
          read_reg pmp5cfg_ref >>= fun w__51 : Pmpcfg_ent =>
          (pmpTORLocked w__51) >>= fun w__52 : bool =>
          ((read_reg pmpaddr4_ref)  : M (mword 32)) >>= fun w__53 : mword 32 =>
          write_reg pmpaddr4_ref (pmpWriteAddr (pmpLocked w__50) w__52 w__53 value) >>
          ((read_reg pmpaddr4_ref)  : M (mword 32)) >>= fun w__54 : mword 32 => returnm (Some w__54)
        else if eq_vec b__0 (Ox"3B5"  : mword 12) then
          read_reg pmp5cfg_ref >>= fun w__55 : Pmpcfg_ent =>
          read_reg pmp6cfg_ref >>= fun w__56 : Pmpcfg_ent =>
          (pmpTORLocked w__56) >>= fun w__57 : bool =>
          ((read_reg pmpaddr5_ref)  : M (mword 32)) >>= fun w__58 : mword 32 =>
          write_reg pmpaddr5_ref (pmpWriteAddr (pmpLocked w__55) w__57 w__58 value) >>
          ((read_reg pmpaddr5_ref)  : M (mword 32)) >>= fun w__59 : mword 32 => returnm (Some w__59)
        else if eq_vec b__0 (Ox"3B6"  : mword 12) then
          read_reg pmp6cfg_ref >>= fun w__60 : Pmpcfg_ent =>
          read_reg pmp7cfg_ref >>= fun w__61 : Pmpcfg_ent =>
          (pmpTORLocked w__61) >>= fun w__62 : bool =>
          ((read_reg pmpaddr6_ref)  : M (mword 32)) >>= fun w__63 : mword 32 =>
          write_reg pmpaddr6_ref (pmpWriteAddr (pmpLocked w__60) w__62 w__63 value) >>
          ((read_reg pmpaddr6_ref)  : M (mword 32)) >>= fun w__64 : mword 32 => returnm (Some w__64)
        else if eq_vec b__0 (Ox"3B7"  : mword 12) then
          read_reg pmp7cfg_ref >>= fun w__65 : Pmpcfg_ent =>
          read_reg pmp8cfg_ref >>= fun w__66 : Pmpcfg_ent =>
          (pmpTORLocked w__66) >>= fun w__67 : bool =>
          ((read_reg pmpaddr7_ref)  : M (mword 32)) >>= fun w__68 : mword 32 =>
          write_reg pmpaddr7_ref (pmpWriteAddr (pmpLocked w__65) w__67 w__68 value) >>
          ((read_reg pmpaddr7_ref)  : M (mword 32)) >>= fun w__69 : mword 32 => returnm (Some w__69)
        else if eq_vec b__0 (Ox"3B8"  : mword 12) then
          read_reg pmp8cfg_ref >>= fun w__70 : Pmpcfg_ent =>
          read_reg pmp9cfg_ref >>= fun w__71 : Pmpcfg_ent =>
          (pmpTORLocked w__71) >>= fun w__72 : bool =>
          ((read_reg pmpaddr8_ref)  : M (mword 32)) >>= fun w__73 : mword 32 =>
          write_reg pmpaddr8_ref (pmpWriteAddr (pmpLocked w__70) w__72 w__73 value) >>
          ((read_reg pmpaddr8_ref)  : M (mword 32)) >>= fun w__74 : mword 32 => returnm (Some w__74)
        else if eq_vec b__0 (Ox"3B9"  : mword 12) then
          read_reg pmp9cfg_ref >>= fun w__75 : Pmpcfg_ent =>
          read_reg pmp10cfg_ref >>= fun w__76 : Pmpcfg_ent =>
          (pmpTORLocked w__76) >>= fun w__77 : bool =>
          ((read_reg pmpaddr9_ref)  : M (mword 32)) >>= fun w__78 : mword 32 =>
          write_reg pmpaddr9_ref (pmpWriteAddr (pmpLocked w__75) w__77 w__78 value) >>
          ((read_reg pmpaddr9_ref)  : M (mword 32)) >>= fun w__79 : mword 32 => returnm (Some w__79)
        else if eq_vec b__0 (Ox"3BA"  : mword 12) then
          read_reg pmp10cfg_ref >>= fun w__80 : Pmpcfg_ent =>
          read_reg pmp11cfg_ref >>= fun w__81 : Pmpcfg_ent =>
          (pmpTORLocked w__81) >>= fun w__82 : bool =>
          ((read_reg pmpaddr10_ref)  : M (mword 32)) >>= fun w__83 : mword 32 =>
          write_reg pmpaddr10_ref (pmpWriteAddr (pmpLocked w__80) w__82 w__83 value) >>
          ((read_reg pmpaddr10_ref)  : M (mword 32)) >>= fun w__84 : mword 32 =>
          returnm (Some w__84)
        else if eq_vec b__0 (Ox"3BB"  : mword 12) then
          read_reg pmp11cfg_ref >>= fun w__85 : Pmpcfg_ent =>
          read_reg pmp12cfg_ref >>= fun w__86 : Pmpcfg_ent =>
          (pmpTORLocked w__86) >>= fun w__87 : bool =>
          ((read_reg pmpaddr11_ref)  : M (mword 32)) >>= fun w__88 : mword 32 =>
          write_reg pmpaddr11_ref (pmpWriteAddr (pmpLocked w__85) w__87 w__88 value) >>
          ((read_reg pmpaddr11_ref)  : M (mword 32)) >>= fun w__89 : mword 32 =>
          returnm (Some w__89)
        else if eq_vec b__0 (Ox"3BC"  : mword 12) then
          read_reg pmp12cfg_ref >>= fun w__90 : Pmpcfg_ent =>
          read_reg pmp13cfg_ref >>= fun w__91 : Pmpcfg_ent =>
          (pmpTORLocked w__91) >>= fun w__92 : bool =>
          ((read_reg pmpaddr12_ref)  : M (mword 32)) >>= fun w__93 : mword 32 =>
          write_reg pmpaddr12_ref (pmpWriteAddr (pmpLocked w__90) w__92 w__93 value) >>
          ((read_reg pmpaddr12_ref)  : M (mword 32)) >>= fun w__94 : mword 32 =>
          returnm (Some w__94)
        else if eq_vec b__0 (Ox"3BD"  : mword 12) then
          read_reg pmp13cfg_ref >>= fun w__95 : Pmpcfg_ent =>
          read_reg pmp14cfg_ref >>= fun w__96 : Pmpcfg_ent =>
          (pmpTORLocked w__96) >>= fun w__97 : bool =>
          ((read_reg pmpaddr13_ref)  : M (mword 32)) >>= fun w__98 : mword 32 =>
          write_reg pmpaddr13_ref (pmpWriteAddr (pmpLocked w__95) w__97 w__98 value) >>
          ((read_reg pmpaddr13_ref)  : M (mword 32)) >>= fun w__99 : mword 32 =>
          returnm (Some w__99)
        else if eq_vec b__0 (Ox"3BE"  : mword 12) then
          read_reg pmp14cfg_ref >>= fun w__100 : Pmpcfg_ent =>
          read_reg pmp15cfg_ref >>= fun w__101 : Pmpcfg_ent =>
          (pmpTORLocked w__101) >>= fun w__102 : bool =>
          ((read_reg pmpaddr14_ref)  : M (mword 32)) >>= fun w__103 : mword 32 =>
          write_reg pmpaddr14_ref (pmpWriteAddr (pmpLocked w__100) w__102 w__103 value) >>
          ((read_reg pmpaddr14_ref)  : M (mword 32)) >>= fun w__104 : mword 32 =>
          returnm (Some w__104)
        else if eq_vec b__0 (Ox"3BF"  : mword 12) then
          read_reg pmp15cfg_ref >>= fun w__105 : Pmpcfg_ent =>
          ((read_reg pmpaddr15_ref)  : M (mword 32)) >>= fun w__106 : mword 32 =>
          write_reg pmpaddr15_ref (pmpWriteAddr (pmpLocked w__105) false w__106 value) >>
          ((read_reg pmpaddr15_ref)  : M (mword 32)) >>= fun w__107 : mword 32 =>
          returnm (Some w__107)
        else if eq_vec b__0 (Ox"B00"  : mword 12) then
          ((read_reg mcycle_ref)  : M (mword 64)) >>= fun w__108 : mword 64 =>
          write_reg mcycle_ref (update_subrange_vec_dec w__108 (Z.sub 32 1) 0 value) >>
          returnm (Some value)
        else if eq_vec b__0 (Ox"B02"  : mword 12) then
          ((read_reg minstret_ref)  : M (mword 64)) >>= fun w__109 : mword 64 =>
          write_reg minstret_ref (update_subrange_vec_dec w__109 (Z.sub 32 1) 0 value) >>
          write_reg minstret_written_ref true >> returnm (Some value)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"B80"  : mword 12)) (Z.eqb g__324 32)) then
          ((read_reg mcycle_ref)  : M (mword 64)) >>= fun w__110 : mword 64 =>
          write_reg mcycle_ref (update_subrange_vec_dec w__110 63 32 value) >> returnm (Some value)
        else if sumbool_of_bool (andb (eq_vec b__0 (Ox"B82"  : mword 12)) (Z.eqb g__324 32)) then
          ((read_reg minstret_ref)  : M (mword 64)) >>= fun w__111 : mword 64 =>
          write_reg minstret_ref (update_subrange_vec_dec w__111 63 32 value) >>
          write_reg minstret_written_ref true >> returnm (Some value)
        else if eq_vec b__0 (Ox"7A0"  : mword 12) then
          write_reg tselect_ref value >>
          ((read_reg tselect_ref)  : M (mword 32)) >>= fun w__112 : mword 32 =>
          returnm (Some w__112)
        else if eq_vec b__0 (Ox"100"  : mword 12) then
          read_reg mstatus_ref >>= fun w__113 : Mstatus =>
          (legalize_sstatus w__113 value) >>= fun w__114 : Mstatus =>
          write_reg mstatus_ref w__114 >>
          read_reg mstatus_ref >>= fun w__115 : Mstatus => returnm (Some (_get_Mstatus_bits w__115))
        else if eq_vec b__0 (Ox"102"  : mword 12) then
          read_reg sedeleg_ref >>= fun w__116 : Sedeleg =>
          write_reg sedeleg_ref (legalize_sedeleg w__116 value) >>
          read_reg sedeleg_ref >>= fun w__117 : Sedeleg => returnm (Some (_get_Sedeleg_bits w__117))
        else if eq_vec b__0 (Ox"103"  : mword 12) then
          (_set_Sinterrupts_bits sideleg_ref value) >>
          read_reg sideleg_ref >>= fun w__118 : Sinterrupts =>
          returnm (Some (_get_Sinterrupts_bits w__118))
        else if eq_vec b__0 (Ox"104"  : mword 12) then
          read_reg mie_ref >>= fun w__119 : Minterrupts =>
          read_reg mideleg_ref >>= fun w__120 : Minterrupts =>
          (legalize_sie w__119 w__120 value) >>= fun w__121 : Minterrupts =>
          write_reg mie_ref w__121 >>
          read_reg mie_ref >>= fun w__122 : Minterrupts =>
          returnm (Some (_get_Minterrupts_bits w__122))
        else if eq_vec b__0 (Ox"105"  : mword 12) then
          (set_stvec value) >>= fun w__123 : mword 32 => returnm (Some w__123)
        else if eq_vec b__0 (Ox"106"  : mword 12) then
          read_reg scounteren_ref >>= fun w__124 : Counteren =>
          write_reg scounteren_ref (legalize_scounteren w__124 value) >>
          read_reg scounteren_ref >>= fun w__125 : Counteren =>
          returnm (Some (EXTZ 32 (_get_Counteren_bits w__125)))
        else if eq_vec b__0 (Ox"140"  : mword 12) then
          write_reg sscratch_ref value >>
          ((read_reg sscratch_ref)  : M (mword 32)) >>= fun w__126 : mword 32 =>
          returnm (Some w__126)
        else if eq_vec b__0 (Ox"141"  : mword 12) then
          (set_xret_target Supervisor value) >>= fun w__127 : mword 32 => returnm (Some w__127)
        else if eq_vec b__0 (Ox"142"  : mword 12) then
          (_set_Mcause_bits scause_ref value) >>
          read_reg scause_ref >>= fun w__128 : Mcause => returnm (Some (_get_Mcause_bits w__128))
        else if eq_vec b__0 (Ox"143"  : mword 12) then
          write_reg stval_ref value >>
          ((read_reg stval_ref)  : M (mword 32)) >>= fun w__129 : mword 32 => returnm (Some w__129)
        else if eq_vec b__0 (Ox"144"  : mword 12) then
          read_reg mip_ref >>= fun w__130 : Minterrupts =>
          read_reg mideleg_ref >>= fun w__131 : Minterrupts =>
          (legalize_sip w__130 w__131 value) >>= fun w__132 : Minterrupts =>
          write_reg mip_ref w__132 >>
          read_reg mip_ref >>= fun w__133 : Minterrupts =>
          returnm (Some (_get_Minterrupts_bits w__133))
        else if eq_vec b__0 (Ox"180"  : mword 12) then
          (cur_Architecture tt) >>= fun w__134 : Architecture =>
          ((read_reg satp_ref)  : M (mword 32)) >>= fun w__135 : mword 32 =>
          write_reg satp_ref (legalize_satp w__134 w__135 value) >>
          ((read_reg satp_ref)  : M (mword 32)) >>= fun w__136 : mword 32 => returnm (Some w__136)
        else (ext_write_CSR csr value)  : M (option (mword 32)))
        : M (option (mword 32))
    end) >>= fun res : option xlenbits =>
   returnm (match res with
            | Some v =>
               if get_config_print_reg tt then
                 print_endline
                   (String.append "CSR "
                      (String.append (csr_name csr)
                         (String.append " <- "
                            (String.append (string_of_bits v)
                               (String.append " (input: " (String.append (string_of_bits value) ")"))))))
               else tt
            | None => print_bits "unhandled write to CSR " csr
            end).

Definition maybe_i_forwards (arg_ : bool) : string :=
   match arg_ with | true => "i" | false => "" end.

Definition maybe_i_backwards (arg_ : string) : M (bool) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "i" then returnm true
    else if generic_eq p0_ "" then returnm false
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (bool).

Definition maybe_i_forwards_matches (arg_ : bool) : bool :=
   match arg_ with | true => true | false => true end.

Definition maybe_i_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "i" then true
   else if generic_eq p0_ "" then true
   else false.

Definition _s1062_ (_s1063_ : string) : option string :=
   let _s1064_ := _s1063_ in
   if string_startswith _s1064_ "" then
     match (string_drop _s1064_ (projT1 (string_length ""))) with | s_ => Some s_ end
   else None.

Definition _s1058_ (_s1059_ : string) : option string :=
   let _s1060_ := _s1059_ in
   if string_startswith _s1060_ "i" then
     match (string_drop _s1060_ (projT1 (string_length "i"))) with | s_ => Some s_ end
   else None.

Definition maybe_i_matches_prefix (arg_ : string)
: M (option ((bool * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1061_ := arg_ in
   (if match (_s1058_ _s1061_) with | Some s_ => true | _ => false end then
      (match (_s1058_ _s1061_) with
       | Some s_ =>
          returnm (Some
                     (true, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1062_ _s1061_) with | Some s_ => true | _ => false end then
      (match (_s1062_ _s1061_) with
       | Some s_ =>
          returnm (Some
                     (false, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((bool * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((bool * {n : Z & ArithFact (n >=? 0)}))).

Definition csr_mnemonic_forwards (arg_ : csrop) : string :=
   match arg_ with | CSRRW => "csrrw" | CSRRS => "csrrs" | CSRRC => "csrrc" end.

Definition csr_mnemonic_backwards (arg_ : string) : M (csrop) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "csrrw" then returnm CSRRW
    else if generic_eq p0_ "csrrs" then returnm CSRRS
    else if generic_eq p0_ "csrrc" then returnm CSRRC
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (csrop).

Definition csr_mnemonic_forwards_matches (arg_ : csrop) : bool :=
   match arg_ with | CSRRW => true | CSRRS => true | CSRRC => true end.

Definition csr_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "csrrw" then true
   else if generic_eq p0_ "csrrs" then true
   else if generic_eq p0_ "csrrc" then true
   else false.

Definition _s1074_ (_s1075_ : string) : option string :=
   let _s1076_ := _s1075_ in
   if string_startswith _s1076_ "csrrc" then
     match (string_drop _s1076_ (projT1 (string_length "csrrc"))) with | s_ => Some s_ end
   else None.

Definition _s1070_ (_s1071_ : string) : option string :=
   let _s1072_ := _s1071_ in
   if string_startswith _s1072_ "csrrs" then
     match (string_drop _s1072_ (projT1 (string_length "csrrs"))) with | s_ => Some s_ end
   else None.

Definition _s1066_ (_s1067_ : string) : option string :=
   let _s1068_ := _s1067_ in
   if string_startswith _s1068_ "csrrw" then
     match (string_drop _s1068_ (projT1 (string_length "csrrw"))) with | s_ => Some s_ end
   else None.

Definition csr_mnemonic_matches_prefix (arg_ : string)
: M (option ((csrop * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1069_ := arg_ in
   (if match (_s1066_ _s1069_) with | Some s_ => true | _ => false end then
      (match (_s1066_ _s1069_) with
       | Some s_ =>
          returnm (Some
                     (CSRRW, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((csrop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((csrop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1070_ _s1069_) with | Some s_ => true | _ => false end then
      (match (_s1070_ _s1069_) with
       | Some s_ =>
          returnm (Some
                     (CSRRS, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((csrop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((csrop * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1074_ _s1069_) with | Some s_ => true | _ => false end then
      (match (_s1074_ _s1069_) with
       | Some s_ =>
          returnm (Some
                     (CSRRC, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((csrop * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((csrop * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((csrop * {n : Z & ArithFact (n >=? 0)}))).

Definition encdec_rounding_mode_forwards (arg_ : rounding_mode) : mword 3 :=
   match arg_ with
   | RM_RNE => 'b"000"  : mword 3
   | RM_RTZ => 'b"001"  : mword 3
   | RM_RDN => 'b"010"  : mword 3
   | RM_RUP => 'b"011"  : mword 3
   | RM_RMM => 'b"100"  : mword 3
   | RM_DYN => 'b"111"  : mword 3
   end.

Definition encdec_rounding_mode_backwards (arg_ : mword 3) : M (rounding_mode) :=
   let b__0 := arg_ in
   (if eq_vec b__0 ('b"000"  : mword 3) then returnm RM_RNE
    else if eq_vec b__0 ('b"001"  : mword 3) then returnm RM_RTZ
    else if eq_vec b__0 ('b"010"  : mword 3) then returnm RM_RDN
    else if eq_vec b__0 ('b"011"  : mword 3) then returnm RM_RUP
    else if eq_vec b__0 ('b"100"  : mword 3) then returnm RM_RMM
    else if eq_vec b__0 ('b"111"  : mword 3) then returnm RM_DYN
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (rounding_mode).

Definition encdec_rounding_mode_forwards_matches (arg_ : rounding_mode) : bool :=
   match arg_ with
   | RM_RNE => true
   | RM_RTZ => true
   | RM_RDN => true
   | RM_RUP => true
   | RM_RMM => true
   | RM_DYN => true
   end.

Definition encdec_rounding_mode_backwards_matches (arg_ : mword 3) : bool :=
   let b__0 := arg_ in
   if eq_vec b__0 ('b"000"  : mword 3) then true
   else if eq_vec b__0 ('b"001"  : mword 3) then true
   else if eq_vec b__0 ('b"010"  : mword 3) then true
   else if eq_vec b__0 ('b"011"  : mword 3) then true
   else if eq_vec b__0 ('b"100"  : mword 3) then true
   else if eq_vec b__0 ('b"111"  : mword 3) then true
   else false.

Definition frm_mnemonic_forwards (arg_ : rounding_mode) : string :=
   match arg_ with
   | RM_RNE => "rne"
   | RM_RTZ => "rtz"
   | RM_RDN => "rdn"
   | RM_RUP => "rup"
   | RM_RMM => "rmm"
   | RM_DYN => "dyn"
   end.

Definition frm_mnemonic_backwards (arg_ : string) : M (rounding_mode) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "rne" then returnm RM_RNE
    else if generic_eq p0_ "rtz" then returnm RM_RTZ
    else if generic_eq p0_ "rdn" then returnm RM_RDN
    else if generic_eq p0_ "rup" then returnm RM_RUP
    else if generic_eq p0_ "rmm" then returnm RM_RMM
    else if generic_eq p0_ "dyn" then returnm RM_DYN
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (rounding_mode).

Definition frm_mnemonic_forwards_matches (arg_ : rounding_mode) : bool :=
   match arg_ with
   | RM_RNE => true
   | RM_RTZ => true
   | RM_RDN => true
   | RM_RUP => true
   | RM_RMM => true
   | RM_DYN => true
   end.

Definition frm_mnemonic_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "rne" then true
   else if generic_eq p0_ "rtz" then true
   else if generic_eq p0_ "rdn" then true
   else if generic_eq p0_ "rup" then true
   else if generic_eq p0_ "rmm" then true
   else if generic_eq p0_ "dyn" then true
   else false.

Definition _s1098_ (_s1099_ : string) : option string :=
   let _s1100_ := _s1099_ in
   if string_startswith _s1100_ "dyn" then
     match (string_drop _s1100_ (projT1 (string_length "dyn"))) with | s_ => Some s_ end
   else None.

Definition _s1094_ (_s1095_ : string) : option string :=
   let _s1096_ := _s1095_ in
   if string_startswith _s1096_ "rmm" then
     match (string_drop _s1096_ (projT1 (string_length "rmm"))) with | s_ => Some s_ end
   else None.

Definition _s1090_ (_s1091_ : string) : option string :=
   let _s1092_ := _s1091_ in
   if string_startswith _s1092_ "rup" then
     match (string_drop _s1092_ (projT1 (string_length "rup"))) with | s_ => Some s_ end
   else None.

Definition _s1086_ (_s1087_ : string) : option string :=
   let _s1088_ := _s1087_ in
   if string_startswith _s1088_ "rdn" then
     match (string_drop _s1088_ (projT1 (string_length "rdn"))) with | s_ => Some s_ end
   else None.

Definition _s1082_ (_s1083_ : string) : option string :=
   let _s1084_ := _s1083_ in
   if string_startswith _s1084_ "rtz" then
     match (string_drop _s1084_ (projT1 (string_length "rtz"))) with | s_ => Some s_ end
   else None.

Definition _s1078_ (_s1079_ : string) : option string :=
   let _s1080_ := _s1079_ in
   if string_startswith _s1080_ "rne" then
     match (string_drop _s1080_ (projT1 (string_length "rne"))) with | s_ => Some s_ end
   else None.

Definition frm_mnemonic_matches_prefix (arg_ : string)
: M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1081_ := arg_ in
   (if match (_s1078_ _s1081_) with | Some s_ => true | _ => false end then
      (match (_s1078_ _s1081_) with
       | Some s_ =>
          returnm (Some
                     (RM_RNE, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1082_ _s1081_) with | Some s_ => true | _ => false end then
      (match (_s1082_ _s1081_) with
       | Some s_ =>
          returnm (Some
                     (RM_RTZ, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1086_ _s1081_) with | Some s_ => true | _ => false end then
      (match (_s1086_ _s1081_) with
       | Some s_ =>
          returnm (Some
                     (RM_RDN, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1090_ _s1081_) with | Some s_ => true | _ => false end then
      (match (_s1090_ _s1081_) with
       | Some s_ =>
          returnm (Some
                     (RM_RUP, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1094_ _s1081_) with | Some s_ => true | _ => false end then
      (match (_s1094_ _s1081_) with
       | Some s_ =>
          returnm (Some
                     (RM_RMM, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1098_ _s1081_) with | Some s_ => true | _ => false end then
      (match (_s1098_ _s1081_) with
       | Some s_ =>
          returnm (Some
                     (RM_DYN, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((rounding_mode * {n : Z & ArithFact (n >=? 0)}))).

Definition select_instr_or_fcsr_rm (instr_rm : rounding_mode) : M (rounding_mode) :=
   (if generic_eq instr_rm RM_DYN then
      read_reg fcsr_ref >>= fun w__0 : Fcsr =>
      (encdec_rounding_mode_backwards (_get_Fcsr_FRM w__0))
       : M (rounding_mode)
    else returnm instr_rm)
    : M (rounding_mode).

Definition nxFlag '(tt : unit) : mword 5 := 'b"00001"  : mword 5.

Definition ufFlag '(tt : unit) : mword 5 := 'b"00010"  : mword 5.

Definition ofFlag '(tt : unit) : mword 5 := 'b"00100"  : mword 5.

Definition dzFlag '(tt : unit) : mword 5 := 'b"01000"  : mword 5.

Definition nvFlag '(tt : unit) : mword 5 := 'b"10000"  : mword 5.

Definition fsplit_S (x32 : mword 32) : (mword 1 * mword 8 * mword 23) :=
   (subrange_vec_dec x32 31 31, subrange_vec_dec x32 30 23, subrange_vec_dec x32 22 0).

Definition fmake_S (sign : mword 1) (exp : mword 8) (mant : mword 23) : mword 32 :=
   concat_vec sign (concat_vec exp mant).

Definition canonical_NaN_S '(tt : unit) : mword 32 := Ox"7FC00000"  : mword 32.

Definition f_is_neg_inf_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec sign ('b"1"  : mword 1))
     (andb (eq_vec exp (ones 8)) (eq_vec mant (zeros_implicit 23))).

Definition f_is_neg_norm_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec sign ('b"1"  : mword 1))
     (andb (neq_vec exp (zeros_implicit 8)) (neq_vec exp (ones 8))).

Definition f_is_neg_subnorm_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec sign ('b"1"  : mword 1))
     (andb (eq_vec exp (zeros_implicit 8)) (neq_vec mant (zeros_implicit 23))).

Definition f_is_neg_zero_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec sign (ones 1))
     (andb (eq_vec exp (zeros_implicit 8)) (eq_vec mant (zeros_implicit 23))).

Definition f_is_pos_zero_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec sign (zeros_implicit 1))
     (andb (eq_vec exp (zeros_implicit 8)) (eq_vec mant (zeros_implicit 23))).

Definition f_is_pos_subnorm_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec sign (zeros_implicit 1))
     (andb (eq_vec exp (zeros_implicit 8)) (neq_vec mant (zeros_implicit 23))).

Definition f_is_pos_norm_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec sign (zeros_implicit 1))
     (andb (neq_vec exp (zeros_implicit 8)) (neq_vec exp (ones 8))).

Definition f_is_pos_inf_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec sign (zeros_implicit 1))
     (andb (eq_vec exp (ones 8)) (eq_vec mant (zeros_implicit 23))).

Definition f_is_SNaN_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec exp (ones 8))
     (andb (eq_bit (access_vec_dec mant 22) B0) (neq_vec mant (zeros_implicit 23))).

Definition f_is_QNaN_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec exp (ones 8)) (eq_bit (access_vec_dec mant 22) B1).

Definition f_is_NaN_S (x32 : mword 32) : bool :=
   let '(sign, exp, mant) := fsplit_S x32 in
   andb (eq_vec exp (ones 8)) (neq_vec mant (zeros_implicit 23)).

Definition negate_S (x32 : mword 32) : mword 32 :=
   let '(sign, exp, mant) := fsplit_S x32 in
   let new_sign := if eq_vec sign ('b"0"  : mword 1) then 'b"1"  : mword 1 else 'b"0"  : mword 1 in
   fmake_S new_sign exp mant.

Definition feq_quiet_S (v1 : mword 32) (v2 : mword 32) : (bool * mword 5) :=
   let '(s1, e1, m1) := fsplit_S v1 in
   let '(s2, e2, m2) := fsplit_S v2 in
   let v1Is0 := orb (f_is_neg_zero_S v1) (f_is_pos_zero_S v1) in
   let v2Is0 := orb (f_is_neg_zero_S v2) (f_is_pos_zero_S v2) in
   let result := orb (eq_vec v1 v2) (andb v1Is0 v2Is0) in
   let fflags := if orb (f_is_SNaN_S v1) (f_is_SNaN_S v2) then nvFlag tt else zeros_implicit 5 in
   (result, fflags).

Definition flt_S (v1 : mword 32) (v2 : mword 32) (is_quiet : bool) : (bool * mword 5) :=
   let '(s1, e1, m1) := fsplit_S v1 in
   let '(s2, e2, m2) := fsplit_S v2 in
   let result : bool :=
     if andb (eq_vec s1 ('b"0"  : mword 1)) (eq_vec s2 ('b"0"  : mword 1)) then
       if eq_vec e1 e2 then Z.ltb (projT1 (uint m1)) (projT1 (uint m2))
       else Z.ltb (projT1 (uint e1)) (projT1 (uint e2))
     else if andb (eq_vec s1 ('b"0"  : mword 1)) (eq_vec s2 ('b"1"  : mword 1)) then false
     else if andb (eq_vec s1 ('b"1"  : mword 1)) (eq_vec s2 ('b"0"  : mword 1)) then true
     else if eq_vec e1 e2 then Z.gtb (projT1 (uint m1)) (projT1 (uint m2))
     else Z.gtb (projT1 (uint e1)) (projT1 (uint e2)) in
   let fflags :=
     if sumbool_of_bool is_quiet then
       if orb (f_is_SNaN_S v1) (f_is_SNaN_S v2) then nvFlag tt
       else zeros_implicit 5
     else if orb (f_is_NaN_S v1) (f_is_NaN_S v2) then nvFlag tt
     else zeros_implicit 5 in
   (result, fflags).

Definition fle_S (v1 : mword 32) (v2 : mword 32) (is_quiet : bool) : (bool * mword 5) :=
   let '(s1, e1, m1) := fsplit_S v1 in
   let '(s2, e2, m2) := fsplit_S v2 in
   let v1Is0 := orb (f_is_neg_zero_S v1) (f_is_pos_zero_S v1) in
   let v2Is0 := orb (f_is_neg_zero_S v2) (f_is_pos_zero_S v2) in
   let result : bool :=
     if andb (eq_vec s1 ('b"0"  : mword 1)) (eq_vec s2 ('b"0"  : mword 1)) then
       if eq_vec e1 e2 then Z.leb (projT1 (uint m1)) (projT1 (uint m2))
       else Z.ltb (projT1 (uint e1)) (projT1 (uint e2))
     else if andb (eq_vec s1 ('b"0"  : mword 1)) (eq_vec s2 ('b"1"  : mword 1)) then
       andb v1Is0 v2Is0
     else if andb (eq_vec s1 ('b"1"  : mword 1)) (eq_vec s2 ('b"0"  : mword 1)) then true
     else if eq_vec e1 e2 then Z.geb (projT1 (uint m1)) (projT1 (uint m2))
     else Z.gtb (projT1 (uint e1)) (projT1 (uint e2)) in
   let fflags :=
     if sumbool_of_bool is_quiet then
       if orb (f_is_SNaN_S v1) (f_is_SNaN_S v2) then nvFlag tt
       else zeros_implicit 5
     else if orb (f_is_NaN_S v1) (f_is_NaN_S v2) then nvFlag tt
     else zeros_implicit 5 in
   (result, fflags).

Definition nan_box (val_32b : mword 32) : mword 32 := val_32b.

Definition nan_unbox (regval : mword 32) : mword 32 := regval.

Definition is_RV32F_or_RV64F '(tt : unit) : M (bool) :=
   projT1_m
   ((and_boolMP (build_trivial_ex ((haveFExt tt)  : M (bool)))
       ((returnm (build_ex
         (projT1
         (build_ex
         (orb (Z.eqb 32 32) (Z.eqb 32 64))
          : {_bool : bool & ArithFact (Bool.eqb ((32 =? 32) || (32 =? 64)) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb ((32 =?
         32) ||
         (32 =? 64)) _bool)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
     ((32 =? 32) || (32 =? 64))) _bool = true)}))
    : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && ((32 =? 32) || (32 =? 64))) _bool = true)})).

Definition is_RV64F '(tt : unit) : M (bool) :=
   projT1_m
   ((and_boolMP (build_trivial_ex ((haveFExt tt)  : M (bool)))
       ((returnm (build_ex
         (projT1
         (build_ex
         (Z.eqb 32 64)
          : {_bool : bool & ArithFact (Bool.eqb (32 =? 64) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
         64) _bool)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
     (32 =? 64)) _bool = true)}))
    : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 64)) _bool = true)})).

Definition is_RV32D_or_RV64D '(tt : unit) : M (bool) :=
   projT1_m
   ((and_boolMP (build_trivial_ex ((haveDExt tt)  : M (bool)))
       ((returnm (build_ex
         (projT1
         (build_ex
         (orb (Z.eqb 32 32) (Z.eqb 32 64))
          : {_bool : bool & ArithFact (Bool.eqb ((32 =? 32) || (32 =? 64)) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb ((32 =?
         32) ||
         (32 =? 64)) _bool)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
     ((32 =? 32) || (32 =? 64))) _bool = true)}))
    : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && ((32 =? 32) || (32 =? 64))) _bool = true)})).

Definition is_RV64D '(tt : unit) : M (bool) :=
   projT1_m
   ((and_boolMP (build_trivial_ex ((haveDExt tt)  : M (bool)))
       ((returnm (build_ex
         (projT1
         (build_ex
         (Z.eqb 32 64)
          : {_bool : bool & ArithFact (Bool.eqb (32 =? 64) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
         64) _bool)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
     (32 =? 64)) _bool = true)}))
    : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 64)) _bool = true)})).

Definition process_fload64 (rd : mword 5) (addr : mword 32) (value : MemoryOpResult (mword 64))
: M (Retired) :=
   returnm RETIRE_FAIL.

Definition process_fload32 (rd : mword 5) (addr : mword 32) (value : MemoryOpResult (mword 32))
: M (Retired) :=
   (match value with
    | MemValue result => (wF_bits rd (nan_box result)) >> returnm RETIRE_SUCCESS
    | MemException e => (handle_mem_exception addr e) >> returnm RETIRE_FAIL
    end)
    : M (Retired).

Definition process_fstore (vaddr : mword 32) (value : MemoryOpResult bool) : M (Retired) :=
   (match value with
    | MemValue true => returnm RETIRE_SUCCESS
    | MemValue false => (internal_error "store got false from mem_write_value")  : M (Retired)
    | MemException e => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
    end)
    : M (Retired).

Definition f_madd_type_mnemonic_S_forwards (arg_ : f_madd_op_S) : string :=
   match arg_ with
   | FMADD_S => "fmadd.s"
   | FMSUB_S => "fmsub.s"
   | FNMSUB_S => "fnmsub.s"
   | FNMADD_S => "fnmadd.s"
   end.

Definition f_madd_type_mnemonic_S_backwards (arg_ : string) : M (f_madd_op_S) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "fmadd.s" then returnm FMADD_S
    else if generic_eq p0_ "fmsub.s" then returnm FMSUB_S
    else if generic_eq p0_ "fnmsub.s" then returnm FNMSUB_S
    else if generic_eq p0_ "fnmadd.s" then returnm FNMADD_S
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (f_madd_op_S).

Definition f_madd_type_mnemonic_S_forwards_matches (arg_ : f_madd_op_S) : bool :=
   match arg_ with | FMADD_S => true | FMSUB_S => true | FNMSUB_S => true | FNMADD_S => true end.

Definition f_madd_type_mnemonic_S_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "fmadd.s" then true
   else if generic_eq p0_ "fmsub.s" then true
   else if generic_eq p0_ "fnmsub.s" then true
   else if generic_eq p0_ "fnmadd.s" then true
   else false.

Definition _s1114_ (_s1115_ : string) : option string :=
   let _s1116_ := _s1115_ in
   if string_startswith _s1116_ "fnmadd.s" then
     match (string_drop _s1116_ (projT1 (string_length "fnmadd.s"))) with | s_ => Some s_ end
   else None.

Definition _s1110_ (_s1111_ : string) : option string :=
   let _s1112_ := _s1111_ in
   if string_startswith _s1112_ "fnmsub.s" then
     match (string_drop _s1112_ (projT1 (string_length "fnmsub.s"))) with | s_ => Some s_ end
   else None.

Definition _s1106_ (_s1107_ : string) : option string :=
   let _s1108_ := _s1107_ in
   if string_startswith _s1108_ "fmsub.s" then
     match (string_drop _s1108_ (projT1 (string_length "fmsub.s"))) with | s_ => Some s_ end
   else None.

Definition _s1102_ (_s1103_ : string) : option string :=
   let _s1104_ := _s1103_ in
   if string_startswith _s1104_ "fmadd.s" then
     match (string_drop _s1104_ (projT1 (string_length "fmadd.s"))) with | s_ => Some s_ end
   else None.

Definition f_madd_type_mnemonic_S_matches_prefix (arg_ : string)
: M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1105_ := arg_ in
   (if match (_s1102_ _s1105_) with | Some s_ => true | _ => false end then
      (match (_s1102_ _s1105_) with
       | Some s_ =>
          returnm (Some
                     (FMADD_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1106_ _s1105_) with | Some s_ => true | _ => false end then
      (match (_s1106_ _s1105_) with
       | Some s_ =>
          returnm (Some
                     (FMSUB_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1110_ _s1105_) with | Some s_ => true | _ => false end then
      (match (_s1110_ _s1105_) with
       | Some s_ =>
          returnm (Some
                     (FNMSUB_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1114_ _s1105_) with | Some s_ => true | _ => false end then
      (match (_s1114_ _s1105_) with
       | Some s_ =>
          returnm (Some
                     (FNMADD_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((f_madd_op_S * {n : Z & ArithFact (n >=? 0)}))).

Definition f_bin_rm_type_mnemonic_S_forwards (arg_ : f_bin_rm_op_S) : string :=
   match arg_ with
   | FADD_S => "fadd.s"
   | FSUB_S => "fsub.s"
   | FMUL_S => "fmul.s"
   | FDIV_S => "fdiv.s"
   end.

Definition f_bin_rm_type_mnemonic_S_backwards (arg_ : string) : M (f_bin_rm_op_S) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "fadd.s" then returnm FADD_S
    else if generic_eq p0_ "fsub.s" then returnm FSUB_S
    else if generic_eq p0_ "fmul.s" then returnm FMUL_S
    else if generic_eq p0_ "fdiv.s" then returnm FDIV_S
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (f_bin_rm_op_S).

Definition f_bin_rm_type_mnemonic_S_forwards_matches (arg_ : f_bin_rm_op_S) : bool :=
   match arg_ with | FADD_S => true | FSUB_S => true | FMUL_S => true | FDIV_S => true end.

Definition f_bin_rm_type_mnemonic_S_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "fadd.s" then true
   else if generic_eq p0_ "fsub.s" then true
   else if generic_eq p0_ "fmul.s" then true
   else if generic_eq p0_ "fdiv.s" then true
   else false.

Definition _s1130_ (_s1131_ : string) : option string :=
   let _s1132_ := _s1131_ in
   if string_startswith _s1132_ "fdiv.s" then
     match (string_drop _s1132_ (projT1 (string_length "fdiv.s"))) with | s_ => Some s_ end
   else None.

Definition _s1126_ (_s1127_ : string) : option string :=
   let _s1128_ := _s1127_ in
   if string_startswith _s1128_ "fmul.s" then
     match (string_drop _s1128_ (projT1 (string_length "fmul.s"))) with | s_ => Some s_ end
   else None.

Definition _s1122_ (_s1123_ : string) : option string :=
   let _s1124_ := _s1123_ in
   if string_startswith _s1124_ "fsub.s" then
     match (string_drop _s1124_ (projT1 (string_length "fsub.s"))) with | s_ => Some s_ end
   else None.

Definition _s1118_ (_s1119_ : string) : option string :=
   let _s1120_ := _s1119_ in
   if string_startswith _s1120_ "fadd.s" then
     match (string_drop _s1120_ (projT1 (string_length "fadd.s"))) with | s_ => Some s_ end
   else None.

Definition f_bin_rm_type_mnemonic_S_matches_prefix (arg_ : string)
: M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1121_ := arg_ in
   (if match (_s1118_ _s1121_) with | Some s_ => true | _ => false end then
      (match (_s1118_ _s1121_) with
       | Some s_ =>
          returnm (Some
                     (FADD_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1122_ _s1121_) with | Some s_ => true | _ => false end then
      (match (_s1122_ _s1121_) with
       | Some s_ =>
          returnm (Some
                     (FSUB_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1126_ _s1121_) with | Some s_ => true | _ => false end then
      (match (_s1126_ _s1121_) with
       | Some s_ =>
          returnm (Some
                     (FMUL_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1130_ _s1121_) with | Some s_ => true | _ => false end then
      (match (_s1130_ _s1121_) with
       | Some s_ =>
          returnm (Some
                     (FDIV_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=? 0)}))).

Definition f_un_rm_type_mnemonic_S_forwards (arg_ : f_un_rm_op_S) : string :=
   match arg_ with
   | FSQRT_S => "fsqrt.s"
   | FCVT_W_S => "fcvt.w.s"
   | FCVT_WU_S => "fcvt.wu.s"
   | FCVT_S_W => "fcvt.s.w"
   | FCVT_S_WU => "fcvt.s.wu"
   | FCVT_L_S => "fcvt.l.s"
   | FCVT_LU_S => "fcvt.lu.s"
   | FCVT_S_L => "fcvt.s.l"
   | FCVT_S_LU => "fcvt.s.lu"
   end.

Definition f_un_rm_type_mnemonic_S_backwards (arg_ : string) : M (f_un_rm_op_S) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "fsqrt.s" then returnm FSQRT_S
    else if generic_eq p0_ "fcvt.w.s" then returnm FCVT_W_S
    else if generic_eq p0_ "fcvt.wu.s" then returnm FCVT_WU_S
    else if generic_eq p0_ "fcvt.s.w" then returnm FCVT_S_W
    else if generic_eq p0_ "fcvt.s.wu" then returnm FCVT_S_WU
    else if generic_eq p0_ "fcvt.l.s" then returnm FCVT_L_S
    else if generic_eq p0_ "fcvt.lu.s" then returnm FCVT_LU_S
    else if generic_eq p0_ "fcvt.s.l" then returnm FCVT_S_L
    else if generic_eq p0_ "fcvt.s.lu" then returnm FCVT_S_LU
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (f_un_rm_op_S).

Definition f_un_rm_type_mnemonic_S_forwards_matches (arg_ : f_un_rm_op_S) : bool :=
   match arg_ with
   | FSQRT_S => true
   | FCVT_W_S => true
   | FCVT_WU_S => true
   | FCVT_S_W => true
   | FCVT_S_WU => true
   | FCVT_L_S => true
   | FCVT_LU_S => true
   | FCVT_S_L => true
   | FCVT_S_LU => true
   end.

Definition f_un_rm_type_mnemonic_S_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "fsqrt.s" then true
   else if generic_eq p0_ "fcvt.w.s" then true
   else if generic_eq p0_ "fcvt.wu.s" then true
   else if generic_eq p0_ "fcvt.s.w" then true
   else if generic_eq p0_ "fcvt.s.wu" then true
   else if generic_eq p0_ "fcvt.l.s" then true
   else if generic_eq p0_ "fcvt.lu.s" then true
   else if generic_eq p0_ "fcvt.s.l" then true
   else if generic_eq p0_ "fcvt.s.lu" then true
   else false.

Definition _s1166_ (_s1167_ : string) : option string :=
   let _s1168_ := _s1167_ in
   if string_startswith _s1168_ "fcvt.s.lu" then
     match (string_drop _s1168_ (projT1 (string_length "fcvt.s.lu"))) with | s_ => Some s_ end
   else None.

Definition _s1162_ (_s1163_ : string) : option string :=
   let _s1164_ := _s1163_ in
   if string_startswith _s1164_ "fcvt.s.l" then
     match (string_drop _s1164_ (projT1 (string_length "fcvt.s.l"))) with | s_ => Some s_ end
   else None.

Definition _s1158_ (_s1159_ : string) : option string :=
   let _s1160_ := _s1159_ in
   if string_startswith _s1160_ "fcvt.lu.s" then
     match (string_drop _s1160_ (projT1 (string_length "fcvt.lu.s"))) with | s_ => Some s_ end
   else None.

Definition _s1154_ (_s1155_ : string) : option string :=
   let _s1156_ := _s1155_ in
   if string_startswith _s1156_ "fcvt.l.s" then
     match (string_drop _s1156_ (projT1 (string_length "fcvt.l.s"))) with | s_ => Some s_ end
   else None.

Definition _s1150_ (_s1151_ : string) : option string :=
   let _s1152_ := _s1151_ in
   if string_startswith _s1152_ "fcvt.s.wu" then
     match (string_drop _s1152_ (projT1 (string_length "fcvt.s.wu"))) with | s_ => Some s_ end
   else None.

Definition _s1146_ (_s1147_ : string) : option string :=
   let _s1148_ := _s1147_ in
   if string_startswith _s1148_ "fcvt.s.w" then
     match (string_drop _s1148_ (projT1 (string_length "fcvt.s.w"))) with | s_ => Some s_ end
   else None.

Definition _s1142_ (_s1143_ : string) : option string :=
   let _s1144_ := _s1143_ in
   if string_startswith _s1144_ "fcvt.wu.s" then
     match (string_drop _s1144_ (projT1 (string_length "fcvt.wu.s"))) with | s_ => Some s_ end
   else None.

Definition _s1138_ (_s1139_ : string) : option string :=
   let _s1140_ := _s1139_ in
   if string_startswith _s1140_ "fcvt.w.s" then
     match (string_drop _s1140_ (projT1 (string_length "fcvt.w.s"))) with | s_ => Some s_ end
   else None.

Definition _s1134_ (_s1135_ : string) : option string :=
   let _s1136_ := _s1135_ in
   if string_startswith _s1136_ "fsqrt.s" then
     match (string_drop _s1136_ (projT1 (string_length "fsqrt.s"))) with | s_ => Some s_ end
   else None.

Definition f_un_rm_type_mnemonic_S_matches_prefix (arg_ : string)
: M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1137_ := arg_ in
   (if match (_s1134_ _s1137_) with | Some s_ => true | _ => false end then
      (match (_s1134_ _s1137_) with
       | Some s_ =>
          returnm (Some
                     (FSQRT_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1138_ _s1137_) with | Some s_ => true | _ => false end then
      (match (_s1138_ _s1137_) with
       | Some s_ =>
          returnm (Some
                     (FCVT_W_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1142_ _s1137_) with | Some s_ => true | _ => false end then
      (match (_s1142_ _s1137_) with
       | Some s_ =>
          returnm (Some
                     (FCVT_WU_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1146_ _s1137_) with | Some s_ => true | _ => false end then
      (match (_s1146_ _s1137_) with
       | Some s_ =>
          returnm (Some
                     (FCVT_S_W, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1150_ _s1137_) with | Some s_ => true | _ => false end then
      (match (_s1150_ _s1137_) with
       | Some s_ =>
          returnm (Some
                     (FCVT_S_WU, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1154_ _s1137_) with | Some s_ => true | _ => false end then
      (match (_s1154_ _s1137_) with
       | Some s_ =>
          returnm (Some
                     (FCVT_L_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1158_ _s1137_) with | Some s_ => true | _ => false end then
      (match (_s1158_ _s1137_) with
       | Some s_ =>
          returnm (Some
                     (FCVT_LU_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1162_ _s1137_) with | Some s_ => true | _ => false end then
      (match (_s1162_ _s1137_) with
       | Some s_ =>
          returnm (Some
                     (FCVT_S_L, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1166_ _s1137_) with | Some s_ => true | _ => false end then
      (match (_s1166_ _s1137_) with
       | Some s_ =>
          returnm (Some
                     (FCVT_S_LU, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((f_un_rm_op_S * {n : Z & ArithFact (n >=? 0)}))).

Definition f_bin_type_mnemonic_S_forwards (arg_ : f_bin_op_S) : string :=
   match arg_ with
   | FSGNJ_S => "fsgnj.s"
   | FSGNJN_S => "fsgnjn.s"
   | FSGNJX_S => "fsgnjx.s"
   | FMIN_S => "fmin.s"
   | FMAX_S => "fmax.s"
   | FEQ_S => "feq.s"
   | FLT_S => "flt.s"
   | FLE_S => "fle.s"
   end.

Definition f_bin_type_mnemonic_S_backwards (arg_ : string) : M (f_bin_op_S) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "fsgnj.s" then returnm FSGNJ_S
    else if generic_eq p0_ "fsgnjn.s" then returnm FSGNJN_S
    else if generic_eq p0_ "fsgnjx.s" then returnm FSGNJX_S
    else if generic_eq p0_ "fmin.s" then returnm FMIN_S
    else if generic_eq p0_ "fmax.s" then returnm FMAX_S
    else if generic_eq p0_ "feq.s" then returnm FEQ_S
    else if generic_eq p0_ "flt.s" then returnm FLT_S
    else if generic_eq p0_ "fle.s" then returnm FLE_S
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (f_bin_op_S).

Definition f_bin_type_mnemonic_S_forwards_matches (arg_ : f_bin_op_S) : bool :=
   match arg_ with
   | FSGNJ_S => true
   | FSGNJN_S => true
   | FSGNJX_S => true
   | FMIN_S => true
   | FMAX_S => true
   | FEQ_S => true
   | FLT_S => true
   | FLE_S => true
   end.

Definition f_bin_type_mnemonic_S_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "fsgnj.s" then true
   else if generic_eq p0_ "fsgnjn.s" then true
   else if generic_eq p0_ "fsgnjx.s" then true
   else if generic_eq p0_ "fmin.s" then true
   else if generic_eq p0_ "fmax.s" then true
   else if generic_eq p0_ "feq.s" then true
   else if generic_eq p0_ "flt.s" then true
   else if generic_eq p0_ "fle.s" then true
   else false.

Definition _s1198_ (_s1199_ : string) : option string :=
   let _s1200_ := _s1199_ in
   if string_startswith _s1200_ "fle.s" then
     match (string_drop _s1200_ (projT1 (string_length "fle.s"))) with | s_ => Some s_ end
   else None.

Definition _s1194_ (_s1195_ : string) : option string :=
   let _s1196_ := _s1195_ in
   if string_startswith _s1196_ "flt.s" then
     match (string_drop _s1196_ (projT1 (string_length "flt.s"))) with | s_ => Some s_ end
   else None.

Definition _s1190_ (_s1191_ : string) : option string :=
   let _s1192_ := _s1191_ in
   if string_startswith _s1192_ "feq.s" then
     match (string_drop _s1192_ (projT1 (string_length "feq.s"))) with | s_ => Some s_ end
   else None.

Definition _s1186_ (_s1187_ : string) : option string :=
   let _s1188_ := _s1187_ in
   if string_startswith _s1188_ "fmax.s" then
     match (string_drop _s1188_ (projT1 (string_length "fmax.s"))) with | s_ => Some s_ end
   else None.

Definition _s1182_ (_s1183_ : string) : option string :=
   let _s1184_ := _s1183_ in
   if string_startswith _s1184_ "fmin.s" then
     match (string_drop _s1184_ (projT1 (string_length "fmin.s"))) with | s_ => Some s_ end
   else None.

Definition _s1178_ (_s1179_ : string) : option string :=
   let _s1180_ := _s1179_ in
   if string_startswith _s1180_ "fsgnjx.s" then
     match (string_drop _s1180_ (projT1 (string_length "fsgnjx.s"))) with | s_ => Some s_ end
   else None.

Definition _s1174_ (_s1175_ : string) : option string :=
   let _s1176_ := _s1175_ in
   if string_startswith _s1176_ "fsgnjn.s" then
     match (string_drop _s1176_ (projT1 (string_length "fsgnjn.s"))) with | s_ => Some s_ end
   else None.

Definition _s1170_ (_s1171_ : string) : option string :=
   let _s1172_ := _s1171_ in
   if string_startswith _s1172_ "fsgnj.s" then
     match (string_drop _s1172_ (projT1 (string_length "fsgnj.s"))) with | s_ => Some s_ end
   else None.

Definition f_bin_type_mnemonic_S_matches_prefix (arg_ : string)
: M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1173_ := arg_ in
   (if match (_s1170_ _s1173_) with | Some s_ => true | _ => false end then
      (match (_s1170_ _s1173_) with
       | Some s_ =>
          returnm (Some
                     (FSGNJ_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1174_ _s1173_) with | Some s_ => true | _ => false end then
      (match (_s1174_ _s1173_) with
       | Some s_ =>
          returnm (Some
                     (FSGNJN_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1178_ _s1173_) with | Some s_ => true | _ => false end then
      (match (_s1178_ _s1173_) with
       | Some s_ =>
          returnm (Some
                     (FSGNJX_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1182_ _s1173_) with | Some s_ => true | _ => false end then
      (match (_s1182_ _s1173_) with
       | Some s_ =>
          returnm (Some
                     (FMIN_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1186_ _s1173_) with | Some s_ => true | _ => false end then
      (match (_s1186_ _s1173_) with
       | Some s_ =>
          returnm (Some
                     (FMAX_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1190_ _s1173_) with | Some s_ => true | _ => false end then
      (match (_s1190_ _s1173_) with
       | Some s_ =>
          returnm (Some
                     (FEQ_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1194_ _s1173_) with | Some s_ => true | _ => false end then
      (match (_s1194_ _s1173_) with
       | Some s_ =>
          returnm (Some
                     (FLT_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1198_ _s1173_) with | Some s_ => true | _ => false end then
      (match (_s1198_ _s1173_) with
       | Some s_ =>
          returnm (Some
                     (FLE_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((f_bin_op_S * {n : Z & ArithFact (n >=? 0)}))).

Definition f_un_type_mnemonic_S_forwards (arg_ : f_un_op_S) : string :=
   match arg_ with | FMV_X_W => "fmv.x.w" | FCLASS_S => "fclass.s" | FMV_W_X => "fmv.w.x" end.

Definition f_un_type_mnemonic_S_backwards (arg_ : string) : M (f_un_op_S) :=
   let p0_ := arg_ in
   (if generic_eq p0_ "fmv.x.w" then returnm FMV_X_W
    else if generic_eq p0_ "fclass.s" then returnm FCLASS_S
    else if generic_eq p0_ "fmv.w.x" then returnm FMV_W_X
    else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
    : M (f_un_op_S).

Definition f_un_type_mnemonic_S_forwards_matches (arg_ : f_un_op_S) : bool :=
   match arg_ with | FMV_X_W => true | FCLASS_S => true | FMV_W_X => true end.

Definition f_un_type_mnemonic_S_backwards_matches (arg_ : string) : bool :=
   let p0_ := arg_ in
   if generic_eq p0_ "fmv.x.w" then true
   else if generic_eq p0_ "fclass.s" then true
   else if generic_eq p0_ "fmv.w.x" then true
   else false.

Definition _s1210_ (_s1211_ : string) : option string :=
   let _s1212_ := _s1211_ in
   if string_startswith _s1212_ "fmv.w.x" then
     match (string_drop _s1212_ (projT1 (string_length "fmv.w.x"))) with | s_ => Some s_ end
   else None.

Definition _s1206_ (_s1207_ : string) : option string :=
   let _s1208_ := _s1207_ in
   if string_startswith _s1208_ "fclass.s" then
     match (string_drop _s1208_ (projT1 (string_length "fclass.s"))) with | s_ => Some s_ end
   else None.

Definition _s1202_ (_s1203_ : string) : option string :=
   let _s1204_ := _s1203_ in
   if string_startswith _s1204_ "fmv.x.w" then
     match (string_drop _s1204_ (projT1 (string_length "fmv.x.w"))) with | s_ => Some s_ end
   else None.

Definition f_un_type_mnemonic_S_matches_prefix (arg_ : string)
: M (option ((f_un_op_S * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s1205_ := arg_ in
   (if match (_s1202_ _s1205_) with | Some s_ => true | _ => false end then
      (match (_s1202_ _s1205_) with
       | Some s_ =>
          returnm (Some
                     (FMV_X_W, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1206_ _s1205_) with | Some s_ => true | _ => false end then
      (match (_s1206_ _s1205_) with
       | Some s_ =>
          returnm (Some
                     (FCLASS_S, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_op_S * {n : Z & ArithFact (n >=? 0)})))
    else if match (_s1210_ _s1205_) with | Some s_ => true | _ => false end then
      (match (_s1210_ _s1205_) with
       | Some s_ =>
          returnm (Some
                     (FMV_W_X, build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((f_un_op_S * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((f_un_op_S * {n : Z & ArithFact (n >=? 0)})))
    else returnm None)
    : M (option ((f_un_op_S * {n : Z & ArithFact (n >=? 0)}))).

Definition encdec_forwards (arg_ : ast) : M (mword 32) :=
   (match arg_ with
    | UTYPE (imm, rd, op) =>
       returnm (concat_vec (imm  : mword 20) (concat_vec (rd  : mword 5) (encdec_uop_forwards op)))
    | RISCV_JAL (v__2, rd) =>
       (if eq_vec (subrange_vec_dec v__2 0 0) ('b"0"  : mword (0 - 0 + 1)) then
          let imm_19 : bits 1 := subrange_vec_dec v__2 20 20 in
          let imm_8 : bits 1 := subrange_vec_dec v__2 11 11 in
          let imm_7_0 : bits 8 := subrange_vec_dec v__2 19 12 in
          let imm_19 : bits 1 := subrange_vec_dec v__2 20 20 in
          let imm_18_13 : bits 6 := subrange_vec_dec v__2 10 5 in
          let imm_12_9 : bits 4 := subrange_vec_dec v__2 4 1 in
          returnm (concat_vec (imm_19  : bits 1)
                     (concat_vec (imm_18_13  : bits 6)
                        (concat_vec (imm_12_9  : bits 4)
                           (concat_vec (imm_8  : bits 1)
                              (concat_vec (imm_7_0  : bits 8)
                                 (concat_vec (rd  : mword 5) ('b"1101111"  : mword 7)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | RISCV_JALR (imm, rs1, rd) =>
       returnm (concat_vec (imm  : mword 12)
                  (concat_vec (rs1  : mword 5)
                     (concat_vec ('b"000"  : mword 3)
                        (concat_vec (rd  : mword 5) ('b"1100111"  : mword 7)))))
    | BTYPE (v__4, rs2, rs1, op) =>
       (if eq_vec (subrange_vec_dec v__4 0 0) ('b"0"  : mword (0 - 0 + 1)) then
          let imm7_6 : bits 1 := subrange_vec_dec v__4 12 12 in
          let imm7_6 : bits 1 := subrange_vec_dec v__4 12 12 in
          let imm7_5_0 : bits 6 := subrange_vec_dec v__4 10 5 in
          let imm5_4_1 : bits 4 := subrange_vec_dec v__4 4 1 in
          let imm5_0 : bits 1 := subrange_vec_dec v__4 11 11 in
          returnm (concat_vec (imm7_6  : bits 1)
                     (concat_vec (imm7_5_0  : bits 6)
                        (concat_vec (rs2  : mword 5)
                           (concat_vec (rs1  : mword 5)
                              (concat_vec (encdec_bop_forwards op)
                                 (concat_vec (imm5_4_1  : bits 4)
                                    (concat_vec (imm5_0  : bits 1) ('b"1100011"  : mword 7))))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | ITYPE (imm, rs1, rd, op) =>
       returnm (concat_vec (imm  : mword 12)
                  (concat_vec (rs1  : mword 5)
                     (concat_vec (encdec_iop_forwards op)
                        (concat_vec (rd  : mword 5) ('b"0010011"  : mword 7)))))
    | SHIFTIOP (shamt, rs1, rd, RISCV_SLLI) =>
       returnm (concat_vec ('b"000000"  : mword 6)
                  (concat_vec (shamt  : mword 6)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"001"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0010011"  : mword 7))))))
    | SHIFTIOP (shamt, rs1, rd, RISCV_SRLI) =>
       returnm (concat_vec ('b"000000"  : mword 6)
                  (concat_vec (shamt  : mword 6)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"101"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0010011"  : mword 7))))))
    | SHIFTIOP (shamt, rs1, rd, RISCV_SRAI) =>
       returnm (concat_vec ('b"010000"  : mword 6)
                  (concat_vec (shamt  : mword 6)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"101"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0010011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_ADD) =>
       returnm (concat_vec ('b"0000000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"000"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_SLT) =>
       returnm (concat_vec ('b"0000000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"010"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_SLTU) =>
       returnm (concat_vec ('b"0000000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"011"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_AND) =>
       returnm (concat_vec ('b"0000000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"111"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_OR) =>
       returnm (concat_vec ('b"0000000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"110"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_XOR) =>
       returnm (concat_vec ('b"0000000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"100"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_SLL) =>
       returnm (concat_vec ('b"0000000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"001"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_SRL) =>
       returnm (concat_vec ('b"0000000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"101"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_SUB) =>
       returnm (concat_vec ('b"0100000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"000"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | RTYPE (rs2, rs1, rd, RISCV_SRA) =>
       returnm (concat_vec ('b"0100000"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"101"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | LOAD (imm, rs1, rd, is_unsigned, size, false, false) =>
       (if sumbool_of_bool
          (orb (Z.ltb (projT1 (word_width_bytes size)) 4)
             (andb (negb is_unsigned) ((Z.leb (projT1 (word_width_bytes size)) 4)  : bool))) then
          returnm (concat_vec (imm  : mword 12)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec (bool_bits_forwards is_unsigned)
                           (concat_vec (size_bits_forwards size)
                              (concat_vec (rd  : mword 5) ('b"0000011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | STORE (v__6, rs2, rs1, size, false, false) =>
       (if sumbool_of_bool (Z.leb (projT1 (word_width_bytes size)) 4) then
          let imm7 : bits 7 := subrange_vec_dec v__6 11 5 in
          let imm7 : bits 7 := subrange_vec_dec v__6 11 5 in
          let imm5 : bits 5 := subrange_vec_dec v__6 4 0 in
          returnm (concat_vec (imm7  : bits 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"0"  : mword 1)
                              (concat_vec (size_bits_forwards size)
                                 (concat_vec (imm5  : bits 5) ('b"0100011"  : mword 7)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | ADDIW (imm, rs1, rd) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec (imm  : mword 12)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"000"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0011011"  : mword 7)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | SHIFTW (shamt, rs1, rd, RISCV_SLLI) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000000"  : mword 7)
                     (concat_vec (shamt  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"001"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0011011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | SHIFTW (shamt, rs1, rd, RISCV_SRLI) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000000"  : mword 7)
                     (concat_vec (shamt  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"101"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0011011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | SHIFTW (shamt, rs1, rd, RISCV_SRAI) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0100000"  : mword 7)
                     (concat_vec (shamt  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"101"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0011011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | RTYPEW (rs2, rs1, rd, RISCV_ADDW) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0111011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | RTYPEW (rs2, rs1, rd, RISCV_SUBW) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0100000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0111011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | RTYPEW (rs2, rs1, rd, RISCV_SLLW) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"001"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0111011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | RTYPEW (rs2, rs1, rd, RISCV_SRLW) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"101"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0111011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | RTYPEW (rs2, rs1, rd, RISCV_SRAW) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0100000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"101"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0111011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | SHIFTIWOP (shamt, rs1, rd, RISCV_SLLIW) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000000"  : mword 7)
                     (concat_vec (shamt  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"001"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0011011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | SHIFTIWOP (shamt, rs1, rd, RISCV_SRLIW) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000000"  : mword 7)
                     (concat_vec (shamt  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"101"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0011011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | SHIFTIWOP (shamt, rs1, rd, RISCV_SRAIW) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0100000"  : mword 7)
                     (concat_vec (shamt  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"101"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0011011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | FENCE (pred, succ) =>
       returnm (concat_vec (Ox"0"  : mword 4)
                  (concat_vec (pred  : mword 4)
                     (concat_vec (succ  : mword 4)
                        (concat_vec ('b"00000"  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec ('b"00000"  : mword 5) ('b"0001111"  : mword 7)))))))
    | FENCE_TSO (pred, succ) =>
       returnm (concat_vec (Ox"8"  : mword 4)
                  (concat_vec (pred  : mword 4)
                     (concat_vec (succ  : mword 4)
                        (concat_vec ('b"00000"  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec ('b"00000"  : mword 5) ('b"0001111"  : mword 7)))))))
    | FENCEI tt =>
       returnm (concat_vec (Ox"000"  : mword 12)
                  (concat_vec ('b"00000"  : mword 5)
                     (concat_vec ('b"001"  : mword 3)
                        (concat_vec ('b"00000"  : mword 5) ('b"0001111"  : mword 7)))))
    | ECALL tt =>
       returnm (concat_vec (Ox"000"  : mword 12)
                  (concat_vec ('b"00000"  : mword 5)
                     (concat_vec ('b"000"  : mword 3)
                        (concat_vec ('b"00000"  : mword 5) ('b"1110011"  : mword 7)))))
    | MRET tt =>
       returnm (concat_vec ('b"0011000"  : mword 7)
                  (concat_vec ('b"00010"  : mword 5)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec ('b"000"  : mword 3)
                           (concat_vec ('b"00000"  : mword 5) ('b"1110011"  : mword 7))))))
    | SRET tt =>
       returnm (concat_vec ('b"0001000"  : mword 7)
                  (concat_vec ('b"00010"  : mword 5)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec ('b"000"  : mword 3)
                           (concat_vec ('b"00000"  : mword 5) ('b"1110011"  : mword 7))))))
    | EBREAK tt =>
       returnm (concat_vec (Ox"001"  : mword 12)
                  (concat_vec ('b"00000"  : mword 5)
                     (concat_vec ('b"000"  : mword 3)
                        (concat_vec ('b"00000"  : mword 5) ('b"1110011"  : mword 7)))))
    | WFI tt =>
       returnm (concat_vec (Ox"105"  : mword 12)
                  (concat_vec ('b"00000"  : mword 5)
                     (concat_vec ('b"000"  : mword 3)
                        (concat_vec ('b"00000"  : mword 5) ('b"1110011"  : mword 7)))))
    | SFENCE_VMA (rs1, rs2) =>
       returnm (concat_vec ('b"0001001"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"000"  : mword 3)
                           (concat_vec ('b"00000"  : mword 5) ('b"1110011"  : mword 7))))))
    | LOADRES (aq, rl, rs1, size, rd) =>
       (if amo_width_valid size then
          returnm (concat_vec ('b"00010"  : mword 5)
                     (concat_vec (bool_bits_forwards aq)
                        (concat_vec (bool_bits_forwards rl)
                           (concat_vec ('b"00000"  : mword 5)
                              (concat_vec (rs1  : mword 5)
                                 (concat_vec ('b"0"  : mword 1)
                                    (concat_vec (size_bits_forwards size)
                                       (concat_vec (rd  : mword 5) ('b"0101111"  : mword 7)))))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | STORECON (aq, rl, rs2, rs1, size, rd) =>
       (if amo_width_valid size then
          returnm (concat_vec ('b"00011"  : mword 5)
                     (concat_vec (bool_bits_forwards aq)
                        (concat_vec (bool_bits_forwards rl)
                           (concat_vec (rs2  : mword 5)
                              (concat_vec (rs1  : mword 5)
                                 (concat_vec ('b"0"  : mword 1)
                                    (concat_vec (size_bits_forwards size)
                                       (concat_vec (rd  : mword 5) ('b"0101111"  : mword 7)))))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | AMO (op, aq, rl, rs2, rs1, size, rd) =>
       (if amo_width_valid size then
          returnm (concat_vec (encdec_amoop_forwards op)
                     (concat_vec (bool_bits_forwards aq)
                        (concat_vec (bool_bits_forwards rl)
                           (concat_vec (rs2  : mword 5)
                              (concat_vec (rs1  : mword 5)
                                 (concat_vec ('b"0"  : mword 1)
                                    (concat_vec (size_bits_forwards size)
                                       (concat_vec (rd  : mword 5) ('b"0101111"  : mword 7)))))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | MUL (rs2, rs1, rd, high, signed1, signed2) =>
       (encdec_mul_op_forwards (high, signed1, signed2)) >>= fun w__38 : mword 3 =>
       returnm (concat_vec ('b"0000001"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec (w__38  : bits 3)
                           (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7))))))
    | DIV (rs2, rs1, rd, s) =>
       returnm (concat_vec ('b"0000001"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"10"  : mword 2)
                           (concat_vec (bool_not_bits_forwards s)
                              (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7)))))))
    | REM (rs2, rs1, rd, s) =>
       returnm (concat_vec ('b"0000001"  : mword 7)
                  (concat_vec (rs2  : mword 5)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"11"  : mword 2)
                           (concat_vec (bool_not_bits_forwards s)
                              (concat_vec (rd  : mword 5) ('b"0110011"  : mword 7)))))))
    | MULW (rs2, rs1, rd) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000001"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"0111011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | DIVW (rs2, rs1, rd, s) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000001"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"10"  : mword 2)
                              (concat_vec (bool_not_bits_forwards s)
                                 (concat_vec (rd  : mword 5) ('b"0111011"  : mword 7)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | REMW (rs2, rs1, rd, s) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"0000001"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"11"  : mword 2)
                              (concat_vec (bool_not_bits_forwards s)
                                 (concat_vec (rd  : mword 5) ('b"0111011"  : mword 7)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | CSR (csr, rs1, rd, is_imm, op) =>
       returnm (concat_vec (csr  : mword 12)
                  (concat_vec (rs1  : mword 5)
                     (concat_vec (bool_bits_forwards is_imm)
                        (concat_vec (encdec_csrop_forwards op)
                           (concat_vec (rd  : mword 5) ('b"1110011"  : mword 7))))))
    | URET tt =>
       returnm (concat_vec ('b"0000000"  : mword 7)
                  (concat_vec ('b"00010"  : mword 5)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec ('b"000"  : mword 3)
                           (concat_vec ('b"00000"  : mword 5) ('b"1110011"  : mword 7))))))
    | FENCE_RESERVED (fm, pred, succ, rs, rd) =>
       (if orb (andb (neq_vec fm (Ox"0"  : mword 4)) (neq_vec fm (Ox"8"  : mword 4)))
             (orb (neq_vec rs ('b"00000"  : mword 5)) (neq_vec rd ('b"00000"  : mword 5))) then
          returnm (concat_vec (fm  : bits 4)
                     (concat_vec (pred  : bits 4)
                        (concat_vec (succ  : bits 4)
                           (concat_vec (rs  : regidx)
                              (concat_vec ('b"000"  : mword 3)
                                 (concat_vec (rd  : regidx) ('b"0001111"  : mword 7)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | FENCEI_RESERVED (imm, rs, rd) =>
       (if orb (neq_vec imm (Ox"000"  : mword 12)) (orb (neq_vec rs zreg) (neq_vec rd zreg)) then
          returnm (concat_vec (imm  : bits 12)
                     (concat_vec (rs  : regidx)
                        (concat_vec ('b"001"  : mword 3)
                           (concat_vec (rd  : regidx) ('b"0001111"  : mword 7)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | LOAD_FP (imm, rs1, rd, WORD) =>
       (is_RV32F_or_RV64F tt) >>= fun w__49 : bool =>
       (if sumbool_of_bool w__49 then
          returnm (concat_vec (imm  : mword 12)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"010"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0000111"  : mword 7)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | LOAD_FP (imm, rs1, rd, DOUBLE) =>
       (is_RV32D_or_RV64D tt) >>= fun w__52 : bool =>
       (if sumbool_of_bool w__52 then
          returnm (concat_vec (imm  : mword 12)
                     (concat_vec (rs1  : mword 5)
                        (concat_vec ('b"011"  : mword 3)
                           (concat_vec (rd  : mword 5) ('b"0000111"  : mword 7)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | STORE_FP (v__7, rs2, rs1, WORD) =>
       (is_RV32F_or_RV64F tt) >>= fun w__55 : bool =>
       (if sumbool_of_bool w__55 then
          let imm7 : bits 7 := subrange_vec_dec v__7 11 5 in
          let imm7 : bits 7 := subrange_vec_dec v__7 11 5 in
          let imm5 : bits 5 := subrange_vec_dec v__7 4 0 in
          returnm (concat_vec (imm7  : bits 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"010"  : mword 3)
                              (concat_vec (imm5  : bits 5) ('b"0100111"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | STORE_FP (v__8, rs2, rs1, DOUBLE) =>
       (is_RV32D_or_RV64D tt) >>= fun w__58 : bool =>
       (if sumbool_of_bool w__58 then
          let imm7 : bits 7 := subrange_vec_dec v__8 11 5 in
          let imm7 : bits 7 := subrange_vec_dec v__8 11 5 in
          let imm5 : bits 5 := subrange_vec_dec v__8 4 0 in
          returnm (concat_vec (imm7  : bits 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"011"  : mword 3)
                              (concat_vec (imm5  : bits 5) ('b"0100111"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FMADD_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__61 : bool =>
       (if sumbool_of_bool w__61 then
          returnm (concat_vec (rs3  : mword 5)
                     (concat_vec ('b"00"  : mword 2)
                        (concat_vec (rs2  : mword 5)
                           (concat_vec (rs1  : mword 5)
                              (concat_vec (encdec_rounding_mode_forwards rm)
                                 (concat_vec (rd  : mword 5) ('b"1000011"  : mword 7)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FMSUB_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__64 : bool =>
       (if sumbool_of_bool w__64 then
          returnm (concat_vec (rs3  : mword 5)
                     (concat_vec ('b"00"  : mword 2)
                        (concat_vec (rs2  : mword 5)
                           (concat_vec (rs1  : mword 5)
                              (concat_vec (encdec_rounding_mode_forwards rm)
                                 (concat_vec (rd  : mword 5) ('b"1000111"  : mword 7)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FNMSUB_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__67 : bool =>
       (if sumbool_of_bool w__67 then
          returnm (concat_vec (rs3  : mword 5)
                     (concat_vec ('b"00"  : mword 2)
                        (concat_vec (rs2  : mword 5)
                           (concat_vec (rs1  : mword 5)
                              (concat_vec (encdec_rounding_mode_forwards rm)
                                 (concat_vec (rd  : mword 5) ('b"1001011"  : mword 7)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FNMADD_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__70 : bool =>
       (if sumbool_of_bool w__70 then
          returnm (concat_vec (rs3  : mword 5)
                     (concat_vec ('b"00"  : mword 2)
                        (concat_vec (rs2  : mword 5)
                           (concat_vec (rs1  : mword 5)
                              (concat_vec (encdec_rounding_mode_forwards rm)
                                 (concat_vec (rd  : mword 5) ('b"1001111"  : mword 7)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FADD_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__73 : bool =>
       (if sumbool_of_bool w__73 then
          returnm (concat_vec ('b"0000000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FSUB_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__76 : bool =>
       (if sumbool_of_bool w__76 then
          returnm (concat_vec ('b"0000100"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FMUL_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__79 : bool =>
       (if sumbool_of_bool w__79 then
          returnm (concat_vec ('b"0001000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FDIV_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__82 : bool =>
       (if sumbool_of_bool w__82 then
          returnm (concat_vec ('b"0001100"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FSQRT_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__85 : bool =>
       (if sumbool_of_bool w__85 then
          returnm (concat_vec ('b"0101100"  : mword 7)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_W_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__88 : bool =>
       (if sumbool_of_bool w__88 then
          returnm (concat_vec ('b"1100000"  : mword 7)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_WU_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__91 : bool =>
       (if sumbool_of_bool w__91 then
          returnm (concat_vec ('b"1100000"  : mword 7)
                     (concat_vec ('b"00001"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_W) =>
       (is_RV32F_or_RV64F tt) >>= fun w__94 : bool =>
       (if sumbool_of_bool w__94 then
          returnm (concat_vec ('b"1101000"  : mword 7)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_WU) =>
       (is_RV32F_or_RV64F tt) >>= fun w__97 : bool =>
       (if sumbool_of_bool w__97 then
          returnm (concat_vec ('b"1101000"  : mword 7)
                     (concat_vec ('b"00001"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_L_S) =>
       (is_RV64F tt) >>= fun w__100 : bool =>
       (if sumbool_of_bool w__100 then
          returnm (concat_vec ('b"1100000"  : mword 7)
                     (concat_vec ('b"00010"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_LU_S) =>
       (is_RV64F tt) >>= fun w__103 : bool =>
       (if sumbool_of_bool w__103 then
          returnm (concat_vec ('b"1100000"  : mword 7)
                     (concat_vec ('b"00011"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_L) =>
       (is_RV64F tt) >>= fun w__106 : bool =>
       (if sumbool_of_bool w__106 then
          returnm (concat_vec ('b"1101000"  : mword 7)
                     (concat_vec ('b"00010"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_LU) =>
       (is_RV64F tt) >>= fun w__109 : bool =>
       (if sumbool_of_bool w__109 then
          returnm (concat_vec ('b"1101000"  : mword 7)
                     (concat_vec ('b"00011"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec (encdec_rounding_mode_forwards rm)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJ_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__112 : bool =>
       (if sumbool_of_bool w__112 then
          returnm (concat_vec ('b"0010000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJN_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__115 : bool =>
       (if sumbool_of_bool w__115 then
          returnm (concat_vec ('b"0010000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"001"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJX_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__118 : bool =>
       (if sumbool_of_bool w__118 then
          returnm (concat_vec ('b"0010000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"010"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_TYPE_S (rs2, rs1, rd, FMIN_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__121 : bool =>
       (if sumbool_of_bool w__121 then
          returnm (concat_vec ('b"0010100"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_TYPE_S (rs2, rs1, rd, FMAX_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__124 : bool =>
       (if sumbool_of_bool w__124 then
          returnm (concat_vec ('b"0010100"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"001"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_TYPE_S (rs2, rs1, rd, FEQ_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__127 : bool =>
       (if sumbool_of_bool w__127 then
          returnm (concat_vec ('b"1010000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"010"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_TYPE_S (rs2, rs1, rd, FLT_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__130 : bool =>
       (if sumbool_of_bool w__130 then
          returnm (concat_vec ('b"1010000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"001"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_BIN_TYPE_S (rs2, rs1, rd, FLE_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__133 : bool =>
       (if sumbool_of_bool w__133 then
          returnm (concat_vec ('b"1010000"  : mword 7)
                     (concat_vec (rs2  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_TYPE_S (rs1, rd, FCLASS_S) =>
       (haveFExt tt) >>= fun w__136 : bool =>
       (if sumbool_of_bool w__136 then
          returnm (concat_vec ('b"1110000"  : mword 7)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"001"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_TYPE_S (rs1, rd, FMV_X_W) =>
       (haveFExt tt) >>= fun w__139 : bool =>
       (if sumbool_of_bool w__139 then
          returnm (concat_vec ('b"1110000"  : mword 7)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | F_UN_TYPE_S (rs1, rd, FMV_W_X) =>
       (haveFExt tt) >>= fun w__142 : bool =>
       (if sumbool_of_bool w__142 then
          returnm (concat_vec ('b"1111000"  : mword 7)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec (rs1  : mword 5)
                           (concat_vec ('b"000"  : mword 3)
                              (concat_vec (rd  : mword 5) ('b"1010011"  : mword 7))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 32)
    | ILLEGAL s => returnm s
    | _ => assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt
    end)
    : M (mword 32).

Definition encdec_backwards (arg_ : mword 32) : M (ast) :=
   let v__9 := arg_ in
   (if let _mappingpatterns_40_ : mword 7 := subrange_vec_dec v__9 6 0 in
      encdec_uop_backwards_matches _mappingpatterns_40_ then
      let imm : mword 20 := subrange_vec_dec v__9 31 12 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      let imm : mword 20 := subrange_vec_dec v__9 31 12 in
      let _mappingpatterns_40_ : mword 7 := subrange_vec_dec v__9 6 0 in
      (encdec_uop_backwards _mappingpatterns_40_) >>= fun op => returnm (UTYPE (imm, rd, op))
    else if eq_vec (subrange_vec_dec v__9 6 0) ('b"1101111"  : mword (6 - 0 + 1)) then
      let imm_19 : bits 1 := subrange_vec_dec v__9 31 31 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      let imm_8 : bits 1 := subrange_vec_dec v__9 20 20 in
      let imm_7_0 : bits 8 := subrange_vec_dec v__9 19 12 in
      let imm_19 : bits 1 := subrange_vec_dec v__9 31 31 in
      let imm_18_13 : bits 6 := subrange_vec_dec v__9 30 25 in
      let imm_12_9 : bits 4 := subrange_vec_dec v__9 24 21 in
      returnm (RISCV_JAL
                 (concat_vec (imm_19  : bits 1)
                    (concat_vec (imm_7_0  : bits 8)
                       (concat_vec (imm_8  : bits 1)
                          (concat_vec (imm_18_13  : bits 6)
                             (concat_vec (imm_12_9  : bits 4) ('b"0"  : mword 1))))), rd))
    else if andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"000"  : mword (14 - 12 + 1)))
              (eq_vec (subrange_vec_dec v__9 6 0) ('b"1100111"  : mword (6 - 0 + 1))) then
      let imm : mword 12 := subrange_vec_dec v__9 31 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      let imm : mword 12 := subrange_vec_dec v__9 31 20 in
      returnm (RISCV_JALR (imm, rs1, rd))
    else if andb
              (let _mappingpatterns_41_ : mword 3 := subrange_vec_dec v__9 14 12 in
              encdec_bop_backwards_matches _mappingpatterns_41_)
              (eq_vec (subrange_vec_dec v__9 6 0) ('b"1100011"  : mword (6 - 0 + 1))) then
      let imm7_6 : bits 1 := subrange_vec_dec v__9 31 31 in
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let imm7_6 : bits 1 := subrange_vec_dec v__9 31 31 in
      let imm7_5_0 : bits 6 := subrange_vec_dec v__9 30 25 in
      let imm5_4_1 : bits 4 := subrange_vec_dec v__9 11 8 in
      let imm5_0 : bits 1 := subrange_vec_dec v__9 7 7 in
      let _mappingpatterns_41_ : mword 3 := subrange_vec_dec v__9 14 12 in
      (encdec_bop_backwards _mappingpatterns_41_) >>= fun op =>
      returnm (BTYPE
                 (concat_vec (imm7_6  : bits 1)
                    (concat_vec (imm5_0  : bits 1)
                       (concat_vec (imm7_5_0  : bits 6)
                          (concat_vec (imm5_4_1  : bits 4) ('b"0"  : mword 1)))), rs2, rs1, op))
    else if andb
              (let _mappingpatterns_42_ : mword 3 := subrange_vec_dec v__9 14 12 in
              encdec_iop_backwards_matches _mappingpatterns_42_)
              (eq_vec (subrange_vec_dec v__9 6 0) ('b"0010011"  : mword (6 - 0 + 1))) then
      let imm : mword 12 := subrange_vec_dec v__9 31 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      let imm : mword 12 := subrange_vec_dec v__9 31 20 in
      let _mappingpatterns_42_ : mword 3 := subrange_vec_dec v__9 14 12 in
      (encdec_iop_backwards _mappingpatterns_42_) >>= fun op => returnm (ITYPE (imm, rs1, rd, op))
    else if sumbool_of_bool
      (andb
         (let shamt : mword 6 := subrange_vec_dec v__9 25 20 in
         orb (Z.eqb 32 64) (eq_bit (access_vec_dec shamt 5) B0))
         (andb (eq_vec (subrange_vec_dec v__9 31 26) ('b"000000"  : mword (31 - 26 + 1)))
            (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"001"  : mword (14 - 12 + 1)))
               (eq_vec (subrange_vec_dec v__9 6 0) ('b"0010011"  : mword (6 - 0 + 1)))))) then
      let shamt : mword 6 := subrange_vec_dec v__9 25 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (SHIFTIOP (shamt, rs1, rd, RISCV_SLLI))
    else if sumbool_of_bool
      (andb
         (let shamt : mword 6 := subrange_vec_dec v__9 25 20 in
         orb (Z.eqb 32 64) (eq_bit (access_vec_dec shamt 5) B0))
         (andb (eq_vec (subrange_vec_dec v__9 31 26) ('b"000000"  : mword (31 - 26 + 1)))
            (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
               (eq_vec (subrange_vec_dec v__9 6 0) ('b"0010011"  : mword (6 - 0 + 1)))))) then
      let shamt : mword 6 := subrange_vec_dec v__9 25 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (SHIFTIOP (shamt, rs1, rd, RISCV_SRLI))
    else if sumbool_of_bool
      (andb
         (let shamt : mword 6 := subrange_vec_dec v__9 25 20 in
         orb (Z.eqb 32 64) (eq_bit (access_vec_dec shamt 5) B0))
         (andb (eq_vec (subrange_vec_dec v__9 31 26) ('b"010000"  : mword (31 - 26 + 1)))
            (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
               (eq_vec (subrange_vec_dec v__9 6 0) ('b"0010011"  : mword (6 - 0 + 1)))))) then
      let shamt : mword 6 := subrange_vec_dec v__9 25 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (SHIFTIOP (shamt, rs1, rd, RISCV_SRAI))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"000"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_ADD))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"010"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_SLT))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"011"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_SLTU))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"111"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_AND))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"110"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_OR))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"100"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_XOR))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"001"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_SLL))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_SRL))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"000"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_SUB))
    else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__9 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
      let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
      returnm (RTYPE (rs2, rs1, rd, RISCV_SRA))
    else
      (and_boolM
         (let _mappingpatterns_44_ : mword 2 := subrange_vec_dec v__9 13 12 in
         let _mappingpatterns_43_ : mword 1 := subrange_vec_dec v__9 14 14 in
         (if size_bits_backwards_matches _mappingpatterns_44_ then
            (size_bits_backwards _mappingpatterns_44_) >>= fun size =>
            (if bool_bits_backwards_matches _mappingpatterns_43_ then
               (bool_bits_backwards _mappingpatterns_43_) >>= fun is_unsigned =>
               returnm ((orb (Z.ltb (projT1 (word_width_bytes size)) 4)
                           (andb (negb is_unsigned)
                              ((Z.leb (projT1 (word_width_bytes size)) 4)
                               : bool)))
                : bool)
             else returnm false)
             : M (bool)
          else returnm false)
          : M (bool))
         (returnm ((eq_vec (subrange_vec_dec v__9 6 0) ('b"0000011"  : mword (6 - 0 + 1)))  : bool))) >>= fun w__2 : bool =>
      (if sumbool_of_bool w__2 then
         let imm : mword 12 := subrange_vec_dec v__9 31 20 in
         let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
         let rd : mword 5 := subrange_vec_dec v__9 11 7 in
         let imm : mword 12 := subrange_vec_dec v__9 31 20 in
         let _mappingpatterns_44_ : mword 2 := subrange_vec_dec v__9 13 12 in
         let _mappingpatterns_43_ : mword 1 := subrange_vec_dec v__9 14 14 in
         (size_bits_backwards _mappingpatterns_44_) >>= fun size =>
         (bool_bits_backwards _mappingpatterns_43_) >>= fun is_unsigned =>
         returnm (LOAD (imm, rs1, rd, is_unsigned, size, false, false))
       else
         (and_boolM
            (let _mappingpatterns_45_ : mword 2 := subrange_vec_dec v__9 13 12 in
            (if size_bits_backwards_matches _mappingpatterns_45_ then
               (size_bits_backwards _mappingpatterns_45_) >>= fun size =>
               returnm ((Z.leb (projT1 (word_width_bytes size)) 4)  : bool)
             else returnm false)
             : M (bool))
            (returnm ((andb (eq_vec (subrange_vec_dec v__9 14 14) ('b"0"  : mword (14 - 14 + 1)))
                         (eq_vec (subrange_vec_dec v__9 6 0) ('b"0100011"  : mword (6 - 0 + 1))))
              : bool))) >>= fun w__4 : bool =>
         (if sumbool_of_bool w__4 then
            let imm7 : bits 7 := subrange_vec_dec v__9 31 25 in
            let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let imm7 : bits 7 := subrange_vec_dec v__9 31 25 in
            let imm5 : bits 5 := subrange_vec_dec v__9 11 7 in
            let _mappingpatterns_45_ : mword 2 := subrange_vec_dec v__9 13 12 in
            (size_bits_backwards _mappingpatterns_45_) >>= fun size =>
            returnm (STORE
                       (concat_vec (imm7  : bits 7) (imm5  : bits 5), rs2, rs1, size, false, false))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"000"  : mword (14 - 12 + 1)))
                  (eq_vec (subrange_vec_dec v__9 6 0) ('b"0011011"  : mword (6 - 0 + 1))))) then
            let imm : mword 12 := subrange_vec_dec v__9 31 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            let imm : mword 12 := subrange_vec_dec v__9 31 20 in
            returnm (ADDIW (imm, rs1, rd))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"001"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0011011"  : mword (6 - 0 + 1)))))) then
            let shamt : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (SHIFTW (shamt, rs1, rd, RISCV_SLLI))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0011011"  : mword (6 - 0 + 1)))))) then
            let shamt : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (SHIFTW (shamt, rs1, rd, RISCV_SRLI))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0011011"  : mword (6 - 0 + 1)))))) then
            let shamt : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (SHIFTW (shamt, rs1, rd, RISCV_SRAI))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"000"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0111011"  : mword (6 - 0 + 1)))))) then
            let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (RTYPEW (rs2, rs1, rd, RISCV_ADDW))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"000"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0111011"  : mword (6 - 0 + 1)))))) then
            let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (RTYPEW (rs2, rs1, rd, RISCV_SUBW))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"001"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0111011"  : mword (6 - 0 + 1)))))) then
            let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (RTYPEW (rs2, rs1, rd, RISCV_SLLW))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0111011"  : mword (6 - 0 + 1)))))) then
            let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (RTYPEW (rs2, rs1, rd, RISCV_SRLW))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0111011"  : mword (6 - 0 + 1)))))) then
            let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (RTYPEW (rs2, rs1, rd, RISCV_SRAW))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"001"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0011011"  : mword (6 - 0 + 1)))))) then
            let shamt : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (SHIFTIWOP (shamt, rs1, rd, RISCV_SLLIW))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0011011"  : mword (6 - 0 + 1)))))) then
            let shamt : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (SHIFTIWOP (shamt, rs1, rd, RISCV_SRLIW))
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__9 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__9 6 0) ('b"0011011"  : mword (6 - 0 + 1)))))) then
            let shamt : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            let rd : mword 5 := subrange_vec_dec v__9 11 7 in
            returnm (SHIFTIWOP (shamt, rs1, rd, RISCV_SRAIW))
          else if andb (eq_vec (subrange_vec_dec v__9 31 28) (Ox"0"  : mword (31 - 28 + 1)))
                    (eq_vec (subrange_vec_dec v__9 19 0) (Ox"0000F"  : mword (19 - 0 + 1))) then
            let succ : mword 4 := subrange_vec_dec v__9 23 20 in
            let pred : mword 4 := subrange_vec_dec v__9 27 24 in
            returnm (FENCE (pred, succ))
          else if andb (eq_vec (subrange_vec_dec v__9 31 28) (Ox"8"  : mword (31 - 28 + 1)))
                    (eq_vec (subrange_vec_dec v__9 19 0) (Ox"0000F"  : mword (19 - 0 + 1))) then
            let succ : mword 4 := subrange_vec_dec v__9 23 20 in
            let pred : mword 4 := subrange_vec_dec v__9 27 24 in
            returnm (FENCE_TSO (pred, succ))
          else if eq_vec v__9 (Ox"0000100F"  : mword 32) then returnm (FENCEI tt)
          else if eq_vec v__9 (Ox"00000073"  : mword 32) then returnm (ECALL tt)
          else if eq_vec v__9 (Ox"30200073"  : mword 32) then returnm (MRET tt)
          else if eq_vec v__9 (Ox"10200073"  : mword 32) then returnm (SRET tt)
          else if eq_vec v__9 (Ox"00100073"  : mword 32) then returnm (EBREAK tt)
          else if eq_vec v__9 (Ox"10500073"  : mword 32) then returnm (WFI tt)
          else if andb (eq_vec (subrange_vec_dec v__9 31 25) ('b"0001001"  : mword (31 - 25 + 1)))
                    (eq_vec (subrange_vec_dec v__9 14 0) ('b"000000001110011"  : mword (14 - 0 + 1)))
          then
            let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
            let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
            returnm (SFENCE_VMA (rs1, rs2))
          else
            (and_boolM
               (let _mappingpatterns_48_ : mword 2 := subrange_vec_dec v__9 13 12 in
               let _mappingpatterns_47_ : mword 1 := subrange_vec_dec v__9 25 25 in
               let _mappingpatterns_46_ : mword 1 := subrange_vec_dec v__9 26 26 in
               (if size_bits_backwards_matches _mappingpatterns_48_ then
                  (size_bits_backwards _mappingpatterns_48_) >>= fun size =>
                  (if bool_bits_backwards_matches _mappingpatterns_47_ then
                     (bool_bits_backwards _mappingpatterns_47_) >>= fun rl =>
                     (if bool_bits_backwards_matches _mappingpatterns_46_ then
                        (bool_bits_backwards _mappingpatterns_46_) >>= fun aq =>
                        returnm ((amo_width_valid size)  : bool)
                      else returnm false)
                      : M (bool)
                   else returnm false)
                   : M (bool)
                else returnm false)
                : M (bool))
               (returnm ((andb
                            (eq_vec (subrange_vec_dec v__9 31 27) ('b"00010"  : mword (31 - 27 + 1)))
                            (andb
                               (eq_vec (subrange_vec_dec v__9 24 20)
                                  ('b"00000"
                                   : mword (24 - 20 + 1)))
                               (andb
                                  (eq_vec (subrange_vec_dec v__9 14 14)
                                     ('b"0"
                                      : mword (14 - 14 + 1)))
                                  (eq_vec (subrange_vec_dec v__9 6 0)
                                     ('b"0101111"
                                      : mword (6 - 0 + 1))))))
                 : bool))) >>= fun w__8 : bool =>
            (if sumbool_of_bool w__8 then
               let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
               let rd : mword 5 := subrange_vec_dec v__9 11 7 in
               let _mappingpatterns_48_ : mword 2 := subrange_vec_dec v__9 13 12 in
               let _mappingpatterns_47_ : mword 1 := subrange_vec_dec v__9 25 25 in
               let _mappingpatterns_46_ : mword 1 := subrange_vec_dec v__9 26 26 in
               (size_bits_backwards _mappingpatterns_48_) >>= fun size =>
               (bool_bits_backwards _mappingpatterns_47_) >>= fun rl =>
               (bool_bits_backwards _mappingpatterns_46_) >>= fun aq =>
               returnm (LOADRES (aq, rl, rs1, size, rd))
             else
               (and_boolM
                  (let _mappingpatterns_51_ : mword 2 := subrange_vec_dec v__9 13 12 in
                  let _mappingpatterns_50_ : mword 1 := subrange_vec_dec v__9 25 25 in
                  let _mappingpatterns_49_ : mword 1 := subrange_vec_dec v__9 26 26 in
                  (if size_bits_backwards_matches _mappingpatterns_51_ then
                     (size_bits_backwards _mappingpatterns_51_) >>= fun size =>
                     (if bool_bits_backwards_matches _mappingpatterns_50_ then
                        (bool_bits_backwards _mappingpatterns_50_) >>= fun rl =>
                        (if bool_bits_backwards_matches _mappingpatterns_49_ then
                           (bool_bits_backwards _mappingpatterns_49_) >>= fun aq =>
                           returnm ((amo_width_valid size)  : bool)
                         else returnm false)
                         : M (bool)
                      else returnm false)
                      : M (bool)
                   else returnm false)
                   : M (bool))
                  (returnm ((andb
                               (eq_vec (subrange_vec_dec v__9 31 27)
                                  ('b"00011"
                                   : mword (31 - 27 + 1)))
                               (andb
                                  (eq_vec (subrange_vec_dec v__9 14 14)
                                     ('b"0"
                                      : mword (14 - 14 + 1)))
                                  (eq_vec (subrange_vec_dec v__9 6 0)
                                     ('b"0101111"
                                      : mword (6 - 0 + 1)))))
                    : bool))) >>= fun w__12 : bool =>
               (if sumbool_of_bool w__12 then
                  let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                  let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                  let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                  let _mappingpatterns_51_ : mword 2 := subrange_vec_dec v__9 13 12 in
                  let _mappingpatterns_50_ : mword 1 := subrange_vec_dec v__9 25 25 in
                  let _mappingpatterns_49_ : mword 1 := subrange_vec_dec v__9 26 26 in
                  (size_bits_backwards _mappingpatterns_51_) >>= fun size =>
                  (bool_bits_backwards _mappingpatterns_50_) >>= fun rl =>
                  (bool_bits_backwards _mappingpatterns_49_) >>= fun aq =>
                  returnm (STORECON (aq, rl, rs2, rs1, size, rd))
                else
                  (and_boolM
                     (let _mappingpatterns_52_ : mword 5 := subrange_vec_dec v__9 31 27 in
                     let _mappingpatterns_55_ : mword 2 := subrange_vec_dec v__9 13 12 in
                     let _mappingpatterns_54_ : mword 1 := subrange_vec_dec v__9 25 25 in
                     let _mappingpatterns_53_ : mword 1 := subrange_vec_dec v__9 26 26 in
                     let _mappingpatterns_52_ : mword 5 := subrange_vec_dec v__9 31 27 in
                     (if size_bits_backwards_matches _mappingpatterns_55_ then
                        (size_bits_backwards _mappingpatterns_55_) >>= fun size =>
                        (if bool_bits_backwards_matches _mappingpatterns_54_ then
                           (bool_bits_backwards _mappingpatterns_54_) >>= fun rl =>
                           (if bool_bits_backwards_matches _mappingpatterns_53_ then
                              (bool_bits_backwards _mappingpatterns_53_) >>= fun aq =>
                              (if encdec_amoop_backwards_matches _mappingpatterns_52_ then
                                 (encdec_amoop_backwards _mappingpatterns_52_) >>= fun op =>
                                 returnm ((amo_width_valid size)  : bool)
                               else returnm false)
                               : M (bool)
                            else returnm false)
                            : M (bool)
                         else returnm false)
                         : M (bool)
                      else returnm false)
                      : M (bool))
                     (returnm ((andb
                                  (eq_vec (subrange_vec_dec v__9 14 14)
                                     ('b"0"
                                      : mword (14 - 14 + 1)))
                                  (eq_vec (subrange_vec_dec v__9 6 0)
                                     ('b"0101111"
                                      : mword (6 - 0 + 1))))
                       : bool))) >>= fun w__17 : bool =>
                  (if sumbool_of_bool w__17 then
                     let _mappingpatterns_52_ : mword 5 := subrange_vec_dec v__9 31 27 in
                     let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                     let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                     let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                     let _mappingpatterns_55_ : mword 2 := subrange_vec_dec v__9 13 12 in
                     let _mappingpatterns_54_ : mword 1 := subrange_vec_dec v__9 25 25 in
                     let _mappingpatterns_53_ : mword 1 := subrange_vec_dec v__9 26 26 in
                     let _mappingpatterns_52_ : mword 5 := subrange_vec_dec v__9 31 27 in
                     (size_bits_backwards _mappingpatterns_55_) >>= fun size =>
                     (bool_bits_backwards _mappingpatterns_54_) >>= fun rl =>
                     (bool_bits_backwards _mappingpatterns_53_) >>= fun aq =>
                     (encdec_amoop_backwards _mappingpatterns_52_) >>= fun op =>
                     returnm (AMO (op, aq, rl, rs2, rs1, size, rd))
                   else if andb
                             (let _mappingpatterns_56_ : mword 3 := subrange_vec_dec v__9 14 12 in
                             encdec_mul_op_backwards_matches _mappingpatterns_56_)
                             (andb
                                (eq_vec (subrange_vec_dec v__9 31 25)
                                   ('b"0000001"
                                    : mword (31 - 25 + 1)))
                                (eq_vec (subrange_vec_dec v__9 6 0)
                                   ('b"0110011"
                                    : mword (6 - 0 + 1)))) then
                     let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                     let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                     let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                     let _mappingpatterns_56_ : mword 3 := subrange_vec_dec v__9 14 12 in
                     (encdec_mul_op_backwards _mappingpatterns_56_) >>= fun '(high, signed1, signed2) =>
                     returnm (MUL (rs2, rs1, rd, high, signed1, signed2))
                   else if andb
                             (let _mappingpatterns_57_ : mword 1 := subrange_vec_dec v__9 12 12 in
                             bool_not_bits_backwards_matches _mappingpatterns_57_)
                             (andb
                                (eq_vec (subrange_vec_dec v__9 31 25)
                                   ('b"0000001"
                                    : mword (31 - 25 + 1)))
                                (andb
                                   (eq_vec (subrange_vec_dec v__9 14 13)
                                      ('b"10"
                                       : mword (14 - 13 + 1)))
                                   (eq_vec (subrange_vec_dec v__9 6 0)
                                      ('b"0110011"
                                       : mword (6 - 0 + 1))))) then
                     let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                     let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                     let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                     let _mappingpatterns_57_ : mword 1 := subrange_vec_dec v__9 12 12 in
                     (bool_not_bits_backwards _mappingpatterns_57_) >>= fun s =>
                     returnm (DIV (rs2, rs1, rd, s))
                   else if andb
                             (let _mappingpatterns_58_ : mword 1 := subrange_vec_dec v__9 12 12 in
                             bool_not_bits_backwards_matches _mappingpatterns_58_)
                             (andb
                                (eq_vec (subrange_vec_dec v__9 31 25)
                                   ('b"0000001"
                                    : mword (31 - 25 + 1)))
                                (andb
                                   (eq_vec (subrange_vec_dec v__9 14 13)
                                      ('b"11"
                                       : mword (14 - 13 + 1)))
                                   (eq_vec (subrange_vec_dec v__9 6 0)
                                      ('b"0110011"
                                       : mword (6 - 0 + 1))))) then
                     let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                     let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                     let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                     let _mappingpatterns_58_ : mword 1 := subrange_vec_dec v__9 12 12 in
                     (bool_not_bits_backwards _mappingpatterns_58_) >>= fun s =>
                     returnm (REM (rs2, rs1, rd, s))
                   else if sumbool_of_bool
                     (andb (Z.eqb 32 64)
                        (andb
                           (eq_vec (subrange_vec_dec v__9 31 25)
                              ('b"0000001"
                               : mword (31 - 25 + 1)))
                           (andb
                              (eq_vec (subrange_vec_dec v__9 14 12) ('b"000"  : mword (14 - 12 + 1)))
                              (eq_vec (subrange_vec_dec v__9 6 0) ('b"0111011"  : mword (6 - 0 + 1))))))
                   then
                     let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                     let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                     let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                     returnm (MULW (rs2, rs1, rd))
                   else
                     (and_boolM
                        (let _mappingpatterns_59_ : mword 1 := subrange_vec_dec v__9 12 12 in
                        (if bool_not_bits_backwards_matches _mappingpatterns_59_ then
                           (bool_not_bits_backwards _mappingpatterns_59_) >>= fun s =>
                           returnm ((Z.eqb 32 64)  : bool)
                         else returnm false)
                         : M (bool))
                        (returnm ((andb
                                     (eq_vec (subrange_vec_dec v__9 31 25)
                                        ('b"0000001"
                                         : mword (31 - 25 + 1)))
                                     (andb
                                        (eq_vec (subrange_vec_dec v__9 14 13)
                                           ('b"10"
                                            : mword (14 - 13 + 1)))
                                        (eq_vec (subrange_vec_dec v__9 6 0)
                                           ('b"0111011"
                                            : mword (6 - 0 + 1)))))
                          : bool))) >>= fun w__19 : bool =>
                     (if sumbool_of_bool w__19 then
                        let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                        let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                        let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                        let _mappingpatterns_59_ : mword 1 := subrange_vec_dec v__9 12 12 in
                        (bool_not_bits_backwards _mappingpatterns_59_) >>= fun s =>
                        returnm (DIVW (rs2, rs1, rd, s))
                      else
                        (and_boolM
                           (let _mappingpatterns_60_ : mword 1 := subrange_vec_dec v__9 12 12 in
                           (if bool_not_bits_backwards_matches _mappingpatterns_60_ then
                              (bool_not_bits_backwards _mappingpatterns_60_) >>= fun s =>
                              returnm ((Z.eqb 32 64)  : bool)
                            else returnm false)
                            : M (bool))
                           (returnm ((andb
                                        (eq_vec (subrange_vec_dec v__9 31 25)
                                           ('b"0000001"
                                            : mword (31 - 25 + 1)))
                                        (andb
                                           (eq_vec (subrange_vec_dec v__9 14 13)
                                              ('b"11"
                                               : mword (14 - 13 + 1)))
                                           (eq_vec (subrange_vec_dec v__9 6 0)
                                              ('b"0111011"
                                               : mword (6 - 0 + 1)))))
                             : bool))) >>= fun w__21 : bool =>
                        (if sumbool_of_bool w__21 then
                           let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                           let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                           let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                           let _mappingpatterns_60_ : mword 1 := subrange_vec_dec v__9 12 12 in
                           (bool_not_bits_backwards _mappingpatterns_60_) >>= fun s =>
                           returnm (REMW (rs2, rs1, rd, s))
                         else
                           (and_boolM
                              (let _mappingpatterns_62_ : mword 2 := subrange_vec_dec v__9 13 12 in
                              let _mappingpatterns_61_ : mword 1 := subrange_vec_dec v__9 14 14 in
                              (if encdec_csrop_backwards_matches _mappingpatterns_62_ then
                                 (encdec_csrop_backwards _mappingpatterns_62_) >>= fun op =>
                                 returnm ((bool_bits_backwards_matches _mappingpatterns_61_)
                                  : bool)
                               else returnm false)
                               : M (bool))
                              (returnm ((eq_vec (subrange_vec_dec v__9 6 0)
                                           ('b"1110011"
                                            : mword (6 - 0 + 1)))
                                : bool))) >>= fun w__23 : bool =>
                           (if sumbool_of_bool w__23 then
                              let csr : mword 12 := subrange_vec_dec v__9 31 20 in
                              let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                              let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                              let csr : mword 12 := subrange_vec_dec v__9 31 20 in
                              let _mappingpatterns_62_ : mword 2 := subrange_vec_dec v__9 13 12 in
                              let _mappingpatterns_61_ : mword 1 := subrange_vec_dec v__9 14 14 in
                              (encdec_csrop_backwards _mappingpatterns_62_) >>= fun op =>
                              (bool_bits_backwards _mappingpatterns_61_) >>= fun is_imm =>
                              returnm (CSR (csr, rs1, rd, is_imm, op))
                            else if eq_vec v__9 (Ox"00200073"  : mword 32) then returnm (URET tt)
                            else if andb
                                      (let fm : bits 4 := subrange_vec_dec v__9 31 28 in
                                      let rs : regidx := subrange_vec_dec v__9 19 15 in
                                      let rd : regidx := subrange_vec_dec v__9 11 7 in
                                      let fm : bits 4 := subrange_vec_dec v__9 31 28 in
                                      orb
                                        (andb (neq_vec fm (Ox"0"  : mword 4))
                                           (neq_vec fm (Ox"8"  : mword 4)))
                                        (orb (neq_vec rs ('b"00000"  : mword 5))
                                           (neq_vec rd ('b"00000"  : mword 5))))
                                      (andb
                                         (eq_vec (subrange_vec_dec v__9 14 12)
                                            ('b"000"
                                             : mword (14 - 12 + 1)))
                                         (eq_vec (subrange_vec_dec v__9 6 0)
                                            ('b"0001111"
                                             : mword (6 - 0 + 1)))) then
                              let fm : bits 4 := subrange_vec_dec v__9 31 28 in
                              let succ : bits 4 := subrange_vec_dec v__9 23 20 in
                              let rs : regidx := subrange_vec_dec v__9 19 15 in
                              let rd : regidx := subrange_vec_dec v__9 11 7 in
                              let pred : bits 4 := subrange_vec_dec v__9 27 24 in
                              let fm : bits 4 := subrange_vec_dec v__9 31 28 in
                              returnm (FENCE_RESERVED (fm, pred, succ, rs, rd))
                            else if andb
                                      (let imm : bits 12 := subrange_vec_dec v__9 31 20 in
                                      let rs : regidx := subrange_vec_dec v__9 19 15 in
                                      let rd : regidx := subrange_vec_dec v__9 11 7 in
                                      let imm : bits 12 := subrange_vec_dec v__9 31 20 in
                                      orb (neq_vec imm (Ox"000"  : mword 12))
                                        (orb (neq_vec rs zreg) (neq_vec rd zreg)))
                                      (andb
                                         (eq_vec (subrange_vec_dec v__9 14 12)
                                            ('b"001"
                                             : mword (14 - 12 + 1)))
                                         (eq_vec (subrange_vec_dec v__9 6 0)
                                            ('b"0001111"
                                             : mword (6 - 0 + 1)))) then
                              let imm : bits 12 := subrange_vec_dec v__9 31 20 in
                              let rs : regidx := subrange_vec_dec v__9 19 15 in
                              let rd : regidx := subrange_vec_dec v__9 11 7 in
                              let imm : bits 12 := subrange_vec_dec v__9 31 20 in
                              returnm (FENCEI_RESERVED (imm, rs, rd))
                            else
                              (and_boolM ((is_RV32F_or_RV64F tt)  : M (bool))
                                 (returnm ((andb
                                              (eq_vec (subrange_vec_dec v__9 14 12)
                                                 ('b"010"
                                                  : mword (14 - 12 + 1)))
                                              (eq_vec (subrange_vec_dec v__9 6 0)
                                                 ('b"0000111"
                                                  : mword (6 - 0 + 1))))
                                   : bool))) >>= fun w__25 : bool =>
                              (if sumbool_of_bool w__25 then
                                 let imm : mword 12 := subrange_vec_dec v__9 31 20 in
                                 let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                                 let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                                 let imm : mword 12 := subrange_vec_dec v__9 31 20 in
                                 returnm (LOAD_FP (imm, rs1, rd, WORD))
                               else
                                 (and_boolM ((is_RV32D_or_RV64D tt)  : M (bool))
                                    (returnm ((andb
                                                 (eq_vec (subrange_vec_dec v__9 14 12)
                                                    ('b"011"
                                                     : mword (14 - 12 + 1)))
                                                 (eq_vec (subrange_vec_dec v__9 6 0)
                                                    ('b"0000111"
                                                     : mword (6 - 0 + 1))))
                                      : bool))) >>= fun w__27 : bool =>
                                 (if sumbool_of_bool w__27 then
                                    let imm : mword 12 := subrange_vec_dec v__9 31 20 in
                                    let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                                    let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                                    let imm : mword 12 := subrange_vec_dec v__9 31 20 in
                                    returnm (LOAD_FP (imm, rs1, rd, DOUBLE))
                                  else
                                    (and_boolM ((is_RV32F_or_RV64F tt)  : M (bool))
                                       (returnm ((andb
                                                    (eq_vec (subrange_vec_dec v__9 14 12)
                                                       ('b"010"
                                                        : mword (14 - 12 + 1)))
                                                    (eq_vec (subrange_vec_dec v__9 6 0)
                                                       ('b"0100111"
                                                        : mword (6 - 0 + 1))))
                                         : bool))) >>= fun w__29 : bool =>
                                    (if sumbool_of_bool w__29 then
                                       let imm7 : bits 7 := subrange_vec_dec v__9 31 25 in
                                       let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                                       let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                                       let imm7 : bits 7 := subrange_vec_dec v__9 31 25 in
                                       let imm5 : bits 5 := subrange_vec_dec v__9 11 7 in
                                       returnm (STORE_FP
                                                  (concat_vec (imm7  : bits 7) (imm5  : bits 5), rs2, rs1, WORD))
                                     else
                                       (and_boolM ((is_RV32D_or_RV64D tt)  : M (bool))
                                          (returnm ((andb
                                                       (eq_vec (subrange_vec_dec v__9 14 12)
                                                          ('b"011"
                                                           : mword (14 - 12 + 1)))
                                                       (eq_vec (subrange_vec_dec v__9 6 0)
                                                          ('b"0100111"
                                                           : mword (6 - 0 + 1))))
                                            : bool))) >>= fun w__31 : bool =>
                                       (if sumbool_of_bool w__31 then
                                          let imm7 : bits 7 := subrange_vec_dec v__9 31 25 in
                                          let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                                          let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                                          let imm7 : bits 7 := subrange_vec_dec v__9 31 25 in
                                          let imm5 : bits 5 := subrange_vec_dec v__9 11 7 in
                                          returnm (STORE_FP
                                                     (concat_vec (imm7  : bits 7) (imm5  : bits 5), rs2, rs1, DOUBLE))
                                        else
                                          (and_boolM
                                             (let _mappingpatterns_63_ : mword 3 :=
                                               subrange_vec_dec v__9 14 12 in
                                             (if encdec_rounding_mode_backwards_matches
                                                   _mappingpatterns_63_ then
                                                (encdec_rounding_mode_backwards _mappingpatterns_63_) >>= fun rm =>
                                                (is_RV32F_or_RV64F tt)
                                                 : M (bool)
                                              else returnm false)
                                              : M (bool))
                                             (returnm ((andb
                                                          (eq_vec (subrange_vec_dec v__9 26 25)
                                                             ('b"00"
                                                              : mword (26 - 25 + 1)))
                                                          (eq_vec (subrange_vec_dec v__9 6 0)
                                                             ('b"1000011"
                                                              : mword (6 - 0 + 1))))
                                               : bool))) >>= fun w__34 : bool =>
                                          (if sumbool_of_bool w__34 then
                                             let rs3 : mword 5 := subrange_vec_dec v__9 31 27 in
                                             let rs3 : mword 5 := subrange_vec_dec v__9 31 27 in
                                             let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                                             let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                                             let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                                             let _mappingpatterns_63_ : mword 3 :=
                                               subrange_vec_dec v__9 14 12 in
                                             (encdec_rounding_mode_backwards _mappingpatterns_63_) >>= fun rm =>
                                             returnm (F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FMADD_S))
                                           else
                                             (and_boolM
                                                (let _mappingpatterns_64_ : mword 3 :=
                                                  subrange_vec_dec v__9 14 12 in
                                                (if encdec_rounding_mode_backwards_matches
                                                      _mappingpatterns_64_ then
                                                   (encdec_rounding_mode_backwards
                                                      _mappingpatterns_64_) >>= fun rm =>
                                                   (is_RV32F_or_RV64F tt)
                                                    : M (bool)
                                                 else returnm false)
                                                 : M (bool))
                                                (returnm ((andb
                                                             (eq_vec (subrange_vec_dec v__9 26 25)
                                                                ('b"00"
                                                                 : mword (26 - 25 + 1)))
                                                             (eq_vec (subrange_vec_dec v__9 6 0)
                                                                ('b"1000111"
                                                                 : mword (6 - 0 + 1))))
                                                  : bool))) >>= fun w__37 : bool =>
                                             (if sumbool_of_bool w__37 then
                                                let rs3 : mword 5 := subrange_vec_dec v__9 31 27 in
                                                let rs3 : mword 5 := subrange_vec_dec v__9 31 27 in
                                                let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                                                let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                                                let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                                                let _mappingpatterns_64_ : mword 3 :=
                                                  subrange_vec_dec v__9 14 12 in
                                                (encdec_rounding_mode_backwards _mappingpatterns_64_) >>= fun rm =>
                                                returnm (F_MADD_TYPE_S
                                                           (rs3, rs2, rs1, rm, rd, FMSUB_S))
                                              else
                                                (and_boolM
                                                   (let _mappingpatterns_65_ : mword 3 :=
                                                     subrange_vec_dec v__9 14 12 in
                                                   (if encdec_rounding_mode_backwards_matches
                                                         _mappingpatterns_65_ then
                                                      (encdec_rounding_mode_backwards
                                                         _mappingpatterns_65_) >>= fun rm =>
                                                      (is_RV32F_or_RV64F tt)
                                                       : M (bool)
                                                    else returnm false)
                                                    : M (bool))
                                                   (returnm ((andb
                                                                (eq_vec
                                                                   (subrange_vec_dec v__9 26 25)
                                                                   ('b"00"
                                                                    : mword (26 - 25 + 1)))
                                                                (eq_vec (subrange_vec_dec v__9 6 0)
                                                                   ('b"1001011"
                                                                    : mword (6 - 0 + 1))))
                                                     : bool))) >>= fun w__40 : bool =>
                                                (if sumbool_of_bool w__40 then
                                                   let rs3 : mword 5 := subrange_vec_dec v__9 31 27 in
                                                   let rs3 : mword 5 := subrange_vec_dec v__9 31 27 in
                                                   let rs2 : mword 5 := subrange_vec_dec v__9 24 20 in
                                                   let rs1 : mword 5 := subrange_vec_dec v__9 19 15 in
                                                   let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                                                   let _mappingpatterns_65_ : mword 3 :=
                                                     subrange_vec_dec v__9 14 12 in
                                                   (encdec_rounding_mode_backwards
                                                      _mappingpatterns_65_) >>= fun rm =>
                                                   returnm (F_MADD_TYPE_S
                                                              (rs3, rs2, rs1, rm, rd, FNMSUB_S))
                                                 else
                                                   (and_boolM
                                                      (let _mappingpatterns_66_ : mword 3 :=
                                                        subrange_vec_dec v__9 14 12 in
                                                      (if encdec_rounding_mode_backwards_matches
                                                            _mappingpatterns_66_ then
                                                         (encdec_rounding_mode_backwards
                                                            _mappingpatterns_66_) >>= fun rm =>
                                                         (is_RV32F_or_RV64F tt)
                                                          : M (bool)
                                                       else returnm false)
                                                       : M (bool))
                                                      (returnm ((andb
                                                                   (eq_vec
                                                                      (subrange_vec_dec v__9 26 25)
                                                                      ('b"00"
                                                                       : mword (26 - 25 + 1)))
                                                                   (eq_vec
                                                                      (subrange_vec_dec v__9 6 0)
                                                                      ('b"1001111"
                                                                       : mword (6 - 0 + 1))))
                                                        : bool))) >>= fun w__43 : bool =>
                                                   (if sumbool_of_bool w__43 then
                                                      let rs3 : mword 5 :=
                                                        subrange_vec_dec v__9 31 27 in
                                                      let rs3 : mword 5 :=
                                                        subrange_vec_dec v__9 31 27 in
                                                      let rs2 : mword 5 :=
                                                        subrange_vec_dec v__9 24 20 in
                                                      let rs1 : mword 5 :=
                                                        subrange_vec_dec v__9 19 15 in
                                                      let rd : mword 5 := subrange_vec_dec v__9 11 7 in
                                                      let _mappingpatterns_66_ : mword 3 :=
                                                        subrange_vec_dec v__9 14 12 in
                                                      (encdec_rounding_mode_backwards
                                                         _mappingpatterns_66_) >>= fun rm =>
                                                      returnm (F_MADD_TYPE_S
                                                                 (rs3, rs2, rs1, rm, rd, FNMADD_S))
                                                    else
                                                      (and_boolM
                                                         (let _mappingpatterns_67_ : mword 3 :=
                                                           subrange_vec_dec v__9 14 12 in
                                                         (if encdec_rounding_mode_backwards_matches
                                                               _mappingpatterns_67_ then
                                                            (encdec_rounding_mode_backwards
                                                               _mappingpatterns_67_) >>= fun rm =>
                                                            (is_RV32F_or_RV64F tt)
                                                             : M (bool)
                                                          else returnm false)
                                                          : M (bool))
                                                         (returnm ((andb
                                                                      (eq_vec
                                                                         (subrange_vec_dec v__9 31
                                                                            25)
                                                                         ('b"0000000"
                                                                          : mword (31 - 25 + 1)))
                                                                      (eq_vec
                                                                         (subrange_vec_dec v__9 6 0)
                                                                         ('b"1010011"
                                                                          : mword (6 - 0 + 1))))
                                                           : bool))) >>= fun w__46 : bool =>
                                                      (if sumbool_of_bool w__46 then
                                                         let rs2 : mword 5 :=
                                                           subrange_vec_dec v__9 24 20 in
                                                         let rs1 : mword 5 :=
                                                           subrange_vec_dec v__9 19 15 in
                                                         let rd : mword 5 :=
                                                           subrange_vec_dec v__9 11 7 in
                                                         let _mappingpatterns_67_ : mword 3 :=
                                                           subrange_vec_dec v__9 14 12 in
                                                         (encdec_rounding_mode_backwards
                                                            _mappingpatterns_67_) >>= fun rm =>
                                                         returnm (F_BIN_RM_TYPE_S
                                                                    (rs2, rs1, rm, rd, FADD_S))
                                                       else
                                                         (and_boolM
                                                            (let _mappingpatterns_68_ : mword 3 :=
                                                              subrange_vec_dec v__9 14 12 in
                                                            (if encdec_rounding_mode_backwards_matches
                                                                  _mappingpatterns_68_ then
                                                               (encdec_rounding_mode_backwards
                                                                  _mappingpatterns_68_) >>= fun rm =>
                                                               (is_RV32F_or_RV64F tt)
                                                                : M (bool)
                                                             else returnm false)
                                                             : M (bool))
                                                            (returnm ((andb
                                                                         (eq_vec
                                                                            (subrange_vec_dec v__9
                                                                               31 25)
                                                                            ('b"0000100"
                                                                             : mword (31 - 25 + 1)))
                                                                         (eq_vec
                                                                            (subrange_vec_dec v__9 6
                                                                               0)
                                                                            ('b"1010011"
                                                                             : mword (6 - 0 + 1))))
                                                              : bool))) >>= fun w__49 : bool =>
                                                         (if sumbool_of_bool w__49 then
                                                            let rs2 : mword 5 :=
                                                              subrange_vec_dec v__9 24 20 in
                                                            let rs1 : mword 5 :=
                                                              subrange_vec_dec v__9 19 15 in
                                                            let rd : mword 5 :=
                                                              subrange_vec_dec v__9 11 7 in
                                                            let _mappingpatterns_68_ : mword 3 :=
                                                              subrange_vec_dec v__9 14 12 in
                                                            (encdec_rounding_mode_backwards
                                                               _mappingpatterns_68_) >>= fun rm =>
                                                            returnm (F_BIN_RM_TYPE_S
                                                                       (rs2, rs1, rm, rd, FSUB_S))
                                                          else
                                                            (and_boolM
                                                               (let _mappingpatterns_69_ : mword 3 :=
                                                                 subrange_vec_dec v__9 14 12 in
                                                               (if encdec_rounding_mode_backwards_matches
                                                                     _mappingpatterns_69_ then
                                                                  (encdec_rounding_mode_backwards
                                                                     _mappingpatterns_69_) >>= fun rm =>
                                                                  (is_RV32F_or_RV64F tt)
                                                                   : M (bool)
                                                                else returnm false)
                                                                : M (bool))
                                                               (returnm ((andb
                                                                            (eq_vec
                                                                               (subrange_vec_dec
                                                                                  v__9 31 25)
                                                                               ('b"0001000"
                                                                                : mword (31 - 25 + 1)))
                                                                            (eq_vec
                                                                               (subrange_vec_dec
                                                                                  v__9 6 0)
                                                                               ('b"1010011"
                                                                                : mword (6 - 0 + 1))))
                                                                 : bool))) >>= fun w__52 : bool =>
                                                            (if sumbool_of_bool w__52 then
                                                               let rs2 : mword 5 :=
                                                                 subrange_vec_dec v__9 24 20 in
                                                               let rs1 : mword 5 :=
                                                                 subrange_vec_dec v__9 19 15 in
                                                               let rd : mword 5 :=
                                                                 subrange_vec_dec v__9 11 7 in
                                                               let _mappingpatterns_69_ : mword 3 :=
                                                                 subrange_vec_dec v__9 14 12 in
                                                               (encdec_rounding_mode_backwards
                                                                  _mappingpatterns_69_) >>= fun rm =>
                                                               returnm (F_BIN_RM_TYPE_S
                                                                          (rs2, rs1, rm, rd, FMUL_S))
                                                             else
                                                               (and_boolM
                                                                  (let _mappingpatterns_70_ : mword 3 :=
                                                                    subrange_vec_dec v__9 14 12 in
                                                                  (if encdec_rounding_mode_backwards_matches
                                                                        _mappingpatterns_70_ then
                                                                     (encdec_rounding_mode_backwards
                                                                        _mappingpatterns_70_) >>= fun rm =>
                                                                     (is_RV32F_or_RV64F tt)
                                                                      : M (bool)
                                                                   else returnm false)
                                                                   : M (bool))
                                                                  (returnm ((andb
                                                                               (eq_vec
                                                                                  (subrange_vec_dec
                                                                                     v__9 31 25)
                                                                                  ('b"0001100"
                                                                                   : mword (31 - 25 + 1)))
                                                                               (eq_vec
                                                                                  (subrange_vec_dec
                                                                                     v__9 6 0)
                                                                                  ('b"1010011"
                                                                                   : mword (6 - 0 + 1))))
                                                                    : bool))) >>= fun w__55 : bool =>
                                                               (if sumbool_of_bool w__55 then
                                                                  let rs2 : mword 5 :=
                                                                    subrange_vec_dec v__9 24 20 in
                                                                  let rs1 : mword 5 :=
                                                                    subrange_vec_dec v__9 19 15 in
                                                                  let rd : mword 5 :=
                                                                    subrange_vec_dec v__9 11 7 in
                                                                  let _mappingpatterns_70_ : mword 3 :=
                                                                    subrange_vec_dec v__9 14 12 in
                                                                  (encdec_rounding_mode_backwards
                                                                     _mappingpatterns_70_) >>= fun rm =>
                                                                  returnm (F_BIN_RM_TYPE_S
                                                                             (rs2, rs1, rm, rd, FDIV_S))
                                                                else
                                                                  (and_boolM
                                                                     (let _mappingpatterns_71_ : mword 3 :=
                                                                       subrange_vec_dec v__9 14 12 in
                                                                     (if encdec_rounding_mode_backwards_matches
                                                                           _mappingpatterns_71_ then
                                                                        (encdec_rounding_mode_backwards
                                                                           _mappingpatterns_71_) >>= fun rm =>
                                                                        (is_RV32F_or_RV64F tt)
                                                                         : M (bool)
                                                                      else returnm false)
                                                                      : M (bool))
                                                                     (returnm ((andb
                                                                                  (eq_vec
                                                                                     (subrange_vec_dec
                                                                                        v__9 31 20)
                                                                                     (Ox"580"
                                                                                      : mword (31 - 20 + 1)))
                                                                                  (eq_vec
                                                                                     (subrange_vec_dec
                                                                                        v__9 6 0)
                                                                                     ('b"1010011"
                                                                                      : mword (6 - 0 + 1))))
                                                                       : bool))) >>= fun w__58 : bool =>
                                                                  (if sumbool_of_bool w__58 then
                                                                     let rs1 : mword 5 :=
                                                                       subrange_vec_dec v__9 19 15 in
                                                                     let rd : mword 5 :=
                                                                       subrange_vec_dec v__9 11 7 in
                                                                     let _mappingpatterns_71_ : mword 3 :=
                                                                       subrange_vec_dec v__9 14 12 in
                                                                     (encdec_rounding_mode_backwards
                                                                        _mappingpatterns_71_) >>= fun rm =>
                                                                     returnm (F_UN_RM_TYPE_S
                                                                                (rs1, rm, rd, FSQRT_S))
                                                                   else
                                                                     (and_boolM
                                                                        (let _mappingpatterns_72_ : mword 3 :=
                                                                          subrange_vec_dec v__9 14
                                                                            12 in
                                                                        (if encdec_rounding_mode_backwards_matches
                                                                              _mappingpatterns_72_
                                                                         then
                                                                           (encdec_rounding_mode_backwards
                                                                              _mappingpatterns_72_) >>= fun rm =>
                                                                           (is_RV32F_or_RV64F tt)
                                                                            : M (bool)
                                                                         else returnm false)
                                                                         : M (bool))
                                                                        (returnm ((andb
                                                                                     (eq_vec
                                                                                        (subrange_vec_dec
                                                                                           v__9 31
                                                                                           20)
                                                                                        (Ox"C00"
                                                                                         : mword (31 - 20 + 1)))
                                                                                     (eq_vec
                                                                                        (subrange_vec_dec
                                                                                           v__9 6 0)
                                                                                        ('b"1010011"
                                                                                         : mword (6 - 0 + 1))))
                                                                          : bool))) >>= fun w__61 : bool =>
                                                                     (if sumbool_of_bool w__61 then
                                                                        let rs1 : mword 5 :=
                                                                          subrange_vec_dec v__9 19
                                                                            15 in
                                                                        let rd : mword 5 :=
                                                                          subrange_vec_dec v__9 11 7 in
                                                                        let _mappingpatterns_72_ : mword 3 :=
                                                                          subrange_vec_dec v__9 14
                                                                            12 in
                                                                        (encdec_rounding_mode_backwards
                                                                           _mappingpatterns_72_) >>= fun rm =>
                                                                        returnm (F_UN_RM_TYPE_S
                                                                                   (rs1, rm, rd, FCVT_W_S))
                                                                      else
                                                                        (and_boolM
                                                                           (let _mappingpatterns_73_ : mword 3 :=
                                                                             subrange_vec_dec v__9
                                                                               14 12 in
                                                                           (if encdec_rounding_mode_backwards_matches
                                                                                 _mappingpatterns_73_
                                                                            then
                                                                              (encdec_rounding_mode_backwards
                                                                                 _mappingpatterns_73_) >>= fun rm =>
                                                                              (is_RV32F_or_RV64F tt)
                                                                               : M (bool)
                                                                            else returnm false)
                                                                            : M (bool))
                                                                           (returnm ((andb
                                                                                        (eq_vec
                                                                                           (subrange_vec_dec
                                                                                              v__9
                                                                                              31 20)
                                                                                           (Ox"C01"
                                                                                            : mword (31 - 20 + 1)))
                                                                                        (eq_vec
                                                                                           (subrange_vec_dec
                                                                                              v__9 6
                                                                                              0)
                                                                                           ('b"1010011"
                                                                                            : mword (6 - 0 + 1))))
                                                                             : bool))) >>= fun w__64 : bool =>
                                                                        (if sumbool_of_bool
                                                                           w__64 then
                                                                           let rs1 : mword 5 :=
                                                                             subrange_vec_dec v__9
                                                                               19 15 in
                                                                           let rd : mword 5 :=
                                                                             subrange_vec_dec v__9
                                                                               11 7 in
                                                                           let _mappingpatterns_73_ : mword 3 :=
                                                                             subrange_vec_dec v__9
                                                                               14 12 in
                                                                           (encdec_rounding_mode_backwards
                                                                              _mappingpatterns_73_) >>= fun rm =>
                                                                           returnm (F_UN_RM_TYPE_S
                                                                                      (rs1, rm, rd, FCVT_WU_S))
                                                                         else
                                                                           (and_boolM
                                                                              (let _mappingpatterns_74_ : mword 3 :=
                                                                                subrange_vec_dec
                                                                                  v__9 14 12 in
                                                                              (if encdec_rounding_mode_backwards_matches
                                                                                    _mappingpatterns_74_
                                                                               then
                                                                                 (encdec_rounding_mode_backwards
                                                                                    _mappingpatterns_74_) >>= fun rm =>
                                                                                 (is_RV32F_or_RV64F
                                                                                    tt)
                                                                                  : M (bool)
                                                                               else returnm false)
                                                                               : M (bool))
                                                                              (returnm ((andb
                                                                                           (eq_vec
                                                                                              (subrange_vec_dec
                                                                                                 v__9
                                                                                                 31
                                                                                                 20)
                                                                                              (Ox"D00"
                                                                                               : mword (31 - 20 + 1)))
                                                                                           (eq_vec
                                                                                              (subrange_vec_dec
                                                                                                 v__9
                                                                                                 6 0)
                                                                                              ('b"1010011"
                                                                                               : mword (6 - 0 + 1))))
                                                                                : bool))) >>= fun w__67 : bool =>
                                                                           (if sumbool_of_bool
                                                                              w__67 then
                                                                              let rs1 : mword 5 :=
                                                                                subrange_vec_dec
                                                                                  v__9 19 15 in
                                                                              let rd : mword 5 :=
                                                                                subrange_vec_dec
                                                                                  v__9 11 7 in
                                                                              let _mappingpatterns_74_ : mword 3 :=
                                                                                subrange_vec_dec
                                                                                  v__9 14 12 in
                                                                              (encdec_rounding_mode_backwards
                                                                                 _mappingpatterns_74_) >>= fun rm =>
                                                                              returnm (F_UN_RM_TYPE_S
                                                                                         (rs1, rm, rd, FCVT_S_W))
                                                                            else
                                                                              (and_boolM
                                                                                 (let _mappingpatterns_75_ : mword 3 :=
                                                                                   subrange_vec_dec
                                                                                     v__9 14 12 in
                                                                                 (if encdec_rounding_mode_backwards_matches
                                                                                       _mappingpatterns_75_
                                                                                  then
                                                                                    (encdec_rounding_mode_backwards
                                                                                       _mappingpatterns_75_) >>= fun rm =>
                                                                                    (is_RV32F_or_RV64F
                                                                                       tt)
                                                                                     : M (bool)
                                                                                  else returnm false)
                                                                                  : M (bool))
                                                                                 (returnm ((andb
                                                                                              (eq_vec
                                                                                                 (subrange_vec_dec
                                                                                                    v__9
                                                                                                    31
                                                                                                    20)
                                                                                                 (Ox"D01"
                                                                                                  : mword (31 - 20 + 1)))
                                                                                              (eq_vec
                                                                                                 (subrange_vec_dec
                                                                                                    v__9
                                                                                                    6
                                                                                                    0)
                                                                                                 ('b"1010011"
                                                                                                  : mword (6 - 0 + 1))))
                                                                                   : bool))) >>= fun w__70 : bool =>
                                                                              (if sumbool_of_bool
                                                                                 w__70 then
                                                                                 let rs1 : mword 5 :=
                                                                                   subrange_vec_dec
                                                                                     v__9 19 15 in
                                                                                 let rd : mword 5 :=
                                                                                   subrange_vec_dec
                                                                                     v__9 11 7 in
                                                                                 let _mappingpatterns_75_ : mword 3 :=
                                                                                   subrange_vec_dec
                                                                                     v__9 14 12 in
                                                                                 (encdec_rounding_mode_backwards
                                                                                    _mappingpatterns_75_) >>= fun rm =>
                                                                                 returnm (F_UN_RM_TYPE_S
                                                                                            (rs1, rm, rd, FCVT_S_WU))
                                                                               else
                                                                                 (and_boolM
                                                                                    (let _mappingpatterns_76_ : mword 3 :=
                                                                                      subrange_vec_dec
                                                                                        v__9 14 12 in
                                                                                    (if encdec_rounding_mode_backwards_matches
                                                                                          _mappingpatterns_76_
                                                                                     then
                                                                                       (encdec_rounding_mode_backwards
                                                                                          _mappingpatterns_76_) >>= fun rm =>
                                                                                       (is_RV64F tt)
                                                                                        : M (bool)
                                                                                     else
                                                                                       returnm false)
                                                                                     : M (bool))
                                                                                    (returnm ((andb
                                                                                                 (eq_vec
                                                                                                    (subrange_vec_dec
                                                                                                       v__9
                                                                                                       31
                                                                                                       20)
                                                                                                    (Ox"C02"
                                                                                                     : mword (31 - 20 + 1)))
                                                                                                 (eq_vec
                                                                                                    (subrange_vec_dec
                                                                                                       v__9
                                                                                                       6
                                                                                                       0)
                                                                                                    ('b"1010011"
                                                                                                     : mword (6 - 0 + 1))))
                                                                                      : bool))) >>= fun w__73 : bool =>
                                                                                 (if sumbool_of_bool
                                                                                    w__73 then
                                                                                    let rs1 : mword 5 :=
                                                                                      subrange_vec_dec
                                                                                        v__9 19 15 in
                                                                                    let rd : mword 5 :=
                                                                                      subrange_vec_dec
                                                                                        v__9 11 7 in
                                                                                    let _mappingpatterns_76_ : mword 3 :=
                                                                                      subrange_vec_dec
                                                                                        v__9 14 12 in
                                                                                    (encdec_rounding_mode_backwards
                                                                                       _mappingpatterns_76_) >>= fun rm =>
                                                                                    returnm (F_UN_RM_TYPE_S
                                                                                               (rs1, rm, rd, FCVT_L_S))
                                                                                  else
                                                                                    (and_boolM
                                                                                       (let _mappingpatterns_77_ : mword 3 :=
                                                                                         subrange_vec_dec
                                                                                           v__9 14
                                                                                           12 in
                                                                                       (if encdec_rounding_mode_backwards_matches
                                                                                             _mappingpatterns_77_
                                                                                        then
                                                                                          (encdec_rounding_mode_backwards
                                                                                             _mappingpatterns_77_) >>= fun rm =>
                                                                                          (is_RV64F
                                                                                             tt)
                                                                                           : M (bool)
                                                                                        else
                                                                                          returnm false)
                                                                                        : M (bool))
                                                                                       (returnm ((andb
                                                                                                    (eq_vec
                                                                                                       (subrange_vec_dec
                                                                                                          v__9
                                                                                                          31
                                                                                                          20)
                                                                                                       (Ox"C03"
                                                                                                        : mword (31 - 20 + 1)))
                                                                                                    (eq_vec
                                                                                                       (subrange_vec_dec
                                                                                                          v__9
                                                                                                          6
                                                                                                          0)
                                                                                                       ('b"1010011"
                                                                                                        : mword (6 - 0 + 1))))
                                                                                         : bool))) >>= fun w__76 : bool =>
                                                                                    (if sumbool_of_bool
                                                                                       w__76 then
                                                                                       let rs1 : mword 5 :=
                                                                                         subrange_vec_dec
                                                                                           v__9 19
                                                                                           15 in
                                                                                       let rd : mword 5 :=
                                                                                         subrange_vec_dec
                                                                                           v__9 11 7 in
                                                                                       let _mappingpatterns_77_ : mword 3 :=
                                                                                         subrange_vec_dec
                                                                                           v__9 14
                                                                                           12 in
                                                                                       (encdec_rounding_mode_backwards
                                                                                          _mappingpatterns_77_) >>= fun rm =>
                                                                                       returnm (F_UN_RM_TYPE_S
                                                                                                  (rs1, rm, rd, FCVT_LU_S))
                                                                                     else
                                                                                       (and_boolM
                                                                                          (let _mappingpatterns_78_ : mword 3 :=
                                                                                            subrange_vec_dec
                                                                                              v__9
                                                                                              14 12 in
                                                                                          (if encdec_rounding_mode_backwards_matches
                                                                                                _mappingpatterns_78_
                                                                                           then
                                                                                             (encdec_rounding_mode_backwards
                                                                                                _mappingpatterns_78_) >>= fun rm =>
                                                                                             (is_RV64F
                                                                                                tt)
                                                                                              : M (bool)
                                                                                           else
                                                                                             returnm false)
                                                                                           : M (bool))
                                                                                          (returnm ((andb
                                                                                                       (eq_vec
                                                                                                          (subrange_vec_dec
                                                                                                             v__9
                                                                                                             31
                                                                                                             20)
                                                                                                          (Ox"D02"
                                                                                                           : mword (31 - 20 + 1)))
                                                                                                       (eq_vec
                                                                                                          (subrange_vec_dec
                                                                                                             v__9
                                                                                                             6
                                                                                                             0)
                                                                                                          ('b"1010011"
                                                                                                           : mword (6 - 0 + 1))))
                                                                                            : bool))) >>= fun w__79 : bool =>
                                                                                       (if sumbool_of_bool
                                                                                          w__79 then
                                                                                          let rs1 : mword 5 :=
                                                                                            subrange_vec_dec
                                                                                              v__9
                                                                                              19 15 in
                                                                                          let rd : mword 5 :=
                                                                                            subrange_vec_dec
                                                                                              v__9
                                                                                              11 7 in
                                                                                          let _mappingpatterns_78_ : mword 3 :=
                                                                                            subrange_vec_dec
                                                                                              v__9
                                                                                              14 12 in
                                                                                          (encdec_rounding_mode_backwards
                                                                                             _mappingpatterns_78_) >>= fun rm =>
                                                                                          returnm (F_UN_RM_TYPE_S
                                                                                                     (rs1, rm, rd, FCVT_S_L))
                                                                                        else
                                                                                          (and_boolM
                                                                                             (let _mappingpatterns_79_ : mword 3 :=
                                                                                               subrange_vec_dec
                                                                                                 v__9
                                                                                                 14
                                                                                                 12 in
                                                                                             (if encdec_rounding_mode_backwards_matches
                                                                                                   _mappingpatterns_79_
                                                                                              then
                                                                                                (encdec_rounding_mode_backwards
                                                                                                   _mappingpatterns_79_) >>= fun rm =>
                                                                                                (is_RV64F
                                                                                                   tt)
                                                                                                 : M (bool)
                                                                                              else
                                                                                                returnm false)
                                                                                              : M (bool))
                                                                                             (returnm ((andb
                                                                                                          (eq_vec
                                                                                                             (subrange_vec_dec
                                                                                                                v__9
                                                                                                                31
                                                                                                                20)
                                                                                                             (Ox"D03"
                                                                                                              : mword (31 - 20 + 1)))
                                                                                                          (eq_vec
                                                                                                             (subrange_vec_dec
                                                                                                                v__9
                                                                                                                6
                                                                                                                0)
                                                                                                             ('b"1010011"
                                                                                                              : mword (6 - 0 + 1))))
                                                                                               : bool))) >>= fun w__82 : bool =>
                                                                                          (if sumbool_of_bool
                                                                                             w__82
                                                                                           then
                                                                                             let rs1 : mword 5 :=
                                                                                               subrange_vec_dec
                                                                                                 v__9
                                                                                                 19
                                                                                                 15 in
                                                                                             let rd : mword 5 :=
                                                                                               subrange_vec_dec
                                                                                                 v__9
                                                                                                 11
                                                                                                 7 in
                                                                                             let _mappingpatterns_79_ : mword 3 :=
                                                                                               subrange_vec_dec
                                                                                                 v__9
                                                                                                 14
                                                                                                 12 in
                                                                                             (encdec_rounding_mode_backwards
                                                                                                _mappingpatterns_79_) >>= fun rm =>
                                                                                             returnm (F_UN_RM_TYPE_S
                                                                                                        (rs1, rm, rd, FCVT_S_LU))
                                                                                           else
                                                                                             (and_boolM
                                                                                                ((is_RV32F_or_RV64F
                                                                                                    tt)
                                                                                                 : M (bool))
                                                                                                (returnm ((andb
                                                                                                             (eq_vec
                                                                                                                (subrange_vec_dec
                                                                                                                   v__9
                                                                                                                   31
                                                                                                                   25)
                                                                                                                ('b"0010000"
                                                                                                                 : mword (31 - 25 + 1)))
                                                                                                             (andb
                                                                                                                (eq_vec
                                                                                                                   (subrange_vec_dec
                                                                                                                      v__9
                                                                                                                      14
                                                                                                                      12)
                                                                                                                   ('b"000"
                                                                                                                    : mword (14 - 12 + 1)))
                                                                                                                (eq_vec
                                                                                                                   (subrange_vec_dec
                                                                                                                      v__9
                                                                                                                      6
                                                                                                                      0)
                                                                                                                   ('b"1010011"
                                                                                                                    : mword (6 - 0 + 1)))))
                                                                                                  : bool))) >>= fun w__84 : bool =>
                                                                                             (if sumbool_of_bool
                                                                                                w__84
                                                                                              then
                                                                                                let rs2 : mword 5 :=
                                                                                                  subrange_vec_dec
                                                                                                    v__9
                                                                                                    24
                                                                                                    20 in
                                                                                                let rs1 : mword 5 :=
                                                                                                  subrange_vec_dec
                                                                                                    v__9
                                                                                                    19
                                                                                                    15 in
                                                                                                let rd : mword 5 :=
                                                                                                  subrange_vec_dec
                                                                                                    v__9
                                                                                                    11
                                                                                                    7 in
                                                                                                returnm (F_BIN_TYPE_S
                                                                                                           (rs2, rs1, rd, FSGNJ_S))
                                                                                              else
                                                                                                (and_boolM
                                                                                                   ((is_RV32F_or_RV64F
                                                                                                       tt)
                                                                                                    : M (bool))
                                                                                                   (returnm ((andb
                                                                                                                (eq_vec
                                                                                                                   (subrange_vec_dec
                                                                                                                      v__9
                                                                                                                      31
                                                                                                                      25)
                                                                                                                   ('b"0010000"
                                                                                                                    : mword (31 - 25 + 1)))
                                                                                                                (andb
                                                                                                                   (eq_vec
                                                                                                                      (subrange_vec_dec
                                                                                                                         v__9
                                                                                                                         14
                                                                                                                         12)
                                                                                                                      ('b"001"
                                                                                                                       : mword (14 - 12 + 1)))
                                                                                                                   (eq_vec
                                                                                                                      (subrange_vec_dec
                                                                                                                         v__9
                                                                                                                         6
                                                                                                                         0)
                                                                                                                      ('b"1010011"
                                                                                                                       : mword (6 - 0 + 1)))))
                                                                                                     : bool))) >>= fun w__86 : bool =>
                                                                                                (if sumbool_of_bool
                                                                                                   w__86
                                                                                                 then
                                                                                                   let rs2 : mword 5 :=
                                                                                                     subrange_vec_dec
                                                                                                       v__9
                                                                                                       24
                                                                                                       20 in
                                                                                                   let rs1 : mword 5 :=
                                                                                                     subrange_vec_dec
                                                                                                       v__9
                                                                                                       19
                                                                                                       15 in
                                                                                                   let rd : mword 5 :=
                                                                                                     subrange_vec_dec
                                                                                                       v__9
                                                                                                       11
                                                                                                       7 in
                                                                                                   returnm (F_BIN_TYPE_S
                                                                                                              (rs2, rs1, rd, FSGNJN_S))
                                                                                                 else
                                                                                                   (and_boolM
                                                                                                      ((is_RV32F_or_RV64F
                                                                                                          tt)
                                                                                                       : M (bool))
                                                                                                      (returnm ((andb
                                                                                                                   (eq_vec
                                                                                                                      (subrange_vec_dec
                                                                                                                         v__9
                                                                                                                         31
                                                                                                                         25)
                                                                                                                      ('b"0010000"
                                                                                                                       : mword (31 - 25 + 1)))
                                                                                                                   (andb
                                                                                                                      (eq_vec
                                                                                                                         (subrange_vec_dec
                                                                                                                            v__9
                                                                                                                            14
                                                                                                                            12)
                                                                                                                         ('b"010"
                                                                                                                          : mword (14 - 12 + 1)))
                                                                                                                      (eq_vec
                                                                                                                         (subrange_vec_dec
                                                                                                                            v__9
                                                                                                                            6
                                                                                                                            0)
                                                                                                                         ('b"1010011"
                                                                                                                          : mword (6 - 0 + 1)))))
                                                                                                        : bool))) >>= fun w__88 : bool =>
                                                                                                   (if
                                                                                                      sumbool_of_bool
                                                                                                      w__88
                                                                                                    then
                                                                                                      let rs2 : mword 5 :=
                                                                                                        subrange_vec_dec
                                                                                                          v__9
                                                                                                          24
                                                                                                          20 in
                                                                                                      let rs1 : mword 5 :=
                                                                                                        subrange_vec_dec
                                                                                                          v__9
                                                                                                          19
                                                                                                          15 in
                                                                                                      let rd : mword 5 :=
                                                                                                        subrange_vec_dec
                                                                                                          v__9
                                                                                                          11
                                                                                                          7 in
                                                                                                      returnm (F_BIN_TYPE_S
                                                                                                                 (rs2, rs1, rd, FSGNJX_S))
                                                                                                    else
                                                                                                      (and_boolM
                                                                                                         ((is_RV32F_or_RV64F
                                                                                                             tt)
                                                                                                          : M (bool))
                                                                                                         (returnm ((andb
                                                                                                                      (eq_vec
                                                                                                                         (subrange_vec_dec
                                                                                                                            v__9
                                                                                                                            31
                                                                                                                            25)
                                                                                                                         ('b"0010100"
                                                                                                                          : mword (31 - 25 + 1)))
                                                                                                                      (andb
                                                                                                                         (eq_vec
                                                                                                                            (subrange_vec_dec
                                                                                                                               v__9
                                                                                                                               14
                                                                                                                               12)
                                                                                                                            ('b"000"
                                                                                                                             : mword (14 - 12 + 1)))
                                                                                                                         (eq_vec
                                                                                                                            (subrange_vec_dec
                                                                                                                               v__9
                                                                                                                               6
                                                                                                                               0)
                                                                                                                            ('b"1010011"
                                                                                                                             : mword (6 - 0 + 1)))))
                                                                                                           : bool))) >>= fun w__90 : bool =>
                                                                                                      (if
                                                                                                         sumbool_of_bool
                                                                                                         w__90
                                                                                                       then
                                                                                                         let rs2 : mword 5 :=
                                                                                                           subrange_vec_dec
                                                                                                             v__9
                                                                                                             24
                                                                                                             20 in
                                                                                                         let rs1 : mword 5 :=
                                                                                                           subrange_vec_dec
                                                                                                             v__9
                                                                                                             19
                                                                                                             15 in
                                                                                                         let rd : mword 5 :=
                                                                                                           subrange_vec_dec
                                                                                                             v__9
                                                                                                             11
                                                                                                             7 in
                                                                                                         returnm (F_BIN_TYPE_S
                                                                                                                    (rs2, rs1, rd, FMIN_S))
                                                                                                       else
                                                                                                         (and_boolM
                                                                                                            ((is_RV32F_or_RV64F
                                                                                                                tt)
                                                                                                             : M (bool))
                                                                                                            (returnm ((andb
                                                                                                                         (eq_vec
                                                                                                                            (subrange_vec_dec
                                                                                                                               v__9
                                                                                                                               31
                                                                                                                               25)
                                                                                                                            ('b"0010100"
                                                                                                                             : mword (31 - 25 + 1)))
                                                                                                                         (andb
                                                                                                                            (eq_vec
                                                                                                                               (subrange_vec_dec
                                                                                                                                  v__9
                                                                                                                                  14
                                                                                                                                  12)
                                                                                                                               ('b"001"
                                                                                                                                : mword (14 - 12 + 1)))
                                                                                                                            (eq_vec
                                                                                                                               (subrange_vec_dec
                                                                                                                                  v__9
                                                                                                                                  6
                                                                                                                                  0)
                                                                                                                               ('b"1010011"
                                                                                                                                : mword (6 - 0 + 1)))))
                                                                                                              : bool))) >>= fun w__92 : bool =>
                                                                                                         (if
                                                                                                            sumbool_of_bool
                                                                                                            w__92
                                                                                                          then
                                                                                                            let rs2 : mword 5 :=
                                                                                                              subrange_vec_dec
                                                                                                                v__9
                                                                                                                24
                                                                                                                20 in
                                                                                                            let rs1 : mword 5 :=
                                                                                                              subrange_vec_dec
                                                                                                                v__9
                                                                                                                19
                                                                                                                15 in
                                                                                                            let rd : mword 5 :=
                                                                                                              subrange_vec_dec
                                                                                                                v__9
                                                                                                                11
                                                                                                                7 in
                                                                                                            returnm (F_BIN_TYPE_S
                                                                                                                       (rs2, rs1, rd, FMAX_S))
                                                                                                          else
                                                                                                            (and_boolM
                                                                                                               ((is_RV32F_or_RV64F
                                                                                                                   tt)
                                                                                                                : M (bool))
                                                                                                               (returnm ((andb
                                                                                                                            (eq_vec
                                                                                                                               (subrange_vec_dec
                                                                                                                                  v__9
                                                                                                                                  31
                                                                                                                                  25)
                                                                                                                               ('b"1010000"
                                                                                                                                : mword (31 - 25 + 1)))
                                                                                                                            (andb
                                                                                                                               (eq_vec
                                                                                                                                  (subrange_vec_dec
                                                                                                                                     v__9
                                                                                                                                     14
                                                                                                                                     12)
                                                                                                                                  ('b"010"
                                                                                                                                   : mword (14 - 12 + 1)))
                                                                                                                               (eq_vec
                                                                                                                                  (subrange_vec_dec
                                                                                                                                     v__9
                                                                                                                                     6
                                                                                                                                     0)
                                                                                                                                  ('b"1010011"
                                                                                                                                   : mword (6 - 0 + 1)))))
                                                                                                                 : bool))) >>= fun w__94 : bool =>
                                                                                                            (if
                                                                                                               sumbool_of_bool
                                                                                                               w__94
                                                                                                             then
                                                                                                               let rs2 : mword 5 :=
                                                                                                                 subrange_vec_dec
                                                                                                                   v__9
                                                                                                                   24
                                                                                                                   20 in
                                                                                                               let rs1 : mword 5 :=
                                                                                                                 subrange_vec_dec
                                                                                                                   v__9
                                                                                                                   19
                                                                                                                   15 in
                                                                                                               let rd : mword 5 :=
                                                                                                                 subrange_vec_dec
                                                                                                                   v__9
                                                                                                                   11
                                                                                                                   7 in
                                                                                                               returnm (F_BIN_TYPE_S
                                                                                                                          (rs2, rs1, rd, FEQ_S))
                                                                                                             else
                                                                                                               (and_boolM
                                                                                                                  ((is_RV32F_or_RV64F
                                                                                                                      tt)
                                                                                                                   : M (bool))
                                                                                                                  (returnm ((andb
                                                                                                                               (eq_vec
                                                                                                                                  (subrange_vec_dec
                                                                                                                                     v__9
                                                                                                                                     31
                                                                                                                                     25)
                                                                                                                                  ('b"1010000"
                                                                                                                                   : mword (31 - 25 + 1)))
                                                                                                                               (andb
                                                                                                                                  (eq_vec
                                                                                                                                     (subrange_vec_dec
                                                                                                                                        v__9
                                                                                                                                        14
                                                                                                                                        12)
                                                                                                                                     ('b"001"
                                                                                                                                      : mword (14 - 12 + 1)))
                                                                                                                                  (eq_vec
                                                                                                                                     (subrange_vec_dec
                                                                                                                                        v__9
                                                                                                                                        6
                                                                                                                                        0)
                                                                                                                                     ('b"1010011"
                                                                                                                                      : mword (6 - 0 + 1)))))
                                                                                                                    : bool))) >>= fun w__96 : bool =>
                                                                                                               (if
                                                                                                                  sumbool_of_bool
                                                                                                                  w__96
                                                                                                                then
                                                                                                                  let rs2 : mword 5 :=
                                                                                                                    subrange_vec_dec
                                                                                                                      v__9
                                                                                                                      24
                                                                                                                      20 in
                                                                                                                  let rs1 : mword 5 :=
                                                                                                                    subrange_vec_dec
                                                                                                                      v__9
                                                                                                                      19
                                                                                                                      15 in
                                                                                                                  let rd : mword 5 :=
                                                                                                                    subrange_vec_dec
                                                                                                                      v__9
                                                                                                                      11
                                                                                                                      7 in
                                                                                                                  returnm (F_BIN_TYPE_S
                                                                                                                             (rs2, rs1, rd, FLT_S))
                                                                                                                else
                                                                                                                  (and_boolM
                                                                                                                     ((is_RV32F_or_RV64F
                                                                                                                         tt)
                                                                                                                      : M (bool))
                                                                                                                     (returnm ((andb
                                                                                                                                  (eq_vec
                                                                                                                                     (subrange_vec_dec
                                                                                                                                        v__9
                                                                                                                                        31
                                                                                                                                        25)
                                                                                                                                     ('b"1010000"
                                                                                                                                      : mword (31 - 25 + 1)))
                                                                                                                                  (andb
                                                                                                                                     (eq_vec
                                                                                                                                        (subrange_vec_dec
                                                                                                                                           v__9
                                                                                                                                           14
                                                                                                                                           12)
                                                                                                                                        ('b"000"
                                                                                                                                         : mword (14 - 12 + 1)))
                                                                                                                                     (eq_vec
                                                                                                                                        (subrange_vec_dec
                                                                                                                                           v__9
                                                                                                                                           6
                                                                                                                                           0)
                                                                                                                                        ('b"1010011"
                                                                                                                                         : mword (6 - 0 + 1)))))
                                                                                                                       : bool))) >>= fun w__98 : bool =>
                                                                                                                  (if
                                                                                                                     sumbool_of_bool
                                                                                                                     w__98
                                                                                                                   then
                                                                                                                     let rs2 : mword 5 :=
                                                                                                                       subrange_vec_dec
                                                                                                                         v__9
                                                                                                                         24
                                                                                                                         20 in
                                                                                                                     let rs1 : mword 5 :=
                                                                                                                       subrange_vec_dec
                                                                                                                         v__9
                                                                                                                         19
                                                                                                                         15 in
                                                                                                                     let rd : mword 5 :=
                                                                                                                       subrange_vec_dec
                                                                                                                         v__9
                                                                                                                         11
                                                                                                                         7 in
                                                                                                                     returnm (F_BIN_TYPE_S
                                                                                                                                (rs2, rs1, rd, FLE_S))
                                                                                                                   else
                                                                                                                     (and_boolM
                                                                                                                        ((haveFExt
                                                                                                                            tt)
                                                                                                                         : M (bool))
                                                                                                                        (returnm ((andb
                                                                                                                                     (eq_vec
                                                                                                                                        (subrange_vec_dec
                                                                                                                                           v__9
                                                                                                                                           31
                                                                                                                                           20)
                                                                                                                                        (Ox"E00"
                                                                                                                                         : mword (31 - 20 + 1)))
                                                                                                                                     (andb
                                                                                                                                        (eq_vec
                                                                                                                                           (subrange_vec_dec
                                                                                                                                              v__9
                                                                                                                                              14
                                                                                                                                              12)
                                                                                                                                           ('b"001"
                                                                                                                                            : mword (14 - 12 + 1)))
                                                                                                                                        (eq_vec
                                                                                                                                           (subrange_vec_dec
                                                                                                                                              v__9
                                                                                                                                              6
                                                                                                                                              0)
                                                                                                                                           ('b"1010011"
                                                                                                                                            : mword (6 - 0 + 1)))))
                                                                                                                          : bool))) >>= fun w__100 : bool =>
                                                                                                                     (if
                                                                                                                        sumbool_of_bool
                                                                                                                        w__100
                                                                                                                      then
                                                                                                                        let rs1 : mword 5 :=
                                                                                                                          subrange_vec_dec
                                                                                                                            v__9
                                                                                                                            19
                                                                                                                            15 in
                                                                                                                        let rd : mword 5 :=
                                                                                                                          subrange_vec_dec
                                                                                                                            v__9
                                                                                                                            11
                                                                                                                            7 in
                                                                                                                        returnm (F_UN_TYPE_S
                                                                                                                                   (rs1, rd, FCLASS_S))
                                                                                                                      else
                                                                                                                        (and_boolM
                                                                                                                           ((haveFExt
                                                                                                                               tt)
                                                                                                                            : M (bool))
                                                                                                                           (returnm ((andb
                                                                                                                                        (eq_vec
                                                                                                                                           (subrange_vec_dec
                                                                                                                                              v__9
                                                                                                                                              31
                                                                                                                                              20)
                                                                                                                                           (Ox"E00"
                                                                                                                                            : mword (31 - 20 + 1)))
                                                                                                                                        (andb
                                                                                                                                           (eq_vec
                                                                                                                                              (subrange_vec_dec
                                                                                                                                                 v__9
                                                                                                                                                 14
                                                                                                                                                 12)
                                                                                                                                              ('b"000"
                                                                                                                                               : mword (14 - 12 + 1)))
                                                                                                                                           (eq_vec
                                                                                                                                              (subrange_vec_dec
                                                                                                                                                 v__9
                                                                                                                                                 6
                                                                                                                                                 0)
                                                                                                                                              ('b"1010011"
                                                                                                                                               : mword (6 - 0 + 1)))))
                                                                                                                             : bool))) >>= fun w__102 : bool =>
                                                                                                                        (if
                                                                                                                           sumbool_of_bool
                                                                                                                           w__102
                                                                                                                         then
                                                                                                                           let rs1 : mword 5 :=
                                                                                                                             subrange_vec_dec
                                                                                                                               v__9
                                                                                                                               19
                                                                                                                               15 in
                                                                                                                           let rd : mword 5 :=
                                                                                                                             subrange_vec_dec
                                                                                                                               v__9
                                                                                                                               11
                                                                                                                               7 in
                                                                                                                           returnm (F_UN_TYPE_S
                                                                                                                                      (rs1, rd, FMV_X_W))
                                                                                                                         else
                                                                                                                           (and_boolM
                                                                                                                              ((haveFExt
                                                                                                                                  tt)
                                                                                                                               : M (bool))
                                                                                                                              (returnm ((andb
                                                                                                                                           (eq_vec
                                                                                                                                              (subrange_vec_dec
                                                                                                                                                 v__9
                                                                                                                                                 31
                                                                                                                                                 20)
                                                                                                                                              (Ox"F00"
                                                                                                                                               : mword (31 - 20 + 1)))
                                                                                                                                           (andb
                                                                                                                                              (eq_vec
                                                                                                                                                 (subrange_vec_dec
                                                                                                                                                    v__9
                                                                                                                                                    14
                                                                                                                                                    12)
                                                                                                                                                 ('b"000"
                                                                                                                                                  : mword (14 - 12 + 1)))
                                                                                                                                              (eq_vec
                                                                                                                                                 (subrange_vec_dec
                                                                                                                                                    v__9
                                                                                                                                                    6
                                                                                                                                                    0)
                                                                                                                                                 ('b"1010011"
                                                                                                                                                  : mword (6 - 0 + 1)))))
                                                                                                                                : bool))) >>= fun w__104 : bool =>
                                                                                                                           returnm (if
                                                                                                                                      sumbool_of_bool
                                                                                                                                      w__104
                                                                                                                                    then
                                                                                                                                      let rs1 : mword 5 :=
                                                                                                                                        subrange_vec_dec
                                                                                                                                          v__9
                                                                                                                                          19
                                                                                                                                          15 in
                                                                                                                                      let rd : mword 5 :=
                                                                                                                                        subrange_vec_dec
                                                                                                                                          v__9
                                                                                                                                          11
                                                                                                                                          7 in
                                                                                                                                      F_UN_TYPE_S
                                                                                                                                        (rs1, rd, FMV_W_X)
                                                                                                                                    else
                                                                                                                                      ILLEGAL
                                                                                                                                        v__9))
                                                                                                                         : M (ast))
                                                                                                                      : M (ast))
                                                                                                                   : M (ast))
                                                                                                                : M (ast))
                                                                                                             : M (ast))
                                                                                                          : M (ast))
                                                                                                       : M (ast))
                                                                                                    : M (ast))
                                                                                                 : M (ast))
                                                                                              : M (ast))
                                                                                           : M (ast))
                                                                                        : M (ast))
                                                                                     : M (ast))
                                                                                  : M (ast))
                                                                               : M (ast))
                                                                            : M (ast))
                                                                         : M (ast))
                                                                      : M (ast))
                                                                   : M (ast))
                                                                : M (ast))
                                                             : M (ast))
                                                          : M (ast))
                                                       : M (ast))
                                                    : M (ast))
                                                 : M (ast))
                                              : M (ast))
                                           : M (ast))
                                        : M (ast))
                                     : M (ast))
                                  : M (ast))
                               : M (ast))
                            : M (ast))
                         : M (ast))
                      : M (ast))
                   : M (ast))
                : M (ast))
             : M (ast))
          : M (ast))
       : M (ast))
    : M (ast).

Definition encdec_forwards_matches (arg_ : ast) : M (bool) :=
   (match arg_ with
    | UTYPE (imm, rd, op) => returnm true
    | RISCV_JAL (v__347, rd) =>
       returnm (if eq_vec (subrange_vec_dec v__347 0 0) ('b"0"  : mword (0 - 0 + 1)) then true
                else false)
    | RISCV_JALR (imm, rs1, rd) => returnm true
    | BTYPE (v__349, rs2, rs1, op) =>
       returnm (if eq_vec (subrange_vec_dec v__349 0 0) ('b"0"  : mword (0 - 0 + 1)) then true
                else false)
    | ITYPE (imm, rs1, rd, op) => returnm true
    | SHIFTIOP (shamt, rs1, rd, RISCV_SLLI) => returnm true
    | SHIFTIOP (shamt, rs1, rd, RISCV_SRLI) => returnm true
    | SHIFTIOP (shamt, rs1, rd, RISCV_SRAI) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_ADD) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_SLT) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_SLTU) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_AND) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_OR) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_XOR) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_SLL) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_SRL) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_SUB) => returnm true
    | RTYPE (rs2, rs1, rd, RISCV_SRA) => returnm true
    | LOAD (imm, rs1, rd, is_unsigned, size, false, false) =>
       returnm (if sumbool_of_bool
                  (orb (Z.ltb (projT1 (word_width_bytes size)) 4)
                     (andb (negb is_unsigned) ((Z.leb (projT1 (word_width_bytes size)) 4)  : bool)))
                then
                  true
                else false)
    | STORE (v__351, rs2, rs1, size, false, false) =>
       returnm (if sumbool_of_bool (Z.leb (projT1 (word_width_bytes size)) 4) then true else false)
    | ADDIW (imm, rs1, rd) => returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | SHIFTW (shamt, rs1, rd, RISCV_SLLI) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | SHIFTW (shamt, rs1, rd, RISCV_SRLI) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | SHIFTW (shamt, rs1, rd, RISCV_SRAI) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | RTYPEW (rs2, rs1, rd, RISCV_ADDW) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | RTYPEW (rs2, rs1, rd, RISCV_SUBW) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | RTYPEW (rs2, rs1, rd, RISCV_SLLW) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | RTYPEW (rs2, rs1, rd, RISCV_SRLW) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | RTYPEW (rs2, rs1, rd, RISCV_SRAW) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | SHIFTIWOP (shamt, rs1, rd, RISCV_SLLIW) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | SHIFTIWOP (shamt, rs1, rd, RISCV_SRLIW) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | SHIFTIWOP (shamt, rs1, rd, RISCV_SRAIW) =>
       returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | FENCE (pred, succ) => returnm true
    | FENCE_TSO (pred, succ) => returnm true
    | FENCEI tt => returnm true
    | ECALL tt => returnm true
    | MRET tt => returnm true
    | SRET tt => returnm true
    | EBREAK tt => returnm true
    | WFI tt => returnm true
    | SFENCE_VMA (rs1, rs2) => returnm true
    | LOADRES (aq, rl, rs1, size, rd) => returnm (if amo_width_valid size then true else false)
    | STORECON (aq, rl, rs2, rs1, size, rd) =>
       returnm (if amo_width_valid size then true else false)
    | AMO (op, aq, rl, rs2, rs1, size, rd) => returnm (if amo_width_valid size then true else false)
    | MUL (rs2, rs1, rd, high, signed1, signed2) => returnm true
    | DIV (rs2, rs1, rd, s) => returnm true
    | REM (rs2, rs1, rd, s) => returnm true
    | MULW (rs2, rs1, rd) => returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | DIVW (rs2, rs1, rd, s) => returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | REMW (rs2, rs1, rd, s) => returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | CSR (csr, rs1, rd, is_imm, op) => returnm true
    | URET tt => returnm true
    | FENCE_RESERVED (fm, pred, succ, rs, rd) =>
       returnm (if orb (andb (neq_vec fm (Ox"0"  : mword 4)) (neq_vec fm (Ox"8"  : mword 4)))
                     (orb (neq_vec rs ('b"00000"  : mword 5)) (neq_vec rd ('b"00000"  : mword 5)))
                then
                  true
                else false)
    | FENCEI_RESERVED (imm, rs, rd) =>
       returnm (if orb (neq_vec imm (Ox"000"  : mword 12)) (orb (neq_vec rs zreg) (neq_vec rd zreg))
                then
                  true
                else false)
    | LOAD_FP (imm, rs1, rd, WORD) =>
       (is_RV32F_or_RV64F tt) >>= fun w__0 : bool =>
       returnm (if sumbool_of_bool w__0 then true else false)
    | LOAD_FP (imm, rs1, rd, DOUBLE) =>
       (is_RV32D_or_RV64D tt) >>= fun w__1 : bool =>
       returnm (if sumbool_of_bool w__1 then true else false)
    | STORE_FP (v__352, rs2, rs1, WORD) =>
       (is_RV32F_or_RV64F tt) >>= fun w__2 : bool =>
       returnm (if sumbool_of_bool w__2 then true else false)
    | STORE_FP (v__353, rs2, rs1, DOUBLE) =>
       (is_RV32D_or_RV64D tt) >>= fun w__3 : bool =>
       returnm (if sumbool_of_bool w__3 then true else false)
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FMADD_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__4 : bool =>
       returnm (if sumbool_of_bool w__4 then true else false)
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FMSUB_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__5 : bool =>
       returnm (if sumbool_of_bool w__5 then true else false)
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FNMSUB_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__6 : bool =>
       returnm (if sumbool_of_bool w__6 then true else false)
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, FNMADD_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__7 : bool =>
       returnm (if sumbool_of_bool w__7 then true else false)
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FADD_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__8 : bool =>
       returnm (if sumbool_of_bool w__8 then true else false)
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FSUB_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__9 : bool =>
       returnm (if sumbool_of_bool w__9 then true else false)
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FMUL_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__10 : bool =>
       returnm (if sumbool_of_bool w__10 then true else false)
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, FDIV_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__11 : bool =>
       returnm (if sumbool_of_bool w__11 then true else false)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FSQRT_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__12 : bool =>
       returnm (if sumbool_of_bool w__12 then true else false)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_W_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__13 : bool =>
       returnm (if sumbool_of_bool w__13 then true else false)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_WU_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__14 : bool =>
       returnm (if sumbool_of_bool w__14 then true else false)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_W) =>
       (is_RV32F_or_RV64F tt) >>= fun w__15 : bool =>
       returnm (if sumbool_of_bool w__15 then true else false)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_WU) =>
       (is_RV32F_or_RV64F tt) >>= fun w__16 : bool =>
       returnm (if sumbool_of_bool w__16 then true else false)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_L_S) =>
       (is_RV64F tt) >>= fun w__17 : bool => returnm (if sumbool_of_bool w__17 then true else false)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_LU_S) =>
       (is_RV64F tt) >>= fun w__18 : bool => returnm (if sumbool_of_bool w__18 then true else false)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_L) =>
       (is_RV64F tt) >>= fun w__19 : bool => returnm (if sumbool_of_bool w__19 then true else false)
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_LU) =>
       (is_RV64F tt) >>= fun w__20 : bool => returnm (if sumbool_of_bool w__20 then true else false)
    | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJ_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__21 : bool =>
       returnm (if sumbool_of_bool w__21 then true else false)
    | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJN_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__22 : bool =>
       returnm (if sumbool_of_bool w__22 then true else false)
    | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJX_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__23 : bool =>
       returnm (if sumbool_of_bool w__23 then true else false)
    | F_BIN_TYPE_S (rs2, rs1, rd, FMIN_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__24 : bool =>
       returnm (if sumbool_of_bool w__24 then true else false)
    | F_BIN_TYPE_S (rs2, rs1, rd, FMAX_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__25 : bool =>
       returnm (if sumbool_of_bool w__25 then true else false)
    | F_BIN_TYPE_S (rs2, rs1, rd, FEQ_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__26 : bool =>
       returnm (if sumbool_of_bool w__26 then true else false)
    | F_BIN_TYPE_S (rs2, rs1, rd, FLT_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__27 : bool =>
       returnm (if sumbool_of_bool w__27 then true else false)
    | F_BIN_TYPE_S (rs2, rs1, rd, FLE_S) =>
       (is_RV32F_or_RV64F tt) >>= fun w__28 : bool =>
       returnm (if sumbool_of_bool w__28 then true else false)
    | F_UN_TYPE_S (rs1, rd, FCLASS_S) =>
       (haveFExt tt) >>= fun w__29 : bool => returnm (if sumbool_of_bool w__29 then true else false)
    | F_UN_TYPE_S (rs1, rd, FMV_X_W) =>
       (haveFExt tt) >>= fun w__30 : bool => returnm (if sumbool_of_bool w__30 then true else false)
    | F_UN_TYPE_S (rs1, rd, FMV_W_X) =>
       (haveFExt tt) >>= fun w__31 : bool => returnm (if sumbool_of_bool w__31 then true else false)
    | ILLEGAL s => returnm true
    | _ => returnm false
    end)
    : M (bool).

Definition encdec_backwards_matches (arg_ : mword 32) : M (bool) :=
   let v__354 := arg_ in
   (if let _mappingpatterns_0_ : mword 7 := subrange_vec_dec v__354 6 0 in
      encdec_uop_backwards_matches _mappingpatterns_0_ then
      let _mappingpatterns_0_ : mword 7 := subrange_vec_dec v__354 6 0 in
      (encdec_uop_backwards _mappingpatterns_0_) >>= fun op => returnm true
    else if eq_vec (subrange_vec_dec v__354 6 0) ('b"1101111"  : mword (6 - 0 + 1)) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"000"  : mword (14 - 12 + 1)))
              (eq_vec (subrange_vec_dec v__354 6 0) ('b"1100111"  : mword (6 - 0 + 1))) then
      returnm true
    else if andb
              (let _mappingpatterns_1_ : mword 3 := subrange_vec_dec v__354 14 12 in
              encdec_bop_backwards_matches _mappingpatterns_1_)
              (eq_vec (subrange_vec_dec v__354 6 0) ('b"1100011"  : mword (6 - 0 + 1))) then
      let _mappingpatterns_1_ : mword 3 := subrange_vec_dec v__354 14 12 in
      (encdec_bop_backwards _mappingpatterns_1_) >>= fun op => returnm true
    else if andb
              (let _mappingpatterns_2_ : mword 3 := subrange_vec_dec v__354 14 12 in
              encdec_iop_backwards_matches _mappingpatterns_2_)
              (eq_vec (subrange_vec_dec v__354 6 0) ('b"0010011"  : mword (6 - 0 + 1))) then
      let _mappingpatterns_2_ : mword 3 := subrange_vec_dec v__354 14 12 in
      (encdec_iop_backwards _mappingpatterns_2_) >>= fun op => returnm true
    else if sumbool_of_bool
      (andb
         (let shamt : mword 6 := subrange_vec_dec v__354 25 20 in
         orb (Z.eqb 32 64) (eq_bit (access_vec_dec shamt 5) B0))
         (andb (eq_vec (subrange_vec_dec v__354 31 26) ('b"000000"  : mword (31 - 26 + 1)))
            (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"001"  : mword (14 - 12 + 1)))
               (eq_vec (subrange_vec_dec v__354 6 0) ('b"0010011"  : mword (6 - 0 + 1)))))) then
      returnm true
    else if sumbool_of_bool
      (andb
         (let shamt : mword 6 := subrange_vec_dec v__354 25 20 in
         orb (Z.eqb 32 64) (eq_bit (access_vec_dec shamt 5) B0))
         (andb (eq_vec (subrange_vec_dec v__354 31 26) ('b"000000"  : mword (31 - 26 + 1)))
            (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
               (eq_vec (subrange_vec_dec v__354 6 0) ('b"0010011"  : mword (6 - 0 + 1)))))) then
      returnm true
    else if sumbool_of_bool
      (andb
         (let shamt : mword 6 := subrange_vec_dec v__354 25 20 in
         orb (Z.eqb 32 64) (eq_bit (access_vec_dec shamt 5) B0))
         (andb (eq_vec (subrange_vec_dec v__354 31 26) ('b"010000"  : mword (31 - 26 + 1)))
            (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
               (eq_vec (subrange_vec_dec v__354 6 0) ('b"0010011"  : mword (6 - 0 + 1)))))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"000"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"010"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"011"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"111"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"110"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"100"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"001"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"000"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
              (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__354 6 0) ('b"0110011"  : mword (6 - 0 + 1)))) then
      returnm true
    else
      (and_boolM
         (let _mappingpatterns_4_ : mword 2 := subrange_vec_dec v__354 13 12 in
         let _mappingpatterns_3_ : mword 1 := subrange_vec_dec v__354 14 14 in
         (if size_bits_backwards_matches _mappingpatterns_4_ then
            (size_bits_backwards _mappingpatterns_4_) >>= fun size =>
            (if bool_bits_backwards_matches _mappingpatterns_3_ then
               (bool_bits_backwards _mappingpatterns_3_) >>= fun is_unsigned =>
               returnm ((orb (Z.ltb (projT1 (word_width_bytes size)) 4)
                           (andb (negb is_unsigned)
                              ((Z.leb (projT1 (word_width_bytes size)) 4)
                               : bool)))
                : bool)
             else returnm false)
             : M (bool)
          else returnm false)
          : M (bool))
         (returnm ((eq_vec (subrange_vec_dec v__354 6 0) ('b"0000011"  : mword (6 - 0 + 1)))
           : bool))) >>= fun w__2 : bool =>
      (if sumbool_of_bool w__2 then
         let _mappingpatterns_4_ : mword 2 := subrange_vec_dec v__354 13 12 in
         let _mappingpatterns_3_ : mword 1 := subrange_vec_dec v__354 14 14 in
         (size_bits_backwards _mappingpatterns_4_) >>= fun size =>
         (bool_bits_backwards _mappingpatterns_3_) >>= fun is_unsigned => returnm true
       else
         (and_boolM
            (let _mappingpatterns_5_ : mword 2 := subrange_vec_dec v__354 13 12 in
            (if size_bits_backwards_matches _mappingpatterns_5_ then
               (size_bits_backwards _mappingpatterns_5_) >>= fun size =>
               returnm ((Z.leb (projT1 (word_width_bytes size)) 4)  : bool)
             else returnm false)
             : M (bool))
            (returnm ((andb (eq_vec (subrange_vec_dec v__354 14 14) ('b"0"  : mword (14 - 14 + 1)))
                         (eq_vec (subrange_vec_dec v__354 6 0) ('b"0100011"  : mword (6 - 0 + 1))))
              : bool))) >>= fun w__4 : bool =>
         (if sumbool_of_bool w__4 then
            let _mappingpatterns_5_ : mword 2 := subrange_vec_dec v__354 13 12 in
            (size_bits_backwards _mappingpatterns_5_) >>= fun size => returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"000"  : mword (14 - 12 + 1)))
                  (eq_vec (subrange_vec_dec v__354 6 0) ('b"0011011"  : mword (6 - 0 + 1))))) then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"001"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0011011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0011011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0011011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"000"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0111011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"000"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0111011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"001"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0111011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0111011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0111011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"001"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0011011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0000000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0011011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if sumbool_of_bool
            (andb (Z.eqb 32 64)
               (andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0100000"  : mword (31 - 25 + 1)))
                  (andb (eq_vec (subrange_vec_dec v__354 14 12) ('b"101"  : mword (14 - 12 + 1)))
                     (eq_vec (subrange_vec_dec v__354 6 0) ('b"0011011"  : mword (6 - 0 + 1))))))
          then
            returnm true
          else if andb (eq_vec (subrange_vec_dec v__354 31 28) (Ox"0"  : mword (31 - 28 + 1)))
                    (eq_vec (subrange_vec_dec v__354 19 0) (Ox"0000F"  : mword (19 - 0 + 1))) then
            returnm true
          else if andb (eq_vec (subrange_vec_dec v__354 31 28) (Ox"8"  : mword (31 - 28 + 1)))
                    (eq_vec (subrange_vec_dec v__354 19 0) (Ox"0000F"  : mword (19 - 0 + 1))) then
            returnm true
          else if eq_vec v__354 (Ox"0000100F"  : mword 32) then returnm true
          else if eq_vec v__354 (Ox"00000073"  : mword 32) then returnm true
          else if eq_vec v__354 (Ox"30200073"  : mword 32) then returnm true
          else if eq_vec v__354 (Ox"10200073"  : mword 32) then returnm true
          else if eq_vec v__354 (Ox"00100073"  : mword 32) then returnm true
          else if eq_vec v__354 (Ox"10500073"  : mword 32) then returnm true
          else if andb (eq_vec (subrange_vec_dec v__354 31 25) ('b"0001001"  : mword (31 - 25 + 1)))
                    (eq_vec (subrange_vec_dec v__354 14 0)
                       ('b"000000001110011"
                        : mword (14 - 0 + 1))) then
            returnm true
          else
            (and_boolM
               (let _mappingpatterns_8_ : mword 2 := subrange_vec_dec v__354 13 12 in
               let _mappingpatterns_7_ : mword 1 := subrange_vec_dec v__354 25 25 in
               let _mappingpatterns_6_ : mword 1 := subrange_vec_dec v__354 26 26 in
               (if size_bits_backwards_matches _mappingpatterns_8_ then
                  (size_bits_backwards _mappingpatterns_8_) >>= fun size =>
                  (if bool_bits_backwards_matches _mappingpatterns_7_ then
                     (bool_bits_backwards _mappingpatterns_7_) >>= fun rl =>
                     (if bool_bits_backwards_matches _mappingpatterns_6_ then
                        (bool_bits_backwards _mappingpatterns_6_) >>= fun aq =>
                        returnm ((amo_width_valid size)  : bool)
                      else returnm false)
                      : M (bool)
                   else returnm false)
                   : M (bool)
                else returnm false)
                : M (bool))
               (returnm ((andb
                            (eq_vec (subrange_vec_dec v__354 31 27)
                               ('b"00010"
                                : mword (31 - 27 + 1)))
                            (andb
                               (eq_vec (subrange_vec_dec v__354 24 20)
                                  ('b"00000"
                                   : mword (24 - 20 + 1)))
                               (andb
                                  (eq_vec (subrange_vec_dec v__354 14 14)
                                     ('b"0"
                                      : mword (14 - 14 + 1)))
                                  (eq_vec (subrange_vec_dec v__354 6 0)
                                     ('b"0101111"
                                      : mword (6 - 0 + 1))))))
                 : bool))) >>= fun w__8 : bool =>
            (if sumbool_of_bool w__8 then
               let _mappingpatterns_8_ : mword 2 := subrange_vec_dec v__354 13 12 in
               let _mappingpatterns_7_ : mword 1 := subrange_vec_dec v__354 25 25 in
               let _mappingpatterns_6_ : mword 1 := subrange_vec_dec v__354 26 26 in
               (size_bits_backwards _mappingpatterns_8_) >>= fun size =>
               (bool_bits_backwards _mappingpatterns_7_) >>= fun rl =>
               (bool_bits_backwards _mappingpatterns_6_) >>= fun aq => returnm true
             else
               (and_boolM
                  (let _mappingpatterns_9_ : mword 1 := subrange_vec_dec v__354 26 26 in
                  let _mappingpatterns_11_ : mword 2 := subrange_vec_dec v__354 13 12 in
                  let _mappingpatterns_10_ : mword 1 := subrange_vec_dec v__354 25 25 in
                  (if size_bits_backwards_matches _mappingpatterns_11_ then
                     (size_bits_backwards _mappingpatterns_11_) >>= fun size =>
                     (if bool_bits_backwards_matches _mappingpatterns_10_ then
                        (bool_bits_backwards _mappingpatterns_10_) >>= fun rl =>
                        (if bool_bits_backwards_matches _mappingpatterns_9_ then
                           (bool_bits_backwards _mappingpatterns_9_) >>= fun aq =>
                           returnm ((amo_width_valid size)  : bool)
                         else returnm false)
                         : M (bool)
                      else returnm false)
                      : M (bool)
                   else returnm false)
                   : M (bool))
                  (returnm ((andb
                               (eq_vec (subrange_vec_dec v__354 31 27)
                                  ('b"00011"
                                   : mword (31 - 27 + 1)))
                               (andb
                                  (eq_vec (subrange_vec_dec v__354 14 14)
                                     ('b"0"
                                      : mword (14 - 14 + 1)))
                                  (eq_vec (subrange_vec_dec v__354 6 0)
                                     ('b"0101111"
                                      : mword (6 - 0 + 1)))))
                    : bool))) >>= fun w__12 : bool =>
               (if sumbool_of_bool w__12 then
                  let _mappingpatterns_9_ : mword 1 := subrange_vec_dec v__354 26 26 in
                  let _mappingpatterns_11_ : mword 2 := subrange_vec_dec v__354 13 12 in
                  let _mappingpatterns_10_ : mword 1 := subrange_vec_dec v__354 25 25 in
                  (size_bits_backwards _mappingpatterns_11_) >>= fun size =>
                  (bool_bits_backwards _mappingpatterns_10_) >>= fun rl =>
                  (bool_bits_backwards _mappingpatterns_9_) >>= fun aq => returnm true
                else
                  (and_boolM
                     (let _mappingpatterns_12_ : mword 5 := subrange_vec_dec v__354 31 27 in
                     let _mappingpatterns_15_ : mword 2 := subrange_vec_dec v__354 13 12 in
                     let _mappingpatterns_14_ : mword 1 := subrange_vec_dec v__354 25 25 in
                     let _mappingpatterns_13_ : mword 1 := subrange_vec_dec v__354 26 26 in
                     let _mappingpatterns_12_ : mword 5 := subrange_vec_dec v__354 31 27 in
                     (if size_bits_backwards_matches _mappingpatterns_15_ then
                        (size_bits_backwards _mappingpatterns_15_) >>= fun size =>
                        (if bool_bits_backwards_matches _mappingpatterns_14_ then
                           (bool_bits_backwards _mappingpatterns_14_) >>= fun rl =>
                           (if bool_bits_backwards_matches _mappingpatterns_13_ then
                              (bool_bits_backwards _mappingpatterns_13_) >>= fun aq =>
                              (if encdec_amoop_backwards_matches _mappingpatterns_12_ then
                                 (encdec_amoop_backwards _mappingpatterns_12_) >>= fun op =>
                                 returnm ((amo_width_valid size)  : bool)
                               else returnm false)
                               : M (bool)
                            else returnm false)
                            : M (bool)
                         else returnm false)
                         : M (bool)
                      else returnm false)
                      : M (bool))
                     (returnm ((andb
                                  (eq_vec (subrange_vec_dec v__354 14 14)
                                     ('b"0"
                                      : mword (14 - 14 + 1)))
                                  (eq_vec (subrange_vec_dec v__354 6 0)
                                     ('b"0101111"
                                      : mword (6 - 0 + 1))))
                       : bool))) >>= fun w__17 : bool =>
                  (if sumbool_of_bool w__17 then
                     let _mappingpatterns_12_ : mword 5 := subrange_vec_dec v__354 31 27 in
                     let _mappingpatterns_15_ : mword 2 := subrange_vec_dec v__354 13 12 in
                     let _mappingpatterns_14_ : mword 1 := subrange_vec_dec v__354 25 25 in
                     let _mappingpatterns_13_ : mword 1 := subrange_vec_dec v__354 26 26 in
                     let _mappingpatterns_12_ : mword 5 := subrange_vec_dec v__354 31 27 in
                     (size_bits_backwards _mappingpatterns_15_) >>= fun size =>
                     (bool_bits_backwards _mappingpatterns_14_) >>= fun rl =>
                     (bool_bits_backwards _mappingpatterns_13_) >>= fun aq =>
                     (encdec_amoop_backwards _mappingpatterns_12_) >>= fun op => returnm true
                   else if andb
                             (let _mappingpatterns_16_ : mword 3 := subrange_vec_dec v__354 14 12 in
                             encdec_mul_op_backwards_matches _mappingpatterns_16_)
                             (andb
                                (eq_vec (subrange_vec_dec v__354 31 25)
                                   ('b"0000001"
                                    : mword (31 - 25 + 1)))
                                (eq_vec (subrange_vec_dec v__354 6 0)
                                   ('b"0110011"
                                    : mword (6 - 0 + 1)))) then
                     let _mappingpatterns_16_ : mword 3 := subrange_vec_dec v__354 14 12 in
                     (encdec_mul_op_backwards _mappingpatterns_16_) >>= fun '(high, signed1, signed2) =>
                     returnm true
                   else if andb
                             (let _mappingpatterns_17_ : mword 1 := subrange_vec_dec v__354 12 12 in
                             bool_not_bits_backwards_matches _mappingpatterns_17_)
                             (andb
                                (eq_vec (subrange_vec_dec v__354 31 25)
                                   ('b"0000001"
                                    : mword (31 - 25 + 1)))
                                (andb
                                   (eq_vec (subrange_vec_dec v__354 14 13)
                                      ('b"10"
                                       : mword (14 - 13 + 1)))
                                   (eq_vec (subrange_vec_dec v__354 6 0)
                                      ('b"0110011"
                                       : mword (6 - 0 + 1))))) then
                     let _mappingpatterns_17_ : mword 1 := subrange_vec_dec v__354 12 12 in
                     (bool_not_bits_backwards _mappingpatterns_17_) >>= fun s => returnm true
                   else if andb
                             (let _mappingpatterns_18_ : mword 1 := subrange_vec_dec v__354 12 12 in
                             bool_not_bits_backwards_matches _mappingpatterns_18_)
                             (andb
                                (eq_vec (subrange_vec_dec v__354 31 25)
                                   ('b"0000001"
                                    : mword (31 - 25 + 1)))
                                (andb
                                   (eq_vec (subrange_vec_dec v__354 14 13)
                                      ('b"11"
                                       : mword (14 - 13 + 1)))
                                   (eq_vec (subrange_vec_dec v__354 6 0)
                                      ('b"0110011"
                                       : mword (6 - 0 + 1))))) then
                     let _mappingpatterns_18_ : mword 1 := subrange_vec_dec v__354 12 12 in
                     (bool_not_bits_backwards _mappingpatterns_18_) >>= fun s => returnm true
                   else if sumbool_of_bool
                     (andb (Z.eqb 32 64)
                        (andb
                           (eq_vec (subrange_vec_dec v__354 31 25)
                              ('b"0000001"
                               : mword (31 - 25 + 1)))
                           (andb
                              (eq_vec (subrange_vec_dec v__354 14 12)
                                 ('b"000"
                                  : mword (14 - 12 + 1)))
                              (eq_vec (subrange_vec_dec v__354 6 0)
                                 ('b"0111011"
                                  : mword (6 - 0 + 1)))))) then
                     returnm true
                   else
                     (and_boolM
                        (let _mappingpatterns_19_ : mword 1 := subrange_vec_dec v__354 12 12 in
                        (if bool_not_bits_backwards_matches _mappingpatterns_19_ then
                           (bool_not_bits_backwards _mappingpatterns_19_) >>= fun s =>
                           returnm ((Z.eqb 32 64)  : bool)
                         else returnm false)
                         : M (bool))
                        (returnm ((andb
                                     (eq_vec (subrange_vec_dec v__354 31 25)
                                        ('b"0000001"
                                         : mword (31 - 25 + 1)))
                                     (andb
                                        (eq_vec (subrange_vec_dec v__354 14 13)
                                           ('b"10"
                                            : mword (14 - 13 + 1)))
                                        (eq_vec (subrange_vec_dec v__354 6 0)
                                           ('b"0111011"
                                            : mword (6 - 0 + 1)))))
                          : bool))) >>= fun w__19 : bool =>
                     (if sumbool_of_bool w__19 then
                        let _mappingpatterns_19_ : mword 1 := subrange_vec_dec v__354 12 12 in
                        (bool_not_bits_backwards _mappingpatterns_19_) >>= fun s => returnm true
                      else
                        (and_boolM
                           (let _mappingpatterns_20_ : mword 1 := subrange_vec_dec v__354 12 12 in
                           (if bool_not_bits_backwards_matches _mappingpatterns_20_ then
                              (bool_not_bits_backwards _mappingpatterns_20_) >>= fun s =>
                              returnm ((Z.eqb 32 64)  : bool)
                            else returnm false)
                            : M (bool))
                           (returnm ((andb
                                        (eq_vec (subrange_vec_dec v__354 31 25)
                                           ('b"0000001"
                                            : mword (31 - 25 + 1)))
                                        (andb
                                           (eq_vec (subrange_vec_dec v__354 14 13)
                                              ('b"11"
                                               : mword (14 - 13 + 1)))
                                           (eq_vec (subrange_vec_dec v__354 6 0)
                                              ('b"0111011"
                                               : mword (6 - 0 + 1)))))
                             : bool))) >>= fun w__21 : bool =>
                        (if sumbool_of_bool w__21 then
                           let _mappingpatterns_20_ : mword 1 := subrange_vec_dec v__354 12 12 in
                           (bool_not_bits_backwards _mappingpatterns_20_) >>= fun s => returnm true
                         else
                           (and_boolM
                              (let _mappingpatterns_22_ : mword 2 := subrange_vec_dec v__354 13 12 in
                              let _mappingpatterns_21_ : mword 1 := subrange_vec_dec v__354 14 14 in
                              (if encdec_csrop_backwards_matches _mappingpatterns_22_ then
                                 (encdec_csrop_backwards _mappingpatterns_22_) >>= fun op =>
                                 returnm ((bool_bits_backwards_matches _mappingpatterns_21_)
                                  : bool)
                               else returnm false)
                               : M (bool))
                              (returnm ((eq_vec (subrange_vec_dec v__354 6 0)
                                           ('b"1110011"
                                            : mword (6 - 0 + 1)))
                                : bool))) >>= fun w__23 : bool =>
                           (if sumbool_of_bool w__23 then
                              let _mappingpatterns_22_ : mword 2 := subrange_vec_dec v__354 13 12 in
                              let _mappingpatterns_21_ : mword 1 := subrange_vec_dec v__354 14 14 in
                              (encdec_csrop_backwards _mappingpatterns_22_) >>= fun op =>
                              (bool_bits_backwards _mappingpatterns_21_) >>= fun is_imm =>
                              returnm true
                            else if eq_vec v__354 (Ox"00200073"  : mword 32) then returnm true
                            else if andb
                                      (let fm : bits 4 := subrange_vec_dec v__354 31 28 in
                                      let rs : regidx := subrange_vec_dec v__354 19 15 in
                                      let rd : regidx := subrange_vec_dec v__354 11 7 in
                                      let fm : bits 4 := subrange_vec_dec v__354 31 28 in
                                      orb
                                        (andb (neq_vec fm (Ox"0"  : mword 4))
                                           (neq_vec fm (Ox"8"  : mword 4)))
                                        (orb (neq_vec rs ('b"00000"  : mword 5))
                                           (neq_vec rd ('b"00000"  : mword 5))))
                                      (andb
                                         (eq_vec (subrange_vec_dec v__354 14 12)
                                            ('b"000"
                                             : mword (14 - 12 + 1)))
                                         (eq_vec (subrange_vec_dec v__354 6 0)
                                            ('b"0001111"
                                             : mword (6 - 0 + 1)))) then
                              returnm true
                            else if andb
                                      (let imm : bits 12 := subrange_vec_dec v__354 31 20 in
                                      let rs : regidx := subrange_vec_dec v__354 19 15 in
                                      let rd : regidx := subrange_vec_dec v__354 11 7 in
                                      let imm : bits 12 := subrange_vec_dec v__354 31 20 in
                                      orb (neq_vec imm (Ox"000"  : mword 12))
                                        (orb (neq_vec rs zreg) (neq_vec rd zreg)))
                                      (andb
                                         (eq_vec (subrange_vec_dec v__354 14 12)
                                            ('b"001"
                                             : mword (14 - 12 + 1)))
                                         (eq_vec (subrange_vec_dec v__354 6 0)
                                            ('b"0001111"
                                             : mword (6 - 0 + 1)))) then
                              returnm true
                            else
                              (and_boolM ((is_RV32F_or_RV64F tt)  : M (bool))
                                 (returnm ((andb
                                              (eq_vec (subrange_vec_dec v__354 14 12)
                                                 ('b"010"
                                                  : mword (14 - 12 + 1)))
                                              (eq_vec (subrange_vec_dec v__354 6 0)
                                                 ('b"0000111"
                                                  : mword (6 - 0 + 1))))
                                   : bool))) >>= fun w__25 : bool =>
                              (if sumbool_of_bool w__25 then returnm true
                               else
                                 (and_boolM ((is_RV32D_or_RV64D tt)  : M (bool))
                                    (returnm ((andb
                                                 (eq_vec (subrange_vec_dec v__354 14 12)
                                                    ('b"011"
                                                     : mword (14 - 12 + 1)))
                                                 (eq_vec (subrange_vec_dec v__354 6 0)
                                                    ('b"0000111"
                                                     : mword (6 - 0 + 1))))
                                      : bool))) >>= fun w__27 : bool =>
                                 (if sumbool_of_bool w__27 then returnm true
                                  else
                                    (and_boolM ((is_RV32F_or_RV64F tt)  : M (bool))
                                       (returnm ((andb
                                                    (eq_vec (subrange_vec_dec v__354 14 12)
                                                       ('b"010"
                                                        : mword (14 - 12 + 1)))
                                                    (eq_vec (subrange_vec_dec v__354 6 0)
                                                       ('b"0100111"
                                                        : mword (6 - 0 + 1))))
                                         : bool))) >>= fun w__29 : bool =>
                                    (if sumbool_of_bool w__29 then returnm true
                                     else
                                       (and_boolM ((is_RV32D_or_RV64D tt)  : M (bool))
                                          (returnm ((andb
                                                       (eq_vec (subrange_vec_dec v__354 14 12)
                                                          ('b"011"
                                                           : mword (14 - 12 + 1)))
                                                       (eq_vec (subrange_vec_dec v__354 6 0)
                                                          ('b"0100111"
                                                           : mword (6 - 0 + 1))))
                                            : bool))) >>= fun w__31 : bool =>
                                       (if sumbool_of_bool w__31 then returnm true
                                        else
                                          (and_boolM
                                             (let _mappingpatterns_23_ : mword 3 :=
                                               subrange_vec_dec v__354 14 12 in
                                             (if encdec_rounding_mode_backwards_matches
                                                   _mappingpatterns_23_ then
                                                (encdec_rounding_mode_backwards _mappingpatterns_23_) >>= fun rm =>
                                                (is_RV32F_or_RV64F tt)
                                                 : M (bool)
                                              else returnm false)
                                              : M (bool))
                                             (returnm ((andb
                                                          (eq_vec (subrange_vec_dec v__354 26 25)
                                                             ('b"00"
                                                              : mword (26 - 25 + 1)))
                                                          (eq_vec (subrange_vec_dec v__354 6 0)
                                                             ('b"1000011"
                                                              : mword (6 - 0 + 1))))
                                               : bool))) >>= fun w__34 : bool =>
                                          (if sumbool_of_bool w__34 then
                                             let _mappingpatterns_23_ : mword 3 :=
                                               subrange_vec_dec v__354 14 12 in
                                             (encdec_rounding_mode_backwards _mappingpatterns_23_) >>= fun rm =>
                                             returnm true
                                           else
                                             (and_boolM
                                                (let _mappingpatterns_24_ : mword 3 :=
                                                  subrange_vec_dec v__354 14 12 in
                                                (if encdec_rounding_mode_backwards_matches
                                                      _mappingpatterns_24_ then
                                                   (encdec_rounding_mode_backwards
                                                      _mappingpatterns_24_) >>= fun rm =>
                                                   (is_RV32F_or_RV64F tt)
                                                    : M (bool)
                                                 else returnm false)
                                                 : M (bool))
                                                (returnm ((andb
                                                             (eq_vec (subrange_vec_dec v__354 26 25)
                                                                ('b"00"
                                                                 : mword (26 - 25 + 1)))
                                                             (eq_vec (subrange_vec_dec v__354 6 0)
                                                                ('b"1000111"
                                                                 : mword (6 - 0 + 1))))
                                                  : bool))) >>= fun w__37 : bool =>
                                             (if sumbool_of_bool w__37 then
                                                let _mappingpatterns_24_ : mword 3 :=
                                                  subrange_vec_dec v__354 14 12 in
                                                (encdec_rounding_mode_backwards _mappingpatterns_24_) >>= fun rm =>
                                                returnm true
                                              else
                                                (and_boolM
                                                   (let _mappingpatterns_25_ : mword 3 :=
                                                     subrange_vec_dec v__354 14 12 in
                                                   (if encdec_rounding_mode_backwards_matches
                                                         _mappingpatterns_25_ then
                                                      (encdec_rounding_mode_backwards
                                                         _mappingpatterns_25_) >>= fun rm =>
                                                      (is_RV32F_or_RV64F tt)
                                                       : M (bool)
                                                    else returnm false)
                                                    : M (bool))
                                                   (returnm ((andb
                                                                (eq_vec
                                                                   (subrange_vec_dec v__354 26 25)
                                                                   ('b"00"
                                                                    : mword (26 - 25 + 1)))
                                                                (eq_vec
                                                                   (subrange_vec_dec v__354 6 0)
                                                                   ('b"1001011"
                                                                    : mword (6 - 0 + 1))))
                                                     : bool))) >>= fun w__40 : bool =>
                                                (if sumbool_of_bool w__40 then
                                                   let _mappingpatterns_25_ : mword 3 :=
                                                     subrange_vec_dec v__354 14 12 in
                                                   (encdec_rounding_mode_backwards
                                                      _mappingpatterns_25_) >>= fun rm =>
                                                   returnm true
                                                 else
                                                   (and_boolM
                                                      (let _mappingpatterns_26_ : mword 3 :=
                                                        subrange_vec_dec v__354 14 12 in
                                                      (if encdec_rounding_mode_backwards_matches
                                                            _mappingpatterns_26_ then
                                                         (encdec_rounding_mode_backwards
                                                            _mappingpatterns_26_) >>= fun rm =>
                                                         (is_RV32F_or_RV64F tt)
                                                          : M (bool)
                                                       else returnm false)
                                                       : M (bool))
                                                      (returnm ((andb
                                                                   (eq_vec
                                                                      (subrange_vec_dec v__354 26 25)
                                                                      ('b"00"
                                                                       : mword (26 - 25 + 1)))
                                                                   (eq_vec
                                                                      (subrange_vec_dec v__354 6 0)
                                                                      ('b"1001111"
                                                                       : mword (6 - 0 + 1))))
                                                        : bool))) >>= fun w__43 : bool =>
                                                   (if sumbool_of_bool w__43 then
                                                      let _mappingpatterns_26_ : mword 3 :=
                                                        subrange_vec_dec v__354 14 12 in
                                                      (encdec_rounding_mode_backwards
                                                         _mappingpatterns_26_) >>= fun rm =>
                                                      returnm true
                                                    else
                                                      (and_boolM
                                                         (let _mappingpatterns_27_ : mword 3 :=
                                                           subrange_vec_dec v__354 14 12 in
                                                         (if encdec_rounding_mode_backwards_matches
                                                               _mappingpatterns_27_ then
                                                            (encdec_rounding_mode_backwards
                                                               _mappingpatterns_27_) >>= fun rm =>
                                                            (is_RV32F_or_RV64F tt)
                                                             : M (bool)
                                                          else returnm false)
                                                          : M (bool))
                                                         (returnm ((andb
                                                                      (eq_vec
                                                                         (subrange_vec_dec v__354 31
                                                                            25)
                                                                         ('b"0000000"
                                                                          : mword (31 - 25 + 1)))
                                                                      (eq_vec
                                                                         (subrange_vec_dec v__354 6
                                                                            0)
                                                                         ('b"1010011"
                                                                          : mword (6 - 0 + 1))))
                                                           : bool))) >>= fun w__46 : bool =>
                                                      (if sumbool_of_bool w__46 then
                                                         let _mappingpatterns_27_ : mword 3 :=
                                                           subrange_vec_dec v__354 14 12 in
                                                         (encdec_rounding_mode_backwards
                                                            _mappingpatterns_27_) >>= fun rm =>
                                                         returnm true
                                                       else
                                                         (and_boolM
                                                            (let _mappingpatterns_28_ : mword 3 :=
                                                              subrange_vec_dec v__354 14 12 in
                                                            (if encdec_rounding_mode_backwards_matches
                                                                  _mappingpatterns_28_ then
                                                               (encdec_rounding_mode_backwards
                                                                  _mappingpatterns_28_) >>= fun rm =>
                                                               (is_RV32F_or_RV64F tt)
                                                                : M (bool)
                                                             else returnm false)
                                                             : M (bool))
                                                            (returnm ((andb
                                                                         (eq_vec
                                                                            (subrange_vec_dec v__354
                                                                               31 25)
                                                                            ('b"0000100"
                                                                             : mword (31 - 25 + 1)))
                                                                         (eq_vec
                                                                            (subrange_vec_dec v__354
                                                                               6 0)
                                                                            ('b"1010011"
                                                                             : mword (6 - 0 + 1))))
                                                              : bool))) >>= fun w__49 : bool =>
                                                         (if sumbool_of_bool w__49 then
                                                            let _mappingpatterns_28_ : mword 3 :=
                                                              subrange_vec_dec v__354 14 12 in
                                                            (encdec_rounding_mode_backwards
                                                               _mappingpatterns_28_) >>= fun rm =>
                                                            returnm true
                                                          else
                                                            (and_boolM
                                                               (let _mappingpatterns_29_ : mword 3 :=
                                                                 subrange_vec_dec v__354 14 12 in
                                                               (if encdec_rounding_mode_backwards_matches
                                                                     _mappingpatterns_29_ then
                                                                  (encdec_rounding_mode_backwards
                                                                     _mappingpatterns_29_) >>= fun rm =>
                                                                  (is_RV32F_or_RV64F tt)
                                                                   : M (bool)
                                                                else returnm false)
                                                                : M (bool))
                                                               (returnm ((andb
                                                                            (eq_vec
                                                                               (subrange_vec_dec
                                                                                  v__354 31 25)
                                                                               ('b"0001000"
                                                                                : mword (31 - 25 + 1)))
                                                                            (eq_vec
                                                                               (subrange_vec_dec
                                                                                  v__354 6 0)
                                                                               ('b"1010011"
                                                                                : mword (6 - 0 + 1))))
                                                                 : bool))) >>= fun w__52 : bool =>
                                                            (if sumbool_of_bool w__52 then
                                                               let _mappingpatterns_29_ : mword 3 :=
                                                                 subrange_vec_dec v__354 14 12 in
                                                               (encdec_rounding_mode_backwards
                                                                  _mappingpatterns_29_) >>= fun rm =>
                                                               returnm true
                                                             else
                                                               (and_boolM
                                                                  (let _mappingpatterns_30_ : mword 3 :=
                                                                    subrange_vec_dec v__354 14 12 in
                                                                  (if encdec_rounding_mode_backwards_matches
                                                                        _mappingpatterns_30_ then
                                                                     (encdec_rounding_mode_backwards
                                                                        _mappingpatterns_30_) >>= fun rm =>
                                                                     (is_RV32F_or_RV64F tt)
                                                                      : M (bool)
                                                                   else returnm false)
                                                                   : M (bool))
                                                                  (returnm ((andb
                                                                               (eq_vec
                                                                                  (subrange_vec_dec
                                                                                     v__354 31 25)
                                                                                  ('b"0001100"
                                                                                   : mword (31 - 25 + 1)))
                                                                               (eq_vec
                                                                                  (subrange_vec_dec
                                                                                     v__354 6 0)
                                                                                  ('b"1010011"
                                                                                   : mword (6 - 0 + 1))))
                                                                    : bool))) >>= fun w__55 : bool =>
                                                               (if sumbool_of_bool w__55 then
                                                                  let _mappingpatterns_30_ : mword 3 :=
                                                                    subrange_vec_dec v__354 14 12 in
                                                                  (encdec_rounding_mode_backwards
                                                                     _mappingpatterns_30_) >>= fun rm =>
                                                                  returnm true
                                                                else
                                                                  (and_boolM
                                                                     (let _mappingpatterns_31_ : mword 3 :=
                                                                       subrange_vec_dec v__354 14 12 in
                                                                     (if encdec_rounding_mode_backwards_matches
                                                                           _mappingpatterns_31_ then
                                                                        (encdec_rounding_mode_backwards
                                                                           _mappingpatterns_31_) >>= fun rm =>
                                                                        (is_RV32F_or_RV64F tt)
                                                                         : M (bool)
                                                                      else returnm false)
                                                                      : M (bool))
                                                                     (returnm ((andb
                                                                                  (eq_vec
                                                                                     (subrange_vec_dec
                                                                                        v__354 31 20)
                                                                                     (Ox"580"
                                                                                      : mword (31 - 20 + 1)))
                                                                                  (eq_vec
                                                                                     (subrange_vec_dec
                                                                                        v__354 6 0)
                                                                                     ('b"1010011"
                                                                                      : mword (6 - 0 + 1))))
                                                                       : bool))) >>= fun w__58 : bool =>
                                                                  (if sumbool_of_bool w__58 then
                                                                     let _mappingpatterns_31_ : mword 3 :=
                                                                       subrange_vec_dec v__354 14 12 in
                                                                     (encdec_rounding_mode_backwards
                                                                        _mappingpatterns_31_) >>= fun rm =>
                                                                     returnm true
                                                                   else
                                                                     (and_boolM
                                                                        (let _mappingpatterns_32_ : mword 3 :=
                                                                          subrange_vec_dec v__354 14
                                                                            12 in
                                                                        (if encdec_rounding_mode_backwards_matches
                                                                              _mappingpatterns_32_
                                                                         then
                                                                           (encdec_rounding_mode_backwards
                                                                              _mappingpatterns_32_) >>= fun rm =>
                                                                           (is_RV32F_or_RV64F tt)
                                                                            : M (bool)
                                                                         else returnm false)
                                                                         : M (bool))
                                                                        (returnm ((andb
                                                                                     (eq_vec
                                                                                        (subrange_vec_dec
                                                                                           v__354 31
                                                                                           20)
                                                                                        (Ox"C00"
                                                                                         : mword (31 - 20 + 1)))
                                                                                     (eq_vec
                                                                                        (subrange_vec_dec
                                                                                           v__354 6
                                                                                           0)
                                                                                        ('b"1010011"
                                                                                         : mword (6 - 0 + 1))))
                                                                          : bool))) >>= fun w__61 : bool =>
                                                                     (if sumbool_of_bool w__61 then
                                                                        let _mappingpatterns_32_ : mword 3 :=
                                                                          subrange_vec_dec v__354 14
                                                                            12 in
                                                                        (encdec_rounding_mode_backwards
                                                                           _mappingpatterns_32_) >>= fun rm =>
                                                                        returnm true
                                                                      else
                                                                        (and_boolM
                                                                           (let _mappingpatterns_33_ : mword 3 :=
                                                                             subrange_vec_dec v__354
                                                                               14 12 in
                                                                           (if encdec_rounding_mode_backwards_matches
                                                                                 _mappingpatterns_33_
                                                                            then
                                                                              (encdec_rounding_mode_backwards
                                                                                 _mappingpatterns_33_) >>= fun rm =>
                                                                              (is_RV32F_or_RV64F tt)
                                                                               : M (bool)
                                                                            else returnm false)
                                                                            : M (bool))
                                                                           (returnm ((andb
                                                                                        (eq_vec
                                                                                           (subrange_vec_dec
                                                                                              v__354
                                                                                              31 20)
                                                                                           (Ox"C01"
                                                                                            : mword (31 - 20 + 1)))
                                                                                        (eq_vec
                                                                                           (subrange_vec_dec
                                                                                              v__354
                                                                                              6 0)
                                                                                           ('b"1010011"
                                                                                            : mword (6 - 0 + 1))))
                                                                             : bool))) >>= fun w__64 : bool =>
                                                                        (if sumbool_of_bool
                                                                           w__64 then
                                                                           let _mappingpatterns_33_ : mword 3 :=
                                                                             subrange_vec_dec v__354
                                                                               14 12 in
                                                                           (encdec_rounding_mode_backwards
                                                                              _mappingpatterns_33_) >>= fun rm =>
                                                                           returnm true
                                                                         else
                                                                           (and_boolM
                                                                              (let _mappingpatterns_34_ : mword 3 :=
                                                                                subrange_vec_dec
                                                                                  v__354 14 12 in
                                                                              (if encdec_rounding_mode_backwards_matches
                                                                                    _mappingpatterns_34_
                                                                               then
                                                                                 (encdec_rounding_mode_backwards
                                                                                    _mappingpatterns_34_) >>= fun rm =>
                                                                                 (is_RV32F_or_RV64F
                                                                                    tt)
                                                                                  : M (bool)
                                                                               else returnm false)
                                                                               : M (bool))
                                                                              (returnm ((andb
                                                                                           (eq_vec
                                                                                              (subrange_vec_dec
                                                                                                 v__354
                                                                                                 31
                                                                                                 20)
                                                                                              (Ox"D00"
                                                                                               : mword (31 - 20 + 1)))
                                                                                           (eq_vec
                                                                                              (subrange_vec_dec
                                                                                                 v__354
                                                                                                 6 0)
                                                                                              ('b"1010011"
                                                                                               : mword (6 - 0 + 1))))
                                                                                : bool))) >>= fun w__67 : bool =>
                                                                           (if sumbool_of_bool
                                                                              w__67 then
                                                                              let _mappingpatterns_34_ : mword 3 :=
                                                                                subrange_vec_dec
                                                                                  v__354 14 12 in
                                                                              (encdec_rounding_mode_backwards
                                                                                 _mappingpatterns_34_) >>= fun rm =>
                                                                              returnm true
                                                                            else
                                                                              (and_boolM
                                                                                 (let _mappingpatterns_35_ : mword 3 :=
                                                                                   subrange_vec_dec
                                                                                     v__354 14 12 in
                                                                                 (if encdec_rounding_mode_backwards_matches
                                                                                       _mappingpatterns_35_
                                                                                  then
                                                                                    (encdec_rounding_mode_backwards
                                                                                       _mappingpatterns_35_) >>= fun rm =>
                                                                                    (is_RV32F_or_RV64F
                                                                                       tt)
                                                                                     : M (bool)
                                                                                  else returnm false)
                                                                                  : M (bool))
                                                                                 (returnm ((andb
                                                                                              (eq_vec
                                                                                                 (subrange_vec_dec
                                                                                                    v__354
                                                                                                    31
                                                                                                    20)
                                                                                                 (Ox"D01"
                                                                                                  : mword (31 - 20 + 1)))
                                                                                              (eq_vec
                                                                                                 (subrange_vec_dec
                                                                                                    v__354
                                                                                                    6
                                                                                                    0)
                                                                                                 ('b"1010011"
                                                                                                  : mword (6 - 0 + 1))))
                                                                                   : bool))) >>= fun w__70 : bool =>
                                                                              (if sumbool_of_bool
                                                                                 w__70 then
                                                                                 let _mappingpatterns_35_ : mword 3 :=
                                                                                   subrange_vec_dec
                                                                                     v__354 14 12 in
                                                                                 (encdec_rounding_mode_backwards
                                                                                    _mappingpatterns_35_) >>= fun rm =>
                                                                                 returnm true
                                                                               else
                                                                                 (and_boolM
                                                                                    (let _mappingpatterns_36_ : mword 3 :=
                                                                                      subrange_vec_dec
                                                                                        v__354 14 12 in
                                                                                    (if encdec_rounding_mode_backwards_matches
                                                                                          _mappingpatterns_36_
                                                                                     then
                                                                                       (encdec_rounding_mode_backwards
                                                                                          _mappingpatterns_36_) >>= fun rm =>
                                                                                       (is_RV64F tt)
                                                                                        : M (bool)
                                                                                     else
                                                                                       returnm false)
                                                                                     : M (bool))
                                                                                    (returnm ((andb
                                                                                                 (eq_vec
                                                                                                    (subrange_vec_dec
                                                                                                       v__354
                                                                                                       31
                                                                                                       20)
                                                                                                    (Ox"C02"
                                                                                                     : mword (31 - 20 + 1)))
                                                                                                 (eq_vec
                                                                                                    (subrange_vec_dec
                                                                                                       v__354
                                                                                                       6
                                                                                                       0)
                                                                                                    ('b"1010011"
                                                                                                     : mword (6 - 0 + 1))))
                                                                                      : bool))) >>= fun w__73 : bool =>
                                                                                 (if sumbool_of_bool
                                                                                    w__73 then
                                                                                    let _mappingpatterns_36_ : mword 3 :=
                                                                                      subrange_vec_dec
                                                                                        v__354 14 12 in
                                                                                    (encdec_rounding_mode_backwards
                                                                                       _mappingpatterns_36_) >>= fun rm =>
                                                                                    returnm true
                                                                                  else
                                                                                    (and_boolM
                                                                                       (let _mappingpatterns_37_ : mword 3 :=
                                                                                         subrange_vec_dec
                                                                                           v__354 14
                                                                                           12 in
                                                                                       (if encdec_rounding_mode_backwards_matches
                                                                                             _mappingpatterns_37_
                                                                                        then
                                                                                          (encdec_rounding_mode_backwards
                                                                                             _mappingpatterns_37_) >>= fun rm =>
                                                                                          (is_RV64F
                                                                                             tt)
                                                                                           : M (bool)
                                                                                        else
                                                                                          returnm false)
                                                                                        : M (bool))
                                                                                       (returnm ((andb
                                                                                                    (eq_vec
                                                                                                       (subrange_vec_dec
                                                                                                          v__354
                                                                                                          31
                                                                                                          20)
                                                                                                       (Ox"C03"
                                                                                                        : mword (31 - 20 + 1)))
                                                                                                    (eq_vec
                                                                                                       (subrange_vec_dec
                                                                                                          v__354
                                                                                                          6
                                                                                                          0)
                                                                                                       ('b"1010011"
                                                                                                        : mword (6 - 0 + 1))))
                                                                                         : bool))) >>= fun w__76 : bool =>
                                                                                    (if sumbool_of_bool
                                                                                       w__76 then
                                                                                       let _mappingpatterns_37_ : mword 3 :=
                                                                                         subrange_vec_dec
                                                                                           v__354 14
                                                                                           12 in
                                                                                       (encdec_rounding_mode_backwards
                                                                                          _mappingpatterns_37_) >>= fun rm =>
                                                                                       returnm true
                                                                                     else
                                                                                       (and_boolM
                                                                                          (let _mappingpatterns_38_ : mword 3 :=
                                                                                            subrange_vec_dec
                                                                                              v__354
                                                                                              14 12 in
                                                                                          (if encdec_rounding_mode_backwards_matches
                                                                                                _mappingpatterns_38_
                                                                                           then
                                                                                             (encdec_rounding_mode_backwards
                                                                                                _mappingpatterns_38_) >>= fun rm =>
                                                                                             (is_RV64F
                                                                                                tt)
                                                                                              : M (bool)
                                                                                           else
                                                                                             returnm false)
                                                                                           : M (bool))
                                                                                          (returnm ((andb
                                                                                                       (eq_vec
                                                                                                          (subrange_vec_dec
                                                                                                             v__354
                                                                                                             31
                                                                                                             20)
                                                                                                          (Ox"D02"
                                                                                                           : mword (31 - 20 + 1)))
                                                                                                       (eq_vec
                                                                                                          (subrange_vec_dec
                                                                                                             v__354
                                                                                                             6
                                                                                                             0)
                                                                                                          ('b"1010011"
                                                                                                           : mword (6 - 0 + 1))))
                                                                                            : bool))) >>= fun w__79 : bool =>
                                                                                       (if sumbool_of_bool
                                                                                          w__79 then
                                                                                          let _mappingpatterns_38_ : mword 3 :=
                                                                                            subrange_vec_dec
                                                                                              v__354
                                                                                              14 12 in
                                                                                          (encdec_rounding_mode_backwards
                                                                                             _mappingpatterns_38_) >>= fun rm =>
                                                                                          returnm true
                                                                                        else
                                                                                          (and_boolM
                                                                                             (let _mappingpatterns_39_ : mword 3 :=
                                                                                               subrange_vec_dec
                                                                                                 v__354
                                                                                                 14
                                                                                                 12 in
                                                                                             (if encdec_rounding_mode_backwards_matches
                                                                                                   _mappingpatterns_39_
                                                                                              then
                                                                                                (encdec_rounding_mode_backwards
                                                                                                   _mappingpatterns_39_) >>= fun rm =>
                                                                                                (is_RV64F
                                                                                                   tt)
                                                                                                 : M (bool)
                                                                                              else
                                                                                                returnm false)
                                                                                              : M (bool))
                                                                                             (returnm ((andb
                                                                                                          (eq_vec
                                                                                                             (subrange_vec_dec
                                                                                                                v__354
                                                                                                                31
                                                                                                                20)
                                                                                                             (Ox"D03"
                                                                                                              : mword (31 - 20 + 1)))
                                                                                                          (eq_vec
                                                                                                             (subrange_vec_dec
                                                                                                                v__354
                                                                                                                6
                                                                                                                0)
                                                                                                             ('b"1010011"
                                                                                                              : mword (6 - 0 + 1))))
                                                                                               : bool))) >>= fun w__82 : bool =>
                                                                                          (if sumbool_of_bool
                                                                                             w__82
                                                                                           then
                                                                                             let _mappingpatterns_39_ : mword 3 :=
                                                                                               subrange_vec_dec
                                                                                                 v__354
                                                                                                 14
                                                                                                 12 in
                                                                                             (encdec_rounding_mode_backwards
                                                                                                _mappingpatterns_39_) >>= fun rm =>
                                                                                             returnm true
                                                                                           else
                                                                                             (and_boolM
                                                                                                ((is_RV32F_or_RV64F
                                                                                                    tt)
                                                                                                 : M (bool))
                                                                                                (returnm ((andb
                                                                                                             (eq_vec
                                                                                                                (subrange_vec_dec
                                                                                                                   v__354
                                                                                                                   31
                                                                                                                   25)
                                                                                                                ('b"0010000"
                                                                                                                 : mword (31 - 25 + 1)))
                                                                                                             (andb
                                                                                                                (eq_vec
                                                                                                                   (subrange_vec_dec
                                                                                                                      v__354
                                                                                                                      14
                                                                                                                      12)
                                                                                                                   ('b"000"
                                                                                                                    : mword (14 - 12 + 1)))
                                                                                                                (eq_vec
                                                                                                                   (subrange_vec_dec
                                                                                                                      v__354
                                                                                                                      6
                                                                                                                      0)
                                                                                                                   ('b"1010011"
                                                                                                                    : mword (6 - 0 + 1)))))
                                                                                                  : bool))) >>= fun w__84 : bool =>
                                                                                             (if sumbool_of_bool
                                                                                                w__84
                                                                                              then
                                                                                                returnm true
                                                                                              else
                                                                                                (and_boolM
                                                                                                   ((is_RV32F_or_RV64F
                                                                                                       tt)
                                                                                                    : M (bool))
                                                                                                   (returnm ((andb
                                                                                                                (eq_vec
                                                                                                                   (subrange_vec_dec
                                                                                                                      v__354
                                                                                                                      31
                                                                                                                      25)
                                                                                                                   ('b"0010000"
                                                                                                                    : mword (31 - 25 + 1)))
                                                                                                                (andb
                                                                                                                   (eq_vec
                                                                                                                      (subrange_vec_dec
                                                                                                                         v__354
                                                                                                                         14
                                                                                                                         12)
                                                                                                                      ('b"001"
                                                                                                                       : mword (14 - 12 + 1)))
                                                                                                                   (eq_vec
                                                                                                                      (subrange_vec_dec
                                                                                                                         v__354
                                                                                                                         6
                                                                                                                         0)
                                                                                                                      ('b"1010011"
                                                                                                                       : mword (6 - 0 + 1)))))
                                                                                                     : bool))) >>= fun w__86 : bool =>
                                                                                                (if sumbool_of_bool
                                                                                                   w__86
                                                                                                 then
                                                                                                   returnm true
                                                                                                 else
                                                                                                   (and_boolM
                                                                                                      ((is_RV32F_or_RV64F
                                                                                                          tt)
                                                                                                       : M (bool))
                                                                                                      (returnm ((andb
                                                                                                                   (eq_vec
                                                                                                                      (subrange_vec_dec
                                                                                                                         v__354
                                                                                                                         31
                                                                                                                         25)
                                                                                                                      ('b"0010000"
                                                                                                                       : mword (31 - 25 + 1)))
                                                                                                                   (andb
                                                                                                                      (eq_vec
                                                                                                                         (subrange_vec_dec
                                                                                                                            v__354
                                                                                                                            14
                                                                                                                            12)
                                                                                                                         ('b"010"
                                                                                                                          : mword (14 - 12 + 1)))
                                                                                                                      (eq_vec
                                                                                                                         (subrange_vec_dec
                                                                                                                            v__354
                                                                                                                            6
                                                                                                                            0)
                                                                                                                         ('b"1010011"
                                                                                                                          : mword (6 - 0 + 1)))))
                                                                                                        : bool))) >>= fun w__88 : bool =>
                                                                                                   (if
                                                                                                      sumbool_of_bool
                                                                                                      w__88
                                                                                                    then
                                                                                                      returnm true
                                                                                                    else
                                                                                                      (and_boolM
                                                                                                         ((is_RV32F_or_RV64F
                                                                                                             tt)
                                                                                                          : M (bool))
                                                                                                         (returnm ((andb
                                                                                                                      (eq_vec
                                                                                                                         (subrange_vec_dec
                                                                                                                            v__354
                                                                                                                            31
                                                                                                                            25)
                                                                                                                         ('b"0010100"
                                                                                                                          : mword (31 - 25 + 1)))
                                                                                                                      (andb
                                                                                                                         (eq_vec
                                                                                                                            (subrange_vec_dec
                                                                                                                               v__354
                                                                                                                               14
                                                                                                                               12)
                                                                                                                            ('b"000"
                                                                                                                             : mword (14 - 12 + 1)))
                                                                                                                         (eq_vec
                                                                                                                            (subrange_vec_dec
                                                                                                                               v__354
                                                                                                                               6
                                                                                                                               0)
                                                                                                                            ('b"1010011"
                                                                                                                             : mword (6 - 0 + 1)))))
                                                                                                           : bool))) >>= fun w__90 : bool =>
                                                                                                      (if
                                                                                                         sumbool_of_bool
                                                                                                         w__90
                                                                                                       then
                                                                                                         returnm true
                                                                                                       else
                                                                                                         (and_boolM
                                                                                                            ((is_RV32F_or_RV64F
                                                                                                                tt)
                                                                                                             : M (bool))
                                                                                                            (returnm ((andb
                                                                                                                         (eq_vec
                                                                                                                            (subrange_vec_dec
                                                                                                                               v__354
                                                                                                                               31
                                                                                                                               25)
                                                                                                                            ('b"0010100"
                                                                                                                             : mword (31 - 25 + 1)))
                                                                                                                         (andb
                                                                                                                            (eq_vec
                                                                                                                               (subrange_vec_dec
                                                                                                                                  v__354
                                                                                                                                  14
                                                                                                                                  12)
                                                                                                                               ('b"001"
                                                                                                                                : mword (14 - 12 + 1)))
                                                                                                                            (eq_vec
                                                                                                                               (subrange_vec_dec
                                                                                                                                  v__354
                                                                                                                                  6
                                                                                                                                  0)
                                                                                                                               ('b"1010011"
                                                                                                                                : mword (6 - 0 + 1)))))
                                                                                                              : bool))) >>= fun w__92 : bool =>
                                                                                                         (if
                                                                                                            sumbool_of_bool
                                                                                                            w__92
                                                                                                          then
                                                                                                            returnm true
                                                                                                          else
                                                                                                            (and_boolM
                                                                                                               ((is_RV32F_or_RV64F
                                                                                                                   tt)
                                                                                                                : M (bool))
                                                                                                               (returnm ((andb
                                                                                                                            (eq_vec
                                                                                                                               (subrange_vec_dec
                                                                                                                                  v__354
                                                                                                                                  31
                                                                                                                                  25)
                                                                                                                               ('b"1010000"
                                                                                                                                : mword (31 - 25 + 1)))
                                                                                                                            (andb
                                                                                                                               (eq_vec
                                                                                                                                  (subrange_vec_dec
                                                                                                                                     v__354
                                                                                                                                     14
                                                                                                                                     12)
                                                                                                                                  ('b"010"
                                                                                                                                   : mword (14 - 12 + 1)))
                                                                                                                               (eq_vec
                                                                                                                                  (subrange_vec_dec
                                                                                                                                     v__354
                                                                                                                                     6
                                                                                                                                     0)
                                                                                                                                  ('b"1010011"
                                                                                                                                   : mword (6 - 0 + 1)))))
                                                                                                                 : bool))) >>= fun w__94 : bool =>
                                                                                                            (if
                                                                                                               sumbool_of_bool
                                                                                                               w__94
                                                                                                             then
                                                                                                               returnm true
                                                                                                             else
                                                                                                               (and_boolM
                                                                                                                  ((is_RV32F_or_RV64F
                                                                                                                      tt)
                                                                                                                   : M (bool))
                                                                                                                  (returnm ((andb
                                                                                                                               (eq_vec
                                                                                                                                  (subrange_vec_dec
                                                                                                                                     v__354
                                                                                                                                     31
                                                                                                                                     25)
                                                                                                                                  ('b"1010000"
                                                                                                                                   : mword (31 - 25 + 1)))
                                                                                                                               (andb
                                                                                                                                  (eq_vec
                                                                                                                                     (subrange_vec_dec
                                                                                                                                        v__354
                                                                                                                                        14
                                                                                                                                        12)
                                                                                                                                     ('b"001"
                                                                                                                                      : mword (14 - 12 + 1)))
                                                                                                                                  (eq_vec
                                                                                                                                     (subrange_vec_dec
                                                                                                                                        v__354
                                                                                                                                        6
                                                                                                                                        0)
                                                                                                                                     ('b"1010011"
                                                                                                                                      : mword (6 - 0 + 1)))))
                                                                                                                    : bool))) >>= fun w__96 : bool =>
                                                                                                               (if
                                                                                                                  sumbool_of_bool
                                                                                                                  w__96
                                                                                                                then
                                                                                                                  returnm true
                                                                                                                else
                                                                                                                  (and_boolM
                                                                                                                     ((is_RV32F_or_RV64F
                                                                                                                         tt)
                                                                                                                      : M (bool))
                                                                                                                     (returnm ((andb
                                                                                                                                  (eq_vec
                                                                                                                                     (subrange_vec_dec
                                                                                                                                        v__354
                                                                                                                                        31
                                                                                                                                        25)
                                                                                                                                     ('b"1010000"
                                                                                                                                      : mword (31 - 25 + 1)))
                                                                                                                                  (andb
                                                                                                                                     (eq_vec
                                                                                                                                        (subrange_vec_dec
                                                                                                                                           v__354
                                                                                                                                           14
                                                                                                                                           12)
                                                                                                                                        ('b"000"
                                                                                                                                         : mword (14 - 12 + 1)))
                                                                                                                                     (eq_vec
                                                                                                                                        (subrange_vec_dec
                                                                                                                                           v__354
                                                                                                                                           6
                                                                                                                                           0)
                                                                                                                                        ('b"1010011"
                                                                                                                                         : mword (6 - 0 + 1)))))
                                                                                                                       : bool))) >>= fun w__98 : bool =>
                                                                                                                  (if
                                                                                                                     sumbool_of_bool
                                                                                                                     w__98
                                                                                                                   then
                                                                                                                     returnm true
                                                                                                                   else
                                                                                                                     (and_boolM
                                                                                                                        ((haveFExt
                                                                                                                            tt)
                                                                                                                         : M (bool))
                                                                                                                        (returnm ((andb
                                                                                                                                     (eq_vec
                                                                                                                                        (subrange_vec_dec
                                                                                                                                           v__354
                                                                                                                                           31
                                                                                                                                           20)
                                                                                                                                        (Ox"E00"
                                                                                                                                         : mword (31 - 20 + 1)))
                                                                                                                                     (andb
                                                                                                                                        (eq_vec
                                                                                                                                           (subrange_vec_dec
                                                                                                                                              v__354
                                                                                                                                              14
                                                                                                                                              12)
                                                                                                                                           ('b"001"
                                                                                                                                            : mword (14 - 12 + 1)))
                                                                                                                                        (eq_vec
                                                                                                                                           (subrange_vec_dec
                                                                                                                                              v__354
                                                                                                                                              6
                                                                                                                                              0)
                                                                                                                                           ('b"1010011"
                                                                                                                                            : mword (6 - 0 + 1)))))
                                                                                                                          : bool))) >>= fun w__100 : bool =>
                                                                                                                     (if
                                                                                                                        sumbool_of_bool
                                                                                                                        w__100
                                                                                                                      then
                                                                                                                        returnm true
                                                                                                                      else
                                                                                                                        (and_boolM
                                                                                                                           ((haveFExt
                                                                                                                               tt)
                                                                                                                            : M (bool))
                                                                                                                           (returnm ((andb
                                                                                                                                        (eq_vec
                                                                                                                                           (subrange_vec_dec
                                                                                                                                              v__354
                                                                                                                                              31
                                                                                                                                              20)
                                                                                                                                           (Ox"E00"
                                                                                                                                            : mword (31 - 20 + 1)))
                                                                                                                                        (andb
                                                                                                                                           (eq_vec
                                                                                                                                              (subrange_vec_dec
                                                                                                                                                 v__354
                                                                                                                                                 14
                                                                                                                                                 12)
                                                                                                                                              ('b"000"
                                                                                                                                               : mword (14 - 12 + 1)))
                                                                                                                                           (eq_vec
                                                                                                                                              (subrange_vec_dec
                                                                                                                                                 v__354
                                                                                                                                                 6
                                                                                                                                                 0)
                                                                                                                                              ('b"1010011"
                                                                                                                                               : mword (6 - 0 + 1)))))
                                                                                                                             : bool))) >>= fun w__102 : bool =>
                                                                                                                        (if
                                                                                                                           sumbool_of_bool
                                                                                                                           w__102
                                                                                                                         then
                                                                                                                           returnm true
                                                                                                                         else
                                                                                                                           (and_boolM
                                                                                                                              ((haveFExt
                                                                                                                                  tt)
                                                                                                                               : M (bool))
                                                                                                                              (returnm ((andb
                                                                                                                                           (eq_vec
                                                                                                                                              (subrange_vec_dec
                                                                                                                                                 v__354
                                                                                                                                                 31
                                                                                                                                                 20)
                                                                                                                                              (Ox"F00"
                                                                                                                                               : mword (31 - 20 + 1)))
                                                                                                                                           (andb
                                                                                                                                              (eq_vec
                                                                                                                                                 (subrange_vec_dec
                                                                                                                                                    v__354
                                                                                                                                                    14
                                                                                                                                                    12)
                                                                                                                                                 ('b"000"
                                                                                                                                                  : mword (14 - 12 + 1)))
                                                                                                                                              (eq_vec
                                                                                                                                                 (subrange_vec_dec
                                                                                                                                                    v__354
                                                                                                                                                    6
                                                                                                                                                    0)
                                                                                                                                                 ('b"1010011"
                                                                                                                                                  : mword (6 - 0 + 1)))))
                                                                                                                                : bool))) >>= fun w__104 : bool =>
                                                                                                                           returnm (if
                                                                                                                                      sumbool_of_bool
                                                                                                                                      w__104
                                                                                                                                    then
                                                                                                                                      true
                                                                                                                                    else
                                                                                                                                      true))
                                                                                                                         : M (bool))
                                                                                                                      : M (bool))
                                                                                                                   : M (bool))
                                                                                                                : M (bool))
                                                                                                             : M (bool))
                                                                                                          : M (bool))
                                                                                                       : M (bool))
                                                                                                    : M (bool))
                                                                                                 : M (bool))
                                                                                              : M (bool))
                                                                                           : M (bool))
                                                                                        : M (bool))
                                                                                     : M (bool))
                                                                                  : M (bool))
                                                                               : M (bool))
                                                                            : M (bool))
                                                                         : M (bool))
                                                                      : M (bool))
                                                                   : M (bool))
                                                                : M (bool))
                                                             : M (bool))
                                                          : M (bool))
                                                       : M (bool))
                                                    : M (bool))
                                                 : M (bool))
                                              : M (bool))
                                           : M (bool))
                                        : M (bool))
                                     : M (bool))
                                  : M (bool))
                               : M (bool))
                            : M (bool))
                         : M (bool))
                      : M (bool))
                   : M (bool))
                : M (bool))
             : M (bool))
          : M (bool))
       : M (bool))
    : M (bool).

Definition encdec_compressed_forwards (arg_ : ast) : M (mword 16) :=
   (match arg_ with
    | C_NOP tt =>
       returnm (concat_vec ('b"000"  : mword 3)
                  (concat_vec ('b"0"  : mword 1)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec ('b"00000"  : mword 5) ('b"01"  : mword 2)))))
    | C_ADDI4SPN (rd, v__692) =>
       (if let nz96 : bits 4 := subrange_vec_dec v__692 7 4 in
          let nz96 : bits 4 := subrange_vec_dec v__692 7 4 in
          let nz54 : bits 2 := subrange_vec_dec v__692 3 2 in
          let nz3 : bits 1 := subrange_vec_dec v__692 1 1 in
          let nz2 : bits 1 := subrange_vec_dec v__692 0 0 in
          neq_vec (concat_vec nz96 (concat_vec nz54 (concat_vec nz3 nz2)))
            (Ox"00"
             : mword (4 + (2 + (1 + 1)))) then
          let nz96 : bits 4 := subrange_vec_dec v__692 7 4 in
          let nz96 : bits 4 := subrange_vec_dec v__692 7 4 in
          let nz54 : bits 2 := subrange_vec_dec v__692 3 2 in
          let nz3 : bits 1 := subrange_vec_dec v__692 1 1 in
          let nz2 : bits 1 := subrange_vec_dec v__692 0 0 in
          returnm (concat_vec ('b"000"  : mword 3)
                     (concat_vec (nz54  : bits 2)
                        (concat_vec (nz96  : bits 4)
                           (concat_vec (nz2  : bits 1)
                              (concat_vec (nz3  : bits 1)
                                 (concat_vec (rd  : cregidx) ('b"00"  : mword 2)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_LW (v__693, rs1, rd) =>
       let ui6 : bits 1 := subrange_vec_dec v__693 4 4 in
       let ui6 : bits 1 := subrange_vec_dec v__693 4 4 in
       let ui53 : bits 3 := subrange_vec_dec v__693 3 1 in
       let ui2 : bits 1 := subrange_vec_dec v__693 0 0 in
       returnm (concat_vec ('b"010"  : mword 3)
                  (concat_vec (ui53  : bits 3)
                     (concat_vec (rs1  : cregidx)
                        (concat_vec (ui2  : bits 1)
                           (concat_vec (ui6  : bits 1)
                              (concat_vec (rd  : cregidx) ('b"00"  : mword 2)))))))
    | C_LD (v__694, rs1, rd) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          let ui76 : bits 2 := subrange_vec_dec v__694 4 3 in
          let ui76 : bits 2 := subrange_vec_dec v__694 4 3 in
          let ui53 : bits 3 := subrange_vec_dec v__694 2 0 in
          returnm (concat_vec ('b"011"  : mword 3)
                     (concat_vec (ui53  : bits 3)
                        (concat_vec (rs1  : cregidx)
                           (concat_vec (ui76  : bits 2)
                              (concat_vec (rd  : cregidx) ('b"00"  : mword 2))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_SW (v__695, rs1, rs2) =>
       let ui6 : bits 1 := subrange_vec_dec v__695 4 4 in
       let ui6 : bits 1 := subrange_vec_dec v__695 4 4 in
       let ui53 : bits 3 := subrange_vec_dec v__695 3 1 in
       let ui2 : bits 1 := subrange_vec_dec v__695 0 0 in
       returnm (concat_vec ('b"110"  : mword 3)
                  (concat_vec (ui53  : bits 3)
                     (concat_vec (rs1  : cregidx)
                        (concat_vec (ui2  : bits 1)
                           (concat_vec (ui6  : bits 1)
                              (concat_vec (rs2  : cregidx) ('b"00"  : mword 2)))))))
    | C_SD (v__696, rs1, rs2) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          let ui76 : bits 2 := subrange_vec_dec v__696 4 3 in
          let ui76 : bits 2 := subrange_vec_dec v__696 4 3 in
          let ui53 : bits 3 := subrange_vec_dec v__696 2 0 in
          returnm (concat_vec ('b"111"  : mword 3)
                     (concat_vec (ui53  : bits 3)
                        (concat_vec (rs1  : bits 3)
                           (concat_vec (ui76  : bits 2)
                              (concat_vec (rs2  : bits 3) ('b"00"  : mword 2))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_ADDI (v__697, rsd) =>
       (if let nzi5 : bits 1 := subrange_vec_dec v__697 5 5 in
          let nzi5 : bits 1 := subrange_vec_dec v__697 5 5 in
          let nzi40 : bits 5 := subrange_vec_dec v__697 4 0 in
          andb (neq_vec (concat_vec nzi5 nzi40) ('b"000000"  : mword (1 + 5))) (neq_vec rsd zreg)
        then
          let nzi5 : bits 1 := subrange_vec_dec v__697 5 5 in
          let nzi5 : bits 1 := subrange_vec_dec v__697 5 5 in
          let nzi40 : bits 5 := subrange_vec_dec v__697 4 0 in
          returnm (concat_vec ('b"000"  : mword 3)
                     (concat_vec (nzi5  : bits 1)
                        (concat_vec (rsd  : regidx)
                           (concat_vec (nzi40  : bits 5) ('b"01"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_JAL v__698 =>
       (if sumbool_of_bool (Z.eqb 32 32) then
          let i11 : bits 1 := subrange_vec_dec v__698 10 10 in
          let i98 : bits 2 := subrange_vec_dec v__698 8 7 in
          let i7 : bits 1 := subrange_vec_dec v__698 6 6 in
          let i6 : bits 1 := subrange_vec_dec v__698 5 5 in
          let i5 : bits 1 := subrange_vec_dec v__698 4 4 in
          let i4 : bits 1 := subrange_vec_dec v__698 3 3 in
          let i31 : bits 3 := subrange_vec_dec v__698 2 0 in
          let i11 : bits 1 := subrange_vec_dec v__698 10 10 in
          let i10 : bits 1 := subrange_vec_dec v__698 9 9 in
          returnm (concat_vec ('b"001"  : mword 3)
                     (concat_vec (i11  : bits 1)
                        (concat_vec (i4  : bits 1)
                           (concat_vec (i98  : bits 2)
                              (concat_vec (i10  : bits 1)
                                 (concat_vec (i6  : bits 1)
                                    (concat_vec (i7  : bits 1)
                                       (concat_vec (i31  : bits 3)
                                          (concat_vec (i5  : bits 1) ('b"01"  : mword 2))))))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_ADDIW (v__699, rsd) =>
       (if sumbool_of_bool (andb (neq_vec rsd zreg) (Z.eqb 32 64)) then
          let imm5 : bits 1 := subrange_vec_dec v__699 5 5 in
          let imm5 : bits 1 := subrange_vec_dec v__699 5 5 in
          let imm40 : bits 5 := subrange_vec_dec v__699 4 0 in
          returnm (concat_vec ('b"001"  : mword 3)
                     (concat_vec (imm5  : bits 1)
                        (concat_vec (rsd  : regidx)
                           (concat_vec (imm40  : bits 5) ('b"01"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_LI (v__700, rd) =>
       (if neq_vec rd zreg then
          let imm5 : bits 1 := subrange_vec_dec v__700 5 5 in
          let imm5 : bits 1 := subrange_vec_dec v__700 5 5 in
          let imm40 : bits 5 := subrange_vec_dec v__700 4 0 in
          returnm (concat_vec ('b"010"  : mword 3)
                     (concat_vec (imm5  : bits 1)
                        (concat_vec (rd  : regidx)
                           (concat_vec (imm40  : bits 5) ('b"01"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_ADDI16SP v__701 =>
       (if let nzi9 : bits 1 := subrange_vec_dec v__701 5 5 in
          let nzi9 : bits 1 := subrange_vec_dec v__701 5 5 in
          let nzi87 : bits 2 := subrange_vec_dec v__701 4 3 in
          let nzi6 : bits 1 := subrange_vec_dec v__701 2 2 in
          let nzi5 : bits 1 := subrange_vec_dec v__701 1 1 in
          let nzi4 : bits 1 := subrange_vec_dec v__701 0 0 in
          neq_vec (concat_vec nzi9 (concat_vec nzi87 (concat_vec nzi6 (concat_vec nzi5 nzi4))))
            ('b"000000"
             : mword (1 + (2 + (1 + (1 + 1))))) then
          let nzi9 : bits 1 := subrange_vec_dec v__701 5 5 in
          let nzi9 : bits 1 := subrange_vec_dec v__701 5 5 in
          let nzi87 : bits 2 := subrange_vec_dec v__701 4 3 in
          let nzi6 : bits 1 := subrange_vec_dec v__701 2 2 in
          let nzi5 : bits 1 := subrange_vec_dec v__701 1 1 in
          let nzi4 : bits 1 := subrange_vec_dec v__701 0 0 in
          returnm (concat_vec ('b"011"  : mword 3)
                     (concat_vec (nzi9  : bits 1)
                        (concat_vec ('b"00010"  : mword 5)
                           (concat_vec (nzi4  : bits 1)
                              (concat_vec (nzi6  : bits 1)
                                 (concat_vec (nzi87  : bits 2)
                                    (concat_vec (nzi5  : bits 1) ('b"01"  : mword 2))))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_LUI (v__702, rd) =>
       (if let imm17 : bits 1 := subrange_vec_dec v__702 5 5 in
          let imm17 : bits 1 := subrange_vec_dec v__702 5 5 in
          let imm1612 : bits 5 := subrange_vec_dec v__702 4 0 in
          andb (neq_vec rd zreg)
            (andb (neq_vec rd sp) (neq_vec (concat_vec imm17 imm1612) ('b"000000"  : mword (1 + 5))))
        then
          let imm17 : bits 1 := subrange_vec_dec v__702 5 5 in
          let imm17 : bits 1 := subrange_vec_dec v__702 5 5 in
          let imm1612 : bits 5 := subrange_vec_dec v__702 4 0 in
          returnm (concat_vec ('b"011"  : mword 3)
                     (concat_vec (imm17  : bits 1)
                        (concat_vec (rd  : regidx)
                           (concat_vec (imm1612  : bits 5) ('b"01"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_SRLI (v__703, rsd) =>
       (if let nzui5 : bits 1 := subrange_vec_dec v__703 5 5 in
          let nzui5 : bits 1 := subrange_vec_dec v__703 5 5 in
          let nzui40 : bits 5 := subrange_vec_dec v__703 4 0 in
          neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)) then
          let nzui5 : bits 1 := subrange_vec_dec v__703 5 5 in
          let nzui5 : bits 1 := subrange_vec_dec v__703 5 5 in
          let nzui40 : bits 5 := subrange_vec_dec v__703 4 0 in
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec (nzui5  : bits 1)
                        (concat_vec ('b"00"  : mword 2)
                           (concat_vec (rsd  : cregidx)
                              (concat_vec (nzui40  : bits 5) ('b"01"  : mword 2))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_SRAI (v__704, rsd) =>
       (if let nzui5 : bits 1 := subrange_vec_dec v__704 5 5 in
          let nzui5 : bits 1 := subrange_vec_dec v__704 5 5 in
          let nzui40 : bits 5 := subrange_vec_dec v__704 4 0 in
          neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)) then
          let nzui5 : bits 1 := subrange_vec_dec v__704 5 5 in
          let nzui5 : bits 1 := subrange_vec_dec v__704 5 5 in
          let nzui40 : bits 5 := subrange_vec_dec v__704 4 0 in
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec (nzui5  : bits 1)
                        (concat_vec ('b"01"  : mword 2)
                           (concat_vec (rsd  : cregidx)
                              (concat_vec (nzui40  : bits 5) ('b"01"  : mword 2))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_ANDI (v__705, rsd) =>
       let i5 : bits 1 := subrange_vec_dec v__705 5 5 in
       let i5 : bits 1 := subrange_vec_dec v__705 5 5 in
       let i40 : bits 5 := subrange_vec_dec v__705 4 0 in
       returnm (concat_vec ('b"100"  : mword 3)
                  (concat_vec (i5  : bits 1)
                     (concat_vec ('b"10"  : mword 2)
                        (concat_vec (rsd  : cregidx)
                           (concat_vec (i40  : bits 5) ('b"01"  : mword 2))))))
    | C_SUB (rsd, rs2) =>
       returnm (concat_vec ('b"100"  : mword 3)
                  (concat_vec ('b"0"  : mword 1)
                     (concat_vec ('b"11"  : mword 2)
                        (concat_vec (rsd  : cregidx)
                           (concat_vec ('b"00"  : mword 2)
                              (concat_vec (rs2  : cregidx) ('b"01"  : mword 2)))))))
    | C_XOR (rsd, rs2) =>
       returnm (concat_vec ('b"100"  : mword 3)
                  (concat_vec ('b"0"  : mword 1)
                     (concat_vec ('b"11"  : mword 2)
                        (concat_vec (rsd  : cregidx)
                           (concat_vec ('b"01"  : mword 2)
                              (concat_vec (rs2  : cregidx) ('b"01"  : mword 2)))))))
    | C_OR (rsd, rs2) =>
       returnm (concat_vec ('b"100"  : mword 3)
                  (concat_vec ('b"0"  : mword 1)
                     (concat_vec ('b"11"  : mword 2)
                        (concat_vec (rsd  : cregidx)
                           (concat_vec ('b"10"  : mword 2)
                              (concat_vec (rs2  : cregidx) ('b"01"  : mword 2)))))))
    | C_AND (rsd, rs2) =>
       returnm (concat_vec ('b"100"  : mword 3)
                  (concat_vec ('b"0"  : mword 1)
                     (concat_vec ('b"11"  : mword 2)
                        (concat_vec (rsd  : cregidx)
                           (concat_vec ('b"11"  : mword 2)
                              (concat_vec (rs2  : cregidx) ('b"01"  : mword 2)))))))
    | C_SUBW (rsd, rs2) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec ('b"1"  : mword 1)
                        (concat_vec ('b"11"  : mword 2)
                           (concat_vec (rsd  : cregidx)
                              (concat_vec ('b"00"  : mword 2)
                                 (concat_vec (rs2  : cregidx) ('b"01"  : mword 2)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_ADDW (rsd, rs2) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec ('b"1"  : mword 1)
                        (concat_vec ('b"11"  : mword 2)
                           (concat_vec (rsd  : cregidx)
                              (concat_vec ('b"01"  : mword 2)
                                 (concat_vec (rs2  : cregidx) ('b"01"  : mword 2)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_J v__706 =>
       let i11 : bits 1 := subrange_vec_dec v__706 10 10 in
       let i98 : bits 2 := subrange_vec_dec v__706 8 7 in
       let i7 : bits 1 := subrange_vec_dec v__706 6 6 in
       let i6 : bits 1 := subrange_vec_dec v__706 5 5 in
       let i5 : bits 1 := subrange_vec_dec v__706 4 4 in
       let i4 : bits 1 := subrange_vec_dec v__706 3 3 in
       let i31 : bits 3 := subrange_vec_dec v__706 2 0 in
       let i11 : bits 1 := subrange_vec_dec v__706 10 10 in
       let i10 : bits 1 := subrange_vec_dec v__706 9 9 in
       returnm (concat_vec ('b"101"  : mword 3)
                  (concat_vec (i11  : bits 1)
                     (concat_vec (i4  : bits 1)
                        (concat_vec (i98  : bits 2)
                           (concat_vec (i10  : bits 1)
                              (concat_vec (i6  : bits 1)
                                 (concat_vec (i7  : bits 1)
                                    (concat_vec (i31  : bits 3)
                                       (concat_vec (i5  : bits 1) ('b"01"  : mword 2))))))))))
    | C_BEQZ (v__707, rs) =>
       let i8 : bits 1 := subrange_vec_dec v__707 7 7 in
       let i8 : bits 1 := subrange_vec_dec v__707 7 7 in
       let i76 : bits 2 := subrange_vec_dec v__707 6 5 in
       let i5 : bits 1 := subrange_vec_dec v__707 4 4 in
       let i43 : bits 2 := subrange_vec_dec v__707 3 2 in
       let i21 : bits 2 := subrange_vec_dec v__707 1 0 in
       returnm (concat_vec ('b"110"  : mword 3)
                  (concat_vec (i8  : bits 1)
                     (concat_vec (i43  : bits 2)
                        (concat_vec (rs  : cregidx)
                           (concat_vec (i76  : bits 2)
                              (concat_vec (i21  : bits 2)
                                 (concat_vec (i5  : bits 1) ('b"01"  : mword 2))))))))
    | C_BNEZ (v__708, rs) =>
       let i8 : bits 1 := subrange_vec_dec v__708 7 7 in
       let i8 : bits 1 := subrange_vec_dec v__708 7 7 in
       let i76 : bits 2 := subrange_vec_dec v__708 6 5 in
       let i5 : bits 1 := subrange_vec_dec v__708 4 4 in
       let i43 : bits 2 := subrange_vec_dec v__708 3 2 in
       let i21 : bits 2 := subrange_vec_dec v__708 1 0 in
       returnm (concat_vec ('b"111"  : mword 3)
                  (concat_vec (i8  : bits 1)
                     (concat_vec (i43  : bits 2)
                        (concat_vec (rs  : cregidx)
                           (concat_vec (i76  : bits 2)
                              (concat_vec (i21  : bits 2)
                                 (concat_vec (i5  : bits 1) ('b"01"  : mword 2))))))))
    | C_SLLI (v__709, rsd) =>
       (if sumbool_of_bool
          (let nzui5 : bits 1 := subrange_vec_dec v__709 5 5 in
          let nzui5 : bits 1 := subrange_vec_dec v__709 5 5 in
          let nzui40 : bits 5 := subrange_vec_dec v__709 4 0 in
          andb (neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)))
            (andb (neq_vec rsd zreg) (orb (Z.eqb 32 64) (eq_vec nzui5 ('b"0"  : mword 1))))) then
          let nzui5 : bits 1 := subrange_vec_dec v__709 5 5 in
          let nzui5 : bits 1 := subrange_vec_dec v__709 5 5 in
          let nzui40 : bits 5 := subrange_vec_dec v__709 4 0 in
          returnm (concat_vec ('b"000"  : mword 3)
                     (concat_vec (nzui5  : bits 1)
                        (concat_vec (rsd  : regidx)
                           (concat_vec (nzui40  : bits 5) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_LWSP (v__710, rd) =>
       (if neq_vec rd zreg then
          let ui76 : bits 2 := subrange_vec_dec v__710 5 4 in
          let ui76 : bits 2 := subrange_vec_dec v__710 5 4 in
          let ui5 : bits 1 := subrange_vec_dec v__710 3 3 in
          let ui42 : bits 3 := subrange_vec_dec v__710 2 0 in
          returnm (concat_vec ('b"010"  : mword 3)
                     (concat_vec (ui5  : bits 1)
                        (concat_vec (rd  : regidx)
                           (concat_vec (ui42  : bits 3)
                              (concat_vec (ui76  : bits 2) ('b"10"  : mword 2))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_LDSP (v__711, rd) =>
       (if sumbool_of_bool (andb (neq_vec rd zreg) (Z.eqb 32 64)) then
          let ui86 : bits 3 := subrange_vec_dec v__711 5 3 in
          let ui86 : bits 3 := subrange_vec_dec v__711 5 3 in
          let ui5 : bits 1 := subrange_vec_dec v__711 2 2 in
          let ui43 : bits 2 := subrange_vec_dec v__711 1 0 in
          returnm (concat_vec ('b"011"  : mword 3)
                     (concat_vec (ui5  : bits 1)
                        (concat_vec (rd  : regidx)
                           (concat_vec (ui43  : bits 2)
                              (concat_vec (ui86  : bits 3) ('b"10"  : mword 2))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_SWSP (v__712, rs2) =>
       let ui76 : bits 2 := subrange_vec_dec v__712 5 4 in
       let ui76 : bits 2 := subrange_vec_dec v__712 5 4 in
       let ui52 : bits 4 := subrange_vec_dec v__712 3 0 in
       returnm (concat_vec ('b"110"  : mword 3)
                  (concat_vec (ui52  : bits 4)
                     (concat_vec (ui76  : bits 2) (concat_vec (rs2  : regidx) ('b"10"  : mword 2)))))
    | C_SDSP (v__713, rs2) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          let ui86 : bits 3 := subrange_vec_dec v__713 5 3 in
          let ui86 : bits 3 := subrange_vec_dec v__713 5 3 in
          let ui53 : bits 3 := subrange_vec_dec v__713 2 0 in
          returnm (concat_vec ('b"111"  : mword 3)
                     (concat_vec (ui53  : bits 3)
                        (concat_vec (ui86  : bits 3)
                           (concat_vec (rs2  : regidx) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_JR rs1 =>
       (if neq_vec rs1 zreg then
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec ('b"0"  : mword 1)
                        (concat_vec (rs1  : regidx)
                           (concat_vec ('b"00000"  : mword 5) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_JALR rs1 =>
       (if neq_vec rs1 zreg then
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec ('b"1"  : mword 1)
                        (concat_vec (rs1  : regidx)
                           (concat_vec ('b"00000"  : mword 5) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_MV (rd, rs2) =>
       (if andb (neq_vec rd zreg) (neq_vec rs2 zreg) then
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec ('b"0"  : mword 1)
                        (concat_vec (rd  : regidx) (concat_vec (rs2  : regidx) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_EBREAK tt =>
       returnm (concat_vec ('b"100"  : mword 3)
                  (concat_vec ('b"1"  : mword 1)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec ('b"00000"  : mword 5) ('b"10"  : mword 2)))))
    | C_ADD (rsd, rs2) =>
       (if andb (neq_vec rsd zreg) (neq_vec rs2 zreg) then
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec ('b"1"  : mword 1)
                        (concat_vec (rsd  : regidx) (concat_vec (rs2  : regidx) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_NOP_HINT v__714 =>
       (if let im5 : bits 1 := subrange_vec_dec v__714 5 5 in
          let im5 : bits 1 := subrange_vec_dec v__714 5 5 in
          let im40 : bits 5 := subrange_vec_dec v__714 4 0 in
          neq_vec (concat_vec im5 im40) ('b"000000"  : mword (1 + 5)) then
          let im5 : bits 1 := subrange_vec_dec v__714 5 5 in
          let im5 : bits 1 := subrange_vec_dec v__714 5 5 in
          let im40 : bits 5 := subrange_vec_dec v__714 4 0 in
          returnm (concat_vec ('b"000"  : mword 3)
                     (concat_vec (im5  : bits 1)
                        (concat_vec ('b"00000"  : mword 5)
                           (concat_vec (im40  : bits 5) ('b"01"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_ADDI_HINT rsd =>
       (if neq_vec rsd zreg then
          returnm (concat_vec ('b"000"  : mword 3)
                     (concat_vec ('b"0"  : mword 1)
                        (concat_vec (rsd  : regidx)
                           (concat_vec ('b"00000"  : mword 5) ('b"01"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_LI_HINT v__715 =>
       let imm5 : bits 1 := subrange_vec_dec v__715 5 5 in
       let imm5 : bits 1 := subrange_vec_dec v__715 5 5 in
       let imm40 : bits 5 := subrange_vec_dec v__715 4 0 in
       returnm (concat_vec ('b"010"  : mword 3)
                  (concat_vec (imm5  : bits 1)
                     (concat_vec ('b"00000"  : mword 5)
                        (concat_vec (imm40  : bits 5) ('b"01"  : mword 2)))))
    | C_LUI_HINT v__716 =>
       (if let imm17 : bits 1 := subrange_vec_dec v__716 5 5 in
          let imm17 : bits 1 := subrange_vec_dec v__716 5 5 in
          let imm1612 : bits 5 := subrange_vec_dec v__716 4 0 in
          neq_vec (concat_vec imm17 imm1612) ('b"000000"  : mword (1 + 5)) then
          let imm17 : bits 1 := subrange_vec_dec v__716 5 5 in
          let imm17 : bits 1 := subrange_vec_dec v__716 5 5 in
          let imm1612 : bits 5 := subrange_vec_dec v__716 4 0 in
          returnm (concat_vec ('b"011"  : mword 3)
                     (concat_vec (imm17  : bits 1)
                        (concat_vec ('b"00000"  : mword 5)
                           (concat_vec (imm1612  : bits 5) ('b"01"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_MV_HINT rs2 =>
       (if neq_vec rs2 zreg then
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec ('b"0"  : mword 1)
                        (concat_vec ('b"00000"  : mword 5)
                           (concat_vec (rs2  : regidx) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_ADD_HINT rs2 =>
       (if neq_vec rs2 zreg then
          returnm (concat_vec ('b"100"  : mword 3)
                     (concat_vec ('b"1"  : mword 1)
                        (concat_vec ('b"00000"  : mword 5)
                           (concat_vec (rs2  : regidx) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_SLLI_HINT (v__717, rsd) =>
       (if sumbool_of_bool
          (let nzui5 : bits 1 := subrange_vec_dec v__717 5 5 in
          let nzui5 : bits 1 := subrange_vec_dec v__717 5 5 in
          let nzui40 : bits 5 := subrange_vec_dec v__717 4 0 in
          andb
            (orb (eq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5))) (eq_vec rsd zreg))
            (orb (Z.eqb 32 64) (eq_vec nzui5 ('b"0"  : mword 1)))) then
          let nzui5 : bits 1 := subrange_vec_dec v__717 5 5 in
          let nzui5 : bits 1 := subrange_vec_dec v__717 5 5 in
          let nzui40 : bits 5 := subrange_vec_dec v__717 4 0 in
          returnm (concat_vec ('b"000"  : mword 3)
                     (concat_vec (nzui5  : bits 1)
                        (concat_vec (rsd  : regidx)
                           (concat_vec (nzui40  : bits 5) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_SRLI_HINT rsd =>
       returnm (concat_vec ('b"100"  : mword 3)
                  (concat_vec ('b"0"  : mword 1)
                     (concat_vec ('b"00"  : mword 2)
                        (concat_vec (rsd  : cregidx)
                           (concat_vec ('b"00000"  : mword 5) ('b"01"  : mword 2))))))
    | C_SRAI_HINT rsd =>
       returnm (concat_vec ('b"100"  : mword 3)
                  (concat_vec ('b"0"  : mword 1)
                     (concat_vec ('b"01"  : mword 2)
                        (concat_vec (rsd  : cregidx)
                           (concat_vec ('b"00000"  : mword 5) ('b"01"  : mword 2))))))
    | C_FLWSP (v__718, rd) =>
       (and_boolMP
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)}))
          (build_trivial_ex
          ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
           : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__57 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)}) =>
       (if sumbool_of_bool w__57 then
          let ui76 : bits 2 := subrange_vec_dec v__718 5 4 in
          let ui76 : bits 2 := subrange_vec_dec v__718 5 4 in
          let ui5 : bits 1 := subrange_vec_dec v__718 3 3 in
          let ui42 : bits 3 := subrange_vec_dec v__718 2 0 in
          returnm (concat_vec ('b"011"  : mword 3)
                     (concat_vec (ui5  : bits 1)
                        (concat_vec (rd  : regidx)
                           (concat_vec (ui42  : bits 3)
                              (concat_vec (ui76  : bits 2) ('b"10"  : mword 2))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_FSWSP (v__719, rs2) =>
       (and_boolMP
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)}))
          (build_trivial_ex
          ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
           : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__63 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)}) =>
       (if sumbool_of_bool w__63 then
          let ui76 : bits 2 := subrange_vec_dec v__719 5 4 in
          let ui76 : bits 2 := subrange_vec_dec v__719 5 4 in
          let ui52 : bits 4 := subrange_vec_dec v__719 3 0 in
          returnm (concat_vec ('b"111"  : mword 3)
                     (concat_vec (ui52  : bits 4)
                        (concat_vec (ui76  : bits 2)
                           (concat_vec (rs2  : regidx) ('b"10"  : mword 2)))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_FLW (v__720, rs1, rd) =>
       (and_boolMP
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)}))
          (build_trivial_ex
          ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
           : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__69 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)}) =>
       (if sumbool_of_bool w__69 then
          let ui6 : bits 1 := subrange_vec_dec v__720 4 4 in
          let ui6 : bits 1 := subrange_vec_dec v__720 4 4 in
          let ui53 : bits 3 := subrange_vec_dec v__720 3 1 in
          let ui2 : bits 1 := subrange_vec_dec v__720 0 0 in
          returnm (concat_vec ('b"011"  : mword 3)
                     (concat_vec (ui53  : bits 3)
                        (concat_vec (rs1  : cregidx)
                           (concat_vec (ui2  : bits 1)
                              (concat_vec (ui6  : bits 1)
                                 (concat_vec (rd  : cregidx) ('b"00"  : mword 2)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_FSW (v__721, rs1, rs2) =>
       (and_boolMP
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)}))
          (build_trivial_ex
          ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
           : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__75 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)}) =>
       (if sumbool_of_bool w__75 then
          let ui6 : bits 1 := subrange_vec_dec v__721 4 4 in
          let ui6 : bits 1 := subrange_vec_dec v__721 4 4 in
          let ui53 : bits 3 := subrange_vec_dec v__721 3 1 in
          let ui2 : bits 1 := subrange_vec_dec v__721 0 0 in
          returnm (concat_vec ('b"111"  : mword 3)
                     (concat_vec (ui53  : bits 3)
                        (concat_vec (rs1  : cregidx)
                           (concat_vec (ui2  : bits 1)
                              (concat_vec (ui6  : bits 1)
                                 (concat_vec (rs2  : cregidx) ('b"00"  : mword 2)))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (mword 16)
    | C_ILLEGAL s => returnm s
    | _ => assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt
    end)
    : M (mword 16).

Definition encdec_compressed_backwards (arg_ : mword 16) : M (ast) :=
   let v__722 := arg_ in
   (if eq_vec v__722 (Ox"0001"  : mword 16) then returnm (C_NOP tt)
    else if andb
              (let nz96 : bits 4 := subrange_vec_dec v__722 10 7 in
              let nz54 : bits 2 := subrange_vec_dec v__722 12 11 in
              let nz3 : bits 1 := subrange_vec_dec v__722 5 5 in
              let nz2 : bits 1 := subrange_vec_dec v__722 6 6 in
              neq_vec (concat_vec nz96 (concat_vec nz54 (concat_vec nz3 nz2)))
                (Ox"00"
                 : mword (4 + (2 + (1 + 1)))))
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"000"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"00"  : mword (1 - 0 + 1)))) then
      let rd : cregidx := subrange_vec_dec v__722 4 2 in
      let nz96 : bits 4 := subrange_vec_dec v__722 10 7 in
      let nz54 : bits 2 := subrange_vec_dec v__722 12 11 in
      let nz3 : bits 1 := subrange_vec_dec v__722 5 5 in
      let nz2 : bits 1 := subrange_vec_dec v__722 6 6 in
      returnm (C_ADDI4SPN
                 (rd, concat_vec (nz96  : bits 4)
                        (concat_vec (nz54  : bits 2) (concat_vec (nz3  : bits 1) (nz2  : bits 1)))))
    else if andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"010"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__722 1 0) ('b"00"  : mword (1 - 0 + 1))) then
      let ui6 : bits 1 := subrange_vec_dec v__722 5 5 in
      let ui53 : bits 3 := subrange_vec_dec v__722 12 10 in
      let ui2 : bits 1 := subrange_vec_dec v__722 6 6 in
      let rs1 : cregidx := subrange_vec_dec v__722 9 7 in
      let rd : cregidx := subrange_vec_dec v__722 4 2 in
      returnm (C_LW
                 (concat_vec (ui6  : bits 1) (concat_vec (ui53  : bits 3) (ui2  : bits 1)), rs1, rd))
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"011"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__722 1 0) ('b"00"  : mword (1 - 0 + 1))))) then
      let ui76 : bits 2 := subrange_vec_dec v__722 6 5 in
      let ui53 : bits 3 := subrange_vec_dec v__722 12 10 in
      let rs1 : cregidx := subrange_vec_dec v__722 9 7 in
      let rd : cregidx := subrange_vec_dec v__722 4 2 in
      returnm (C_LD (concat_vec (ui76  : bits 2) (ui53  : bits 3), rs1, rd))
    else if andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"110"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__722 1 0) ('b"00"  : mword (1 - 0 + 1))) then
      let ui6 : bits 1 := subrange_vec_dec v__722 5 5 in
      let ui53 : bits 3 := subrange_vec_dec v__722 12 10 in
      let ui2 : bits 1 := subrange_vec_dec v__722 6 6 in
      let rs2 : cregidx := subrange_vec_dec v__722 4 2 in
      let rs1 : cregidx := subrange_vec_dec v__722 9 7 in
      returnm (C_SW
                 (concat_vec (ui6  : bits 1) (concat_vec (ui53  : bits 3) (ui2  : bits 1)), rs1, rs2))
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"111"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__722 1 0) ('b"00"  : mword (1 - 0 + 1))))) then
      let ui76 : bits 2 := subrange_vec_dec v__722 6 5 in
      let ui53 : bits 3 := subrange_vec_dec v__722 12 10 in
      let rs2 : bits 3 := subrange_vec_dec v__722 4 2 in
      let rs1 : bits 3 := subrange_vec_dec v__722 9 7 in
      returnm (C_SD (concat_vec (ui76  : bits 2) (ui53  : bits 3), rs1, rs2))
    else if andb
              (let rsd : regidx := subrange_vec_dec v__722 11 7 in
              let nzi5 : bits 1 := subrange_vec_dec v__722 12 12 in
              let nzi40 : bits 5 := subrange_vec_dec v__722 6 2 in
              andb (neq_vec (concat_vec nzi5 nzi40) ('b"000000"  : mword (1 + 5)))
                (neq_vec rsd zreg))
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"000"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      let rsd : regidx := subrange_vec_dec v__722 11 7 in
      let nzi5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let nzi40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_ADDI (concat_vec (nzi5  : bits 1) (nzi40  : bits 5), rsd))
    else if sumbool_of_bool
      (andb (Z.eqb 32 32)
         (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"001"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      let i98 : bits 2 := subrange_vec_dec v__722 10 9 in
      let i7 : bits 1 := subrange_vec_dec v__722 6 6 in
      let i6 : bits 1 := subrange_vec_dec v__722 7 7 in
      let i5 : bits 1 := subrange_vec_dec v__722 2 2 in
      let i4 : bits 1 := subrange_vec_dec v__722 11 11 in
      let i31 : bits 3 := subrange_vec_dec v__722 5 3 in
      let i11 : bits 1 := subrange_vec_dec v__722 12 12 in
      let i10 : bits 1 := subrange_vec_dec v__722 8 8 in
      returnm (C_JAL
                 (concat_vec (i11  : bits 1)
                    (concat_vec (i10  : bits 1)
                       (concat_vec (i98  : bits 2)
                          (concat_vec (i7  : bits 1)
                             (concat_vec (i6  : bits 1)
                                (concat_vec (i5  : bits 1)
                                   (concat_vec (i4  : bits 1) (i31  : bits 3)))))))))
    else if sumbool_of_bool
      (andb
         (let rsd : regidx := subrange_vec_dec v__722 11 7 in
         andb (neq_vec rsd zreg) (Z.eqb 32 64))
         (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"001"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      let rsd : regidx := subrange_vec_dec v__722 11 7 in
      let imm5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let imm40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_ADDIW (concat_vec (imm5  : bits 1) (imm40  : bits 5), rsd))
    else if andb
              (let rd : regidx := subrange_vec_dec v__722 11 7 in
              neq_vec rd zreg)
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"010"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      let rd : regidx := subrange_vec_dec v__722 11 7 in
      let imm5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let imm40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_LI (concat_vec (imm5  : bits 1) (imm40  : bits 5), rd))
    else if andb
              (let nzi9 : bits 1 := subrange_vec_dec v__722 12 12 in
              let nzi87 : bits 2 := subrange_vec_dec v__722 4 3 in
              let nzi6 : bits 1 := subrange_vec_dec v__722 5 5 in
              let nzi5 : bits 1 := subrange_vec_dec v__722 2 2 in
              let nzi4 : bits 1 := subrange_vec_dec v__722 6 6 in
              neq_vec (concat_vec nzi9 (concat_vec nzi87 (concat_vec nzi6 (concat_vec nzi5 nzi4))))
                ('b"000000"
                 : mword (1 + (2 + (1 + (1 + 1))))))
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"011"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__722 11 7) ('b"00010"  : mword (11 - 7 + 1)))
                    (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      let nzi9 : bits 1 := subrange_vec_dec v__722 12 12 in
      let nzi87 : bits 2 := subrange_vec_dec v__722 4 3 in
      let nzi6 : bits 1 := subrange_vec_dec v__722 5 5 in
      let nzi5 : bits 1 := subrange_vec_dec v__722 2 2 in
      let nzi4 : bits 1 := subrange_vec_dec v__722 6 6 in
      returnm (C_ADDI16SP
                 (concat_vec (nzi9  : bits 1)
                    (concat_vec (nzi87  : bits 2)
                       (concat_vec (nzi6  : bits 1) (concat_vec (nzi5  : bits 1) (nzi4  : bits 1))))))
    else if andb
              (let rd : regidx := subrange_vec_dec v__722 11 7 in
              let imm17 : bits 1 := subrange_vec_dec v__722 12 12 in
              let imm1612 : bits 5 := subrange_vec_dec v__722 6 2 in
              andb (neq_vec rd zreg)
                (andb (neq_vec rd sp)
                   (neq_vec (concat_vec imm17 imm1612) ('b"000000"  : mword (1 + 5)))))
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"011"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      let rd : regidx := subrange_vec_dec v__722 11 7 in
      let imm17 : bits 1 := subrange_vec_dec v__722 12 12 in
      let imm1612 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_LUI (concat_vec (imm17  : bits 1) (imm1612  : bits 5), rd))
    else if andb
              (let nzui5 : bits 1 := subrange_vec_dec v__722 12 12 in
              let nzui40 : bits 5 := subrange_vec_dec v__722 6 2 in
              neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)))
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"100"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__722 11 10) ('b"00"  : mword (11 - 10 + 1)))
                    (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      let nzui5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let nzui40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_SRLI (concat_vec (nzui5  : bits 1) (nzui40  : bits 5), rsd))
    else if andb
              (let nzui5 : bits 1 := subrange_vec_dec v__722 12 12 in
              let nzui40 : bits 5 := subrange_vec_dec v__722 6 2 in
              neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)))
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"100"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__722 11 10) ('b"01"  : mword (11 - 10 + 1)))
                    (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      let nzui5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let nzui40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_SRAI (concat_vec (nzui5  : bits 1) (nzui40  : bits 5), rsd))
    else if andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"100"  : mword (15 - 13 + 1)))
              (andb (eq_vec (subrange_vec_dec v__722 11 10) ('b"10"  : mword (11 - 10 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      let i5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let i40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_ANDI (concat_vec (i5  : bits 1) (i40  : bits 5), rsd))
    else if andb (eq_vec (subrange_vec_dec v__722 15 10) ('b"100011"  : mword (15 - 10 + 1)))
              (andb (eq_vec (subrange_vec_dec v__722 6 5) ('b"00"  : mword (6 - 5 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      let rs2 : cregidx := subrange_vec_dec v__722 4 2 in
      returnm (C_SUB (rsd, rs2))
    else if andb (eq_vec (subrange_vec_dec v__722 15 10) ('b"100011"  : mword (15 - 10 + 1)))
              (andb (eq_vec (subrange_vec_dec v__722 6 5) ('b"01"  : mword (6 - 5 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      let rs2 : cregidx := subrange_vec_dec v__722 4 2 in
      returnm (C_XOR (rsd, rs2))
    else if andb (eq_vec (subrange_vec_dec v__722 15 10) ('b"100011"  : mword (15 - 10 + 1)))
              (andb (eq_vec (subrange_vec_dec v__722 6 5) ('b"10"  : mword (6 - 5 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      let rs2 : cregidx := subrange_vec_dec v__722 4 2 in
      returnm (C_OR (rsd, rs2))
    else if andb (eq_vec (subrange_vec_dec v__722 15 10) ('b"100011"  : mword (15 - 10 + 1)))
              (andb (eq_vec (subrange_vec_dec v__722 6 5) ('b"11"  : mword (6 - 5 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      let rs2 : cregidx := subrange_vec_dec v__722 4 2 in
      returnm (C_AND (rsd, rs2))
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__722 15 10) ('b"100111"  : mword (15 - 10 + 1)))
            (andb (eq_vec (subrange_vec_dec v__722 6 5) ('b"00"  : mword (6 - 5 + 1)))
               (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      let rs2 : cregidx := subrange_vec_dec v__722 4 2 in
      returnm (C_SUBW (rsd, rs2))
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__722 15 10) ('b"100111"  : mword (15 - 10 + 1)))
            (andb (eq_vec (subrange_vec_dec v__722 6 5) ('b"01"  : mword (6 - 5 + 1)))
               (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      let rs2 : cregidx := subrange_vec_dec v__722 4 2 in
      returnm (C_ADDW (rsd, rs2))
    else if andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"101"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))) then
      let i98 : bits 2 := subrange_vec_dec v__722 10 9 in
      let i7 : bits 1 := subrange_vec_dec v__722 6 6 in
      let i6 : bits 1 := subrange_vec_dec v__722 7 7 in
      let i5 : bits 1 := subrange_vec_dec v__722 2 2 in
      let i4 : bits 1 := subrange_vec_dec v__722 11 11 in
      let i31 : bits 3 := subrange_vec_dec v__722 5 3 in
      let i11 : bits 1 := subrange_vec_dec v__722 12 12 in
      let i10 : bits 1 := subrange_vec_dec v__722 8 8 in
      returnm (C_J
                 (concat_vec (i11  : bits 1)
                    (concat_vec (i10  : bits 1)
                       (concat_vec (i98  : bits 2)
                          (concat_vec (i7  : bits 1)
                             (concat_vec (i6  : bits 1)
                                (concat_vec (i5  : bits 1)
                                   (concat_vec (i4  : bits 1) (i31  : bits 3)))))))))
    else if andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"110"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))) then
      let rs : cregidx := subrange_vec_dec v__722 9 7 in
      let i8 : bits 1 := subrange_vec_dec v__722 12 12 in
      let i76 : bits 2 := subrange_vec_dec v__722 6 5 in
      let i5 : bits 1 := subrange_vec_dec v__722 2 2 in
      let i43 : bits 2 := subrange_vec_dec v__722 11 10 in
      let i21 : bits 2 := subrange_vec_dec v__722 4 3 in
      returnm (C_BEQZ
                 (concat_vec (i8  : bits 1)
                    (concat_vec (i76  : bits 2)
                       (concat_vec (i5  : bits 1) (concat_vec (i43  : bits 2) (i21  : bits 2)))), rs))
    else if andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"111"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))) then
      let rs : cregidx := subrange_vec_dec v__722 9 7 in
      let i8 : bits 1 := subrange_vec_dec v__722 12 12 in
      let i76 : bits 2 := subrange_vec_dec v__722 6 5 in
      let i5 : bits 1 := subrange_vec_dec v__722 2 2 in
      let i43 : bits 2 := subrange_vec_dec v__722 11 10 in
      let i21 : bits 2 := subrange_vec_dec v__722 4 3 in
      returnm (C_BNEZ
                 (concat_vec (i8  : bits 1)
                    (concat_vec (i76  : bits 2)
                       (concat_vec (i5  : bits 1) (concat_vec (i43  : bits 2) (i21  : bits 2)))), rs))
    else if sumbool_of_bool
      (andb
         (let rsd : regidx := subrange_vec_dec v__722 11 7 in
         let nzui5 : bits 1 := subrange_vec_dec v__722 12 12 in
         let nzui40 : bits 5 := subrange_vec_dec v__722 6 2 in
         andb (neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)))
           (andb (neq_vec rsd zreg) (orb (Z.eqb 32 64) (eq_vec nzui5 ('b"0"  : mword 1)))))
         (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"000"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1))))) then
      let rsd : regidx := subrange_vec_dec v__722 11 7 in
      let nzui5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let nzui40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_SLLI (concat_vec (nzui5  : bits 1) (nzui40  : bits 5), rsd))
    else if andb
              (let rd : regidx := subrange_vec_dec v__722 11 7 in
              neq_vec rd zreg)
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"010"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      let ui76 : bits 2 := subrange_vec_dec v__722 3 2 in
      let ui5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let ui42 : bits 3 := subrange_vec_dec v__722 6 4 in
      let rd : regidx := subrange_vec_dec v__722 11 7 in
      returnm (C_LWSP
                 (concat_vec (ui76  : bits 2) (concat_vec (ui5  : bits 1) (ui42  : bits 3)), rd))
    else if sumbool_of_bool
      (andb
         (let rd : regidx := subrange_vec_dec v__722 11 7 in
         andb (neq_vec rd zreg) (Z.eqb 32 64))
         (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"011"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1))))) then
      let ui86 : bits 3 := subrange_vec_dec v__722 4 2 in
      let ui5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let ui43 : bits 2 := subrange_vec_dec v__722 6 5 in
      let rd : regidx := subrange_vec_dec v__722 11 7 in
      returnm (C_LDSP
                 (concat_vec (ui86  : bits 3) (concat_vec (ui5  : bits 1) (ui43  : bits 2)), rd))
    else if andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"110"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1))) then
      let ui76 : bits 2 := subrange_vec_dec v__722 8 7 in
      let ui52 : bits 4 := subrange_vec_dec v__722 12 9 in
      let rs2 : regidx := subrange_vec_dec v__722 6 2 in
      returnm (C_SWSP (concat_vec (ui76  : bits 2) (ui52  : bits 4), rs2))
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"111"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1))))) then
      let ui86 : bits 3 := subrange_vec_dec v__722 9 7 in
      let ui53 : bits 3 := subrange_vec_dec v__722 12 10 in
      let rs2 : regidx := subrange_vec_dec v__722 6 2 in
      returnm (C_SDSP (concat_vec (ui86  : bits 3) (ui53  : bits 3), rs2))
    else if andb
              (let rs1 : regidx := subrange_vec_dec v__722 11 7 in
              neq_vec rs1 zreg)
              (andb (eq_vec (subrange_vec_dec v__722 15 12) (Ox"8"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__722 6 0) ('b"0000010"  : mword (6 - 0 + 1)))) then
      let rs1 : regidx := subrange_vec_dec v__722 11 7 in
      returnm (C_JR rs1)
    else if andb
              (let rs1 : regidx := subrange_vec_dec v__722 11 7 in
              neq_vec rs1 zreg)
              (andb (eq_vec (subrange_vec_dec v__722 15 12) (Ox"9"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__722 6 0) ('b"0000010"  : mword (6 - 0 + 1)))) then
      let rs1 : regidx := subrange_vec_dec v__722 11 7 in
      returnm (C_JALR rs1)
    else if andb
              (let rs2 : regidx := subrange_vec_dec v__722 6 2 in
              let rd : regidx := subrange_vec_dec v__722 11 7 in
              andb (neq_vec rd zreg) (neq_vec rs2 zreg))
              (andb (eq_vec (subrange_vec_dec v__722 15 12) (Ox"8"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      let rs2 : regidx := subrange_vec_dec v__722 6 2 in
      let rd : regidx := subrange_vec_dec v__722 11 7 in
      returnm (C_MV (rd, rs2))
    else if eq_vec v__722 (Ox"9002"  : mword 16) then returnm (C_EBREAK tt)
    else if andb
              (let rsd : regidx := subrange_vec_dec v__722 11 7 in
              let rs2 : regidx := subrange_vec_dec v__722 6 2 in
              andb (neq_vec rsd zreg) (neq_vec rs2 zreg))
              (andb (eq_vec (subrange_vec_dec v__722 15 12) (Ox"9"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      let rsd : regidx := subrange_vec_dec v__722 11 7 in
      let rs2 : regidx := subrange_vec_dec v__722 6 2 in
      returnm (C_ADD (rsd, rs2))
    else if andb
              (let im5 : bits 1 := subrange_vec_dec v__722 12 12 in
              let im40 : bits 5 := subrange_vec_dec v__722 6 2 in
              neq_vec (concat_vec im5 im40) ('b"000000"  : mword (1 + 5)))
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"000"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__722 11 7) ('b"00000"  : mword (11 - 7 + 1)))
                    (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      let im5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let im40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_NOP_HINT (concat_vec (im5  : bits 1) (im40  : bits 5)))
    else if andb
              (let rsd : regidx := subrange_vec_dec v__722 11 7 in
              neq_vec rsd zreg)
              (andb (eq_vec (subrange_vec_dec v__722 15 12) (Ox"0"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__722 6 0) ('b"0000001"  : mword (6 - 0 + 1)))) then
      let rsd : regidx := subrange_vec_dec v__722 11 7 in
      returnm (C_ADDI_HINT rsd)
    else if andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"010"  : mword (15 - 13 + 1)))
              (andb (eq_vec (subrange_vec_dec v__722 11 7) ('b"00000"  : mword (11 - 7 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      let imm5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let imm40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_LI_HINT (concat_vec (imm5  : bits 1) (imm40  : bits 5)))
    else if andb
              (let imm17 : bits 1 := subrange_vec_dec v__722 12 12 in
              let imm1612 : bits 5 := subrange_vec_dec v__722 6 2 in
              neq_vec (concat_vec imm17 imm1612) ('b"000000"  : mword (1 + 5)))
              (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"011"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__722 11 7) ('b"00000"  : mword (11 - 7 + 1)))
                    (eq_vec (subrange_vec_dec v__722 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      let imm17 : bits 1 := subrange_vec_dec v__722 12 12 in
      let imm1612 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_LUI_HINT (concat_vec (imm17  : bits 1) (imm1612  : bits 5)))
    else if andb
              (let rs2 : regidx := subrange_vec_dec v__722 6 2 in
              neq_vec rs2 zreg)
              (andb (eq_vec (subrange_vec_dec v__722 15 7) ('b"100000000"  : mword (15 - 7 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      let rs2 : regidx := subrange_vec_dec v__722 6 2 in
      returnm (C_MV_HINT rs2)
    else if andb
              (let rs2 : regidx := subrange_vec_dec v__722 6 2 in
              neq_vec rs2 zreg)
              (andb (eq_vec (subrange_vec_dec v__722 15 7) ('b"100100000"  : mword (15 - 7 + 1)))
                 (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      let rs2 : regidx := subrange_vec_dec v__722 6 2 in
      returnm (C_ADD_HINT rs2)
    else if sumbool_of_bool
      (andb
         (let rsd : regidx := subrange_vec_dec v__722 11 7 in
         let nzui5 : bits 1 := subrange_vec_dec v__722 12 12 in
         let nzui40 : bits 5 := subrange_vec_dec v__722 6 2 in
         andb
           (orb (eq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5))) (eq_vec rsd zreg))
           (orb (Z.eqb 32 64) (eq_vec nzui5 ('b"0"  : mword 1))))
         (andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"000"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1))))) then
      let rsd : regidx := subrange_vec_dec v__722 11 7 in
      let nzui5 : bits 1 := subrange_vec_dec v__722 12 12 in
      let nzui40 : bits 5 := subrange_vec_dec v__722 6 2 in
      returnm (C_SLLI_HINT (concat_vec (nzui5  : bits 1) (nzui40  : bits 5), rsd))
    else if andb (eq_vec (subrange_vec_dec v__722 15 10) ('b"100000"  : mword (15 - 10 + 1)))
              (eq_vec (subrange_vec_dec v__722 6 0) ('b"0000001"  : mword (6 - 0 + 1))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      returnm (C_SRLI_HINT rsd)
    else if andb (eq_vec (subrange_vec_dec v__722 15 10) ('b"100001"  : mword (15 - 10 + 1)))
              (eq_vec (subrange_vec_dec v__722 6 0) ('b"0000001"  : mword (6 - 0 + 1))) then
      let rsd : cregidx := subrange_vec_dec v__722 9 7 in
      returnm (C_SRAI_HINT rsd)
    else
      (and_boolMP
         (((and_boolMP
              ((returnm (build_ex
                (projT1
                (build_ex
                (Z.eqb 32 32)
                 : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
                32) _bool)}))
              (build_trivial_ex
              ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
               : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
           (32 =? 32)) _bool = true)}))
          : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
           (32 =? 32)) _bool = true)}))
         (build_trivial_ex
         (returnm ((andb (eq_vec (subrange_vec_dec v__722 15 13) ('b"011"  : mword (15 - 13 + 1)))
                      (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1))))
           : bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__4 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
        (32 =? 32)) _bool = true)}) =>
      (if sumbool_of_bool w__4 then
         let ui76 : bits 2 := subrange_vec_dec v__722 3 2 in
         let ui5 : bits 1 := subrange_vec_dec v__722 12 12 in
         let ui42 : bits 3 := subrange_vec_dec v__722 6 4 in
         let rd : regidx := subrange_vec_dec v__722 11 7 in
         returnm (C_FLWSP
                    (concat_vec (ui76  : bits 2) (concat_vec (ui5  : bits 1) (ui42  : bits 3)), rd))
       else
         (and_boolMP
            (((and_boolMP
                 ((returnm (build_ex
                   (projT1
                   (build_ex
                   (Z.eqb 32 32)
                    : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
                   32) _bool)}))
                 (build_trivial_ex
                 ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
                  : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
              (32 =? 32)) _bool = true)}))
             : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
              (32 =? 32)) _bool = true)}))
            (build_trivial_ex
            (returnm ((andb
                         (eq_vec (subrange_vec_dec v__722 15 13) ('b"111"  : mword (15 - 13 + 1)))
                         (eq_vec (subrange_vec_dec v__722 1 0) ('b"10"  : mword (1 - 0 + 1))))
              : bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
           (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__9 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
           (32 =? 32)) _bool = true)}) =>
         (if sumbool_of_bool w__9 then
            let ui76 : bits 2 := subrange_vec_dec v__722 8 7 in
            let ui52 : bits 4 := subrange_vec_dec v__722 12 9 in
            let rs2 : regidx := subrange_vec_dec v__722 6 2 in
            returnm (C_FSWSP (concat_vec (ui76  : bits 2) (ui52  : bits 4), rs2))
          else
            (and_boolMP
               (((and_boolMP
                    ((returnm (build_ex
                      (projT1
                      (build_ex
                      (Z.eqb 32 32)
                       : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
                      32) _bool)}))
                    (build_trivial_ex
                    ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
                     : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                 (32 =? 32)) _bool = true)}))
                : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                 (32 =? 32)) _bool = true)}))
               (build_trivial_ex
               (returnm ((andb
                            (eq_vec (subrange_vec_dec v__722 15 13) ('b"011"  : mword (15 - 13 + 1)))
                            (eq_vec (subrange_vec_dec v__722 1 0) ('b"00"  : mword (1 - 0 + 1))))
                 : bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
              (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__14 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
              (32 =? 32)) _bool = true)}) =>
            (if sumbool_of_bool w__14 then
               let ui6 : bits 1 := subrange_vec_dec v__722 5 5 in
               let ui53 : bits 3 := subrange_vec_dec v__722 12 10 in
               let ui2 : bits 1 := subrange_vec_dec v__722 6 6 in
               let rs1 : cregidx := subrange_vec_dec v__722 9 7 in
               let rd : cregidx := subrange_vec_dec v__722 4 2 in
               returnm (C_FLW
                          (concat_vec (ui6  : bits 1) (concat_vec (ui53  : bits 3) (ui2  : bits 1)), rs1, rd))
             else
               (and_boolMP
                  (((and_boolMP
                       ((returnm (build_ex
                         (projT1
                         (build_ex
                         (Z.eqb 32 32)
                          : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
                         32) _bool)}))
                       (build_trivial_ex
                       ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
                        : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                    (32 =? 32)) _bool = true)}))
                   : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                    (32 =? 32)) _bool = true)}))
                  (build_trivial_ex
                  (returnm ((andb
                               (eq_vec (subrange_vec_dec v__722 15 13)
                                  ('b"111"
                                   : mword (15 - 13 + 1)))
                               (eq_vec (subrange_vec_dec v__722 1 0) ('b"00"  : mword (1 - 0 + 1))))
                    : bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                 (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__19 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                 (32 =? 32)) _bool = true)}) =>
               returnm (if sumbool_of_bool w__19 then
                          let ui6 : bits 1 := subrange_vec_dec v__722 5 5 in
                          let ui53 : bits 3 := subrange_vec_dec v__722 12 10 in
                          let ui2 : bits 1 := subrange_vec_dec v__722 6 6 in
                          let rs2 : cregidx := subrange_vec_dec v__722 4 2 in
                          let rs1 : cregidx := subrange_vec_dec v__722 9 7 in
                          C_FSW
                            (concat_vec (ui6  : bits 1)
                               (concat_vec (ui53  : bits 3) (ui2  : bits 1)), rs1, rs2)
                        else C_ILLEGAL v__722))
             : M (ast))
          : M (ast))
       : M (ast))
    : M (ast).

Definition encdec_compressed_forwards_matches (arg_ : ast) : M (bool) :=
   (match arg_ with
    | C_NOP tt => returnm true
    | C_ADDI4SPN (rd, v__912) =>
       returnm (if let nz96 : bits 4 := subrange_vec_dec v__912 7 4 in
                  let nz96 : bits 4 := subrange_vec_dec v__912 7 4 in
                  let nz54 : bits 2 := subrange_vec_dec v__912 3 2 in
                  let nz3 : bits 1 := subrange_vec_dec v__912 1 1 in
                  let nz2 : bits 1 := subrange_vec_dec v__912 0 0 in
                  neq_vec (concat_vec nz96 (concat_vec nz54 (concat_vec nz3 nz2)))
                    (Ox"00"
                     : mword (4 + (2 + (1 + 1)))) then
                  true
                else false)
    | C_LW (v__913, rs1, rd) => returnm true
    | C_LD (v__914, rs1, rd) => returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | C_SW (v__915, rs1, rs2) => returnm true
    | C_SD (v__916, rs1, rs2) => returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | C_ADDI (v__917, rsd) =>
       returnm (if let nzi5 : bits 1 := subrange_vec_dec v__917 5 5 in
                  let nzi5 : bits 1 := subrange_vec_dec v__917 5 5 in
                  let nzi40 : bits 5 := subrange_vec_dec v__917 4 0 in
                  andb (neq_vec (concat_vec nzi5 nzi40) ('b"000000"  : mword (1 + 5)))
                    (neq_vec rsd zreg) then
                  true
                else false)
    | C_JAL v__918 => returnm (if sumbool_of_bool (Z.eqb 32 32) then true else false)
    | C_ADDIW (v__919, rsd) =>
       returnm (if sumbool_of_bool (andb (neq_vec rsd zreg) (Z.eqb 32 64)) then true else false)
    | C_LI (v__920, rd) => returnm (if neq_vec rd zreg then true else false)
    | C_ADDI16SP v__921 =>
       returnm (if let nzi9 : bits 1 := subrange_vec_dec v__921 5 5 in
                  let nzi9 : bits 1 := subrange_vec_dec v__921 5 5 in
                  let nzi87 : bits 2 := subrange_vec_dec v__921 4 3 in
                  let nzi6 : bits 1 := subrange_vec_dec v__921 2 2 in
                  let nzi5 : bits 1 := subrange_vec_dec v__921 1 1 in
                  let nzi4 : bits 1 := subrange_vec_dec v__921 0 0 in
                  neq_vec
                    (concat_vec nzi9 (concat_vec nzi87 (concat_vec nzi6 (concat_vec nzi5 nzi4))))
                    ('b"000000"
                     : mword (1 + (2 + (1 + (1 + 1))))) then
                  true
                else false)
    | C_LUI (v__922, rd) =>
       returnm (if let imm17 : bits 1 := subrange_vec_dec v__922 5 5 in
                  let imm17 : bits 1 := subrange_vec_dec v__922 5 5 in
                  let imm1612 : bits 5 := subrange_vec_dec v__922 4 0 in
                  andb (neq_vec rd zreg)
                    (andb (neq_vec rd sp)
                       (neq_vec (concat_vec imm17 imm1612) ('b"000000"  : mword (1 + 5)))) then
                  true
                else false)
    | C_SRLI (v__923, rsd) =>
       returnm (if let nzui5 : bits 1 := subrange_vec_dec v__923 5 5 in
                  let nzui5 : bits 1 := subrange_vec_dec v__923 5 5 in
                  let nzui40 : bits 5 := subrange_vec_dec v__923 4 0 in
                  neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)) then
                  true
                else false)
    | C_SRAI (v__924, rsd) =>
       returnm (if let nzui5 : bits 1 := subrange_vec_dec v__924 5 5 in
                  let nzui5 : bits 1 := subrange_vec_dec v__924 5 5 in
                  let nzui40 : bits 5 := subrange_vec_dec v__924 4 0 in
                  neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)) then
                  true
                else false)
    | C_ANDI (v__925, rsd) => returnm true
    | C_SUB (rsd, rs2) => returnm true
    | C_XOR (rsd, rs2) => returnm true
    | C_OR (rsd, rs2) => returnm true
    | C_AND (rsd, rs2) => returnm true
    | C_SUBW (rsd, rs2) => returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | C_ADDW (rsd, rs2) => returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | C_J v__926 => returnm true
    | C_BEQZ (v__927, rs) => returnm true
    | C_BNEZ (v__928, rs) => returnm true
    | C_SLLI (v__929, rsd) =>
       returnm (if sumbool_of_bool
                  (let nzui5 : bits 1 := subrange_vec_dec v__929 5 5 in
                  let nzui5 : bits 1 := subrange_vec_dec v__929 5 5 in
                  let nzui40 : bits 5 := subrange_vec_dec v__929 4 0 in
                  andb (neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)))
                    (andb (neq_vec rsd zreg) (orb (Z.eqb 32 64) (eq_vec nzui5 ('b"0"  : mword 1)))))
                then
                  true
                else false)
    | C_LWSP (v__930, rd) => returnm (if neq_vec rd zreg then true else false)
    | C_LDSP (v__931, rd) =>
       returnm (if sumbool_of_bool (andb (neq_vec rd zreg) (Z.eqb 32 64)) then true else false)
    | C_SWSP (v__932, rs2) => returnm true
    | C_SDSP (v__933, rs2) => returnm (if sumbool_of_bool (Z.eqb 32 64) then true else false)
    | C_JR rs1 => returnm (if neq_vec rs1 zreg then true else false)
    | C_JALR rs1 => returnm (if neq_vec rs1 zreg then true else false)
    | C_MV (rd, rs2) => returnm (if andb (neq_vec rd zreg) (neq_vec rs2 zreg) then true else false)
    | C_EBREAK tt => returnm true
    | C_ADD (rsd, rs2) =>
       returnm (if andb (neq_vec rsd zreg) (neq_vec rs2 zreg) then true else false)
    | C_NOP_HINT v__934 =>
       returnm (if let im5 : bits 1 := subrange_vec_dec v__934 5 5 in
                  let im5 : bits 1 := subrange_vec_dec v__934 5 5 in
                  let im40 : bits 5 := subrange_vec_dec v__934 4 0 in
                  neq_vec (concat_vec im5 im40) ('b"000000"  : mword (1 + 5)) then
                  true
                else false)
    | C_ADDI_HINT rsd => returnm (if neq_vec rsd zreg then true else false)
    | C_LI_HINT v__935 => returnm true
    | C_LUI_HINT v__936 =>
       returnm (if let imm17 : bits 1 := subrange_vec_dec v__936 5 5 in
                  let imm17 : bits 1 := subrange_vec_dec v__936 5 5 in
                  let imm1612 : bits 5 := subrange_vec_dec v__936 4 0 in
                  neq_vec (concat_vec imm17 imm1612) ('b"000000"  : mword (1 + 5)) then
                  true
                else false)
    | C_MV_HINT rs2 => returnm (if neq_vec rs2 zreg then true else false)
    | C_ADD_HINT rs2 => returnm (if neq_vec rs2 zreg then true else false)
    | C_SLLI_HINT (v__937, rsd) =>
       returnm (if sumbool_of_bool
                  (let nzui5 : bits 1 := subrange_vec_dec v__937 5 5 in
                  let nzui5 : bits 1 := subrange_vec_dec v__937 5 5 in
                  let nzui40 : bits 5 := subrange_vec_dec v__937 4 0 in
                  andb
                    (orb (eq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)))
                       (eq_vec rsd zreg)) (orb (Z.eqb 32 64) (eq_vec nzui5 ('b"0"  : mword 1))))
                then
                  true
                else false)
    | C_SRLI_HINT rsd => returnm true
    | C_SRAI_HINT rsd => returnm true
    | C_FLWSP (v__938, rd) =>
       (and_boolMP
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)}))
          (build_trivial_ex
          ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
           : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__3 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)}) =>
       returnm (if sumbool_of_bool w__3 then true else false)
    | C_FSWSP (v__939, rs2) =>
       (and_boolMP
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)}))
          (build_trivial_ex
          ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
           : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__7 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)}) =>
       returnm (if sumbool_of_bool w__7 then true else false)
    | C_FLW (v__940, rs1, rd) =>
       (and_boolMP
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)}))
          (build_trivial_ex
          ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
           : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__11 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)}) =>
       returnm (if sumbool_of_bool w__11 then true else false)
    | C_FSW (v__941, rs1, rs2) =>
       (and_boolMP
          ((returnm (build_ex
            (projT1
            (build_ex
            (Z.eqb 32 32)
             : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
            32) _bool)}))
          (build_trivial_ex
          ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
           : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__15 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
         (32 =? 32)) _bool = true)}) =>
       returnm (if sumbool_of_bool w__15 then true else false)
    | C_ILLEGAL s => returnm true
    | _ => returnm false
    end)
    : M (bool).

Definition encdec_compressed_backwards_matches (arg_ : mword 16) : M (bool) :=
   let v__942 := arg_ in
   (if eq_vec v__942 (Ox"0001"  : mword 16) then returnm true
    else if andb
              (let nz96 : bits 4 := subrange_vec_dec v__942 10 7 in
              let nz54 : bits 2 := subrange_vec_dec v__942 12 11 in
              let nz3 : bits 1 := subrange_vec_dec v__942 5 5 in
              let nz2 : bits 1 := subrange_vec_dec v__942 6 6 in
              neq_vec (concat_vec nz96 (concat_vec nz54 (concat_vec nz3 nz2)))
                (Ox"00"
                 : mword (4 + (2 + (1 + 1)))))
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"000"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"00"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"010"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__942 1 0) ('b"00"  : mword (1 - 0 + 1))) then
      returnm true
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"011"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__942 1 0) ('b"00"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"110"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__942 1 0) ('b"00"  : mword (1 - 0 + 1))) then
      returnm true
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"111"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__942 1 0) ('b"00"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb
              (let rsd : regidx := subrange_vec_dec v__942 11 7 in
              let nzi5 : bits 1 := subrange_vec_dec v__942 12 12 in
              let nzi40 : bits 5 := subrange_vec_dec v__942 6 2 in
              andb (neq_vec (concat_vec nzi5 nzi40) ('b"000000"  : mword (1 + 5)))
                (neq_vec rsd zreg))
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"000"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      returnm true
    else if sumbool_of_bool
      (andb (Z.eqb 32 32)
         (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"001"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      returnm true
    else if sumbool_of_bool
      (andb
         (let rsd : regidx := subrange_vec_dec v__942 11 7 in
         andb (neq_vec rsd zreg) (Z.eqb 32 64))
         (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"001"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb
              (let rd : regidx := subrange_vec_dec v__942 11 7 in
              neq_vec rd zreg)
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"010"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb
              (let nzi9 : bits 1 := subrange_vec_dec v__942 12 12 in
              let nzi87 : bits 2 := subrange_vec_dec v__942 4 3 in
              let nzi6 : bits 1 := subrange_vec_dec v__942 5 5 in
              let nzi5 : bits 1 := subrange_vec_dec v__942 2 2 in
              let nzi4 : bits 1 := subrange_vec_dec v__942 6 6 in
              neq_vec (concat_vec nzi9 (concat_vec nzi87 (concat_vec nzi6 (concat_vec nzi5 nzi4))))
                ('b"000000"
                 : mword (1 + (2 + (1 + (1 + 1))))))
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"011"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__942 11 7) ('b"00010"  : mword (11 - 7 + 1)))
                    (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb
              (let rd : regidx := subrange_vec_dec v__942 11 7 in
              let imm17 : bits 1 := subrange_vec_dec v__942 12 12 in
              let imm1612 : bits 5 := subrange_vec_dec v__942 6 2 in
              andb (neq_vec rd zreg)
                (andb (neq_vec rd sp)
                   (neq_vec (concat_vec imm17 imm1612) ('b"000000"  : mword (1 + 5)))))
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"011"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb
              (let nzui5 : bits 1 := subrange_vec_dec v__942 12 12 in
              let nzui40 : bits 5 := subrange_vec_dec v__942 6 2 in
              neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)))
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"100"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__942 11 10) ('b"00"  : mword (11 - 10 + 1)))
                    (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb
              (let nzui5 : bits 1 := subrange_vec_dec v__942 12 12 in
              let nzui40 : bits 5 := subrange_vec_dec v__942 6 2 in
              neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)))
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"100"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__942 11 10) ('b"01"  : mword (11 - 10 + 1)))
                    (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"100"  : mword (15 - 13 + 1)))
              (andb (eq_vec (subrange_vec_dec v__942 11 10) ('b"10"  : mword (11 - 10 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 10) ('b"100011"  : mword (15 - 10 + 1)))
              (andb (eq_vec (subrange_vec_dec v__942 6 5) ('b"00"  : mword (6 - 5 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 10) ('b"100011"  : mword (15 - 10 + 1)))
              (andb (eq_vec (subrange_vec_dec v__942 6 5) ('b"01"  : mword (6 - 5 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 10) ('b"100011"  : mword (15 - 10 + 1)))
              (andb (eq_vec (subrange_vec_dec v__942 6 5) ('b"10"  : mword (6 - 5 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 10) ('b"100011"  : mword (15 - 10 + 1)))
              (andb (eq_vec (subrange_vec_dec v__942 6 5) ('b"11"  : mword (6 - 5 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      returnm true
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__942 15 10) ('b"100111"  : mword (15 - 10 + 1)))
            (andb (eq_vec (subrange_vec_dec v__942 6 5) ('b"00"  : mword (6 - 5 + 1)))
               (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))))) then
      returnm true
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__942 15 10) ('b"100111"  : mword (15 - 10 + 1)))
            (andb (eq_vec (subrange_vec_dec v__942 6 5) ('b"01"  : mword (6 - 5 + 1)))
               (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"101"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"110"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"111"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))) then
      returnm true
    else if sumbool_of_bool
      (andb
         (let rsd : regidx := subrange_vec_dec v__942 11 7 in
         let nzui5 : bits 1 := subrange_vec_dec v__942 12 12 in
         let nzui40 : bits 5 := subrange_vec_dec v__942 6 2 in
         andb (neq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5)))
           (andb (neq_vec rsd zreg) (orb (Z.eqb 32 64) (eq_vec nzui5 ('b"0"  : mword 1)))))
         (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"000"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb
              (let rd : regidx := subrange_vec_dec v__942 11 7 in
              neq_vec rd zreg)
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"010"  : mword (15 - 13 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      returnm true
    else if sumbool_of_bool
      (andb
         (let rd : regidx := subrange_vec_dec v__942 11 7 in
         andb (neq_vec rd zreg) (Z.eqb 32 64))
         (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"011"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"110"  : mword (15 - 13 + 1)))
              (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1))) then
      returnm true
    else if sumbool_of_bool
      (andb (Z.eqb 32 64)
         (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"111"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb
              (let rs1 : regidx := subrange_vec_dec v__942 11 7 in
              neq_vec rs1 zreg)
              (andb (eq_vec (subrange_vec_dec v__942 15 12) (Ox"8"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__942 6 0) ('b"0000010"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb
              (let rs1 : regidx := subrange_vec_dec v__942 11 7 in
              neq_vec rs1 zreg)
              (andb (eq_vec (subrange_vec_dec v__942 15 12) (Ox"9"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__942 6 0) ('b"0000010"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb
              (let rs2 : regidx := subrange_vec_dec v__942 6 2 in
              let rd : regidx := subrange_vec_dec v__942 11 7 in
              andb (neq_vec rd zreg) (neq_vec rs2 zreg))
              (andb (eq_vec (subrange_vec_dec v__942 15 12) (Ox"8"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      returnm true
    else if eq_vec v__942 (Ox"9002"  : mword 16) then returnm true
    else if andb
              (let rsd : regidx := subrange_vec_dec v__942 11 7 in
              let rs2 : regidx := subrange_vec_dec v__942 6 2 in
              andb (neq_vec rsd zreg) (neq_vec rs2 zreg))
              (andb (eq_vec (subrange_vec_dec v__942 15 12) (Ox"9"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb
              (let im5 : bits 1 := subrange_vec_dec v__942 12 12 in
              let im40 : bits 5 := subrange_vec_dec v__942 6 2 in
              neq_vec (concat_vec im5 im40) ('b"000000"  : mword (1 + 5)))
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"000"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__942 11 7) ('b"00000"  : mword (11 - 7 + 1)))
                    (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb
              (let rsd : regidx := subrange_vec_dec v__942 11 7 in
              neq_vec rsd zreg)
              (andb (eq_vec (subrange_vec_dec v__942 15 12) (Ox"0"  : mword (15 - 12 + 1)))
                 (eq_vec (subrange_vec_dec v__942 6 0) ('b"0000001"  : mword (6 - 0 + 1)))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"010"  : mword (15 - 13 + 1)))
              (andb (eq_vec (subrange_vec_dec v__942 11 7) ('b"00000"  : mword (11 - 7 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb
              (let imm17 : bits 1 := subrange_vec_dec v__942 12 12 in
              let imm1612 : bits 5 := subrange_vec_dec v__942 6 2 in
              neq_vec (concat_vec imm17 imm1612) ('b"000000"  : mword (1 + 5)))
              (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"011"  : mword (15 - 13 + 1)))
                 (andb (eq_vec (subrange_vec_dec v__942 11 7) ('b"00000"  : mword (11 - 7 + 1)))
                    (eq_vec (subrange_vec_dec v__942 1 0) ('b"01"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb
              (let rs2 : regidx := subrange_vec_dec v__942 6 2 in
              neq_vec rs2 zreg)
              (andb (eq_vec (subrange_vec_dec v__942 15 7) ('b"100000000"  : mword (15 - 7 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      returnm true
    else if andb
              (let rs2 : regidx := subrange_vec_dec v__942 6 2 in
              neq_vec rs2 zreg)
              (andb (eq_vec (subrange_vec_dec v__942 15 7) ('b"100100000"  : mword (15 - 7 + 1)))
                 (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1)))) then
      returnm true
    else if sumbool_of_bool
      (andb
         (let rsd : regidx := subrange_vec_dec v__942 11 7 in
         let nzui5 : bits 1 := subrange_vec_dec v__942 12 12 in
         let nzui40 : bits 5 := subrange_vec_dec v__942 6 2 in
         andb
           (orb (eq_vec (concat_vec nzui5 nzui40) ('b"000000"  : mword (1 + 5))) (eq_vec rsd zreg))
           (orb (Z.eqb 32 64) (eq_vec nzui5 ('b"0"  : mword 1))))
         (andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"000"  : mword (15 - 13 + 1)))
            (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1))))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 10) ('b"100000"  : mword (15 - 10 + 1)))
              (eq_vec (subrange_vec_dec v__942 6 0) ('b"0000001"  : mword (6 - 0 + 1))) then
      returnm true
    else if andb (eq_vec (subrange_vec_dec v__942 15 10) ('b"100001"  : mword (15 - 10 + 1)))
              (eq_vec (subrange_vec_dec v__942 6 0) ('b"0000001"  : mword (6 - 0 + 1))) then
      returnm true
    else
      (and_boolMP
         (((and_boolMP
              ((returnm (build_ex
                (projT1
                (build_ex
                (Z.eqb 32 32)
                 : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
                32) _bool)}))
              (build_trivial_ex
              ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
               : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
           (32 =? 32)) _bool = true)}))
          : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
           (32 =? 32)) _bool = true)}))
         (build_trivial_ex
         (returnm ((andb (eq_vec (subrange_vec_dec v__942 15 13) ('b"011"  : mword (15 - 13 + 1)))
                      (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1))))
           : bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__4 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
        (32 =? 32)) _bool = true)}) =>
      (if sumbool_of_bool w__4 then returnm true
       else
         (and_boolMP
            (((and_boolMP
                 ((returnm (build_ex
                   (projT1
                   (build_ex
                   (Z.eqb 32 32)
                    : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
                   32) _bool)}))
                 (build_trivial_ex
                 ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
                  : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
              (32 =? 32)) _bool = true)}))
             : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
              (32 =? 32)) _bool = true)}))
            (build_trivial_ex
            (returnm ((andb
                         (eq_vec (subrange_vec_dec v__942 15 13) ('b"111"  : mword (15 - 13 + 1)))
                         (eq_vec (subrange_vec_dec v__942 1 0) ('b"10"  : mword (1 - 0 + 1))))
              : bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
           (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__9 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
           (32 =? 32)) _bool = true)}) =>
         (if sumbool_of_bool w__9 then returnm true
          else
            (and_boolMP
               (((and_boolMP
                    ((returnm (build_ex
                      (projT1
                      (build_ex
                      (Z.eqb 32 32)
                       : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
                      32) _bool)}))
                    (build_trivial_ex
                    ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
                     : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                 (32 =? 32)) _bool = true)}))
                : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                 (32 =? 32)) _bool = true)}))
               (build_trivial_ex
               (returnm ((andb
                            (eq_vec (subrange_vec_dec v__942 15 13) ('b"011"  : mword (15 - 13 + 1)))
                            (eq_vec (subrange_vec_dec v__942 1 0) ('b"00"  : mword (1 - 0 + 1))))
                 : bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
              (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__14 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
              (32 =? 32)) _bool = true)}) =>
            (if sumbool_of_bool w__14 then returnm true
             else
               (and_boolMP
                  (((and_boolMP
                       ((returnm (build_ex
                         (projT1
                         (build_ex
                         (Z.eqb 32 32)
                          : {_bool : bool & ArithFact (Bool.eqb (32 =? 32) _bool)})))) : M ({_bool : bool & ArithFact (Bool.eqb (32 =?
                         32) _bool)}))
                       (build_trivial_ex
                       ((and_boolM ((haveRVC tt)  : M (bool)) ((haveFExt tt)  : M (bool)))
                        : M (bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                    (32 =? 32)) _bool = true)}))
                   : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 && (32 =? 32)) _bool = true)})) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                    (32 =? 32)) _bool = true)}))
                  (build_trivial_ex
                  (returnm ((andb
                               (eq_vec (subrange_vec_dec v__942 15 13)
                                  ('b"111"
                                   : mword (15 - 13 + 1)))
                               (eq_vec (subrange_vec_dec v__942 1 0) ('b"00"  : mword (1 - 0 + 1))))
                    : bool))) : M ({_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                 (32 =? 32)) _bool = true)})) >>= fun '(existT _ w__19 _ : {_bool : bool & ArithFactP (exists simp_0 , Bool.eqb (simp_0 &&
                 (32 =? 32)) _bool = true)}) =>
               returnm (if sumbool_of_bool w__19 then true else true))
             : M (bool))
          : M (bool))
       : M (bool))
    : M (bool).

Definition execute_WFI '(tt : unit) : M (Retired) :=
   read_reg cur_privilege_ref >>= fun w__0 : Privilege =>
   (match w__0 with
    | Machine => (platform_wfi tt) >> returnm RETIRE_SUCCESS
    | Supervisor =>
       read_reg mstatus_ref >>= fun w__1 : Mstatus =>
       (if eq_vec (_get_Mstatus_TW w__1) ('b"1"  : mword 1) then
          (handle_illegal tt) >> returnm RETIRE_FAIL
        else (platform_wfi tt) >> returnm RETIRE_SUCCESS)
        : M (Retired)
    | User => (handle_illegal tt) >> returnm RETIRE_FAIL
    end)
    : M (Retired).

Definition execute_UTYPE (imm : mword 20) (rd : mword 5) (op : uop) : M (Retired) :=
   let off : xlenbits := EXTS 32 (concat_vec imm (Ox"000"  : mword 12)) in
   (match op with
    | RISCV_LUI => returnm off
    | RISCV_AUIPC => (get_arch_pc tt) >>= fun w__0 : mword 32 => returnm (add_vec w__0 off)
    end) >>= fun ret : xlenbits =>
   (wX_bits rd ret) >> returnm RETIRE_SUCCESS.

Definition execute_URET '(tt : unit) : M (Retired) :=
   (or_boolM ((haveUsrMode tt) >>= fun w__0 : bool => returnm ((negb w__0)  : bool))
      (returnm ((negb (sys_enable_next tt))  : bool))) >>= fun w__1 : bool =>
   (if sumbool_of_bool w__1 then (handle_illegal tt)  : M (unit)
    else if negb (ext_check_xret_priv User) then returnm (ext_fail_xret_priv tt)
    else
      read_reg cur_privilege_ref >>= fun w__2 : Privilege =>
      ((read_reg PC_ref)  : M (mword 32)) >>= fun w__3 : mword 32 =>
      (exception_handler w__2 (CTL_URET tt) w__3) >>= fun w__4 : mword 32 =>
      (set_next_pc w__4)
       : M (unit)) >>
   returnm RETIRE_FAIL.

Definition execute_STORE_FP (imm : mword 12) (rs2 : mword 5) (rs1 : mword 5) (width : word_width)
: M (Retired) :=
   let offset : xlenbits := EXTS 32 imm in
   let '(aq, rl, con) := (false, false, false) in
   (ext_data_get_addr rs1 offset (Write Data) width) >>= fun w__0 : Ext_DataAddr_Check unit =>
   (match w__0 with
    | Ext_DataAddr_Error e =>
       let '_ := (ext_handle_data_check_error e)  : unit in
       returnm RETIRE_FAIL
    | Ext_DataAddr_OK vaddr =>
       (if check_misaligned vaddr width then
          (handle_mem_exception vaddr (E_SAMO_Addr_Align tt)) >> returnm RETIRE_FAIL
        else
          (translateAddr vaddr (Write Data)) >>= fun w__1 : TR_Result (mword 32) ExceptionType =>
          (match w__1 with
           | TR_Failure (e, _) => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
           | TR_Address (addr, _) =>
              (match width with
               | BYTE => returnm (MemValue tt)
               | HALF => returnm (MemValue tt)
               | WORD => (mem_write_ea addr 4 aq rl false)  : M (MemoryOpResult unit)
               | DOUBLE => (mem_write_ea addr 8 aq rl false)  : M (MemoryOpResult unit)
               end) >>= fun eares : MemoryOpResult unit =>
              (match eares with
               | MemException e => (handle_mem_exception addr e) >> returnm RETIRE_FAIL
               | MemValue _ =>
                  (rF_bits rs2) >>= fun rs2_val =>
                  (match (width, 32) with
                   | (BYTE, g__321) => (handle_illegal tt) >> returnm RETIRE_FAIL
                   | (HALF, g__322) => (handle_illegal tt) >> returnm RETIRE_FAIL
                   | (WORD, g__323) =>
                      (mem_write_value addr 4 (subrange_vec_dec rs2_val 31 0) aq rl con) >>= fun w__4 : MemoryOpResult bool =>
                      (process_fstore vaddr w__4)
                       : M (Retired)
                   | _ =>
                      assert_exp' false "Pattern match failure at model/riscv_insts_fext.sail 401:14 - 406:15" >>= fun _ =>
                      exit tt
                   end)
                   : M (Retired)
               end)
               : M (Retired)
           end)
           : M (Retired))
        : M (Retired)
    end)
    : M (Retired).

Definition execute_STORECON
(aq : bool) (rl : bool) (rs2 : mword 5) (rs1 : mword 5) (width : word_width) (rd : mword 5)
: M (Retired) :=
   (speculate_conditional tt) >>= fun w__0 : bool =>
   (if Bool.eqb w__0 false then (wX_bits rd (EXTZ 32 ('b"1"  : mword 1))) >> returnm RETIRE_SUCCESS
    else
      (haveAtomics tt) >>= fun w__1 : bool =>
      (if sumbool_of_bool w__1 then
         (ext_data_get_addr rs1 (zeros_implicit 32) (Write Data) width) >>= fun w__2 : Ext_DataAddr_Check unit =>
         (match w__2 with
          | Ext_DataAddr_Error e =>
             let '_ := (ext_handle_data_check_error e)  : unit in
             returnm RETIRE_FAIL
          | Ext_DataAddr_OK vaddr =>
             let aligned : bool :=
               match width with
               | BYTE => true
               | HALF => eq_vec (subrange_vec_dec vaddr 0 0) ('b"0"  : mword (0 - 0 + 1))
               | WORD => eq_vec (subrange_vec_dec vaddr 1 0) ('b"00"  : mword (1 - 0 + 1))
               | DOUBLE => eq_vec (subrange_vec_dec vaddr 2 0) ('b"000"  : mword (2 - 0 + 1))
               end in
             (if sumbool_of_bool (negb aligned) then
                (handle_mem_exception vaddr (E_SAMO_Addr_Align tt)) >> returnm RETIRE_FAIL
              else if Bool.eqb (match_reservation vaddr) false then
                (wX_bits rd (EXTZ 32 ('b"1"  : mword 1))) >>
                let '_ := (cancel_reservation tt)  : unit in
                returnm RETIRE_SUCCESS
              else
                (translateAddr vaddr (Write Data)) >>= fun w__3 : TR_Result (mword 32) ExceptionType =>
                (match w__3 with
                 | TR_Failure (e, _) => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
                 | TR_Address (addr, _) =>
                    (match (width, 32) with
                     | (BYTE, _) =>
                        (mem_write_ea addr 1 (andb aq rl) rl true)  : M (MemoryOpResult unit)
                     | (HALF, _) =>
                        (mem_write_ea addr 2 (andb aq rl) rl true)  : M (MemoryOpResult unit)
                     | (WORD, _) =>
                        (mem_write_ea addr 4 (andb aq rl) rl true)  : M (MemoryOpResult unit)
                     | _ =>
                        (internal_error "STORECON expected word or double")
                         : M (MemoryOpResult unit)
                     end) >>= fun eares : MemoryOpResult unit =>
                    (match eares with
                     | MemException e => (handle_mem_exception addr e) >> returnm RETIRE_FAIL
                     | MemValue _ =>
                        (rX_bits rs2) >>= fun rs2_val =>
                        (match (width, 32) with
                         | (BYTE, _) =>
                            (mem_write_value addr 1 (subrange_vec_dec rs2_val 7 0) (andb aq rl) rl
                               true)
                             : M (MemoryOpResult bool)
                         | (HALF, _) =>
                            (mem_write_value addr 2 (subrange_vec_dec rs2_val 15 0) (andb aq rl) rl
                               true)
                             : M (MemoryOpResult bool)
                         | (WORD, _) =>
                            (mem_write_value addr 4 (subrange_vec_dec rs2_val 31 0) (andb aq rl) rl
                               true)
                             : M (MemoryOpResult bool)
                         | _ =>
                            (internal_error "STORECON expected word or double")
                             : M (MemoryOpResult bool)
                         end) >>= fun res : MemoryOpResult bool =>
                        (match res with
                         | MemValue true =>
                            (wX_bits rd (EXTZ 32 ('b"0"  : mword 1))) >>
                            let '_ := (cancel_reservation tt)  : unit in
                            returnm RETIRE_SUCCESS
                         | MemValue false =>
                            (wX_bits rd (EXTZ 32 ('b"1"  : mword 1))) >>
                            let '_ := (cancel_reservation tt)  : unit in
                            returnm RETIRE_SUCCESS
                         | MemException e => (handle_mem_exception addr e) >> returnm RETIRE_FAIL
                         end)
                         : M (Retired)
                     end)
                     : M (Retired)
                 end)
                 : M (Retired))
              : M (Retired)
          end)
          : M (Retired)
       else (handle_illegal tt) >> returnm RETIRE_FAIL)
       : M (Retired))
    : M (Retired).

Definition execute_STORE
(imm : mword 12) (rs2 : mword 5) (rs1 : mword 5) (width : word_width) (aq : bool) (rl : bool)
: M (Retired) :=
   let offset : xlenbits := EXTS 32 imm in
   (ext_data_get_addr rs1 offset (Write Data) width) >>= fun w__0 : Ext_DataAddr_Check unit =>
   (match w__0 with
    | Ext_DataAddr_Error e =>
       let '_ := (ext_handle_data_check_error e)  : unit in
       returnm RETIRE_FAIL
    | Ext_DataAddr_OK vaddr =>
       (if check_misaligned vaddr width then
          (handle_mem_exception vaddr (E_SAMO_Addr_Align tt)) >> returnm RETIRE_FAIL
        else
          (translateAddr vaddr (Write Data)) >>= fun w__1 : TR_Result (mword 32) ExceptionType =>
          (match w__1 with
           | TR_Failure (e, _) => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
           | TR_Address (paddr, _) =>
              (match width with
               | BYTE => (mem_write_ea paddr 1 aq rl false)  : M (MemoryOpResult unit)
               | HALF => (mem_write_ea paddr 2 aq rl false)  : M (MemoryOpResult unit)
               | WORD => (mem_write_ea paddr 4 aq rl false)  : M (MemoryOpResult unit)
               | DOUBLE => (mem_write_ea paddr 8 aq rl false)  : M (MemoryOpResult unit)
               end) >>= fun eares : MemoryOpResult unit =>
              (match eares with
               | MemException e => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
               | MemValue _ =>
                  (rX_bits rs2) >>= fun rs2_val =>
                  (match (width, 32) with
                   | (BYTE, g__313) =>
                      (mem_write_value paddr 1 (subrange_vec_dec rs2_val 7 0) aq rl false)
                       : M (MemoryOpResult bool)
                   | (HALF, g__314) =>
                      (mem_write_value paddr 2 (subrange_vec_dec rs2_val 15 0) aq rl false)
                       : M (MemoryOpResult bool)
                   | (WORD, g__315) =>
                      (mem_write_value paddr 4 (subrange_vec_dec rs2_val 31 0) aq rl false)
                       : M (MemoryOpResult bool)
                   | _ =>
                      assert_exp' false "Pattern match failure at model/riscv_insts_base.sail 394:47 - 399:15" >>= fun _ =>
                      exit tt
                   end) >>= fun res : MemoryOpResult bool =>
                  (match res with
                   | MemValue true => returnm RETIRE_SUCCESS
                   | MemValue false =>
                      (internal_error "store got false from mem_write_value")  : M (Retired)
                   | MemException e => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
                   end)
                   : M (Retired)
               end)
               : M (Retired)
           end)
           : M (Retired))
        : M (Retired)
    end)
    : M (Retired).

Definition execute_SRET '(tt : unit) : M (Retired) :=
   read_reg cur_privilege_ref >>= fun w__0 : Privilege =>
   (match w__0 with
    | User => returnm true
    | Supervisor =>
       (or_boolM ((haveSupMode tt) >>= fun w__1 : bool => returnm ((negb w__1)  : bool))
          (read_reg mstatus_ref >>= fun w__2 : Mstatus =>
           returnm ((eq_vec (_get_Mstatus_TSR w__2) ('b"1"  : mword 1))  : bool)))
        : M (bool)
    | Machine => (haveSupMode tt) >>= fun w__4 : bool => returnm (negb w__4)
    end) >>= fun sret_illegal : bool =>
   (if sumbool_of_bool sret_illegal then (handle_illegal tt) >> returnm RETIRE_FAIL
    else if negb (ext_check_xret_priv Supervisor) then
      let '_ := (ext_fail_xret_priv tt)  : unit in
      returnm RETIRE_FAIL
    else
      read_reg cur_privilege_ref >>= fun w__5 : Privilege =>
      ((read_reg PC_ref)  : M (mword 32)) >>= fun w__6 : mword 32 =>
      (exception_handler w__5 (CTL_SRET tt) w__6) >>= fun w__7 : mword 32 =>
      (set_next_pc w__7) >> returnm RETIRE_SUCCESS)
    : M (Retired).

Definition execute_SHIFTW (shamt : mword 5) (rs1 : mword 5) (rd : mword 5) (op : sop) : M (Retired) :=
   (rX_bits rs1) >>= fun w__0 : mword 32 =>
   let rs1_val := subrange_vec_dec w__0 31 0 in
   let result : bits 32 :=
     match op with
     | RISCV_SLLI => shift_bits_left rs1_val shamt
     | RISCV_SRLI => shift_bits_right rs1_val shamt
     | RISCV_SRAI => shift_right_arith32 rs1_val shamt
     end in
   (wX_bits rd (EXTS 32 result)) >> returnm RETIRE_SUCCESS.

Definition execute_SHIFTIWOP (shamt : mword 5) (rs1 : mword 5) (rd : mword 5) (op : sopw)
: M (Retired) :=
   (rX_bits rs1) >>= fun rs1_val =>
   let result : bits 32 :=
     match op with
     | RISCV_SLLIW => shift_bits_left (subrange_vec_dec rs1_val 31 0) shamt
     | RISCV_SRLIW => shift_bits_right (subrange_vec_dec rs1_val 31 0) shamt
     | RISCV_SRAIW => shift_right_arith32 (subrange_vec_dec rs1_val 31 0) shamt
     end in
   (wX_bits rd (EXTS 32 result)) >> returnm RETIRE_SUCCESS.

Definition execute_SHIFTIOP (shamt : mword 6) (rs1 : mword 5) (rd : mword 5) (op : sop)
: M (Retired) :=
   (rX_bits rs1) >>= fun rs1_val =>
   let result : xlenbits :=
     match op with
     | RISCV_SLLI => shift_bits_left rs1_val (subrange_vec_dec shamt 4 0)
     | RISCV_SRLI => shift_bits_right rs1_val (subrange_vec_dec shamt 4 0)
     | RISCV_SRAI => shift_right_arith32 rs1_val (subrange_vec_dec shamt 4 0)
     end in
   (wX_bits rd result) >> returnm RETIRE_SUCCESS.

Definition execute_SFENCE_VMA (rs1 : mword 5) (rs2 : mword 5) : M (Retired) :=
   (if eq_vec rs1 ('b"00000"  : mword 5) then returnm None
    else (rX_bits rs1) >>= fun w__0 : mword 32 => returnm (Some w__0)) >>= fun addr : option xlenbits =>
   (if eq_vec rs2 ('b"00000"  : mword 5) then returnm None
    else (rX_bits rs2) >>= fun w__1 : mword 32 => returnm (Some w__1)) >>= fun asid : option xlenbits =>
   read_reg cur_privilege_ref >>= fun w__2 : Privilege =>
   (match w__2 with
    | User => (handle_illegal tt) >> returnm RETIRE_FAIL
    | Supervisor =>
       read_reg mstatus_ref >>= fun w__3 : Mstatus =>
       read_reg mstatus_ref >>= fun w__4 : Mstatus =>
       let p__317 := (architecture (get_mstatus_SXL w__3), _get_Mstatus_TVM w__4) in
       (match p__317 with
        | (Some g__316, b__0) =>
           (if eq_vec b__0 ('b"1"  : mword 1) then (handle_illegal tt) >> returnm RETIRE_FAIL
            else if eq_vec b__0 ('b"0"  : mword 1) then
              (flush_TLB asid addr) >> returnm RETIRE_SUCCESS
            else
              (match (Some g__316, b__0) with
               | (_, _) => (internal_error "unimplemented sfence architecture")  : M (Retired)
               end)
               : M (Retired))
            : M (Retired)
        | (_, _) => (internal_error "unimplemented sfence architecture")  : M (Retired)
        end)
        : M (Retired)
    | Machine => (flush_TLB asid addr) >> returnm RETIRE_SUCCESS
    end)
    : M (Retired).

Definition execute_RTYPEW (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (op : ropw) : M (Retired) :=
   (rX_bits rs1) >>= fun w__0 : mword 32 =>
   let rs1_val := subrange_vec_dec w__0 31 0 in
   (rX_bits rs2) >>= fun w__1 : mword 32 =>
   let rs2_val := subrange_vec_dec w__1 31 0 in
   let result : bits 32 :=
     match op with
     | RISCV_ADDW => add_vec rs1_val rs2_val
     | RISCV_SUBW => sub_vec rs1_val rs2_val
     | RISCV_SLLW => shift_bits_left rs1_val (subrange_vec_dec rs2_val 4 0)
     | RISCV_SRLW => shift_bits_right rs1_val (subrange_vec_dec rs2_val 4 0)
     | RISCV_SRAW => shift_right_arith32 rs1_val (subrange_vec_dec rs2_val 4 0)
     end in
   (wX_bits rd (EXTS 32 result)) >> returnm RETIRE_SUCCESS.

Definition execute_RTYPE (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (op : rop) : M (Retired) :=
   (rX_bits rs1) >>= fun rs1_val =>
   (rX_bits rs2) >>= fun rs2_val =>
   let result : xlenbits :=
     match op with
     | RISCV_ADD => add_vec rs1_val rs2_val
     | RISCV_SLT => EXTZ 32 (bool_to_bits (zopz0zI_s rs1_val rs2_val))
     | RISCV_SLTU => EXTZ 32 (bool_to_bits (zopz0zI_u rs1_val rs2_val))
     | RISCV_AND => and_vec rs1_val rs2_val
     | RISCV_OR => or_vec rs1_val rs2_val
     | RISCV_XOR => xor_vec rs1_val rs2_val
     | RISCV_SLL => shift_bits_left rs1_val (subrange_vec_dec rs2_val 4 0)
     | RISCV_SRL => shift_bits_right rs1_val (subrange_vec_dec rs2_val 4 0)
     | RISCV_SUB => sub_vec rs1_val rs2_val
     | RISCV_SRA => shift_right_arith32 rs1_val (subrange_vec_dec rs2_val 4 0)
     end in
   (wX_bits rd result) >> returnm RETIRE_SUCCESS.

Definition execute_RISCV_JALR (imm : mword 12) (rs1 : mword 5) (rd : mword 5) : M (Retired) :=
   (rX_bits rs1) >>= fun w__0 : mword 32 =>
   let t : xlenbits := add_vec w__0 (EXTS 32 imm) in
   (match (ext_control_check_addr t) with
    | Ext_ControlAddr_Error e =>
       let '_ := (ext_handle_control_check_error e)  : unit in
       returnm RETIRE_FAIL
    | Ext_ControlAddr_OK addr =>
       let target := update_vec_dec addr 0 B0 in
       (and_boolM ((bit_to_bool (access_vec_dec target 1))  : M (bool))
          ((haveRVC tt) >>= fun w__2 : bool => returnm ((negb w__2)  : bool))) >>= fun w__3 : bool =>
       (if sumbool_of_bool w__3 then
          (handle_mem_exception target (E_Fetch_Addr_Align tt)) >> returnm RETIRE_FAIL
        else
          (get_next_pc tt) >>= fun w__4 : mword 32 =>
          (wX_bits rd w__4) >> (set_next_pc target) >> returnm RETIRE_SUCCESS)
        : M (Retired)
    end)
    : M (Retired).

Definition execute_RISCV_JAL (imm : mword 21) (rd : mword 5) : M (Retired) :=
   ((read_reg PC_ref)  : M (mword 32)) >>= fun w__0 : mword 32 =>
   let t : xlenbits := add_vec w__0 (EXTS 32 imm) in
   (match (ext_control_check_pc t) with
    | Ext_ControlAddr_Error e =>
       let '_ := (ext_handle_control_check_error e)  : unit in
       returnm RETIRE_FAIL
    | Ext_ControlAddr_OK target =>
       (and_boolM ((bit_to_bool (access_vec_dec target 1))  : M (bool))
          ((haveRVC tt) >>= fun w__2 : bool => returnm ((negb w__2)  : bool))) >>= fun w__3 : bool =>
       (if sumbool_of_bool w__3 then
          (handle_mem_exception target (E_Fetch_Addr_Align tt)) >> returnm RETIRE_FAIL
        else
          (get_next_pc tt) >>= fun w__4 : mword 32 =>
          (wX_bits rd w__4) >> (set_next_pc target) >> returnm RETIRE_SUCCESS)
        : M (Retired)
    end)
    : M (Retired).

Definition execute_REMW (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (s : bool) : M (Retired) :=
   (haveMulDiv tt) >>= fun w__0 : bool =>
   (if sumbool_of_bool w__0 then
      (rX_bits rs1) >>= fun w__1 : mword 32 =>
      let rs1_val := subrange_vec_dec w__1 31 0 in
      (rX_bits rs2) >>= fun w__2 : mword 32 =>
      let rs2_val := subrange_vec_dec w__2 31 0 in
      let rs1_int : Z := if sumbool_of_bool s then projT1 (sint rs1_val) else projT1 (uint rs1_val) in
      let rs2_int : Z := if sumbool_of_bool s then projT1 (sint rs2_val) else projT1 (uint rs2_val) in
      let r : Z := if sumbool_of_bool (Z.eqb rs2_int 0) then rs1_int else Z.rem rs1_int rs2_int in
      (wX_bits rd (EXTS 32 (to_bits 32 r))) >> returnm RETIRE_SUCCESS
    else (handle_illegal tt) >> returnm RETIRE_FAIL)
    : M (Retired).

Definition execute_REM (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (s : bool) : M (Retired) :=
   (haveMulDiv tt) >>= fun w__0 : bool =>
   (if sumbool_of_bool w__0 then
      (rX_bits rs1) >>= fun rs1_val =>
      (rX_bits rs2) >>= fun rs2_val =>
      let rs1_int : Z := if sumbool_of_bool s then projT1 (sint rs1_val) else projT1 (uint rs1_val) in
      let rs2_int : Z := if sumbool_of_bool s then projT1 (sint rs2_val) else projT1 (uint rs2_val) in
      let r : Z := if sumbool_of_bool (Z.eqb rs2_int 0) then rs1_int else Z.rem rs1_int rs2_int in
      (wX_bits rd (to_bits 32 r)) >> returnm RETIRE_SUCCESS
    else (handle_illegal tt) >> returnm RETIRE_FAIL)
    : M (Retired).

Definition execute_MULW (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) : M (Retired) :=
   (haveMulDiv tt) >>= fun w__0 : bool =>
   (if sumbool_of_bool w__0 then
      (rX_bits rs1) >>= fun w__1 : mword 32 =>
      let rs1_val := subrange_vec_dec w__1 31 0 in
      (rX_bits rs2) >>= fun w__2 : mword 32 =>
      let rs2_val := subrange_vec_dec w__2 31 0 in
      let rs1_int : Z := projT1 (sint rs1_val) in
      let rs2_int : Z := projT1 (sint rs2_val) in
      let result32 := subrange_vec_dec (to_bits 64 (Z.mul rs1_int rs2_int)) 31 0 in
      let result : xlenbits := EXTS 32 result32 in
      (wX_bits rd result) >> returnm RETIRE_SUCCESS
    else (handle_illegal tt) >> returnm RETIRE_FAIL)
    : M (Retired).

Definition execute_MUL
(rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (high : bool) (signed1 : bool) (signed2 : bool)
: M (Retired) :=
   (haveMulDiv tt) >>= fun w__0 : bool =>
   (if sumbool_of_bool w__0 then
      (rX_bits rs1) >>= fun rs1_val =>
      (rX_bits rs2) >>= fun rs2_val =>
      let rs1_int : Z :=
        if sumbool_of_bool signed1 then projT1 (sint rs1_val)
        else projT1 (uint rs1_val) in
      let rs2_int : Z :=
        if sumbool_of_bool signed2 then projT1 (sint rs2_val)
        else projT1 (uint rs2_val) in
      let result_wide := to_bits (Z.mul 2 32) (Z.mul rs1_int rs2_int) in
      let result :=
        if sumbool_of_bool high then subrange_vec_dec result_wide (Z.sub (Z.mul 2 32) 1) 32
        else subrange_vec_dec result_wide (Z.sub 32 1) 0 in
      (wX_bits rd result) >> returnm RETIRE_SUCCESS
    else (handle_illegal tt) >> returnm RETIRE_FAIL)
    : M (Retired).

Definition execute_MRET '(tt : unit) : M (Retired) :=
   read_reg cur_privilege_ref >>= fun w__0 : Privilege =>
   (if generic_neq w__0 Machine then (handle_illegal tt) >> returnm RETIRE_FAIL
    else if negb (ext_check_xret_priv Machine) then
      let '_ := (ext_fail_xret_priv tt)  : unit in
      returnm RETIRE_FAIL
    else
      read_reg cur_privilege_ref >>= fun w__1 : Privilege =>
      ((read_reg PC_ref)  : M (mword 32)) >>= fun w__2 : mword 32 =>
      (exception_handler w__1 (CTL_MRET tt) w__2) >>= fun w__3 : mword 32 =>
      (set_next_pc w__3) >> returnm RETIRE_SUCCESS)
    : M (Retired).

Definition execute_LOAD_FP (imm : mword 12) (rs1 : mword 5) (rd : mword 5) (width : word_width)
: M (Retired) :=
   let offset : xlenbits := EXTS 32 imm in
   (ext_data_get_addr rs1 offset (Read Data) width) >>= fun w__0 : Ext_DataAddr_Check unit =>
   (match w__0 with
    | Ext_DataAddr_Error e =>
       let '_ := (ext_handle_data_check_error e)  : unit in
       returnm RETIRE_FAIL
    | Ext_DataAddr_OK vaddr =>
       (if check_misaligned vaddr width then
          (handle_mem_exception vaddr (E_Load_Addr_Align tt)) >> returnm RETIRE_FAIL
        else
          (translateAddr vaddr (Read Data)) >>= fun w__1 : TR_Result (mword 32) ExceptionType =>
          (match w__1 with
           | TR_Failure (e, _) => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
           | TR_Address (addr, _) =>
              let '(aq, rl, res) := (false, false, false) in
              (match (width, 32) with
               | (BYTE, g__318) => (handle_illegal tt) >> returnm RETIRE_FAIL
               | (HALF, g__319) => (handle_illegal tt) >> returnm RETIRE_FAIL
               | (WORD, g__320) =>
                  (mem_read (Read Data) addr 4 aq rl res) >>= fun w__2 : MemoryOpResult (mword (8 * 4)) =>
                  (process_fload32 rd vaddr w__2)
                   : M (Retired)
               | _ =>
                  assert_exp' false "Pattern match failure at model/riscv_insts_fext.sail 331:10 - 338:11" >>= fun _ =>
                  exit tt
               end)
               : M (Retired)
           end)
           : M (Retired))
        : M (Retired)
    end)
    : M (Retired).

Definition execute_LOADRES
(aq : bool) (rl : bool) (rs1 : mword 5) (width : word_width) (rd : mword 5)
: M (Retired) :=
   (haveAtomics tt) >>= fun w__0 : bool =>
   (if sumbool_of_bool w__0 then
      (ext_data_get_addr rs1 (zeros_implicit 32) (Read Data) width) >>= fun w__1 : Ext_DataAddr_Check unit =>
      (match w__1 with
       | Ext_DataAddr_Error e =>
          let '_ := (ext_handle_data_check_error e)  : unit in
          returnm RETIRE_FAIL
       | Ext_DataAddr_OK vaddr =>
          let aligned : bool :=
            match width with
            | BYTE => true
            | HALF => eq_vec (subrange_vec_dec vaddr 0 0) ('b"0"  : mword (0 - 0 + 1))
            | WORD => eq_vec (subrange_vec_dec vaddr 1 0) ('b"00"  : mword (1 - 0 + 1))
            | DOUBLE => eq_vec (subrange_vec_dec vaddr 2 0) ('b"000"  : mword (2 - 0 + 1))
            end in
          (if sumbool_of_bool (negb aligned) then
             (handle_mem_exception vaddr (E_Load_Addr_Align tt)) >> returnm RETIRE_FAIL
           else
             (translateAddr vaddr (Read Data)) >>= fun w__2 : TR_Result (mword 32) ExceptionType =>
             (match w__2 with
              | TR_Failure (e, _) => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
              | TR_Address (addr, _) =>
                 (match (width, 32) with
                  | (BYTE, _) =>
                     (mem_read (Read Data) addr 1 aq (andb aq rl) true) >>= fun w__3 : MemoryOpResult (mword (8 * 1)) =>
                     (process_loadres rd vaddr w__3 false)
                      : M (Retired)
                  | (HALF, _) =>
                     (mem_read (Read Data) addr 2 aq (andb aq rl) true) >>= fun w__5 : MemoryOpResult (mword (8 * 2)) =>
                     (process_loadres rd vaddr w__5 false)
                      : M (Retired)
                  | (WORD, _) =>
                     (mem_read (Read Data) addr 4 aq (andb aq rl) true) >>= fun w__7 : MemoryOpResult (mword (8 * 4)) =>
                     (process_loadres rd vaddr w__7 false)
                      : M (Retired)
                  | _ => (internal_error "Unexpected AMO width")  : M (Retired)
                  end)
                  : M (Retired)
              end)
              : M (Retired))
           : M (Retired)
       end)
       : M (Retired)
    else (handle_illegal tt) >> returnm RETIRE_FAIL)
    : M (Retired).

Definition execute_LOAD
(imm : mword 12) (rs1 : mword 5) (rd : mword 5) (is_unsigned : bool) (width : word_width)
(aq : bool) (rl : bool)
: M (Retired) :=
   let offset : xlenbits := EXTS 32 imm in
   (ext_data_get_addr rs1 offset (Read Data) width) >>= fun w__0 : Ext_DataAddr_Check unit =>
   (match w__0 with
    | Ext_DataAddr_Error e =>
       let '_ := (ext_handle_data_check_error e)  : unit in
       returnm RETIRE_FAIL
    | Ext_DataAddr_OK vaddr =>
       (if check_misaligned vaddr width then
          (handle_mem_exception vaddr (E_Load_Addr_Align tt)) >> returnm RETIRE_FAIL
        else
          (translateAddr vaddr (Read Data)) >>= fun w__1 : TR_Result (mword 32) ExceptionType =>
          (match w__1 with
           | TR_Failure (e, _) => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
           | TR_Address (paddr, _) =>
              (match (width, 32) with
               | (BYTE, g__310) =>
                  (mem_read (Read Data) paddr 1 aq rl false) >>= fun w__2 : MemoryOpResult (mword (8 * 1)) =>
                  (process_load rd vaddr w__2 is_unsigned)
                   : M (Retired)
               | (HALF, g__311) =>
                  (mem_read (Read Data) paddr 2 aq rl false) >>= fun w__4 : MemoryOpResult (mword (8 * 2)) =>
                  (process_load rd vaddr w__4 is_unsigned)
                   : M (Retired)
               | (WORD, g__312) =>
                  (mem_read (Read Data) paddr 4 aq rl false) >>= fun w__6 : MemoryOpResult (mword (8 * 4)) =>
                  (process_load rd vaddr w__6 is_unsigned)
                   : M (Retired)
               | _ =>
                  assert_exp' false "Pattern match failure at model/riscv_insts_base.sail 329:10 - 338:11" >>= fun _ =>
                  exit tt
               end)
               : M (Retired)
           end)
           : M (Retired))
        : M (Retired)
    end)
    : M (Retired).

Definition execute_ITYPE (imm : mword 12) (rs1 : mword 5) (rd : mword 5) (op : iop) : M (Retired) :=
   (rX_bits rs1) >>= fun rs1_val =>
   let immext : xlenbits := EXTS 32 imm in
   let result : xlenbits :=
     match op with
     | RISCV_ADDI => add_vec rs1_val immext
     | RISCV_SLTI => EXTZ 32 (bool_to_bits (zopz0zI_s rs1_val immext))
     | RISCV_SLTIU => EXTZ 32 (bool_to_bits (zopz0zI_u rs1_val immext))
     | RISCV_ANDI => and_vec rs1_val immext
     | RISCV_ORI => or_vec rs1_val immext
     | RISCV_XORI => xor_vec rs1_val immext
     end in
   (wX_bits rd result) >> returnm RETIRE_SUCCESS.

Definition execute_ILLEGAL (s : mword 32) : M (Retired) :=
   (handle_illegal tt) >> returnm RETIRE_FAIL.

Definition execute_F_UN_TYPE_S (arg0 : mword 5) (arg1 : mword 5) (arg2 : f_un_op_S) : M (Retired) :=
   let merge_var := (arg0, arg1, arg2) in
   (match merge_var with
    | (rs1, rd, FCLASS_S) =>
       (rF_bits rs1) >>= fun w__0 : mword 32 =>
       let rs1_val_S := nan_unbox w__0 in
       let rd_val_10b : bits 10 :=
         if f_is_neg_inf_S rs1_val_S then 'b"0000000001"  : mword 10
         else if f_is_neg_norm_S rs1_val_S then 'b"0000000010"  : mword 10
         else if f_is_neg_subnorm_S rs1_val_S then 'b"0000000100"  : mword 10
         else if f_is_neg_zero_S rs1_val_S then 'b"0000001000"  : mword 10
         else if f_is_pos_zero_S rs1_val_S then 'b"0000010000"  : mword 10
         else if f_is_pos_subnorm_S rs1_val_S then 'b"0000100000"  : mword 10
         else if f_is_pos_norm_S rs1_val_S then 'b"0001000000"  : mword 10
         else if f_is_pos_inf_S rs1_val_S then 'b"0010000000"  : mword 10
         else if f_is_SNaN_S rs1_val_S then 'b"0100000000"  : mword 10
         else if f_is_QNaN_S rs1_val_S then 'b"1000000000"  : mword 10
         else zeros_implicit 10 in
       (wX_bits rd (EXTZ 32 rd_val_10b)) >> returnm RETIRE_SUCCESS
    | (rs1, rd, FMV_X_W) =>
       (rF_bits rs1) >>= fun w__1 : mword 32 =>
       let rs1_val_S := subrange_vec_dec w__1 31 0 in
       let rd_val_X : xlenbits := EXTS 32 rs1_val_S in
       (wX_bits rd rd_val_X) >> returnm RETIRE_SUCCESS
    | (rs1, rd, FMV_W_X) =>
       (rX_bits rs1) >>= fun rs1_val_X =>
       let rd_val_S := subrange_vec_dec rs1_val_X 31 0 in
       (wF_bits rd (nan_box rd_val_S)) >> returnm RETIRE_SUCCESS
    end)
    : M (Retired).

Definition execute_F_UN_RM_TYPE_S
(arg0 : mword 5) (arg1 : rounding_mode) (arg2 : mword 5) (arg3 : f_un_rm_op_S)
: M (Retired) :=
   let merge_var := (arg0, arg1, arg2, arg3) in
   (match merge_var with
    | (rs1, rm, rd, FSQRT_S) =>
       (rF_bits rs1) >>= fun w__0 : mword 32 =>
       let rs1_val_S := nan_unbox w__0 in
       (select_instr_or_fcsr_rm rm) >>= fun w__1 : rounding_mode =>
       let rm_3b := encdec_rounding_mode_forwards w__1 in
       (riscv_f32Sqrt rm_3b rs1_val_S) >>= fun '(fflags, rd_val_S) =>
       (write_fflags fflags) >> (wF_bits rd (nan_box rd_val_S)) >> returnm RETIRE_SUCCESS
    | (rs1, rm, rd, FCVT_W_S) =>
       (rF_bits rs1) >>= fun w__2 : mword 32 =>
       let rs1_val_S := nan_unbox w__2 in
       (select_instr_or_fcsr_rm rm) >>= fun w__3 : rounding_mode =>
       let rm_3b := encdec_rounding_mode_forwards w__3 in
       (riscv_f32ToI32 rm_3b rs1_val_S) >>= fun '(fflags, rd_val_W) =>
       (write_fflags fflags) >> (wX_bits rd (EXTS 32 rd_val_W)) >> returnm RETIRE_SUCCESS
    | (rs1, rm, rd, FCVT_WU_S) =>
       (rF_bits rs1) >>= fun w__4 : mword 32 =>
       let rs1_val_S := nan_unbox w__4 in
       (select_instr_or_fcsr_rm rm) >>= fun w__5 : rounding_mode =>
       let rm_3b := encdec_rounding_mode_forwards w__5 in
       (riscv_f32ToUi32 rm_3b rs1_val_S) >>= fun '(fflags, rd_val_WU) =>
       (write_fflags fflags) >> (wX_bits rd (EXTS 32 rd_val_WU)) >> returnm RETIRE_SUCCESS
    | (rs1, rm, rd, FCVT_S_W) =>
       (rX_bits rs1) >>= fun w__6 : mword 32 =>
       let rs1_val_W := subrange_vec_dec w__6 31 0 in
       (select_instr_or_fcsr_rm rm) >>= fun w__7 : rounding_mode =>
       let rm_3b := encdec_rounding_mode_forwards w__7 in
       (riscv_i32ToF32 rm_3b rs1_val_W) >>= fun '(fflags, rd_val_S) =>
       (write_fflags fflags) >> (wF_bits rd (nan_box rd_val_S)) >> returnm RETIRE_SUCCESS
    | (rs1, rm, rd, FCVT_S_WU) =>
       (rX_bits rs1) >>= fun w__8 : mword 32 =>
       let rs1_val_WU := subrange_vec_dec w__8 31 0 in
       (select_instr_or_fcsr_rm rm) >>= fun w__9 : rounding_mode =>
       let rm_3b := encdec_rounding_mode_forwards w__9 in
       (riscv_ui32ToF32 rm_3b rs1_val_WU) >>= fun '(fflags, rd_val_S) =>
       (write_fflags fflags) >> (wF_bits rd (nan_box rd_val_S)) >> returnm RETIRE_SUCCESS
    | (rs1, rm, rd, FCVT_L_S) => returnm RETIRE_FAIL
    | (rs1, rm, rd, FCVT_LU_S) => returnm RETIRE_FAIL
    | (rs1, rm, rd, FCVT_S_L) => returnm RETIRE_FAIL
    | (rs1, rm, rd, FCVT_S_LU) => returnm RETIRE_FAIL
    end)
    : M (Retired).

Definition execute_F_MADD_TYPE_S
(rs3 : mword 5) (rs2 : mword 5) (rs1 : mword 5) (rm : rounding_mode) (rd : mword 5)
(op : f_madd_op_S)
: M (Retired) :=
   (rF_bits rs1) >>= fun w__0 : mword 32 =>
   let rs1_val_32b := nan_unbox w__0 in
   (rF_bits rs2) >>= fun w__1 : mword 32 =>
   let rs2_val_32b := nan_unbox w__1 in
   (rF_bits rs3) >>= fun w__2 : mword 32 =>
   let rs3_val_32b := nan_unbox w__2 in
   (select_instr_or_fcsr_rm rm) >>= fun w__3 : rounding_mode =>
   let rm_3b := encdec_rounding_mode_forwards w__3 in
   (match op with
    | FMADD_S =>
       (riscv_f32MulAdd rm_3b rs1_val_32b rs2_val_32b rs3_val_32b)  : M ((mword 5 * mword 32))
    | FMSUB_S =>
       (riscv_f32MulAdd rm_3b rs1_val_32b rs2_val_32b (negate_S rs3_val_32b))
        : M ((mword 5 * mword 32))
    | FNMSUB_S =>
       (riscv_f32MulAdd rm_3b (negate_S rs1_val_32b) rs2_val_32b rs3_val_32b)
        : M ((mword 5 * mword 32))
    | FNMADD_S =>
       (riscv_f32MulAdd rm_3b (negate_S rs1_val_32b) rs2_val_32b (negate_S rs3_val_32b))
        : M ((mword 5 * mword 32))
    end) >>= fun '((fflags, rd_val_32b)
   : (bits 5 * bits 32)) =>
   (write_fflags fflags) >> (wF_bits rd (nan_box rd_val_32b)) >> returnm RETIRE_SUCCESS.

Definition execute_F_BIN_TYPE_S
(arg0 : mword 5) (arg1 : mword 5) (arg2 : mword 5) (arg3 : f_bin_op_S)
: M (Retired) :=
   let merge_var := (arg0, arg1, arg2, arg3) in
   (match merge_var with
    | (rs2, rs1, rd, FSGNJ_S) =>
       (rF_bits rs1) >>= fun w__0 : mword 32 =>
       let rs1_val_S := nan_unbox w__0 in
       (rF_bits rs2) >>= fun w__1 : mword 32 =>
       let rs2_val_S := nan_unbox w__1 in
       let '(s1, e1, m1) := fsplit_S rs1_val_S in
       let '(s2, e2, m2) := fsplit_S rs2_val_S in
       let rd_val_S := fmake_S s2 e1 m1 in
       (wF_bits rd (nan_box rd_val_S)) >> returnm RETIRE_SUCCESS
    | (rs2, rs1, rd, FSGNJN_S) =>
       (rF_bits rs1) >>= fun w__2 : mword 32 =>
       let rs1_val_S := nan_unbox w__2 in
       (rF_bits rs2) >>= fun w__3 : mword 32 =>
       let rs2_val_S := nan_unbox w__3 in
       let '(s1, e1, m1) := fsplit_S rs1_val_S in
       let '(s2, e2, m2) := fsplit_S rs2_val_S in
       let rd_val_S := fmake_S (xor_vec ('b"1"  : mword 1) s2) e1 m1 in
       (wF_bits rd (nan_box rd_val_S)) >> returnm RETIRE_SUCCESS
    | (rs2, rs1, rd, FSGNJX_S) =>
       (rF_bits rs1) >>= fun w__4 : mword 32 =>
       let rs1_val_S := nan_unbox w__4 in
       (rF_bits rs2) >>= fun w__5 : mword 32 =>
       let rs2_val_S := nan_unbox w__5 in
       let '(s1, e1, m1) := fsplit_S rs1_val_S in
       let '(s2, e2, m2) := fsplit_S rs2_val_S in
       let rd_val_S := fmake_S (xor_vec s1 s2) e1 m1 in
       (wF_bits rd (nan_box rd_val_S)) >> returnm RETIRE_SUCCESS
    | (rs2, rs1, rd, FMIN_S) =>
       (rF_bits rs1) >>= fun w__6 : mword 32 =>
       let rs1_val_S := nan_unbox w__6 in
       (rF_bits rs2) >>= fun w__7 : mword 32 =>
       let rs2_val_S := nan_unbox w__7 in
       let is_quiet := true in
       let '(rs1_lt_rs2, fflags) := fle_S rs1_val_S rs2_val_S is_quiet in
       let rd_val_S :=
         if andb (f_is_NaN_S rs1_val_S) (f_is_NaN_S rs2_val_S) then canonical_NaN_S tt
         else if f_is_NaN_S rs1_val_S then rs2_val_S
         else if f_is_NaN_S rs2_val_S then rs1_val_S
         else if andb (f_is_neg_zero_S rs1_val_S) (f_is_pos_zero_S rs2_val_S) then rs1_val_S
         else if andb (f_is_neg_zero_S rs2_val_S) (f_is_pos_zero_S rs1_val_S) then rs2_val_S
         else if sumbool_of_bool rs1_lt_rs2 then rs1_val_S
         else rs2_val_S in
       (accrue_fflags fflags) >> (wF_bits rd (nan_box rd_val_S)) >> returnm RETIRE_SUCCESS
    | (rs2, rs1, rd, FMAX_S) =>
       (rF_bits rs1) >>= fun w__8 : mword 32 =>
       let rs1_val_S := nan_unbox w__8 in
       (rF_bits rs2) >>= fun w__9 : mword 32 =>
       let rs2_val_S := nan_unbox w__9 in
       let is_quiet := true in
       let '(rs2_lt_rs1, fflags) := fle_S rs2_val_S rs1_val_S is_quiet in
       let rd_val_S :=
         if andb (f_is_NaN_S rs1_val_S) (f_is_NaN_S rs2_val_S) then canonical_NaN_S tt
         else if f_is_NaN_S rs1_val_S then rs2_val_S
         else if f_is_NaN_S rs2_val_S then rs1_val_S
         else if andb (f_is_neg_zero_S rs1_val_S) (f_is_pos_zero_S rs2_val_S) then rs2_val_S
         else if andb (f_is_neg_zero_S rs2_val_S) (f_is_pos_zero_S rs1_val_S) then rs1_val_S
         else if sumbool_of_bool rs2_lt_rs1 then rs1_val_S
         else rs2_val_S in
       (accrue_fflags fflags) >> (wF_bits rd (nan_box rd_val_S)) >> returnm RETIRE_SUCCESS
    | (rs2, rs1, rd, FEQ_S) =>
       (rF_bits rs1) >>= fun w__10 : mword 32 =>
       let rs1_val_S := nan_unbox w__10 in
       (rF_bits rs2) >>= fun w__11 : mword 32 =>
       let rs2_val_S := nan_unbox w__11 in
       (riscv_f32Eq rs1_val_S rs2_val_S) >>= fun '((fflags, rd_val)
       : (bits_fflags * bits_WU)) =>
       (write_fflags fflags) >> (wX_bits rd (EXTZ 32 rd_val)) >> returnm RETIRE_SUCCESS
    | (rs2, rs1, rd, FLT_S) =>
       (rF_bits rs1) >>= fun w__12 : mword 32 =>
       let rs1_val_S := nan_unbox w__12 in
       (rF_bits rs2) >>= fun w__13 : mword 32 =>
       let rs2_val_S := nan_unbox w__13 in
       (riscv_f32Lt rs1_val_S rs2_val_S) >>= fun '((fflags, rd_val)
       : (bits_fflags * bits_WU)) =>
       (write_fflags fflags) >> (wX_bits rd (EXTZ 32 rd_val)) >> returnm RETIRE_SUCCESS
    | (rs2, rs1, rd, FLE_S) =>
       (rF_bits rs1) >>= fun w__14 : mword 32 =>
       let rs1_val_S := nan_unbox w__14 in
       (rF_bits rs2) >>= fun w__15 : mword 32 =>
       let rs2_val_S := nan_unbox w__15 in
       (riscv_f32Le rs1_val_S rs2_val_S) >>= fun '((fflags, rd_val)
       : (bits_fflags * bits_WU)) =>
       (write_fflags fflags) >> (wX_bits rd (EXTZ 32 rd_val)) >> returnm RETIRE_SUCCESS
    end)
    : M (Retired).

Definition execute_F_BIN_RM_TYPE_S
(rs2 : mword 5) (rs1 : mword 5) (rm : rounding_mode) (rd : mword 5) (op : f_bin_rm_op_S)
: M (Retired) :=
   (rF_bits rs1) >>= fun w__0 : mword 32 =>
   let rs1_val_32b := nan_unbox w__0 in
   (rF_bits rs2) >>= fun w__1 : mword 32 =>
   let rs2_val_32b := nan_unbox w__1 in
   (select_instr_or_fcsr_rm rm) >>= fun w__2 : rounding_mode =>
   let rm_3b := encdec_rounding_mode_forwards w__2 in
   (match op with
    | FADD_S => (riscv_f32Add rm_3b rs1_val_32b rs2_val_32b)  : M ((mword 5 * mword 32))
    | FSUB_S => (riscv_f32Sub rm_3b rs1_val_32b rs2_val_32b)  : M ((mword 5 * mword 32))
    | FMUL_S => (riscv_f32Mul rm_3b rs1_val_32b rs2_val_32b)  : M ((mword 5 * mword 32))
    | FDIV_S => (riscv_f32Div rm_3b rs1_val_32b rs2_val_32b)  : M ((mword 5 * mword 32))
    end) >>= fun '((fflags, rd_val_32b)
   : (bits 5 * bits 32)) =>
   (write_fflags fflags) >> (wF_bits rd (nan_box rd_val_32b)) >> returnm RETIRE_SUCCESS.

Definition execute_FENCE_TSO (pred : mword 4) (succ : mword 4) : M (Retired) :=
   (match (pred, succ) with
    | (v__1172, v__1173) =>
       (if andb (eq_vec (subrange_vec_dec v__1172 1 0) ('b"11"  : mword (1 - 0 + 1)))
             (eq_vec (subrange_vec_dec v__1173 1 0) ('b"11"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_tso tt))
           : M (unit)
        else
          returnm (if andb (eq_vec (subrange_vec_dec v__1172 1 0) ('b"00"  : mword (1 - 0 + 1)))
                        (eq_vec (subrange_vec_dec v__1173 1 0) ('b"00"  : mword (1 - 0 + 1))) then
                     tt
                   else
                     let '_ := (print_endline "FIXME: unsupported fence")  : unit in
                     tt))
        : M (unit)
    end) >>
   returnm RETIRE_SUCCESS.

Definition execute_FENCE_RESERVED
(fm : mword 4) (pred : mword 4) (succ : mword 4) (rs : mword 5) (rd : mword 5)
: Retired :=
   RETIRE_SUCCESS.

Definition execute_FENCEI_RESERVED (imm : mword 12) (rs : mword 5) (rd : mword 5) : Retired :=
   RETIRE_SUCCESS.

Definition execute_FENCEI '(tt : unit) : Retired := RETIRE_SUCCESS.

Definition execute_FENCE (pred : mword 4) (succ : mword 4) : M (Retired) :=
   (match (pred, succ) with
    | (v__1132, v__1133) =>
       (if andb (eq_vec (subrange_vec_dec v__1132 1 0) ('b"11"  : mword (1 - 0 + 1)))
             (eq_vec (subrange_vec_dec v__1133 1 0) ('b"11"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_rw_rw tt))
           : M (unit)
        else if andb (eq_vec (subrange_vec_dec v__1132 1 0) ('b"10"  : mword (1 - 0 + 1)))
                  (eq_vec (subrange_vec_dec v__1133 1 0) ('b"11"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_r_rw tt))
           : M (unit)
        else if andb (eq_vec (subrange_vec_dec v__1132 1 0) ('b"10"  : mword (1 - 0 + 1)))
                  (eq_vec (subrange_vec_dec v__1133 1 0) ('b"10"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_r_r tt))
           : M (unit)
        else if andb (eq_vec (subrange_vec_dec v__1132 1 0) ('b"11"  : mword (1 - 0 + 1)))
                  (eq_vec (subrange_vec_dec v__1133 1 0) ('b"01"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_rw_w tt))
           : M (unit)
        else if andb (eq_vec (subrange_vec_dec v__1132 1 0) ('b"01"  : mword (1 - 0 + 1)))
                  (eq_vec (subrange_vec_dec v__1133 1 0) ('b"01"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_w_w tt))
           : M (unit)
        else if andb (eq_vec (subrange_vec_dec v__1132 1 0) ('b"01"  : mword (1 - 0 + 1)))
                  (eq_vec (subrange_vec_dec v__1133 1 0) ('b"11"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_w_rw tt))
           : M (unit)
        else if andb (eq_vec (subrange_vec_dec v__1132 1 0) ('b"11"  : mword (1 - 0 + 1)))
                  (eq_vec (subrange_vec_dec v__1133 1 0) ('b"10"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_rw_r tt))
           : M (unit)
        else if andb (eq_vec (subrange_vec_dec v__1132 1 0) ('b"10"  : mword (1 - 0 + 1)))
                  (eq_vec (subrange_vec_dec v__1133 1 0) ('b"01"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_r_w tt))
           : M (unit)
        else if andb (eq_vec (subrange_vec_dec v__1132 1 0) ('b"01"  : mword (1 - 0 + 1)))
                  (eq_vec (subrange_vec_dec v__1133 1 0) ('b"10"  : mword (1 - 0 + 1))) then
          (barrier (Barrier_RISCV_w_r tt))
           : M (unit)
        else
          returnm (if eq_vec (subrange_vec_dec v__1133 1 0) ('b"00"  : mword (1 - 0 + 1)) then tt
                   else if eq_vec (subrange_vec_dec v__1132 1 0) ('b"00"  : mword (1 - 0 + 1)) then
                     tt
                   else
                     let '_ := (print_endline "FIXME: unsupported fence")  : unit in
                     tt))
        : M (unit)
    end) >>
   returnm RETIRE_SUCCESS.

Definition execute_ECALL '(tt : unit) : M (Retired) :=
   read_reg cur_privilege_ref >>= fun w__0 : Privilege =>
   let t : sync_exception :=
     {| sync_exception_trap :=
          (match w__0 with
           | User => E_U_EnvCall tt
           | Supervisor => E_S_EnvCall tt
           | Machine => E_M_EnvCall tt
           end); 
        sync_exception_excinfo := (None  : option xlenbits); 
        sync_exception_ext := None |} in
   read_reg cur_privilege_ref >>= fun w__1 : Privilege =>
   ((read_reg PC_ref)  : M (mword 32)) >>= fun w__2 : mword 32 =>
   (exception_handler w__1 (CTL_TRAP t) w__2) >>= fun w__3 : mword 32 =>
   (set_next_pc w__3) >> returnm RETIRE_FAIL.

Definition execute_EBREAK '(tt : unit) : M (Retired) :=
   ((read_reg PC_ref)  : M (mword 32)) >>= fun w__0 : mword 32 =>
   (handle_mem_exception w__0 (E_Breakpoint tt)) >> returnm RETIRE_FAIL.

Definition execute_DIVW (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (s : bool) : M (Retired) :=
   (haveMulDiv tt) >>= fun w__0 : bool =>
   (if sumbool_of_bool w__0 then
      (rX_bits rs1) >>= fun w__1 : mword 32 =>
      let rs1_val := subrange_vec_dec w__1 31 0 in
      (rX_bits rs2) >>= fun w__2 : mword 32 =>
      let rs2_val := subrange_vec_dec w__2 31 0 in
      let rs1_int : Z := if sumbool_of_bool s then projT1 (sint rs1_val) else projT1 (uint rs1_val) in
      let rs2_int : Z := if sumbool_of_bool s then projT1 (sint rs2_val) else projT1 (uint rs2_val) in
      let q : Z := if sumbool_of_bool (Z.eqb rs2_int 0) then (-1) else Z.quot rs1_int rs2_int in
      let q' : Z :=
        if sumbool_of_bool (andb s (Z.gtb q (Z.sub (projT1 (pow2 31)) 1))) then Z.sub 0 (pow 2 31)
        else q in
      (wX_bits rd (EXTS 32 (to_bits 32 q'))) >> returnm RETIRE_SUCCESS
    else (handle_illegal tt) >> returnm RETIRE_FAIL)
    : M (Retired).

Definition execute_DIV (rs2 : mword 5) (rs1 : mword 5) (rd : mword 5) (s : bool) : M (Retired) :=
   (haveMulDiv tt) >>= fun w__0 : bool =>
   (if sumbool_of_bool w__0 then
      (rX_bits rs1) >>= fun rs1_val =>
      (rX_bits rs2) >>= fun rs2_val =>
      let rs1_int : Z := if sumbool_of_bool s then projT1 (sint rs1_val) else projT1 (uint rs1_val) in
      let rs2_int : Z := if sumbool_of_bool s then projT1 (sint rs2_val) else projT1 (uint rs2_val) in
      let q : Z := if sumbool_of_bool (Z.eqb rs2_int 0) then (-1) else Z.quot rs1_int rs2_int in
      let q' : Z :=
        if sumbool_of_bool (andb s (Z.gtb q xlen_max_signed)) then xlen_min_signed
        else q in
      (wX_bits rd (to_bits 32 q')) >> returnm RETIRE_SUCCESS
    else (handle_illegal tt) >> returnm RETIRE_FAIL)
    : M (Retired).

Definition execute_C_SRLI_HINT (rsd : mword 3) : Retired := RETIRE_SUCCESS.

Definition execute_C_SRAI_HINT (rsd : mword 3) : Retired := RETIRE_SUCCESS.

Definition execute_C_SLLI_HINT (shamt : mword 6) (rsd : mword 5) : Retired := RETIRE_SUCCESS.

Definition execute_C_NOP_HINT (imm : mword 6) : Retired := RETIRE_SUCCESS.

Definition execute_C_NOP '(tt : unit) : Retired := RETIRE_SUCCESS.

Definition execute_C_MV_HINT (rs2 : mword 5) : Retired := RETIRE_SUCCESS.

Definition execute_C_LUI_HINT (imm : mword 6) : Retired := RETIRE_SUCCESS.

Definition execute_C_LI_HINT (imm : mword 6) : Retired := RETIRE_SUCCESS.

Definition execute_C_ILLEGAL (s : mword 16) : M (Retired) :=
   (handle_illegal tt) >> returnm RETIRE_FAIL.

Definition execute_C_ADD_HINT (rs2 : mword 5) : Retired := RETIRE_SUCCESS.

Definition execute_C_ADDI_HINT (rsd : mword 5) : Retired := RETIRE_SUCCESS.

Definition execute_CSR (csr : mword 12) (rs1 : mword 5) (rd : mword 5) (is_imm : bool) (op : csrop)
: M (Retired) :=
   (if sumbool_of_bool is_imm then returnm (EXTZ 32 rs1)
    else (rX_bits rs1)  : M (mword 32)) >>= fun rs1_val : xlenbits =>
   let isWrite : bool :=
     match op with
     | CSRRW => true
     | _ =>
        if sumbool_of_bool is_imm then projT1 (neq_int (projT1 (uint rs1_val)) 0)
        else projT1 (neq_int (projT1 (uint rs1)) 0)
     end in
   read_reg cur_privilege_ref >>= fun w__1 : Privilege =>
   (check_CSR csr w__1 isWrite) >>= fun w__2 : bool =>
   (if sumbool_of_bool (negb w__2) then (handle_illegal tt) >> returnm RETIRE_FAIL
    else
      read_reg cur_privilege_ref >>= fun w__3 : Privilege =>
      (if negb (ext_check_CSR csr w__3 isWrite) then
         let '_ := (ext_check_CSR_fail tt)  : unit in
         returnm RETIRE_FAIL
       else
         (readCSR csr) >>= fun csr_val =>
         (if sumbool_of_bool isWrite then
            let new_val : xlenbits :=
              match op with
              | CSRRW => rs1_val
              | CSRRS => or_vec csr_val rs1_val
              | CSRRC => and_vec csr_val (not_vec rs1_val)
              end in
            (writeCSR csr new_val)
             : M (unit)
          else returnm tt) >>
         (wX_bits rd csr_val) >> returnm RETIRE_SUCCESS)
       : M (Retired))
    : M (Retired).

Definition execute_BTYPE (imm : mword 13) (rs2 : mword 5) (rs1 : mword 5) (op : bop) : M (Retired) :=
   (rX_bits rs1) >>= fun rs1_val =>
   (rX_bits rs2) >>= fun rs2_val =>
   let taken : bool :=
     match op with
     | RISCV_BEQ => eq_vec rs1_val rs2_val
     | RISCV_BNE => neq_vec rs1_val rs2_val
     | RISCV_BLT => zopz0zI_s rs1_val rs2_val
     | RISCV_BGE => zopz0zKzJ_s rs1_val rs2_val
     | RISCV_BLTU => zopz0zI_u rs1_val rs2_val
     | RISCV_BGEU => zopz0zKzJ_u rs1_val rs2_val
     end in
   ((read_reg PC_ref)  : M (mword 32)) >>= fun w__0 : mword 32 =>
   let t : xlenbits := add_vec w__0 (EXTS 32 imm) in
   (if sumbool_of_bool taken then
      (match (ext_control_check_pc t) with
       | Ext_ControlAddr_Error e =>
          let '_ := (ext_handle_control_check_error e)  : unit in
          returnm RETIRE_FAIL
       | Ext_ControlAddr_OK target =>
          (and_boolM ((bit_to_bool (access_vec_dec target 1))  : M (bool))
             ((haveRVC tt) >>= fun w__2 : bool => returnm ((negb w__2)  : bool))) >>= fun w__3 : bool =>
          (if sumbool_of_bool w__3 then
             (handle_mem_exception target (E_Fetch_Addr_Align tt)) >> returnm RETIRE_FAIL
           else (set_next_pc target) >> returnm RETIRE_SUCCESS)
           : M (Retired)
       end)
       : M (Retired)
    else returnm RETIRE_SUCCESS)
    : M (Retired).

Definition execute_AMO
(op : amoop) (aq : bool) (rl : bool) (rs2 : mword 5) (rs1 : mword 5) (width : word_width)
(rd : mword 5)
: M (Retired) :=
   (haveAtomics tt) >>= fun w__0 : bool =>
   (if sumbool_of_bool w__0 then
      (ext_data_get_addr rs1 (zeros_implicit 32) (ReadWrite (Data, Data)) width) >>= fun w__1 : Ext_DataAddr_Check unit =>
      (match w__1 with
       | Ext_DataAddr_Error e =>
          let '_ := (ext_handle_data_check_error e)  : unit in
          returnm RETIRE_FAIL
       | Ext_DataAddr_OK vaddr =>
          (translateAddr vaddr (ReadWrite (Data, Data))) >>= fun w__2 : TR_Result (mword 32) ExceptionType =>
          (match w__2 with
           | TR_Failure (e, _) => (handle_mem_exception vaddr e) >> returnm RETIRE_FAIL
           | TR_Address (addr, _) =>
              (match (width, 32) with
               | (BYTE, _) => (mem_write_ea addr 1 (andb aq rl) rl true)  : M (MemoryOpResult unit)
               | (HALF, _) => (mem_write_ea addr 2 (andb aq rl) rl true)  : M (MemoryOpResult unit)
               | (WORD, _) => (mem_write_ea addr 4 (andb aq rl) rl true)  : M (MemoryOpResult unit)
               | _ => (internal_error "Unexpected AMO width")  : M (MemoryOpResult unit)
               end) >>= fun eares : MemoryOpResult unit =>
              let is_unsigned : bool :=
                match op with | AMOMINU => true | AMOMAXU => true | _ => false end in
              (match width with
               | BYTE =>
                  (if sumbool_of_bool is_unsigned then
                     (rX_bits rs2) >>= fun w__7 : mword 32 =>
                     returnm (EXTZ 32 (subrange_vec_dec w__7 7 0))
                   else
                     (rX_bits rs2) >>= fun w__8 : mword 32 =>
                     returnm (EXTS 32 (subrange_vec_dec w__8 7 0)))
                   : M (mword 32)
               | HALF =>
                  (if sumbool_of_bool is_unsigned then
                     (rX_bits rs2) >>= fun w__10 : mword 32 =>
                     returnm (EXTZ 32 (subrange_vec_dec w__10 15 0))
                   else
                     (rX_bits rs2) >>= fun w__11 : mword 32 =>
                     returnm (EXTS 32 (subrange_vec_dec w__11 15 0)))
                   : M (mword 32)
               | WORD =>
                  (if sumbool_of_bool is_unsigned then
                     (rX_bits rs2) >>= fun w__13 : mword 32 =>
                     returnm (EXTZ 32 (subrange_vec_dec w__13 31 0))
                   else
                     (rX_bits rs2) >>= fun w__14 : mword 32 =>
                     returnm (EXTS 32 (subrange_vec_dec w__14 31 0)))
                   : M (mword 32)
               | DOUBLE => (rX_bits rs2)  : M (mword 32)
               end) >>= fun rs2_val : xlenbits =>
              (match eares with
               | MemException e => (handle_mem_exception addr e) >> returnm RETIRE_FAIL
               | MemValue _ =>
                  (match (width, 32) with
                   | (BYTE, _) =>
                      (mem_read (ReadWrite (Data, Data)) addr 1 aq (andb aq rl) true) >>= fun w__17 : MemoryOpResult (mword (8 * 1)) =>
                      returnm (extend_value is_unsigned w__17)
                   | (HALF, _) =>
                      (mem_read (ReadWrite (Data, Data)) addr 2 aq (andb aq rl) true) >>= fun w__18 : MemoryOpResult (mword (8 * 2)) =>
                      returnm (extend_value is_unsigned w__18)
                   | (WORD, _) =>
                      (mem_read (ReadWrite (Data, Data)) addr 4 aq (andb aq rl) true) >>= fun w__19 : MemoryOpResult (mword (8 * 4)) =>
                      returnm (extend_value is_unsigned w__19)
                   | _ => (internal_error "Unexpected AMO width")  : M (MemoryOpResult (mword 32))
                   end) >>= fun mval : MemoryOpResult xlenbits =>
                  (match mval with
                   | MemException e => (handle_mem_exception addr e) >> returnm RETIRE_FAIL
                   | MemValue loaded =>
                      let result : xlenbits :=
                        match op with
                        | AMOSWAP => rs2_val
                        | AMOADD => add_vec rs2_val loaded
                        | AMOXOR => xor_vec rs2_val loaded
                        | AMOAND => and_vec rs2_val loaded
                        | AMOOR => or_vec rs2_val loaded
                        | AMOMIN =>
                           to_bits 32
                             (projT1
                              (min_atom (projT1 (sint rs2_val)) (projT1 (sint loaded))))
                        | AMOMAX =>
                           to_bits 32
                             (projT1
                              (max_atom (projT1 (sint rs2_val)) (projT1 (sint loaded))))
                        | AMOMINU =>
                           to_bits 32
                             (projT1
                              (min_atom (projT1 (uint rs2_val)) (projT1 (uint loaded))))
                        | AMOMAXU =>
                           to_bits 32
                             (projT1
                              (max_atom (projT1 (uint rs2_val)) (projT1 (uint loaded))))
                        end in
                      let rval : xlenbits :=
                        match width with
                        | BYTE => EXTS 32 (subrange_vec_dec loaded 7 0)
                        | HALF => EXTS 32 (subrange_vec_dec loaded 15 0)
                        | WORD => EXTS 32 (subrange_vec_dec loaded 31 0)
                        | DOUBLE => loaded
                        end in
                      (match (width, 32) with
                       | (BYTE, _) =>
                          (mem_write_value addr 1 (subrange_vec_dec result 7 0) (andb aq rl) rl true)
                           : M (MemoryOpResult bool)
                       | (HALF, _) =>
                          (mem_write_value addr 2 (subrange_vec_dec result 15 0) (andb aq rl) rl
                             true)
                           : M (MemoryOpResult bool)
                       | (WORD, _) =>
                          (mem_write_value addr 4 (subrange_vec_dec result 31 0) (andb aq rl) rl
                             true)
                           : M (MemoryOpResult bool)
                       | _ => (internal_error "Unexpected AMO width")  : M (MemoryOpResult bool)
                       end) >>= fun wval : MemoryOpResult bool =>
                      (match wval with
                       | MemValue true => (wX_bits rd rval) >> returnm RETIRE_SUCCESS
                       | MemValue false =>
                          (internal_error "AMO got false from mem_write_value")  : M (Retired)
                       | MemException e => (handle_mem_exception addr e) >> returnm RETIRE_FAIL
                       end)
                       : M (Retired)
                   end)
                   : M (Retired)
               end)
               : M (Retired)
           end)
           : M (Retired)
       end)
       : M (Retired)
    else (handle_illegal tt) >> returnm RETIRE_FAIL)
    : M (Retired).

Definition execute_ADDIW (imm : mword 12) (rs1 : mword 5) (rd : mword 5) : M (Retired) :=
   (rX_bits rs1) >>= fun w__0 : mword 32 =>
   let result : xlenbits := add_vec (EXTS 32 imm) w__0 in
   (wX_bits rd (EXTS 32 (subrange_vec_dec result 31 0))) >> returnm RETIRE_SUCCESS.

Definition compressed_measure (instr : ast) : Z :=
   match instr with
   | C_ADDI4SPN (rdc, nzimm) => 1
   | C_LW (uimm, rsc, rdc) => 1
   | C_LD (uimm, rsc, rdc) => 1
   | C_SW (uimm, rsc1, rsc2) => 1
   | C_SD (uimm, rsc1, rsc2) => 1
   | C_ADDI (nzi, rsd) => 1
   | C_JAL imm => 1
   | C_LI (imm, rd) => 1
   | C_ADDI16SP imm => 1
   | C_LUI (imm, rd) => 1
   | C_SRLI (shamt, rsd) => 1
   | C_SRAI (shamt, rsd) => 1
   | C_ANDI (imm, rsd) => 1
   | C_SUB (rsd, rs2) => 1
   | C_XOR (rsd, rs2) => 1
   | C_OR (rsd, rs2) => 1
   | C_AND (rsd, rs2) => 1
   | C_SUBW (rsd, rs2) => 1
   | C_ADDW (rsd, rs2) => 1
   | C_J imm => 1
   | C_BEQZ (imm, rs) => 1
   | C_BNEZ (imm, rs) => 1
   | C_SLLI (shamt, rsd) => 1
   | C_LWSP (uimm, rd) => 1
   | C_LDSP (uimm, rd) => 1
   | C_SWSP (uimm, rs2) => 1
   | C_SDSP (uimm, rs2) => 1
   | C_JR rs1 => 1
   | C_JALR rs1 => 1
   | C_MV (rd, rs2) => 1
   | C_EBREAK tt' => 1
   | C_ADD (rsd, rs2) => 1
   | _ => 0
   end.

Fixpoint _rec_execute (merge_var : ast) (_reclimit : Z) (_acc : Acc (Zwf 0) _reclimit)
{struct _acc} : M (Retired).
exact (
   assert_exp' (Z.geb _reclimit 0) "recursion limit reached" >>= fun _ =>
   (match merge_var with
    | C_ADDI4SPN (rdc, nzimm) =>
       let imm : bits 12 := concat_vec ('b"00"  : mword 2) (concat_vec nzimm ('b"00"  : mword 2)) in
       let rd := creg2reg_idx rdc in
       (_rec_execute (ITYPE (imm, sp, rd, RISCV_ADDI)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_LW (uimm, rsc, rdc) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"00"  : mword 2)) in
       let rd := creg2reg_idx rdc in
       let rs := creg2reg_idx rsc in
       (_rec_execute (LOAD (imm, rs, rd, false, WORD, false, false)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_LD (uimm, rsc, rdc) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"000"  : mword 3)) in
       let rd := creg2reg_idx rdc in
       let rs := creg2reg_idx rsc in
       (_rec_execute (LOAD (imm, rs, rd, false, DOUBLE, false, false)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_SW (uimm, rsc1, rsc2) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"00"  : mword 2)) in
       let rs1 := creg2reg_idx rsc1 in
       let rs2 := creg2reg_idx rsc2 in
       (_rec_execute (STORE (imm, rs2, rs1, WORD, false, false)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_SD (uimm, rsc1, rsc2) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"000"  : mword 3)) in
       let rs1 := creg2reg_idx rsc1 in
       let rs2 := creg2reg_idx rsc2 in
       (_rec_execute (STORE (imm, rs2, rs1, DOUBLE, false, false)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_ADDI (nzi, rsd) =>
       let imm : bits 12 := EXTS 12 nzi in
       (_rec_execute (ITYPE (imm, rsd, rsd, RISCV_ADDI)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_JAL imm =>
       (_rec_execute (RISCV_JAL (EXTS 21 (concat_vec imm ('b"0"  : mword 1)), ra))
          (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_ADDIW (imm, rsd) =>
       (_rec_execute (ADDIW (EXTS 12 imm, rsd, rsd)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_LI (imm, rd) =>
       let imm : bits 12 := EXTS 12 imm in
       (_rec_execute (ITYPE (imm, zreg, rd, RISCV_ADDI)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_ADDI16SP imm =>
       let imm : bits 12 := EXTS 12 (concat_vec imm (Ox"0"  : mword 4)) in
       (_rec_execute (ITYPE (imm, sp, sp, RISCV_ADDI)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_LUI (imm, rd) =>
       let res : bits 20 := EXTS 20 imm in
       (_rec_execute (UTYPE (res, rd, RISCV_LUI)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_SRLI (shamt, rsd) =>
       let rsd := creg2reg_idx rsd in
       (_rec_execute (SHIFTIOP (shamt, rsd, rsd, RISCV_SRLI)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_SRAI (shamt, rsd) =>
       let rsd := creg2reg_idx rsd in
       (_rec_execute (SHIFTIOP (shamt, rsd, rsd, RISCV_SRAI)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_ANDI (imm, rsd) =>
       let rsd := creg2reg_idx rsd in
       (_rec_execute (ITYPE (EXTS 12 imm, rsd, rsd, RISCV_ANDI)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_SUB (rsd, rs2) =>
       let rsd := creg2reg_idx rsd in
       let rs2 := creg2reg_idx rs2 in
       (_rec_execute (RTYPE (rs2, rsd, rsd, RISCV_SUB)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_XOR (rsd, rs2) =>
       let rsd := creg2reg_idx rsd in
       let rs2 := creg2reg_idx rs2 in
       (_rec_execute (RTYPE (rs2, rsd, rsd, RISCV_XOR)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_OR (rsd, rs2) =>
       let rsd := creg2reg_idx rsd in
       let rs2 := creg2reg_idx rs2 in
       (_rec_execute (RTYPE (rs2, rsd, rsd, RISCV_OR)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_AND (rsd, rs2) =>
       let rsd := creg2reg_idx rsd in
       let rs2 := creg2reg_idx rs2 in
       (_rec_execute (RTYPE (rs2, rsd, rsd, RISCV_AND)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_SUBW (rsd, rs2) =>
       let rsd := creg2reg_idx rsd in
       let rs2 := creg2reg_idx rs2 in
       (_rec_execute (RTYPEW (rs2, rsd, rsd, RISCV_SUBW)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_ADDW (rsd, rs2) =>
       let rsd := creg2reg_idx rsd in
       let rs2 := creg2reg_idx rs2 in
       (_rec_execute (RTYPEW (rs2, rsd, rsd, RISCV_ADDW)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_J imm =>
       (_rec_execute (RISCV_JAL (EXTS 21 (concat_vec imm ('b"0"  : mword 1)), zreg))
          (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_BEQZ (imm, rs) =>
       (_rec_execute
          (BTYPE (EXTS 13 (concat_vec imm ('b"0"  : mword 1)), zreg, creg2reg_idx rs, RISCV_BEQ))
          (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_BNEZ (imm, rs) =>
       (_rec_execute
          (BTYPE (EXTS 13 (concat_vec imm ('b"0"  : mword 1)), zreg, creg2reg_idx rs, RISCV_BNE))
          (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_SLLI (shamt, rsd) =>
       (_rec_execute (SHIFTIOP (shamt, rsd, rsd, RISCV_SLLI)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_LWSP (uimm, rd) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"00"  : mword 2)) in
       (_rec_execute (LOAD (imm, sp, rd, false, WORD, false, false)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_LDSP (uimm, rd) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"000"  : mword 3)) in
       (_rec_execute (LOAD (imm, sp, rd, false, DOUBLE, false, false)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_SWSP (uimm, rs2) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"00"  : mword 2)) in
       (_rec_execute (STORE (imm, rs2, sp, WORD, false, false)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_SDSP (uimm, rs2) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"000"  : mword 3)) in
       (_rec_execute (STORE (imm, rs2, sp, DOUBLE, false, false)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_JR rs1 =>
       (_rec_execute (RISCV_JALR (EXTZ 12 ('b"0"  : mword 1), rs1, zreg)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_JALR rs1 =>
       (_rec_execute (RISCV_JALR (EXTZ 12 ('b"0"  : mword 1), rs1, ra)) (Z.sub _reclimit 1)
          (_limit_reduces _acc))
        : M (Retired)
    | C_MV (rd, rs2) =>
       (_rec_execute (RTYPE (rs2, zreg, rd, RISCV_ADD)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_EBREAK tt =>
       (_rec_execute (EBREAK tt) (Z.sub _reclimit 1) (_limit_reduces _acc))  : M (Retired)
    | C_ADD (rsd, rs2) =>
       (_rec_execute (RTYPE (rs2, rsd, rsd, RISCV_ADD)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_FLWSP (imm, rd) =>
       let imm : bits 12 := EXTZ 12 (concat_vec imm ('b"00"  : mword 2)) in
       (_rec_execute (LOAD_FP (imm, sp, rd, WORD)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_FSWSP (uimm, rs2) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"00"  : mword 2)) in
       (_rec_execute (STORE_FP (imm, rs2, sp, WORD)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_FLW (uimm, rsc, rdc) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"00"  : mword 2)) in
       let rd := creg2reg_idx rdc in
       let rs := creg2reg_idx rsc in
       (_rec_execute (LOAD_FP (imm, rs, rd, WORD)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | C_FSW (uimm, rsc1, rsc2) =>
       let imm : bits 12 := EXTZ 12 (concat_vec uimm ('b"00"  : mword 2)) in
       let rs1 := creg2reg_idx rsc1 in
       let rs2 := creg2reg_idx rsc2 in
       (_rec_execute (STORE_FP (imm, rs2, rs1, WORD)) (Z.sub _reclimit 1) (_limit_reduces _acc))
        : M (Retired)
    | UTYPE (imm, rd, op) => (execute_UTYPE imm rd op)  : M (Retired)
    | RISCV_JAL (imm, rd) => (execute_RISCV_JAL imm rd)  : M (Retired)
    | BTYPE (imm, rs2, rs1, op) => (execute_BTYPE imm rs2 rs1 op)  : M (Retired)
    | ITYPE (imm, rs1, rd, op) => (execute_ITYPE imm rs1 rd op)  : M (Retired)
    | SHIFTIOP (shamt, rs1, rd, op) => (execute_SHIFTIOP shamt rs1 rd op)  : M (Retired)
    | RTYPE (rs2, rs1, rd, op) => (execute_RTYPE rs2 rs1 rd op)  : M (Retired)
    | LOAD (imm, rs1, rd, is_unsigned, width, aq, rl) =>
       (execute_LOAD imm rs1 rd is_unsigned width aq rl)  : M (Retired)
    | STORE (imm, rs2, rs1, width, aq, rl) => (execute_STORE imm rs2 rs1 width aq rl)  : M (Retired)
    | ADDIW (imm, rs1, rd) => (execute_ADDIW imm rs1 rd)  : M (Retired)
    | SHIFTW (shamt, rs1, rd, op) => (execute_SHIFTW shamt rs1 rd op)  : M (Retired)
    | RTYPEW (rs2, rs1, rd, op) => (execute_RTYPEW rs2 rs1 rd op)  : M (Retired)
    | SHIFTIWOP (shamt, rs1, rd, op) => (execute_SHIFTIWOP shamt rs1 rd op)  : M (Retired)
    | FENCE (pred, succ) => (execute_FENCE pred succ)  : M (Retired)
    | FENCE_TSO (pred, succ) => (execute_FENCE_TSO pred succ)  : M (Retired)
    | FENCEI arg0 => returnm (execute_FENCEI arg0)
    | ECALL arg0 => (execute_ECALL arg0)  : M (Retired)
    | MRET arg0 => (execute_MRET arg0)  : M (Retired)
    | SRET arg0 => (execute_SRET arg0)  : M (Retired)
    | EBREAK arg0 => (execute_EBREAK arg0)  : M (Retired)
    | WFI arg0 => (execute_WFI arg0)  : M (Retired)
    | SFENCE_VMA (rs1, rs2) => (execute_SFENCE_VMA rs1 rs2)  : M (Retired)
    | LOADRES (aq, rl, rs1, width, rd) => (execute_LOADRES aq rl rs1 width rd)  : M (Retired)
    | STORECON (aq, rl, rs2, rs1, width, rd) =>
       (execute_STORECON aq rl rs2 rs1 width rd)  : M (Retired)
    | AMO (op, aq, rl, rs2, rs1, width, rd) =>
       (execute_AMO op aq rl rs2 rs1 width rd)  : M (Retired)
    | C_NOP arg0 => returnm (execute_C_NOP arg0)
    | MUL (rs2, rs1, rd, high, signed1, signed2) =>
       (execute_MUL rs2 rs1 rd high signed1 signed2)  : M (Retired)
    | DIV (rs2, rs1, rd, s) => (execute_DIV rs2 rs1 rd s)  : M (Retired)
    | REM (rs2, rs1, rd, s) => (execute_REM rs2 rs1 rd s)  : M (Retired)
    | MULW (rs2, rs1, rd) => (execute_MULW rs2 rs1 rd)  : M (Retired)
    | DIVW (rs2, rs1, rd, s) => (execute_DIVW rs2 rs1 rd s)  : M (Retired)
    | REMW (rs2, rs1, rd, s) => (execute_REMW rs2 rs1 rd s)  : M (Retired)
    | CSR (csr, rs1, rd, is_imm, op) => (execute_CSR csr rs1 rd is_imm op)  : M (Retired)
    | URET arg0 => (execute_URET arg0)  : M (Retired)
    | C_NOP_HINT imm => returnm (execute_C_NOP_HINT imm)
    | C_ADDI_HINT rsd => returnm (execute_C_ADDI_HINT rsd)
    | C_LI_HINT imm => returnm (execute_C_LI_HINT imm)
    | C_LUI_HINT imm => returnm (execute_C_LUI_HINT imm)
    | C_MV_HINT rs2 => returnm (execute_C_MV_HINT rs2)
    | C_ADD_HINT rs2 => returnm (execute_C_ADD_HINT rs2)
    | C_SLLI_HINT (shamt, rsd) => returnm (execute_C_SLLI_HINT shamt rsd)
    | C_SRLI_HINT rsd => returnm (execute_C_SRLI_HINT rsd)
    | C_SRAI_HINT rsd => returnm (execute_C_SRAI_HINT rsd)
    | FENCE_RESERVED (fm, pred, succ, rs, rd) => returnm (execute_FENCE_RESERVED fm pred succ rs rd)
    | FENCEI_RESERVED (imm, rs, rd) => returnm (execute_FENCEI_RESERVED imm rs rd)
    | LOAD_FP (imm, rs1, rd, width) => (execute_LOAD_FP imm rs1 rd width)  : M (Retired)
    | STORE_FP (imm, rs2, rs1, width) => (execute_STORE_FP imm rs2 rs1 width)  : M (Retired)
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, op) =>
       (execute_F_MADD_TYPE_S rs3 rs2 rs1 rm rd op)  : M (Retired)
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, op) =>
       (execute_F_BIN_RM_TYPE_S rs2 rs1 rm rd op)  : M (Retired)
    | F_UN_RM_TYPE_S (rs1, rm, rd, arg3) => (execute_F_UN_RM_TYPE_S rs1 rm rd arg3)  : M (Retired)
    | F_BIN_TYPE_S (rs2, rs1, rd, arg3) => (execute_F_BIN_TYPE_S rs2 rs1 rd arg3)  : M (Retired)
    | F_UN_TYPE_S (rs1, rd, arg2) => (execute_F_UN_TYPE_S rs1 rd arg2)  : M (Retired)
    | RISCV_JALR (imm, rs1, rd) => (execute_RISCV_JALR imm rs1 rd)  : M (Retired)
    | ILLEGAL s => (execute_ILLEGAL s)  : M (Retired)
    | C_ILLEGAL s => (execute_C_ILLEGAL s)  : M (Retired)
    end)
    : M (Retired)
).
Defined.


Definition execute (i : ast) : M (Retired) :=
   (_rec_execute i ((compressed_measure i)  : Z) (Zwf_guarded _))  : M (Retired).

Definition assembly_forwards (arg_ : ast) : M (string) :=
   (match arg_ with
    | UTYPE (imm, rd, op) =>
       (reg_name_forwards rd) >>= fun w__0 : string =>
       returnm (string_append (utype_mnemonic_forwards op)
                  (string_append (spc_forwards tt)
                     (string_append w__0
                        (string_append (sep_forwards tt)
                           (string_append (decimal_string_of_bits imm) "")))))
    | RISCV_JAL (imm, rd) =>
       (reg_name_forwards rd) >>= fun w__1 : string =>
       returnm (string_append "jal"
                  (string_append (spc_forwards tt)
                     (string_append w__1
                        (string_append (sep_forwards tt)
                           (string_append (decimal_string_of_bits imm) "")))))
    | RISCV_JALR (imm, rs1, rd) =>
       (reg_name_forwards rd) >>= fun w__2 : string =>
       (reg_name_forwards rs1) >>= fun w__3 : string =>
       returnm (string_append "jalr"
                  (string_append (spc_forwards tt)
                     (string_append w__2
                        (string_append (sep_forwards tt)
                           (string_append w__3
                              (string_append (sep_forwards tt)
                                 (string_append (decimal_string_of_bits imm) "")))))))
    | BTYPE (imm, rs2, rs1, op) =>
       (reg_name_forwards rs1) >>= fun w__4 : string =>
       (reg_name_forwards rs2) >>= fun w__5 : string =>
       returnm (string_append (btype_mnemonic_forwards op)
                  (string_append (spc_forwards tt)
                     (string_append w__4
                        (string_append (sep_forwards tt)
                           (string_append w__5
                              (string_append (sep_forwards tt)
                                 (string_append (decimal_string_of_bits imm) "")))))))
    | ITYPE (imm, rs1, rd, op) =>
       (reg_name_forwards rd) >>= fun w__6 : string =>
       (reg_name_forwards rs1) >>= fun w__7 : string =>
       returnm (string_append (itype_mnemonic_forwards op)
                  (string_append (spc_forwards tt)
                     (string_append w__6
                        (string_append (sep_forwards tt)
                           (string_append w__7
                              (string_append (sep_forwards tt)
                                 (string_append (decimal_string_of_bits imm) "")))))))
    | SHIFTIOP (shamt, rs1, rd, op) =>
       (reg_name_forwards rd) >>= fun w__8 : string =>
       (reg_name_forwards rs1) >>= fun w__9 : string =>
       returnm (string_append (shiftiop_mnemonic_forwards op)
                  (string_append (spc_forwards tt)
                     (string_append w__8
                        (string_append (sep_forwards tt)
                           (string_append w__9
                              (string_append (sep_forwards tt)
                                 (string_append (decimal_string_of_bits shamt) "")))))))
    | RTYPE (rs2, rs1, rd, op) =>
       (reg_name_forwards rd) >>= fun w__10 : string =>
       (reg_name_forwards rs1) >>= fun w__11 : string =>
       (reg_name_forwards rs2) >>= fun w__12 : string =>
       returnm (string_append (rtype_mnemonic_forwards op)
                  (string_append (spc_forwards tt)
                     (string_append w__10
                        (string_append (sep_forwards tt)
                           (string_append w__11
                              (string_append (sep_forwards tt) (string_append w__12 "")))))))
    | LOAD (imm, rs1, rd, is_unsigned, size, aq, rl) =>
       (reg_name_forwards rd) >>= fun w__13 : string =>
       (reg_name_forwards rs1) >>= fun w__14 : string =>
       returnm (string_append "l"
                  (string_append (size_mnemonic_forwards size)
                     (string_append (maybe_u_forwards is_unsigned)
                        (string_append (maybe_aq_forwards aq)
                           (string_append (maybe_rl_forwards rl)
                              (string_append (spc_forwards tt)
                                 (string_append w__13
                                    (string_append (sep_forwards tt)
                                       (string_append (decimal_string_of_bits imm)
                                          (string_append (opt_spc_forwards tt)
                                             (string_append "("
                                                (string_append (opt_spc_forwards tt)
                                                   (string_append w__14
                                                      (string_append (opt_spc_forwards tt)
                                                         (string_append ")" "")))))))))))))))
    | STORE (imm, rs2, rs1, size, aq, rl) =>
       (reg_name_forwards rs2) >>= fun w__15 : string =>
       (reg_name_forwards rs1) >>= fun w__16 : string =>
       returnm (string_append "s"
                  (string_append (size_mnemonic_forwards size)
                     (string_append (maybe_aq_forwards aq)
                        (string_append (maybe_rl_forwards rl)
                           (string_append (spc_forwards tt)
                              (string_append w__15
                                 (string_append (sep_forwards tt)
                                    (string_append (decimal_string_of_bits imm)
                                       (string_append (opt_spc_forwards tt)
                                          (string_append "("
                                             (string_append (opt_spc_forwards tt)
                                                (string_append w__16
                                                   (string_append (opt_spc_forwards tt)
                                                      (string_append ")" ""))))))))))))))
    | ADDIW (imm, rs1, rd) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (reg_name_forwards rd) >>= fun w__17 : string =>
          (reg_name_forwards rs1) >>= fun w__18 : string =>
          returnm (string_append "addiw"
                     (string_append (spc_forwards tt)
                        (string_append w__17
                           (string_append (sep_forwards tt)
                              (string_append w__18
                                 (string_append (sep_forwards tt)
                                    (string_append (decimal_string_of_bits imm) "")))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | SHIFTW (shamt, rs1, rd, op) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (reg_name_forwards rd) >>= fun w__21 : string =>
          (reg_name_forwards rs1) >>= fun w__22 : string =>
          returnm (string_append (shiftw_mnemonic_forwards op)
                     (string_append (spc_forwards tt)
                        (string_append w__21
                           (string_append (sep_forwards tt)
                              (string_append w__22
                                 (string_append (sep_forwards tt)
                                    (string_append (decimal_string_of_bits shamt) "")))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | RTYPEW (rs2, rs1, rd, op) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (reg_name_forwards rd) >>= fun w__25 : string =>
          (reg_name_forwards rs1) >>= fun w__26 : string =>
          (reg_name_forwards rs2) >>= fun w__27 : string =>
          returnm (string_append (rtypew_mnemonic_forwards op)
                     (string_append (spc_forwards tt)
                        (string_append w__25
                           (string_append (sep_forwards tt)
                              (string_append w__26
                                 (string_append (sep_forwards tt) (string_append w__27 "")))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | SHIFTIWOP (shamt, rs1, rd, op) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (reg_name_forwards rd) >>= fun w__30 : string =>
          (reg_name_forwards rs1) >>= fun w__31 : string =>
          returnm (string_append (shiftiwop_mnemonic_forwards op)
                     (string_append (spc_forwards tt)
                        (string_append w__30
                           (string_append (sep_forwards tt)
                              (string_append w__31
                                 (string_append (sep_forwards tt)
                                    (string_append (decimal_string_of_bits shamt) "")))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | FENCE (pred, succ) =>
       (fence_bits_forwards pred) >>= fun w__34 : string =>
       (fence_bits_forwards succ) >>= fun w__35 : string =>
       returnm (string_append "fence"
                  (string_append (spc_forwards tt)
                     (string_append w__34 (string_append (sep_forwards tt) (string_append w__35 "")))))
    | FENCE_TSO (pred, succ) =>
       (fence_bits_forwards pred) >>= fun w__36 : string =>
       (fence_bits_forwards succ) >>= fun w__37 : string =>
       returnm (string_append "fence.tso"
                  (string_append (spc_forwards tt)
                     (string_append w__36 (string_append (sep_forwards tt) (string_append w__37 "")))))
    | FENCEI tt => returnm "fence.i"
    | ECALL tt => returnm "ecall"
    | MRET tt => returnm "mret"
    | SRET tt => returnm "sret"
    | EBREAK tt => returnm "ebreak"
    | WFI tt => returnm "wfi"
    | SFENCE_VMA (rs1, rs2) =>
       (reg_name_forwards rs1) >>= fun w__38 : string =>
       (reg_name_forwards rs2) >>= fun w__39 : string =>
       returnm (string_append "sfence.vma"
                  (string_append (spc_forwards tt)
                     (string_append w__38 (string_append (sep_forwards tt) (string_append w__39 "")))))
    | LOADRES (aq, rl, rs1, size, rd) =>
       (reg_name_forwards rd) >>= fun w__40 : string =>
       (reg_name_forwards rs1) >>= fun w__41 : string =>
       returnm (string_append "lr."
                  (string_append (size_mnemonic_forwards size)
                     (string_append (maybe_aq_forwards aq)
                        (string_append (maybe_rl_forwards rl)
                           (string_append (spc_forwards tt)
                              (string_append w__40
                                 (string_append (sep_forwards tt) (string_append w__41 ""))))))))
    | STORECON (aq, rl, rs2, rs1, size, rd) =>
       (reg_name_forwards rd) >>= fun w__42 : string =>
       (reg_name_forwards rs1) >>= fun w__43 : string =>
       (reg_name_forwards rs2) >>= fun w__44 : string =>
       returnm (string_append "sc."
                  (string_append (size_mnemonic_forwards size)
                     (string_append (maybe_aq_forwards aq)
                        (string_append (maybe_rl_forwards rl)
                           (string_append (spc_forwards tt)
                              (string_append w__42
                                 (string_append (sep_forwards tt)
                                    (string_append w__43
                                       (string_append (sep_forwards tt) (string_append w__44 ""))))))))))
    | AMO (op, aq, rl, rs2, rs1, width, rd) =>
       (reg_name_forwards rd) >>= fun w__45 : string =>
       (reg_name_forwards rs2) >>= fun w__46 : string =>
       (reg_name_forwards rs1) >>= fun w__47 : string =>
       returnm (string_append (amo_mnemonic_forwards op)
                  (string_append "."
                     (string_append (size_mnemonic_forwards width)
                        (string_append (maybe_aq_forwards aq)
                           (string_append (maybe_rl_forwards rl)
                              (string_append (spc_forwards tt)
                                 (string_append w__45
                                    (string_append (sep_forwards tt)
                                       (string_append w__46
                                          (string_append (sep_forwards tt)
                                             (string_append "("
                                                (string_append w__47 (string_append ")" "")))))))))))))
    | C_NOP tt => returnm "c.nop"
    | C_ADDI4SPN (rdc, nzimm) =>
       (if neq_vec nzimm (Ox"00"  : mword 8) then
          (creg_name_forwards rdc) >>= fun w__48 : string =>
          returnm (string_append "c.addi4spn"
                     (string_append (spc_forwards tt)
                        (string_append w__48
                           (string_append (sep_forwards tt)
                              (string_append
                                 (decimal_string_of_bits
                                    (concat_vec (nzimm  : mword 8) ('b"00"  : mword 2))) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_LW (uimm, rsc, rdc) =>
       (creg_name_forwards rdc) >>= fun w__51 : string =>
       (creg_name_forwards rsc) >>= fun w__52 : string =>
       returnm (string_append "c.lw"
                  (string_append (spc_forwards tt)
                     (string_append w__51
                        (string_append (sep_forwards tt)
                           (string_append w__52
                              (string_append (sep_forwards tt)
                                 (string_append
                                    (decimal_string_of_bits
                                       (concat_vec (uimm  : mword 5) ('b"00"  : mword 2))) "")))))))
    | C_LD (uimm, rsc, rdc) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (creg_name_forwards rdc) >>= fun w__53 : string =>
          (creg_name_forwards rsc) >>= fun w__54 : string =>
          returnm (string_append "c.ld"
                     (string_append (spc_forwards tt)
                        (string_append w__53
                           (string_append (sep_forwards tt)
                              (string_append w__54
                                 (string_append (sep_forwards tt)
                                    (string_append
                                       (decimal_string_of_bits
                                          (concat_vec (uimm  : mword 5) ('b"000"  : mword 3))) "")))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_SW (uimm, rsc1, rsc2) =>
       (creg_name_forwards rsc1) >>= fun w__57 : string =>
       (creg_name_forwards rsc2) >>= fun w__58 : string =>
       returnm (string_append "c.sw"
                  (string_append (spc_forwards tt)
                     (string_append w__57
                        (string_append (sep_forwards tt)
                           (string_append w__58
                              (string_append (sep_forwards tt)
                                 (string_append
                                    (decimal_string_of_bits
                                       (concat_vec (uimm  : mword 5) ('b"00"  : mword 2))) "")))))))
    | C_SD (uimm, rsc1, rsc2) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (creg_name_forwards rsc1) >>= fun w__59 : string =>
          (creg_name_forwards rsc2) >>= fun w__60 : string =>
          returnm (string_append "c.sd"
                     (string_append (spc_forwards tt)
                        (string_append w__59
                           (string_append (sep_forwards tt)
                              (string_append w__60
                                 (string_append (sep_forwards tt)
                                    (string_append
                                       (decimal_string_of_bits
                                          (concat_vec (uimm  : mword 5) ('b"000"  : mword 3))) "")))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_ADDI (nzi, rsd) =>
       (if andb (neq_vec nzi ('b"000000"  : mword 6)) (neq_vec rsd zreg) then
          (reg_name_forwards rsd) >>= fun w__63 : string =>
          returnm (string_append "c.addi"
                     (string_append (spc_forwards tt)
                        (string_append w__63
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits nzi) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_JAL imm =>
       (if sumbool_of_bool (Z.eqb 32 32) then
          returnm (string_append "c.jal"
                     (string_append (spc_forwards tt)
                        (string_append
                           (decimal_string_of_bits (concat_vec (imm  : mword 11) ('b"0"  : mword 1)))
                           "")))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_ADDIW (imm, rsd) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (reg_name_forwards rsd) >>= fun w__68 : string =>
          returnm (string_append "c.addiw"
                     (string_append (spc_forwards tt)
                        (string_append w__68
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits imm) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_LI (imm, rd) =>
       (if neq_vec rd zreg then
          (reg_name_forwards rd) >>= fun w__71 : string =>
          returnm (string_append "c.li"
                     (string_append (spc_forwards tt)
                        (string_append w__71
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits imm) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_ADDI16SP imm =>
       (if neq_vec imm ('b"000000"  : mword 6) then
          returnm (string_append "c.addi16sp"
                     (string_append (spc_forwards tt)
                        (string_append (decimal_string_of_bits imm) "")))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_LUI (imm, rd) =>
       (if andb (neq_vec rd zreg) (andb (neq_vec rd sp) (neq_vec imm ('b"000000"  : mword 6))) then
          (reg_name_forwards rd) >>= fun w__76 : string =>
          returnm (string_append "c.lui"
                     (string_append (spc_forwards tt)
                        (string_append w__76
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits imm) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_SRLI (shamt, rsd) =>
       (if neq_vec shamt ('b"000000"  : mword 6) then
          (creg_name_forwards rsd) >>= fun w__79 : string =>
          returnm (string_append "c.srli"
                     (string_append (spc_forwards tt)
                        (string_append w__79
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits shamt) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_SRAI (shamt, rsd) =>
       (if neq_vec shamt ('b"000000"  : mword 6) then
          (creg_name_forwards rsd) >>= fun w__82 : string =>
          returnm (string_append "c.srai"
                     (string_append (spc_forwards tt)
                        (string_append w__82
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits shamt) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_ANDI (imm, rsd) =>
       (creg_name_forwards rsd) >>= fun w__85 : string =>
       returnm (string_append "c.andi"
                  (string_append (spc_forwards tt)
                     (string_append w__85
                        (string_append (sep_forwards tt)
                           (string_append (decimal_string_of_bits imm) "")))))
    | C_SUB (rsd, rs2) =>
       (creg_name_forwards rsd) >>= fun w__86 : string =>
       (creg_name_forwards rs2) >>= fun w__87 : string =>
       returnm (string_append "c.sub"
                  (string_append (spc_forwards tt)
                     (string_append w__86 (string_append (sep_forwards tt) (string_append w__87 "")))))
    | C_XOR (rsd, rs2) =>
       (creg_name_forwards rsd) >>= fun w__88 : string =>
       (creg_name_forwards rs2) >>= fun w__89 : string =>
       returnm (string_append "c.xor"
                  (string_append (spc_forwards tt)
                     (string_append w__88 (string_append (sep_forwards tt) (string_append w__89 "")))))
    | C_OR (rsd, rs2) =>
       (creg_name_forwards rsd) >>= fun w__90 : string =>
       (creg_name_forwards rs2) >>= fun w__91 : string =>
       returnm (string_append "c.or"
                  (string_append (spc_forwards tt)
                     (string_append w__90 (string_append (sep_forwards tt) (string_append w__91 "")))))
    | C_AND (rsd, rs2) =>
       (creg_name_forwards rsd) >>= fun w__92 : string =>
       (creg_name_forwards rs2) >>= fun w__93 : string =>
       returnm (string_append "c.and"
                  (string_append (spc_forwards tt)
                     (string_append w__92 (string_append (sep_forwards tt) (string_append w__93 "")))))
    | C_SUBW (rsd, rs2) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (creg_name_forwards rsd) >>= fun w__94 : string =>
          (creg_name_forwards rs2) >>= fun w__95 : string =>
          returnm (string_append "c.subw"
                     (string_append (spc_forwards tt)
                        (string_append w__94
                           (string_append (sep_forwards tt) (string_append w__95 "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_ADDW (rsd, rs2) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (creg_name_forwards rsd) >>= fun w__98 : string =>
          (creg_name_forwards rs2) >>= fun w__99 : string =>
          returnm (string_append "c.addw"
                     (string_append (spc_forwards tt)
                        (string_append w__98
                           (string_append (sep_forwards tt) (string_append w__99 "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_J imm =>
       returnm (string_append "c.j"
                  (string_append (spc_forwards tt) (string_append (decimal_string_of_bits imm) "")))
    | C_BEQZ (imm, rs) =>
       (creg_name_forwards rs) >>= fun w__102 : string =>
       returnm (string_append "c.beqz"
                  (string_append (spc_forwards tt)
                     (string_append w__102
                        (string_append (sep_forwards tt)
                           (string_append (decimal_string_of_bits imm) "")))))
    | C_BNEZ (imm, rs) =>
       (creg_name_forwards rs) >>= fun w__103 : string =>
       returnm (string_append "c.bnez"
                  (string_append (spc_forwards tt)
                     (string_append w__103
                        (string_append (sep_forwards tt)
                           (string_append (decimal_string_of_bits imm) "")))))
    | C_SLLI (shamt, rsd) =>
       (if andb (neq_vec shamt ('b"000000"  : mword 6)) (neq_vec rsd zreg) then
          (reg_name_forwards rsd) >>= fun w__104 : string =>
          returnm (string_append "c.slli"
                     (string_append (spc_forwards tt)
                        (string_append w__104
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits shamt) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_LWSP (uimm, rd) =>
       (if neq_vec rd zreg then
          (reg_name_forwards rd) >>= fun w__107 : string =>
          returnm (string_append "c.lwsp"
                     (string_append (spc_forwards tt)
                        (string_append w__107
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits uimm) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_LDSP (uimm, rd) =>
       (if sumbool_of_bool (andb (neq_vec rd zreg) (Z.eqb 32 64)) then
          (reg_name_forwards rd) >>= fun w__110 : string =>
          returnm (string_append "c.ldsp"
                     (string_append (spc_forwards tt)
                        (string_append w__110
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits uimm) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_SWSP (uimm, rd) =>
       (reg_name_forwards rd) >>= fun w__113 : string =>
       returnm (string_append "c.swsp"
                  (string_append (spc_forwards tt)
                     (string_append w__113
                        (string_append (sep_forwards tt)
                           (string_append (decimal_string_of_bits uimm) "")))))
    | C_SDSP (uimm, rs2) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (reg_name_forwards rs2) >>= fun w__114 : string =>
          returnm (string_append "c.sdsp"
                     (string_append (spc_forwards tt)
                        (string_append w__114
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits uimm) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_JR rs1 =>
       (if neq_vec rs1 zreg then
          (reg_name_forwards rs1) >>= fun w__117 : string =>
          returnm (string_append "c.jr" (string_append (spc_forwards tt) (string_append w__117 "")))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_JALR rs1 =>
       (if neq_vec rs1 zreg then
          (reg_name_forwards rs1) >>= fun w__120 : string =>
          returnm (string_append "c.jalr"
                     (string_append (spc_forwards tt) (string_append w__120 "")))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_MV (rd, rs2) =>
       (if andb (neq_vec rd zreg) (neq_vec rs2 zreg) then
          (reg_name_forwards rd) >>= fun w__123 : string =>
          (reg_name_forwards rs2) >>= fun w__124 : string =>
          returnm (string_append "c.mv"
                     (string_append (spc_forwards tt)
                        (string_append w__123
                           (string_append (sep_forwards tt) (string_append w__124 "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_EBREAK tt => returnm "c.ebreak"
    | C_ADD (rsd, rs2) =>
       (if andb (neq_vec rsd zreg) (neq_vec rs2 zreg) then
          (reg_name_forwards rsd) >>= fun w__127 : string =>
          (reg_name_forwards rs2) >>= fun w__128 : string =>
          returnm (string_append "c.add"
                     (string_append (spc_forwards tt)
                        (string_append w__127
                           (string_append (sep_forwards tt) (string_append w__128 "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | MUL (rs2, rs1, rd, high, signed1, signed2) =>
       (mul_mnemonic_forwards (high, signed1, signed2)) >>= fun w__131 : string =>
       (reg_name_forwards rd) >>= fun w__132 : string =>
       (reg_name_forwards rs1) >>= fun w__133 : string =>
       (reg_name_forwards rs2) >>= fun w__134 : string =>
       returnm (string_append w__131
                  (string_append (spc_forwards tt)
                     (string_append w__132
                        (string_append (sep_forwards tt)
                           (string_append w__133
                              (string_append (sep_forwards tt) (string_append w__134 "")))))))
    | DIV (rs2, rs1, rd, s) =>
       (reg_name_forwards rd) >>= fun w__135 : string =>
       (reg_name_forwards rs1) >>= fun w__136 : string =>
       (reg_name_forwards rs2) >>= fun w__137 : string =>
       returnm (string_append "div"
                  (string_append (maybe_not_u_forwards s)
                     (string_append (spc_forwards tt)
                        (string_append w__135
                           (string_append (sep_forwards tt)
                              (string_append w__136
                                 (string_append (sep_forwards tt) (string_append w__137 ""))))))))
    | REM (rs2, rs1, rd, s) =>
       (reg_name_forwards rd) >>= fun w__138 : string =>
       (reg_name_forwards rs1) >>= fun w__139 : string =>
       (reg_name_forwards rs2) >>= fun w__140 : string =>
       returnm (string_append "rem"
                  (string_append (maybe_not_u_forwards s)
                     (string_append (spc_forwards tt)
                        (string_append w__138
                           (string_append (sep_forwards tt)
                              (string_append w__139
                                 (string_append (sep_forwards tt) (string_append w__140 ""))))))))
    | MULW (rs2, rs1, rd) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (reg_name_forwards rd) >>= fun w__141 : string =>
          (reg_name_forwards rs1) >>= fun w__142 : string =>
          (reg_name_forwards rs2) >>= fun w__143 : string =>
          returnm (string_append "mulw"
                     (string_append (spc_forwards tt)
                        (string_append w__141
                           (string_append (sep_forwards tt)
                              (string_append w__142
                                 (string_append (sep_forwards tt) (string_append w__143 "")))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | DIVW (rs2, rs1, rd, s) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (reg_name_forwards rd) >>= fun w__146 : string =>
          (reg_name_forwards rs1) >>= fun w__147 : string =>
          (reg_name_forwards rs2) >>= fun w__148 : string =>
          returnm (string_append "div"
                     (string_append (maybe_not_u_forwards s)
                        (string_append "w"
                           (string_append (spc_forwards tt)
                              (string_append w__146
                                 (string_append (sep_forwards tt)
                                    (string_append w__147
                                       (string_append (sep_forwards tt) (string_append w__148 "")))))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | REMW (rs2, rs1, rd, s) =>
       (if sumbool_of_bool (Z.eqb 32 64) then
          (reg_name_forwards rd) >>= fun w__151 : string =>
          (reg_name_forwards rs1) >>= fun w__152 : string =>
          (reg_name_forwards rs2) >>= fun w__153 : string =>
          returnm (string_append "rem"
                     (string_append (maybe_not_u_forwards s)
                        (string_append "w"
                           (string_append (spc_forwards tt)
                              (string_append w__151
                                 (string_append (sep_forwards tt)
                                    (string_append w__152
                                       (string_append (sep_forwards tt) (string_append w__153 "")))))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | CSR (csr, rs1, rd, true, op) =>
       (reg_name_forwards rd) >>= fun w__156 : string =>
       returnm (string_append (csr_mnemonic_forwards op)
                  (string_append "i"
                     (string_append (spc_forwards tt)
                        (string_append w__156
                           (string_append (sep_forwards tt)
                              (string_append (csr_name_map_forwards csr)
                                 (string_append (sep_forwards tt)
                                    (string_append (decimal_string_of_bits rs1) ""))))))))
    | CSR (csr, rs1, rd, false, op) =>
       (reg_name_forwards rd) >>= fun w__157 : string =>
       (reg_name_forwards rs1) >>= fun w__158 : string =>
       returnm (string_append (csr_mnemonic_forwards op)
                  (string_append (spc_forwards tt)
                     (string_append w__157
                        (string_append (sep_forwards tt)
                           (string_append (csr_name_map_forwards csr)
                              (string_append (sep_forwards tt) (string_append w__158 "")))))))
    | URET tt => returnm "uret"
    | C_NOP_HINT imm =>
       returnm (string_append "c.nop.hint." (string_append (decimal_string_of_bits imm) ""))
    | C_ADDI_HINT rsd =>
       (if neq_vec rsd zreg then
          (reg_name_forwards rsd) >>= fun w__159 : string =>
          returnm (string_append "c.addi.hint." (string_append w__159 ""))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_LI_HINT imm =>
       returnm (string_append "c.li.hint." (string_append (decimal_string_of_bits imm) ""))
    | C_LUI_HINT imm =>
       (if neq_vec imm ('b"000000"  : mword 6) then
          returnm (string_append "c.lui.hint." (string_append (decimal_string_of_bits imm) ""))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_MV_HINT rs2 =>
       (if neq_vec rs2 zreg then
          (reg_name_forwards rs2) >>= fun w__164 : string =>
          returnm (string_append "c.mv.hint." (string_append w__164 ""))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_ADD_HINT rs2 =>
       (if neq_vec rs2 zreg then
          (reg_name_forwards rs2) >>= fun w__167 : string =>
          returnm (string_append "c.add.hint." (string_append w__167 ""))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_SLLI_HINT (shamt, rsd) =>
       (if orb (eq_vec shamt ('b"000000"  : mword 6)) (eq_vec rsd zreg) then
          (reg_name_forwards rsd) >>= fun w__170 : string =>
          returnm (string_append "c.slli.hint."
                     (string_append w__170
                        (string_append "." (string_append (decimal_string_of_bits shamt) ""))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_SRLI_HINT rsd =>
       (creg_name_forwards rsd) >>= fun w__173 : string =>
       returnm (string_append "c.srli.hint." (string_append w__173 ""))
    | C_SRAI_HINT rsd =>
       (creg_name_forwards rsd) >>= fun w__174 : string =>
       returnm (string_append "c.srai.hint." (string_append w__174 ""))
    | FENCE_RESERVED (fm, pred, succ, rs, rd) =>
       (if orb (andb (neq_vec fm (Ox"0"  : mword 4)) (neq_vec fm (Ox"8"  : mword 4)))
             (orb (neq_vec rs ('b"00000"  : mword 5)) (neq_vec rd ('b"00000"  : mword 5))) then
          (fence_bits_forwards pred) >>= fun w__175 : string =>
          (fence_bits_forwards succ) >>= fun w__176 : string =>
          (reg_name_forwards rs) >>= fun w__177 : string =>
          (reg_name_forwards rd) >>= fun w__178 : string =>
          returnm (string_append "fence.reserved."
                     (string_append w__175
                        (string_append "."
                           (string_append w__176
                              (string_append "."
                                 (string_append w__177
                                    (string_append "."
                                       (string_append w__178
                                          (string_append "."
                                             (string_append (decimal_string_of_bits fm) ""))))))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | FENCEI_RESERVED (imm, rs, rd) =>
       (if orb (neq_vec imm (Ox"000"  : mword 12)) (orb (neq_vec rs zreg) (neq_vec rd zreg)) then
          (reg_name_forwards rd) >>= fun w__181 : string =>
          (reg_name_forwards rs) >>= fun w__182 : string =>
          returnm (string_append "fence.i.reserved."
                     (string_append w__181
                        (string_append "."
                           (string_append w__182
                              (string_append "." (string_append (decimal_string_of_bits imm) ""))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | LOAD_FP (imm, rs1, rd, width) =>
       (freg_name_forwards rd) >>= fun w__185 : string =>
       (reg_name_forwards rs1) >>= fun w__186 : string =>
       returnm (string_append "fl"
                  (string_append (size_mnemonic_forwards width)
                     (string_append (spc_forwards tt)
                        (string_append w__185
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits imm)
                                 (string_append (opt_spc_forwards tt)
                                    (string_append "("
                                       (string_append (opt_spc_forwards tt)
                                          (string_append w__186
                                             (string_append (opt_spc_forwards tt)
                                                (string_append ")" ""))))))))))))
    | STORE_FP (imm, rs2, rs1, width) =>
       (freg_name_forwards rs2) >>= fun w__187 : string =>
       (reg_name_forwards rs1) >>= fun w__188 : string =>
       returnm (string_append "fs"
                  (string_append (size_mnemonic_forwards width)
                     (string_append (spc_forwards tt)
                        (string_append w__187
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits imm)
                                 (string_append (opt_spc_forwards tt)
                                    (string_append "("
                                       (string_append (opt_spc_forwards tt)
                                          (string_append w__188
                                             (string_append (opt_spc_forwards tt)
                                                (string_append ")" ""))))))))))))
    | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, op) =>
       (freg_name_forwards rd) >>= fun w__189 : string =>
       (freg_name_forwards rs1) >>= fun w__190 : string =>
       (freg_name_forwards rs2) >>= fun w__191 : string =>
       (freg_name_forwards rs3) >>= fun w__192 : string =>
       returnm (string_append (f_madd_type_mnemonic_S_forwards op)
                  (string_append (spc_forwards tt)
                     (string_append w__189
                        (string_append (sep_forwards tt)
                           (string_append w__190
                              (string_append (sep_forwards tt)
                                 (string_append w__191
                                    (string_append (sep_forwards tt)
                                       (string_append w__192
                                          (string_append (sep_forwards tt)
                                             (string_append (frm_mnemonic_forwards rm) "")))))))))))
    | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, op) =>
       (freg_name_forwards rd) >>= fun w__193 : string =>
       (freg_name_forwards rs1) >>= fun w__194 : string =>
       (freg_name_forwards rs2) >>= fun w__195 : string =>
       returnm (string_append (f_bin_rm_type_mnemonic_S_forwards op)
                  (string_append (spc_forwards tt)
                     (string_append w__193
                        (string_append (sep_forwards tt)
                           (string_append w__194
                              (string_append (sep_forwards tt)
                                 (string_append w__195
                                    (string_append (sep_forwards tt)
                                       (string_append (frm_mnemonic_forwards rm) "")))))))))
    | F_UN_RM_TYPE_S (rs1, rm, rd, FSQRT_S) =>
       (freg_name_forwards rd) >>= fun w__196 : string =>
       (freg_name_forwards rs1) >>= fun w__197 : string =>
       returnm (string_append (f_un_rm_type_mnemonic_S_forwards FSQRT_S)
                  (string_append (spc_forwards tt)
                     (string_append w__196
                        (string_append (sep_forwards tt)
                           (string_append w__197
                              (string_append (sep_forwards tt)
                                 (string_append (frm_mnemonic_forwards rm) "")))))))
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_W_S) =>
       (reg_name_forwards rd) >>= fun w__198 : string =>
       (freg_name_forwards rs1) >>= fun w__199 : string =>
       returnm (string_append (f_un_rm_type_mnemonic_S_forwards FCVT_W_S)
                  (string_append (spc_forwards tt)
                     (string_append w__198
                        (string_append (sep_forwards tt)
                           (string_append w__199
                              (string_append (sep_forwards tt)
                                 (string_append (frm_mnemonic_forwards rm) "")))))))
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_WU_S) =>
       (reg_name_forwards rd) >>= fun w__200 : string =>
       (freg_name_forwards rs1) >>= fun w__201 : string =>
       returnm (string_append (f_un_rm_type_mnemonic_S_forwards FCVT_WU_S)
                  (string_append (spc_forwards tt)
                     (string_append w__200
                        (string_append (sep_forwards tt)
                           (string_append w__201
                              (string_append (sep_forwards tt)
                                 (string_append (frm_mnemonic_forwards rm) "")))))))
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_W) =>
       (freg_name_forwards rd) >>= fun w__202 : string =>
       (reg_name_forwards rs1) >>= fun w__203 : string =>
       returnm (string_append (f_un_rm_type_mnemonic_S_forwards FCVT_S_W)
                  (string_append (spc_forwards tt)
                     (string_append w__202
                        (string_append (sep_forwards tt)
                           (string_append w__203
                              (string_append (sep_forwards tt)
                                 (string_append (frm_mnemonic_forwards rm) "")))))))
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_WU) =>
       (freg_name_forwards rd) >>= fun w__204 : string =>
       (reg_name_forwards rs1) >>= fun w__205 : string =>
       returnm (string_append (f_un_rm_type_mnemonic_S_forwards FCVT_S_WU)
                  (string_append (spc_forwards tt)
                     (string_append w__204
                        (string_append (sep_forwards tt)
                           (string_append w__205
                              (string_append (sep_forwards tt)
                                 (string_append (frm_mnemonic_forwards rm) "")))))))
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_L_S) =>
       (reg_name_forwards rd) >>= fun w__206 : string =>
       (freg_name_forwards rs1) >>= fun w__207 : string =>
       returnm (string_append (f_un_rm_type_mnemonic_S_forwards FCVT_L_S)
                  (string_append (spc_forwards tt)
                     (string_append w__206
                        (string_append (sep_forwards tt)
                           (string_append w__207
                              (string_append (sep_forwards tt)
                                 (string_append (frm_mnemonic_forwards rm) "")))))))
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_LU_S) =>
       (reg_name_forwards rd) >>= fun w__208 : string =>
       (freg_name_forwards rs1) >>= fun w__209 : string =>
       returnm (string_append (f_un_rm_type_mnemonic_S_forwards FCVT_LU_S)
                  (string_append (spc_forwards tt)
                     (string_append w__208
                        (string_append (sep_forwards tt)
                           (string_append w__209
                              (string_append (sep_forwards tt)
                                 (string_append (frm_mnemonic_forwards rm) "")))))))
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_L) =>
       (freg_name_forwards rd) >>= fun w__210 : string =>
       (reg_name_forwards rs1) >>= fun w__211 : string =>
       returnm (string_append (f_un_rm_type_mnemonic_S_forwards FCVT_S_L)
                  (string_append (spc_forwards tt)
                     (string_append w__210
                        (string_append (sep_forwards tt)
                           (string_append w__211
                              (string_append (sep_forwards tt)
                                 (string_append (frm_mnemonic_forwards rm) "")))))))
    | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_LU) =>
       (freg_name_forwards rd) >>= fun w__212 : string =>
       (reg_name_forwards rs1) >>= fun w__213 : string =>
       returnm (string_append (f_un_rm_type_mnemonic_S_forwards FCVT_S_LU)
                  (string_append (spc_forwards tt)
                     (string_append w__212
                        (string_append (sep_forwards tt)
                           (string_append w__213
                              (string_append (sep_forwards tt)
                                 (string_append (frm_mnemonic_forwards rm) "")))))))
    | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJ_S) =>
       (freg_name_forwards rd) >>= fun w__214 : string =>
       (freg_name_forwards rs1) >>= fun w__215 : string =>
       (freg_name_forwards rs2) >>= fun w__216 : string =>
       returnm (string_append (f_bin_type_mnemonic_S_forwards FSGNJ_S)
                  (string_append (spc_forwards tt)
                     (string_append w__214
                        (string_append (sep_forwards tt)
                           (string_append w__215
                              (string_append (sep_forwards tt) (string_append w__216 "")))))))
    | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJN_S) =>
       (freg_name_forwards rd) >>= fun w__217 : string =>
       (freg_name_forwards rs1) >>= fun w__218 : string =>
       (freg_name_forwards rs2) >>= fun w__219 : string =>
       returnm (string_append (f_bin_type_mnemonic_S_forwards FSGNJN_S)
                  (string_append (spc_forwards tt)
                     (string_append w__217
                        (string_append (sep_forwards tt)
                           (string_append w__218
                              (string_append (sep_forwards tt) (string_append w__219 "")))))))
    | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJX_S) =>
       (freg_name_forwards rd) >>= fun w__220 : string =>
       (freg_name_forwards rs1) >>= fun w__221 : string =>
       (freg_name_forwards rs2) >>= fun w__222 : string =>
       returnm (string_append (f_bin_type_mnemonic_S_forwards FSGNJX_S)
                  (string_append (spc_forwards tt)
                     (string_append w__220
                        (string_append (sep_forwards tt)
                           (string_append w__221
                              (string_append (sep_forwards tt) (string_append w__222 "")))))))
    | F_BIN_TYPE_S (rs2, rs1, rd, FMIN_S) =>
       (freg_name_forwards rd) >>= fun w__223 : string =>
       (freg_name_forwards rs1) >>= fun w__224 : string =>
       (freg_name_forwards rs2) >>= fun w__225 : string =>
       returnm (string_append (f_bin_type_mnemonic_S_forwards FMIN_S)
                  (string_append (spc_forwards tt)
                     (string_append w__223
                        (string_append (sep_forwards tt)
                           (string_append w__224
                              (string_append (sep_forwards tt) (string_append w__225 "")))))))
    | F_BIN_TYPE_S (rs2, rs1, rd, FMAX_S) =>
       (freg_name_forwards rd) >>= fun w__226 : string =>
       (freg_name_forwards rs1) >>= fun w__227 : string =>
       (freg_name_forwards rs2) >>= fun w__228 : string =>
       returnm (string_append (f_bin_type_mnemonic_S_forwards FMAX_S)
                  (string_append (spc_forwards tt)
                     (string_append w__226
                        (string_append (sep_forwards tt)
                           (string_append w__227
                              (string_append (sep_forwards tt) (string_append w__228 "")))))))
    | F_BIN_TYPE_S (rs2, rs1, rd, FEQ_S) =>
       (reg_name_forwards rd) >>= fun w__229 : string =>
       (freg_name_forwards rs1) >>= fun w__230 : string =>
       (freg_name_forwards rs2) >>= fun w__231 : string =>
       returnm (string_append (f_bin_type_mnemonic_S_forwards FEQ_S)
                  (string_append (spc_forwards tt)
                     (string_append w__229
                        (string_append (sep_forwards tt)
                           (string_append w__230
                              (string_append (sep_forwards tt) (string_append w__231 "")))))))
    | F_BIN_TYPE_S (rs2, rs1, rd, FLT_S) =>
       (reg_name_forwards rd) >>= fun w__232 : string =>
       (freg_name_forwards rs1) >>= fun w__233 : string =>
       (freg_name_forwards rs2) >>= fun w__234 : string =>
       returnm (string_append (f_bin_type_mnemonic_S_forwards FLT_S)
                  (string_append (spc_forwards tt)
                     (string_append w__232
                        (string_append (sep_forwards tt)
                           (string_append w__233
                              (string_append (sep_forwards tt) (string_append w__234 "")))))))
    | F_BIN_TYPE_S (rs2, rs1, rd, FLE_S) =>
       (reg_name_forwards rd) >>= fun w__235 : string =>
       (freg_name_forwards rs1) >>= fun w__236 : string =>
       (freg_name_forwards rs2) >>= fun w__237 : string =>
       returnm (string_append (f_bin_type_mnemonic_S_forwards FLE_S)
                  (string_append (spc_forwards tt)
                     (string_append w__235
                        (string_append (sep_forwards tt)
                           (string_append w__236
                              (string_append (sep_forwards tt) (string_append w__237 "")))))))
    | F_UN_TYPE_S (rs1, rd, FMV_X_W) =>
       (reg_name_forwards rd) >>= fun w__238 : string =>
       (freg_name_forwards rs1) >>= fun w__239 : string =>
       returnm (string_append (f_un_type_mnemonic_S_forwards FMV_X_W)
                  (string_append (spc_forwards tt)
                     (string_append w__238
                        (string_append (sep_forwards tt) (string_append w__239 "")))))
    | F_UN_TYPE_S (rs1, rd, FMV_W_X) =>
       (freg_name_forwards rd) >>= fun w__240 : string =>
       (reg_name_forwards rs1) >>= fun w__241 : string =>
       returnm (string_append (f_un_type_mnemonic_S_forwards FMV_W_X)
                  (string_append (spc_forwards tt)
                     (string_append w__240
                        (string_append (sep_forwards tt) (string_append w__241 "")))))
    | F_UN_TYPE_S (rs1, rd, FCLASS_S) =>
       (reg_name_forwards rd) >>= fun w__242 : string =>
       (freg_name_forwards rs1) >>= fun w__243 : string =>
       returnm (string_append (f_un_type_mnemonic_S_forwards FCLASS_S)
                  (string_append (spc_forwards tt)
                     (string_append w__242
                        (string_append (sep_forwards tt) (string_append w__243 "")))))
    | C_FLWSP (imm, rd) =>
       (if sumbool_of_bool (Z.eqb 32 32) then
          (reg_name_forwards rd) >>= fun w__244 : string =>
          returnm (string_append "c.flwsp"
                     (string_append (spc_forwards tt)
                        (string_append w__244
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits imm) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_FSWSP (uimm, rd) =>
       (if sumbool_of_bool (Z.eqb 32 32) then
          (reg_name_forwards rd) >>= fun w__247 : string =>
          returnm (string_append "c.fswsp"
                     (string_append (spc_forwards tt)
                        (string_append w__247
                           (string_append (sep_forwards tt)
                              (string_append (decimal_string_of_bits uimm) "")))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_FLW (uimm, rsc, rdc) =>
       (if sumbool_of_bool (Z.eqb 32 32) then
          (creg_name_forwards rdc) >>= fun w__250 : string =>
          (creg_name_forwards rsc) >>= fun w__251 : string =>
          returnm (string_append "c.flw"
                     (string_append (spc_forwards tt)
                        (string_append w__250
                           (string_append (sep_forwards tt)
                              (string_append w__251
                                 (string_append (sep_forwards tt)
                                    (string_append
                                       (decimal_string_of_bits
                                          (concat_vec (uimm  : mword 5) ('b"00"  : mword 2))) "")))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | C_FSW (uimm, rsc1, rsc2) =>
       (if sumbool_of_bool (Z.eqb 32 32) then
          (creg_name_forwards rsc1) >>= fun w__254 : string =>
          (creg_name_forwards rsc2) >>= fun w__255 : string =>
          returnm (string_append "c.fsw"
                     (string_append (spc_forwards tt)
                        (string_append w__254
                           (string_append (sep_forwards tt)
                              (string_append w__255
                                 (string_append (sep_forwards tt)
                                    (string_append
                                       (decimal_string_of_bits
                                          (concat_vec (uimm  : mword 5) ('b"00"  : mword 2))) "")))))))
        else assert_exp' false "Pattern match failure at unknown location" >>= fun _ => exit tt)
        : M (string)
    | ILLEGAL s =>
       returnm (string_append "illegal"
                  (string_append (spc_forwards tt) (string_append (decimal_string_of_bits s) "")))
    | C_ILLEGAL s =>
       returnm (string_append "c.illegal"
                  (string_append (spc_forwards tt) (string_append (decimal_string_of_bits s) "")))
    end)
    : M (string).

Definition _s2645_ (_s2646_ : string) : M (option (mword 16)) :=
   let _s2647_ := _s2646_ in
   (if string_startswith _s2647_ "c.illegal" then
      (match (string_drop _s2647_ (projT1 (string_length "c.illegal"))) with
       | _s2648_ =>
          (spc_matches_prefix _s2648_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s2649_ _) =>
                      match (string_drop _s2648_ _s2649_) with
                      | _s2650_ =>
                         match (hex_bits_16_matches_prefix _s2650_) with
                         | Some (s, existT _ _s2651_ _) =>
                            let p0_ := string_drop _s2650_ _s2651_ in
                            if generic_eq p0_ "" then Some s
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 16))
    else returnm None)
    : M (option (mword 16)).

Definition _s2637_ (_s2638_ : string) : M (option (mword 32)) :=
   let _s2639_ := _s2638_ in
   (if string_startswith _s2639_ "illegal" then
      (match (string_drop _s2639_ (projT1 (string_length "illegal"))) with
       | _s2640_ =>
          (spc_matches_prefix _s2640_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s2641_ _) =>
                      match (string_drop _s2640_ _s2641_) with
                      | _s2642_ =>
                         match (hex_bits_32_matches_prefix _s2642_) with
                         | Some (s, existT _ _s2643_ _) =>
                            let p0_ := string_drop _s2642_ _s2643_ in
                            if generic_eq p0_ "" then Some s
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 32))
    else returnm None)
    : M (option (mword 32)).

Definition _s2621_ (_s2622_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s2623_ := _s2622_ in
   (if string_startswith _s2623_ "c.fsw" then
      (match (string_drop _s2623_ (projT1 (string_length "c.fsw"))) with
       | _s2624_ =>
          (spc_matches_prefix _s2624_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2625_ _) =>
              (match (string_drop _s2624_ _s2625_) with
               | _s2626_ =>
                  (creg_name_matches_prefix _s2626_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsc1, existT _ _s2627_ _) =>
                      (match (string_drop _s2626_ _s2627_) with
                       | _s2628_ =>
                          (sep_matches_prefix _s2628_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s2629_ _) =>
                              (match (string_drop _s2628_ _s2629_) with
                               | _s2630_ =>
                                  (creg_name_matches_prefix _s2630_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc2, existT _ _s2631_ _) =>
                                      (match (string_drop _s2630_ _s2631_) with
                                       | _s2632_ =>
                                          (sep_matches_prefix _s2632_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s2633_ _) =>
                                                      match (string_drop _s2632_ _s2633_) with
                                                      | _s2634_ =>
                                                         match (hex_bits_7_matches_prefix _s2634_) with
                                                         | Some (v__1180, existT _ _s2635_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1180 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1180 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1180 6 2 in
                                                              let p0_ := string_drop _s2634_ _s2635_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rsc1, rsc2, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s2605_ (_s2606_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s2607_ := _s2606_ in
   (if string_startswith _s2607_ "c.flw" then
      (match (string_drop _s2607_ (projT1 (string_length "c.flw"))) with
       | _s2608_ =>
          (spc_matches_prefix _s2608_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2609_ _) =>
              (match (string_drop _s2608_ _s2609_) with
               | _s2610_ =>
                  (creg_name_matches_prefix _s2610_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s2611_ _) =>
                      (match (string_drop _s2610_ _s2611_) with
                       | _s2612_ =>
                          (sep_matches_prefix _s2612_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s2613_ _) =>
                              (match (string_drop _s2612_ _s2613_) with
                               | _s2614_ =>
                                  (creg_name_matches_prefix _s2614_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc, existT _ _s2615_ _) =>
                                      (match (string_drop _s2614_ _s2615_) with
                                       | _s2616_ =>
                                          (sep_matches_prefix _s2616_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s2617_ _) =>
                                                      match (string_drop _s2616_ _s2617_) with
                                                      | _s2618_ =>
                                                         match (hex_bits_7_matches_prefix _s2618_) with
                                                         | Some (v__1182, existT _ _s2619_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1182 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1182 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1182 6 2 in
                                                              let p0_ := string_drop _s2618_ _s2619_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rdc, rsc, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s2593_ (_s2594_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s2595_ := _s2594_ in
   (if string_startswith _s2595_ "c.fswsp" then
      (match (string_drop _s2595_ (projT1 (string_length "c.fswsp"))) with
       | _s2596_ =>
          (spc_matches_prefix _s2596_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2597_ _) =>
              (match (string_drop _s2596_ _s2597_) with
               | _s2598_ =>
                  (reg_name_matches_prefix _s2598_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s2599_ _) =>
                      (match (string_drop _s2598_ _s2599_) with
                       | _s2600_ =>
                          (sep_matches_prefix _s2600_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s2601_ _) =>
                                      match (string_drop _s2600_ _s2601_) with
                                      | _s2602_ =>
                                         match (hex_bits_6_matches_prefix _s2602_) with
                                         | Some (uimm, existT _ _s2603_ _) =>
                                            let p0_ := string_drop _s2602_ _s2603_ in
                                            if generic_eq p0_ "" then Some (rd, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s2581_ (_s2582_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s2583_ := _s2582_ in
   (if string_startswith _s2583_ "c.flwsp" then
      (match (string_drop _s2583_ (projT1 (string_length "c.flwsp"))) with
       | _s2584_ =>
          (spc_matches_prefix _s2584_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2585_ _) =>
              (match (string_drop _s2584_ _s2585_) with
               | _s2586_ =>
                  (reg_name_matches_prefix _s2586_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s2587_ _) =>
                      (match (string_drop _s2586_ _s2587_) with
                       | _s2588_ =>
                          (sep_matches_prefix _s2588_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s2589_ _) =>
                                      match (string_drop _s2588_ _s2589_) with
                                      | _s2590_ =>
                                         match (hex_bits_6_matches_prefix _s2590_) with
                                         | Some (imm, existT _ _s2591_ _) =>
                                            let p0_ := string_drop _s2590_ _s2591_ in
                                            if generic_eq p0_ "" then Some (rd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s2568_ (_s2569_ : string) : M (option ((f_un_op_S * mword 5 * mword 5))) :=
   (match _s2569_ with
    | _s2570_ =>
       (f_un_type_mnemonic_S_matches_prefix _s2570_) >>= fun w__0 : option ((f_un_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCLASS_S, existT _ _s2571_ _) =>
           (match (string_drop _s2570_ _s2571_) with
            | _s2572_ =>
               (spc_matches_prefix _s2572_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2573_ _) =>
                   (match (string_drop _s2572_ _s2573_) with
                    | _s2574_ =>
                       (reg_name_matches_prefix _s2574_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2575_ _) =>
                           (match (string_drop _s2574_ _s2575_) with
                            | _s2576_ =>
                               (sep_matches_prefix _s2576_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2577_ _) =>
                                   (match (string_drop _s2576_ _s2577_) with
                                    | _s2578_ =>
                                       (freg_name_matches_prefix _s2578_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       returnm (match w__4 with
                                                | Some (rs1, existT _ _s2579_ _) =>
                                                   let p0_ := string_drop _s2578_ _s2579_ in
                                                   if generic_eq p0_ "" then
                                                     Some (FCLASS_S, rd, rs1)
                                                   else None
                                                | _ => None
                                                end)
                                    end)
                                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_op_S * mword 5 * mword 5)))
                            end)
                            : M (option ((f_un_op_S * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_op_S * mword 5 * mword 5)))
                    end)
                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_un_op_S * mword 5 * mword 5)))
            end)
            : M (option ((f_un_op_S * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_un_op_S * mword 5 * mword 5)))
    end)
    : M (option ((f_un_op_S * mword 5 * mword 5))).

Definition _s2555_ (_s2556_ : string) : M (option ((f_un_op_S * mword 5 * mword 5))) :=
   (match _s2556_ with
    | _s2557_ =>
       (f_un_type_mnemonic_S_matches_prefix _s2557_) >>= fun w__0 : option ((f_un_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMV_W_X, existT _ _s2558_ _) =>
           (match (string_drop _s2557_ _s2558_) with
            | _s2559_ =>
               (spc_matches_prefix _s2559_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2560_ _) =>
                   (match (string_drop _s2559_ _s2560_) with
                    | _s2561_ =>
                       (freg_name_matches_prefix _s2561_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2562_ _) =>
                           (match (string_drop _s2561_ _s2562_) with
                            | _s2563_ =>
                               (sep_matches_prefix _s2563_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2564_ _) =>
                                   (match (string_drop _s2563_ _s2564_) with
                                    | _s2565_ =>
                                       (reg_name_matches_prefix _s2565_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       returnm (match w__4 with
                                                | Some (rs1, existT _ _s2566_ _) =>
                                                   let p0_ := string_drop _s2565_ _s2566_ in
                                                   if generic_eq p0_ "" then Some (FMV_W_X, rd, rs1)
                                                   else None
                                                | _ => None
                                                end)
                                    end)
                                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_op_S * mword 5 * mword 5)))
                            end)
                            : M (option ((f_un_op_S * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_op_S * mword 5 * mword 5)))
                    end)
                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_un_op_S * mword 5 * mword 5)))
            end)
            : M (option ((f_un_op_S * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_un_op_S * mword 5 * mword 5)))
    end)
    : M (option ((f_un_op_S * mword 5 * mword 5))).

Definition _s2542_ (_s2543_ : string) : M (option ((f_un_op_S * mword 5 * mword 5))) :=
   (match _s2543_ with
    | _s2544_ =>
       (f_un_type_mnemonic_S_matches_prefix _s2544_) >>= fun w__0 : option ((f_un_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMV_X_W, existT _ _s2545_ _) =>
           (match (string_drop _s2544_ _s2545_) with
            | _s2546_ =>
               (spc_matches_prefix _s2546_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2547_ _) =>
                   (match (string_drop _s2546_ _s2547_) with
                    | _s2548_ =>
                       (reg_name_matches_prefix _s2548_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2549_ _) =>
                           (match (string_drop _s2548_ _s2549_) with
                            | _s2550_ =>
                               (sep_matches_prefix _s2550_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2551_ _) =>
                                   (match (string_drop _s2550_ _s2551_) with
                                    | _s2552_ =>
                                       (freg_name_matches_prefix _s2552_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       returnm (match w__4 with
                                                | Some (rs1, existT _ _s2553_ _) =>
                                                   let p0_ := string_drop _s2552_ _s2553_ in
                                                   if generic_eq p0_ "" then Some (FMV_X_W, rd, rs1)
                                                   else None
                                                | _ => None
                                                end)
                                    end)
                                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_op_S * mword 5 * mword 5)))
                            end)
                            : M (option ((f_un_op_S * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_op_S * mword 5 * mword 5)))
                    end)
                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_un_op_S * mword 5 * mword 5)))
            end)
            : M (option ((f_un_op_S * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_un_op_S * mword 5 * mword 5)))
    end)
    : M (option ((f_un_op_S * mword 5 * mword 5))).

Definition _s2525_ (_s2526_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s2526_ with
    | _s2527_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s2527_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FLE_S, existT _ _s2528_ _) =>
           (match (string_drop _s2527_ _s2528_) with
            | _s2529_ =>
               (spc_matches_prefix _s2529_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2530_ _) =>
                   (match (string_drop _s2529_ _s2530_) with
                    | _s2531_ =>
                       (reg_name_matches_prefix _s2531_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2532_ _) =>
                           (match (string_drop _s2531_ _s2532_) with
                            | _s2533_ =>
                               (sep_matches_prefix _s2533_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2534_ _) =>
                                   (match (string_drop _s2533_ _s2534_) with
                                    | _s2535_ =>
                                       (freg_name_matches_prefix _s2535_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2536_ _) =>
                                           (match (string_drop _s2535_ _s2536_) with
                                            | _s2537_ =>
                                               (sep_matches_prefix _s2537_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2538_ _) =>
                                                   (match (string_drop _s2537_ _s2538_) with
                                                    | _s2539_ =>
                                                       (freg_name_matches_prefix _s2539_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2540_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2539_ _s2540_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FLE_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s2508_ (_s2509_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s2509_ with
    | _s2510_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s2510_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FLT_S, existT _ _s2511_ _) =>
           (match (string_drop _s2510_ _s2511_) with
            | _s2512_ =>
               (spc_matches_prefix _s2512_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2513_ _) =>
                   (match (string_drop _s2512_ _s2513_) with
                    | _s2514_ =>
                       (reg_name_matches_prefix _s2514_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2515_ _) =>
                           (match (string_drop _s2514_ _s2515_) with
                            | _s2516_ =>
                               (sep_matches_prefix _s2516_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2517_ _) =>
                                   (match (string_drop _s2516_ _s2517_) with
                                    | _s2518_ =>
                                       (freg_name_matches_prefix _s2518_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2519_ _) =>
                                           (match (string_drop _s2518_ _s2519_) with
                                            | _s2520_ =>
                                               (sep_matches_prefix _s2520_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2521_ _) =>
                                                   (match (string_drop _s2520_ _s2521_) with
                                                    | _s2522_ =>
                                                       (freg_name_matches_prefix _s2522_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2523_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2522_ _s2523_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FLT_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s2491_ (_s2492_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s2492_ with
    | _s2493_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s2493_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FEQ_S, existT _ _s2494_ _) =>
           (match (string_drop _s2493_ _s2494_) with
            | _s2495_ =>
               (spc_matches_prefix _s2495_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2496_ _) =>
                   (match (string_drop _s2495_ _s2496_) with
                    | _s2497_ =>
                       (reg_name_matches_prefix _s2497_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2498_ _) =>
                           (match (string_drop _s2497_ _s2498_) with
                            | _s2499_ =>
                               (sep_matches_prefix _s2499_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2500_ _) =>
                                   (match (string_drop _s2499_ _s2500_) with
                                    | _s2501_ =>
                                       (freg_name_matches_prefix _s2501_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2502_ _) =>
                                           (match (string_drop _s2501_ _s2502_) with
                                            | _s2503_ =>
                                               (sep_matches_prefix _s2503_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2504_ _) =>
                                                   (match (string_drop _s2503_ _s2504_) with
                                                    | _s2505_ =>
                                                       (freg_name_matches_prefix _s2505_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2506_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2505_ _s2506_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FEQ_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s2474_ (_s2475_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s2475_ with
    | _s2476_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s2476_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMAX_S, existT _ _s2477_ _) =>
           (match (string_drop _s2476_ _s2477_) with
            | _s2478_ =>
               (spc_matches_prefix _s2478_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2479_ _) =>
                   (match (string_drop _s2478_ _s2479_) with
                    | _s2480_ =>
                       (freg_name_matches_prefix _s2480_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2481_ _) =>
                           (match (string_drop _s2480_ _s2481_) with
                            | _s2482_ =>
                               (sep_matches_prefix _s2482_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2483_ _) =>
                                   (match (string_drop _s2482_ _s2483_) with
                                    | _s2484_ =>
                                       (freg_name_matches_prefix _s2484_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2485_ _) =>
                                           (match (string_drop _s2484_ _s2485_) with
                                            | _s2486_ =>
                                               (sep_matches_prefix _s2486_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2487_ _) =>
                                                   (match (string_drop _s2486_ _s2487_) with
                                                    | _s2488_ =>
                                                       (freg_name_matches_prefix _s2488_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2489_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2488_ _s2489_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FMAX_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s2457_ (_s2458_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s2458_ with
    | _s2459_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s2459_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMIN_S, existT _ _s2460_ _) =>
           (match (string_drop _s2459_ _s2460_) with
            | _s2461_ =>
               (spc_matches_prefix _s2461_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2462_ _) =>
                   (match (string_drop _s2461_ _s2462_) with
                    | _s2463_ =>
                       (freg_name_matches_prefix _s2463_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2464_ _) =>
                           (match (string_drop _s2463_ _s2464_) with
                            | _s2465_ =>
                               (sep_matches_prefix _s2465_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2466_ _) =>
                                   (match (string_drop _s2465_ _s2466_) with
                                    | _s2467_ =>
                                       (freg_name_matches_prefix _s2467_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2468_ _) =>
                                           (match (string_drop _s2467_ _s2468_) with
                                            | _s2469_ =>
                                               (sep_matches_prefix _s2469_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2470_ _) =>
                                                   (match (string_drop _s2469_ _s2470_) with
                                                    | _s2471_ =>
                                                       (freg_name_matches_prefix _s2471_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2472_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2471_ _s2472_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FMIN_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s2440_ (_s2441_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s2441_ with
    | _s2442_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s2442_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSGNJX_S, existT _ _s2443_ _) =>
           (match (string_drop _s2442_ _s2443_) with
            | _s2444_ =>
               (spc_matches_prefix _s2444_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2445_ _) =>
                   (match (string_drop _s2444_ _s2445_) with
                    | _s2446_ =>
                       (freg_name_matches_prefix _s2446_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2447_ _) =>
                           (match (string_drop _s2446_ _s2447_) with
                            | _s2448_ =>
                               (sep_matches_prefix _s2448_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2449_ _) =>
                                   (match (string_drop _s2448_ _s2449_) with
                                    | _s2450_ =>
                                       (freg_name_matches_prefix _s2450_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2451_ _) =>
                                           (match (string_drop _s2450_ _s2451_) with
                                            | _s2452_ =>
                                               (sep_matches_prefix _s2452_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2453_ _) =>
                                                   (match (string_drop _s2452_ _s2453_) with
                                                    | _s2454_ =>
                                                       (freg_name_matches_prefix _s2454_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2455_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2454_ _s2455_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FSGNJX_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s2423_ (_s2424_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s2424_ with
    | _s2425_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s2425_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSGNJN_S, existT _ _s2426_ _) =>
           (match (string_drop _s2425_ _s2426_) with
            | _s2427_ =>
               (spc_matches_prefix _s2427_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2428_ _) =>
                   (match (string_drop _s2427_ _s2428_) with
                    | _s2429_ =>
                       (freg_name_matches_prefix _s2429_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2430_ _) =>
                           (match (string_drop _s2429_ _s2430_) with
                            | _s2431_ =>
                               (sep_matches_prefix _s2431_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2432_ _) =>
                                   (match (string_drop _s2431_ _s2432_) with
                                    | _s2433_ =>
                                       (freg_name_matches_prefix _s2433_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2434_ _) =>
                                           (match (string_drop _s2433_ _s2434_) with
                                            | _s2435_ =>
                                               (sep_matches_prefix _s2435_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2436_ _) =>
                                                   (match (string_drop _s2435_ _s2436_) with
                                                    | _s2437_ =>
                                                       (freg_name_matches_prefix _s2437_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2438_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2437_ _s2438_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FSGNJN_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s2406_ (_s2407_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s2407_ with
    | _s2408_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s2408_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSGNJ_S, existT _ _s2409_ _) =>
           (match (string_drop _s2408_ _s2409_) with
            | _s2410_ =>
               (spc_matches_prefix _s2410_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2411_ _) =>
                   (match (string_drop _s2410_ _s2411_) with
                    | _s2412_ =>
                       (freg_name_matches_prefix _s2412_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2413_ _) =>
                           (match (string_drop _s2412_ _s2413_) with
                            | _s2414_ =>
                               (sep_matches_prefix _s2414_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2415_ _) =>
                                   (match (string_drop _s2414_ _s2415_) with
                                    | _s2416_ =>
                                       (freg_name_matches_prefix _s2416_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2417_ _) =>
                                           (match (string_drop _s2416_ _s2417_) with
                                            | _s2418_ =>
                                               (sep_matches_prefix _s2418_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2419_ _) =>
                                                   (match (string_drop _s2418_ _s2419_) with
                                                    | _s2420_ =>
                                                       (freg_name_matches_prefix _s2420_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2421_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2420_ _s2421_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FSGNJ_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s2389_ (_s2390_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2390_ with
    | _s2391_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s2391_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_LU, existT _ _s2392_ _) =>
           (match (string_drop _s2391_ _s2392_) with
            | _s2393_ =>
               (spc_matches_prefix _s2393_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2394_ _) =>
                   (match (string_drop _s2393_ _s2394_) with
                    | _s2395_ =>
                       (freg_name_matches_prefix _s2395_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2396_ _) =>
                           (match (string_drop _s2395_ _s2396_) with
                            | _s2397_ =>
                               (sep_matches_prefix _s2397_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2398_ _) =>
                                   (match (string_drop _s2397_ _s2398_) with
                                    | _s2399_ =>
                                       (reg_name_matches_prefix _s2399_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2400_ _) =>
                                           (match (string_drop _s2399_ _s2400_) with
                                            | _s2401_ =>
                                               (sep_matches_prefix _s2401_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2402_ _) =>
                                                   (match (string_drop _s2401_ _s2402_) with
                                                    | _s2403_ =>
                                                       (frm_mnemonic_matches_prefix _s2403_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s2404_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2403_ _s2404_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_S_LU, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s2372_ (_s2373_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2373_ with
    | _s2374_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s2374_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_L, existT _ _s2375_ _) =>
           (match (string_drop _s2374_ _s2375_) with
            | _s2376_ =>
               (spc_matches_prefix _s2376_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2377_ _) =>
                   (match (string_drop _s2376_ _s2377_) with
                    | _s2378_ =>
                       (freg_name_matches_prefix _s2378_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2379_ _) =>
                           (match (string_drop _s2378_ _s2379_) with
                            | _s2380_ =>
                               (sep_matches_prefix _s2380_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2381_ _) =>
                                   (match (string_drop _s2380_ _s2381_) with
                                    | _s2382_ =>
                                       (reg_name_matches_prefix _s2382_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2383_ _) =>
                                           (match (string_drop _s2382_ _s2383_) with
                                            | _s2384_ =>
                                               (sep_matches_prefix _s2384_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2385_ _) =>
                                                   (match (string_drop _s2384_ _s2385_) with
                                                    | _s2386_ =>
                                                       (frm_mnemonic_matches_prefix _s2386_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s2387_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2386_ _s2387_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_S_L, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s2355_ (_s2356_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2356_ with
    | _s2357_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s2357_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_LU_S, existT _ _s2358_ _) =>
           (match (string_drop _s2357_ _s2358_) with
            | _s2359_ =>
               (spc_matches_prefix _s2359_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2360_ _) =>
                   (match (string_drop _s2359_ _s2360_) with
                    | _s2361_ =>
                       (reg_name_matches_prefix _s2361_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2362_ _) =>
                           (match (string_drop _s2361_ _s2362_) with
                            | _s2363_ =>
                               (sep_matches_prefix _s2363_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2364_ _) =>
                                   (match (string_drop _s2363_ _s2364_) with
                                    | _s2365_ =>
                                       (freg_name_matches_prefix _s2365_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2366_ _) =>
                                           (match (string_drop _s2365_ _s2366_) with
                                            | _s2367_ =>
                                               (sep_matches_prefix _s2367_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2368_ _) =>
                                                   (match (string_drop _s2367_ _s2368_) with
                                                    | _s2369_ =>
                                                       (frm_mnemonic_matches_prefix _s2369_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s2370_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2369_ _s2370_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_LU_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s2338_ (_s2339_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2339_ with
    | _s2340_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s2340_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_L_S, existT _ _s2341_ _) =>
           (match (string_drop _s2340_ _s2341_) with
            | _s2342_ =>
               (spc_matches_prefix _s2342_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2343_ _) =>
                   (match (string_drop _s2342_ _s2343_) with
                    | _s2344_ =>
                       (reg_name_matches_prefix _s2344_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2345_ _) =>
                           (match (string_drop _s2344_ _s2345_) with
                            | _s2346_ =>
                               (sep_matches_prefix _s2346_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2347_ _) =>
                                   (match (string_drop _s2346_ _s2347_) with
                                    | _s2348_ =>
                                       (freg_name_matches_prefix _s2348_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2349_ _) =>
                                           (match (string_drop _s2348_ _s2349_) with
                                            | _s2350_ =>
                                               (sep_matches_prefix _s2350_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2351_ _) =>
                                                   (match (string_drop _s2350_ _s2351_) with
                                                    | _s2352_ =>
                                                       (frm_mnemonic_matches_prefix _s2352_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s2353_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2352_ _s2353_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_L_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s2321_ (_s2322_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2322_ with
    | _s2323_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s2323_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_WU, existT _ _s2324_ _) =>
           (match (string_drop _s2323_ _s2324_) with
            | _s2325_ =>
               (spc_matches_prefix _s2325_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2326_ _) =>
                   (match (string_drop _s2325_ _s2326_) with
                    | _s2327_ =>
                       (freg_name_matches_prefix _s2327_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2328_ _) =>
                           (match (string_drop _s2327_ _s2328_) with
                            | _s2329_ =>
                               (sep_matches_prefix _s2329_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2330_ _) =>
                                   (match (string_drop _s2329_ _s2330_) with
                                    | _s2331_ =>
                                       (reg_name_matches_prefix _s2331_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2332_ _) =>
                                           (match (string_drop _s2331_ _s2332_) with
                                            | _s2333_ =>
                                               (sep_matches_prefix _s2333_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2334_ _) =>
                                                   (match (string_drop _s2333_ _s2334_) with
                                                    | _s2335_ =>
                                                       (frm_mnemonic_matches_prefix _s2335_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s2336_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2335_ _s2336_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_S_WU, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s2304_ (_s2305_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2305_ with
    | _s2306_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s2306_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_W, existT _ _s2307_ _) =>
           (match (string_drop _s2306_ _s2307_) with
            | _s2308_ =>
               (spc_matches_prefix _s2308_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2309_ _) =>
                   (match (string_drop _s2308_ _s2309_) with
                    | _s2310_ =>
                       (freg_name_matches_prefix _s2310_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2311_ _) =>
                           (match (string_drop _s2310_ _s2311_) with
                            | _s2312_ =>
                               (sep_matches_prefix _s2312_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2313_ _) =>
                                   (match (string_drop _s2312_ _s2313_) with
                                    | _s2314_ =>
                                       (reg_name_matches_prefix _s2314_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2315_ _) =>
                                           (match (string_drop _s2314_ _s2315_) with
                                            | _s2316_ =>
                                               (sep_matches_prefix _s2316_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2317_ _) =>
                                                   (match (string_drop _s2316_ _s2317_) with
                                                    | _s2318_ =>
                                                       (frm_mnemonic_matches_prefix _s2318_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s2319_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2318_ _s2319_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_S_W, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s2287_ (_s2288_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2288_ with
    | _s2289_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s2289_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_WU_S, existT _ _s2290_ _) =>
           (match (string_drop _s2289_ _s2290_) with
            | _s2291_ =>
               (spc_matches_prefix _s2291_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2292_ _) =>
                   (match (string_drop _s2291_ _s2292_) with
                    | _s2293_ =>
                       (reg_name_matches_prefix _s2293_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2294_ _) =>
                           (match (string_drop _s2293_ _s2294_) with
                            | _s2295_ =>
                               (sep_matches_prefix _s2295_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2296_ _) =>
                                   (match (string_drop _s2295_ _s2296_) with
                                    | _s2297_ =>
                                       (freg_name_matches_prefix _s2297_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2298_ _) =>
                                           (match (string_drop _s2297_ _s2298_) with
                                            | _s2299_ =>
                                               (sep_matches_prefix _s2299_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2300_ _) =>
                                                   (match (string_drop _s2299_ _s2300_) with
                                                    | _s2301_ =>
                                                       (frm_mnemonic_matches_prefix _s2301_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s2302_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2301_ _s2302_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_WU_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s2270_ (_s2271_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2271_ with
    | _s2272_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s2272_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_W_S, existT _ _s2273_ _) =>
           (match (string_drop _s2272_ _s2273_) with
            | _s2274_ =>
               (spc_matches_prefix _s2274_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2275_ _) =>
                   (match (string_drop _s2274_ _s2275_) with
                    | _s2276_ =>
                       (reg_name_matches_prefix _s2276_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2277_ _) =>
                           (match (string_drop _s2276_ _s2277_) with
                            | _s2278_ =>
                               (sep_matches_prefix _s2278_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2279_ _) =>
                                   (match (string_drop _s2278_ _s2279_) with
                                    | _s2280_ =>
                                       (freg_name_matches_prefix _s2280_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2281_ _) =>
                                           (match (string_drop _s2280_ _s2281_) with
                                            | _s2282_ =>
                                               (sep_matches_prefix _s2282_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2283_ _) =>
                                                   (match (string_drop _s2282_ _s2283_) with
                                                    | _s2284_ =>
                                                       (frm_mnemonic_matches_prefix _s2284_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s2285_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2284_ _s2285_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_W_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s2253_ (_s2254_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2254_ with
    | _s2255_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s2255_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSQRT_S, existT _ _s2256_ _) =>
           (match (string_drop _s2255_ _s2256_) with
            | _s2257_ =>
               (spc_matches_prefix _s2257_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2258_ _) =>
                   (match (string_drop _s2257_ _s2258_) with
                    | _s2259_ =>
                       (freg_name_matches_prefix _s2259_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2260_ _) =>
                           (match (string_drop _s2259_ _s2260_) with
                            | _s2261_ =>
                               (sep_matches_prefix _s2261_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2262_ _) =>
                                   (match (string_drop _s2261_ _s2262_) with
                                    | _s2263_ =>
                                       (freg_name_matches_prefix _s2263_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2264_ _) =>
                                           (match (string_drop _s2263_ _s2264_) with
                                            | _s2265_ =>
                                               (sep_matches_prefix _s2265_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2266_ _) =>
                                                   (match (string_drop _s2265_ _s2266_) with
                                                    | _s2267_ =>
                                                       (frm_mnemonic_matches_prefix _s2267_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s2268_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2267_ _s2268_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FSQRT_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s2232_ (_s2233_ : string)
: M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2233_ with
    | _s2234_ =>
       (f_bin_rm_type_mnemonic_S_matches_prefix _s2234_) >>= fun w__0 : option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2235_ _) =>
           (match (string_drop _s2234_ _s2235_) with
            | _s2236_ =>
               (spc_matches_prefix _s2236_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2237_ _) =>
                   (match (string_drop _s2236_ _s2237_) with
                    | _s2238_ =>
                       (freg_name_matches_prefix _s2238_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2239_ _) =>
                           (match (string_drop _s2238_ _s2239_) with
                            | _s2240_ =>
                               (sep_matches_prefix _s2240_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2241_ _) =>
                                   (match (string_drop _s2240_ _s2241_) with
                                    | _s2242_ =>
                                       (freg_name_matches_prefix _s2242_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2243_ _) =>
                                           (match (string_drop _s2242_ _s2243_) with
                                            | _s2244_ =>
                                               (sep_matches_prefix _s2244_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2245_ _) =>
                                                   (match (string_drop _s2244_ _s2245_) with
                                                    | _s2246_ =>
                                                       (freg_name_matches_prefix _s2246_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       (match w__6 with
                                                        | Some (rs2, existT _ _s2247_ _) =>
                                                           (match (string_drop _s2246_ _s2247_) with
                                                            | _s2248_ =>
                                                               (sep_matches_prefix _s2248_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                 0)})) =>
                                                               (match w__7 with
                                                                | Some (tt, existT _ _s2249_ _) =>
                                                                   (match (string_drop _s2248_
                                                                             _s2249_) with
                                                                    | _s2250_ =>
                                                                       (frm_mnemonic_matches_prefix
                                                                          _s2250_) >>= fun w__8 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                                         0)})) =>
                                                                       returnm (match w__8 with
                                                                                | Some
                                                                                  (rm, existT _ _s2251_ _) =>
                                                                                   let p0_ :=
                                                                                     string_drop
                                                                                       _s2250_
                                                                                       _s2251_ in
                                                                                   if generic_eq p0_
                                                                                        "" then
                                                                                     Some
                                                                                       (op, rd, rs1, rs2, rm)
                                                                                   else None
                                                                                | _ => None
                                                                                end)
                                                                    end)
                                                                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                | _ => returnm None
                                                                end)
                                                                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                            end)
                                                            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                        | _ => returnm None
                                                        end)
                                                        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                    end)
                                                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode))).

Definition _s2207_ (_s2208_ : string)
: M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode))) :=
   (match _s2208_ with
    | _s2209_ =>
       (f_madd_type_mnemonic_S_matches_prefix _s2209_) >>= fun w__0 : option ((f_madd_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2210_ _) =>
           (match (string_drop _s2209_ _s2210_) with
            | _s2211_ =>
               (spc_matches_prefix _s2211_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2212_ _) =>
                   (match (string_drop _s2211_ _s2212_) with
                    | _s2213_ =>
                       (freg_name_matches_prefix _s2213_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2214_ _) =>
                           (match (string_drop _s2213_ _s2214_) with
                            | _s2215_ =>
                               (sep_matches_prefix _s2215_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2216_ _) =>
                                   (match (string_drop _s2215_ _s2216_) with
                                    | _s2217_ =>
                                       (freg_name_matches_prefix _s2217_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2218_ _) =>
                                           (match (string_drop _s2217_ _s2218_) with
                                            | _s2219_ =>
                                               (sep_matches_prefix _s2219_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2220_ _) =>
                                                   (match (string_drop _s2219_ _s2220_) with
                                                    | _s2221_ =>
                                                       (freg_name_matches_prefix _s2221_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       (match w__6 with
                                                        | Some (rs2, existT _ _s2222_ _) =>
                                                           (match (string_drop _s2221_ _s2222_) with
                                                            | _s2223_ =>
                                                               (sep_matches_prefix _s2223_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                 0)})) =>
                                                               (match w__7 with
                                                                | Some (tt, existT _ _s2224_ _) =>
                                                                   (match (string_drop _s2223_
                                                                             _s2224_) with
                                                                    | _s2225_ =>
                                                                       (freg_name_matches_prefix
                                                                          _s2225_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                         0)})) =>
                                                                       (match w__8 with
                                                                        | Some
                                                                          (rs3, existT _ _s2226_ _) =>
                                                                           (match (string_drop
                                                                                     _s2225_ _s2226_) with
                                                                            | _s2227_ =>
                                                                               (sep_matches_prefix
                                                                                  _s2227_) >>= fun w__9 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                 0)})) =>
                                                                               (match w__9 with
                                                                                | Some
                                                                                  (tt, existT _ _s2228_ _) =>
                                                                                   (match (string_drop
                                                                                             _s2227_
                                                                                             _s2228_) with
                                                                                    | _s2229_ =>
                                                                                       (frm_mnemonic_matches_prefix
                                                                                          _s2229_) >>= fun w__10 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                                                         0)})) =>
                                                                                       returnm (match w__10 with
                                                                                                | Some
                                                                                                  (rm, existT _ _s2230_ _) =>
                                                                                                   let p0_ :=
                                                                                                     string_drop
                                                                                                       _s2229_
                                                                                                       _s2230_ in
                                                                                                   if
                                                                                                     generic_eq
                                                                                                       p0_
                                                                                                       ""
                                                                                                   then
                                                                                                     Some
                                                                                                       (op, rd, rs1, rs2, rs3, rm)
                                                                                                   else
                                                                                                     None
                                                                                                | _ =>
                                                                                                   None
                                                                                                end)
                                                                                    end)
                                                                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                                | _ => returnm None
                                                                                end)
                                                                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                            end)
                                                                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                        | _ => returnm None
                                                                        end)
                                                                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                    end)
                                                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                | _ => returnm None
                                                                end)
                                                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                            end)
                                                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                        | _ => returnm None
                                                        end)
                                                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                    end)
                                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode))).

Definition _s2183_ (_s2184_ : string) : M (option ((word_width * mword 5 * mword 12 * mword 5))) :=
   let _s2185_ := _s2184_ in
   (if string_startswith _s2185_ "fs" then
      (match (string_drop _s2185_ (projT1 (string_length "fs"))) with
       | _s2186_ =>
          (size_mnemonic_matches_prefix _s2186_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (width, existT _ _s2187_ _) =>
              (match (string_drop _s2186_ _s2187_) with
               | _s2188_ =>
                  (spc_matches_prefix _s2188_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s2189_ _) =>
                      (match (string_drop _s2188_ _s2189_) with
                       | _s2190_ =>
                          (freg_name_matches_prefix _s2190_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rs2, existT _ _s2191_ _) =>
                              (match (string_drop _s2190_ _s2191_) with
                               | _s2192_ =>
                                  (sep_matches_prefix _s2192_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s2193_ _) =>
                                      (match (string_drop _s2192_ _s2193_) with
                                       | _s2194_ =>
                                          (match (hex_bits_12_matches_prefix _s2194_) with
                                           | Some (imm, existT _ _s2195_ _) =>
                                              (match (string_drop _s2194_ _s2195_) with
                                               | _s2196_ =>
                                                  (opt_spc_matches_prefix _s2196_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__4 with
                                                   | Some (tt, existT _ _s2197_ _) =>
                                                      let _s2198_ := string_drop _s2196_ _s2197_ in
                                                      (if string_startswith _s2198_ "(" then
                                                         (match (string_drop _s2198_
                                                                   (projT1
                                                                    (string_length "("))) with
                                                          | _s2199_ =>
                                                             (opt_spc_matches_prefix _s2199_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             (match w__5 with
                                                              | Some (tt, existT _ _s2200_ _) =>
                                                                 (match (string_drop _s2199_ _s2200_) with
                                                                  | _s2201_ =>
                                                                     (reg_name_matches_prefix
                                                                        _s2201_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                       0)})) =>
                                                                     (match w__6 with
                                                                      | Some
                                                                        (rs1, existT _ _s2202_ _) =>
                                                                         (match (string_drop _s2201_
                                                                                   _s2202_) with
                                                                          | _s2203_ =>
                                                                             (opt_spc_matches_prefix
                                                                                _s2203_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                               0)})) =>
                                                                             returnm (match w__7 with
                                                                                      | Some
                                                                                        (tt, existT _ _s2204_ _) =>
                                                                                         let _s2205_ :=
                                                                                           string_drop
                                                                                             _s2203_
                                                                                             _s2204_ in
                                                                                         if string_startswith
                                                                                              _s2205_
                                                                                              ")"
                                                                                         then
                                                                                           let p0_ :=
                                                                                             string_drop
                                                                                               _s2205_
                                                                                               (projT1
                                                                                                (string_length
                                                                                                   ")")) in
                                                                                           if generic_eq
                                                                                                p0_
                                                                                                ""
                                                                                           then
                                                                                             Some
                                                                                               (width, rs2, imm, rs1)
                                                                                           else None
                                                                                         else None
                                                                                      | _ => None
                                                                                      end)
                                                                          end)
                                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                                      | _ => returnm None
                                                                      end)
                                                                      : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                                  end)
                                                                  : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                              | _ => returnm None
                                                              end)
                                                              : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                          end)
                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                       else returnm None)
                                                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                               end)
                                               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
       end)
       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
    else returnm None)
    : M (option ((word_width * mword 5 * mword 12 * mword 5))).

Definition _s2159_ (_s2160_ : string) : M (option ((word_width * mword 5 * mword 12 * mword 5))) :=
   let _s2161_ := _s2160_ in
   (if string_startswith _s2161_ "fl" then
      (match (string_drop _s2161_ (projT1 (string_length "fl"))) with
       | _s2162_ =>
          (size_mnemonic_matches_prefix _s2162_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (width, existT _ _s2163_ _) =>
              (match (string_drop _s2162_ _s2163_) with
               | _s2164_ =>
                  (spc_matches_prefix _s2164_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s2165_ _) =>
                      (match (string_drop _s2164_ _s2165_) with
                       | _s2166_ =>
                          (freg_name_matches_prefix _s2166_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s2167_ _) =>
                              (match (string_drop _s2166_ _s2167_) with
                               | _s2168_ =>
                                  (sep_matches_prefix _s2168_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s2169_ _) =>
                                      (match (string_drop _s2168_ _s2169_) with
                                       | _s2170_ =>
                                          (match (hex_bits_12_matches_prefix _s2170_) with
                                           | Some (imm, existT _ _s2171_ _) =>
                                              (match (string_drop _s2170_ _s2171_) with
                                               | _s2172_ =>
                                                  (opt_spc_matches_prefix _s2172_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__4 with
                                                   | Some (tt, existT _ _s2173_ _) =>
                                                      let _s2174_ := string_drop _s2172_ _s2173_ in
                                                      (if string_startswith _s2174_ "(" then
                                                         (match (string_drop _s2174_
                                                                   (projT1
                                                                    (string_length "("))) with
                                                          | _s2175_ =>
                                                             (opt_spc_matches_prefix _s2175_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             (match w__5 with
                                                              | Some (tt, existT _ _s2176_ _) =>
                                                                 (match (string_drop _s2175_ _s2176_) with
                                                                  | _s2177_ =>
                                                                     (reg_name_matches_prefix
                                                                        _s2177_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                       0)})) =>
                                                                     (match w__6 with
                                                                      | Some
                                                                        (rs1, existT _ _s2178_ _) =>
                                                                         (match (string_drop _s2177_
                                                                                   _s2178_) with
                                                                          | _s2179_ =>
                                                                             (opt_spc_matches_prefix
                                                                                _s2179_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                               0)})) =>
                                                                             returnm (match w__7 with
                                                                                      | Some
                                                                                        (tt, existT _ _s2180_ _) =>
                                                                                         let _s2181_ :=
                                                                                           string_drop
                                                                                             _s2179_
                                                                                             _s2180_ in
                                                                                         if string_startswith
                                                                                              _s2181_
                                                                                              ")"
                                                                                         then
                                                                                           let p0_ :=
                                                                                             string_drop
                                                                                               _s2181_
                                                                                               (projT1
                                                                                                (string_length
                                                                                                   ")")) in
                                                                                           if generic_eq
                                                                                                p0_
                                                                                                ""
                                                                                           then
                                                                                             Some
                                                                                               (width, rd, imm, rs1)
                                                                                           else None
                                                                                         else None
                                                                                      | _ => None
                                                                                      end)
                                                                          end)
                                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                                      | _ => returnm None
                                                                      end)
                                                                      : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                                  end)
                                                                  : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                              | _ => returnm None
                                                              end)
                                                              : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                          end)
                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                       else returnm None)
                                                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                               end)
                                               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
       end)
       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
    else returnm None)
    : M (option ((word_width * mword 5 * mword 12 * mword 5))).

Definition _s2147_ (_s2148_ : string) : M (option ((mword 5 * mword 5 * mword 12))) :=
   let _s2149_ := _s2148_ in
   (if string_startswith _s2149_ "fence.i.reserved." then
      (match (string_drop _s2149_ (projT1 (string_length "fence.i.reserved."))) with
       | _s2150_ =>
          (reg_name_matches_prefix _s2150_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (rd, existT _ _s2151_ _) =>
              let _s2152_ := string_drop _s2150_ _s2151_ in
              (if string_startswith _s2152_ "." then
                 (match (string_drop _s2152_ (projT1 (string_length "."))) with
                  | _s2153_ =>
                     (reg_name_matches_prefix _s2153_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                       0)})) =>
                     returnm (match w__1 with
                              | Some (rs, existT _ _s2154_ _) =>
                                 let _s2155_ := string_drop _s2153_ _s2154_ in
                                 if string_startswith _s2155_ "." then
                                   match (string_drop _s2155_ (projT1 (string_length "."))) with
                                   | _s2156_ =>
                                      match (hex_bits_12_matches_prefix _s2156_) with
                                      | Some (imm, existT _ _s2157_ _) =>
                                         let p0_ := string_drop _s2156_ _s2157_ in
                                         if generic_eq p0_ "" then Some (rd, rs, imm)
                                         else None
                                      | _ => None
                                      end
                                   end
                                 else None
                              | _ => None
                              end)
                  end)
                  : M (option ((mword 5 * mword 5 * mword 12)))
               else returnm None)
               : M (option ((mword 5 * mword 5 * mword 12)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 12)))
       end)
       : M (option ((mword 5 * mword 5 * mword 12)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 12))).

Definition _s2129_ (_s2130_ : string)
: M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4))) :=
   let _s2131_ := _s2130_ in
   (if string_startswith _s2131_ "fence.reserved." then
      (match (string_drop _s2131_ (projT1 (string_length "fence.reserved."))) with
       | _s2132_ =>
          (fence_bits_matches_prefix _s2132_) >>= fun w__0 : option ((mword 4 * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (pred, existT _ _s2133_ _) =>
              let _s2134_ := string_drop _s2132_ _s2133_ in
              (if string_startswith _s2134_ "." then
                 (match (string_drop _s2134_ (projT1 (string_length "."))) with
                  | _s2135_ =>
                     (fence_bits_matches_prefix _s2135_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >=?
                       0)})) =>
                     (match w__1 with
                      | Some (succ, existT _ _s2136_ _) =>
                         let _s2137_ := string_drop _s2135_ _s2136_ in
                         (if string_startswith _s2137_ "." then
                            (match (string_drop _s2137_ (projT1 (string_length "."))) with
                             | _s2138_ =>
                                (reg_name_matches_prefix _s2138_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                  0)})) =>
                                (match w__2 with
                                 | Some (rs, existT _ _s2139_ _) =>
                                    let _s2140_ := string_drop _s2138_ _s2139_ in
                                    (if string_startswith _s2140_ "." then
                                       (match (string_drop _s2140_ (projT1 (string_length "."))) with
                                        | _s2141_ =>
                                           (reg_name_matches_prefix _s2141_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                             0)})) =>
                                           returnm (match w__3 with
                                                    | Some (rd, existT _ _s2142_ _) =>
                                                       let _s2143_ := string_drop _s2141_ _s2142_ in
                                                       if string_startswith _s2143_ "." then
                                                         match (string_drop _s2143_
                                                                  (projT1
                                                                   (string_length "."))) with
                                                         | _s2144_ =>
                                                            match (hex_bits_4_matches_prefix _s2144_) with
                                                            | Some (fm, existT _ _s2145_ _) =>
                                                               let p0_ :=
                                                                 string_drop _s2144_ _s2145_ in
                                                               if generic_eq p0_ "" then
                                                                 Some (pred, succ, rs, rd, fm)
                                                               else None
                                                            | _ => None
                                                            end
                                                         end
                                                       else None
                                                    | _ => None
                                                    end)
                                        end)
                                        : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                                     else returnm None)
                                     : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                                 | _ => returnm None
                                 end)
                                 : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                             end)
                             : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                          else returnm None)
                          : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                      | _ => returnm None
                      end)
                      : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                  end)
                  : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
               else returnm None)
               : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
           | _ => returnm None
           end)
           : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
       end)
       : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
    else returnm None)
    : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4))).

Definition _s2123_ (_s2124_ : string) : M (option (mword 3)) :=
   let _s2125_ := _s2124_ in
   (if string_startswith _s2125_ "c.srai.hint." then
      (match (string_drop _s2125_ (projT1 (string_length "c.srai.hint."))) with
       | _s2126_ =>
          (creg_name_matches_prefix _s2126_) >>= fun w__0 : option ((mword 3 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s2127_ _) =>
                      let p0_ := string_drop _s2126_ _s2127_ in
                      if generic_eq p0_ "" then Some rsd
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 3))
    else returnm None)
    : M (option (mword 3)).

Definition _s2117_ (_s2118_ : string) : M (option (mword 3)) :=
   let _s2119_ := _s2118_ in
   (if string_startswith _s2119_ "c.srli.hint." then
      (match (string_drop _s2119_ (projT1 (string_length "c.srli.hint."))) with
       | _s2120_ =>
          (creg_name_matches_prefix _s2120_) >>= fun w__0 : option ((mword 3 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s2121_ _) =>
                      let p0_ := string_drop _s2120_ _s2121_ in
                      if generic_eq p0_ "" then Some rsd
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 3))
    else returnm None)
    : M (option (mword 3)).

Definition _s2108_ (_s2109_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s2110_ := _s2109_ in
   (if string_startswith _s2110_ "c.slli.hint." then
      (match (string_drop _s2110_ (projT1 (string_length "c.slli.hint."))) with
       | _s2111_ =>
          (reg_name_matches_prefix _s2111_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s2112_ _) =>
                      let _s2113_ := string_drop _s2111_ _s2112_ in
                      if string_startswith _s2113_ "." then
                        match (string_drop _s2113_ (projT1 (string_length "."))) with
                        | _s2114_ =>
                           match (hex_bits_6_matches_prefix _s2114_) with
                           | Some (shamt, existT _ _s2115_ _) =>
                              let p0_ := string_drop _s2114_ _s2115_ in
                              if generic_eq p0_ "" then Some (rsd, shamt)
                              else None
                           | _ => None
                           end
                        end
                      else None
                   | _ => None
                   end)
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s2102_ (_s2103_ : string) : M (option (mword 5)) :=
   let _s2104_ := _s2103_ in
   (if string_startswith _s2104_ "c.add.hint." then
      (match (string_drop _s2104_ (projT1 (string_length "c.add.hint."))) with
       | _s2105_ =>
          (reg_name_matches_prefix _s2105_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rs2, existT _ _s2106_ _) =>
                      let p0_ := string_drop _s2105_ _s2106_ in
                      if generic_eq p0_ "" then Some rs2
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s2096_ (_s2097_ : string) : M (option (mword 5)) :=
   let _s2098_ := _s2097_ in
   (if string_startswith _s2098_ "c.mv.hint." then
      (match (string_drop _s2098_ (projT1 (string_length "c.mv.hint."))) with
       | _s2099_ =>
          (reg_name_matches_prefix _s2099_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rs2, existT _ _s2100_ _) =>
                      let p0_ := string_drop _s2099_ _s2100_ in
                      if generic_eq p0_ "" then Some rs2
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s2090_ (_s2091_ : string) : option (mword 6) :=
   let _s2092_ := _s2091_ in
   if string_startswith _s2092_ "c.lui.hint." then
     match (string_drop _s2092_ (projT1 (string_length "c.lui.hint."))) with
     | _s2093_ =>
        match (hex_bits_6_matches_prefix _s2093_) with
        | Some (imm, existT _ _s2094_ _) =>
           let p0_ := string_drop _s2093_ _s2094_ in
           if generic_eq p0_ "" then Some imm
           else None
        | _ => None
        end
     end
   else None.

Definition _s2084_ (_s2085_ : string) : option (mword 6) :=
   let _s2086_ := _s2085_ in
   if string_startswith _s2086_ "c.li.hint." then
     match (string_drop _s2086_ (projT1 (string_length "c.li.hint."))) with
     | _s2087_ =>
        match (hex_bits_6_matches_prefix _s2087_) with
        | Some (imm, existT _ _s2088_ _) =>
           let p0_ := string_drop _s2087_ _s2088_ in
           if generic_eq p0_ "" then Some imm
           else None
        | _ => None
        end
     end
   else None.

Definition _s2078_ (_s2079_ : string) : M (option (mword 5)) :=
   let _s2080_ := _s2079_ in
   (if string_startswith _s2080_ "c.addi.hint." then
      (match (string_drop _s2080_ (projT1 (string_length "c.addi.hint."))) with
       | _s2081_ =>
          (reg_name_matches_prefix _s2081_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s2082_ _) =>
                      let p0_ := string_drop _s2081_ _s2082_ in
                      if generic_eq p0_ "" then Some rsd
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s2072_ (_s2073_ : string) : option (mword 6) :=
   let _s2074_ := _s2073_ in
   if string_startswith _s2074_ "c.nop.hint." then
     match (string_drop _s2074_ (projT1 (string_length "c.nop.hint."))) with
     | _s2075_ =>
        match (hex_bits_6_matches_prefix _s2075_) with
        | Some (imm, existT _ _s2076_ _) =>
           let p0_ := string_drop _s2075_ _s2076_ in
           if generic_eq p0_ "" then Some imm
           else None
        | _ => None
        end
     end
   else None.

Definition _s2055_ (_s2056_ : string) : M (option ((csrop * mword 5 * mword 12 * mword 5))) :=
   (match _s2056_ with
    | _s2057_ =>
       (csr_mnemonic_matches_prefix _s2057_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2058_ _) =>
           (match (string_drop _s2057_ _s2058_) with
            | _s2059_ =>
               (spc_matches_prefix _s2059_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2060_ _) =>
                   (match (string_drop _s2059_ _s2060_) with
                    | _s2061_ =>
                       (reg_name_matches_prefix _s2061_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2062_ _) =>
                           (match (string_drop _s2061_ _s2062_) with
                            | _s2063_ =>
                               (sep_matches_prefix _s2063_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2064_ _) =>
                                   (match (string_drop _s2063_ _s2064_) with
                                    | _s2065_ =>
                                       (csr_name_map_matches_prefix _s2065_) >>= fun w__4 : option ((mword 12 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (csr, existT _ _s2066_ _) =>
                                           (match (string_drop _s2065_ _s2066_) with
                                            | _s2067_ =>
                                               (sep_matches_prefix _s2067_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2068_ _) =>
                                                   (match (string_drop _s2067_ _s2068_) with
                                                    | _s2069_ =>
                                                       (reg_name_matches_prefix _s2069_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs1, existT _ _s2070_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2069_ _s2070_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (op, rd, csr, rs1)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                            end)
                                            : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                    end)
                                    : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                            end)
                            : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                    end)
                    : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((csrop * mword 5 * mword 12 * mword 5)))
            end)
            : M (option ((csrop * mword 5 * mword 12 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((csrop * mword 5 * mword 12 * mword 5)))
    end)
    : M (option ((csrop * mword 5 * mword 12 * mword 5))).

Definition _s2037_ (_s2038_ : string) : M (option ((csrop * mword 5 * mword 12 * mword 5))) :=
   (match _s2038_ with
    | _s2039_ =>
       (csr_mnemonic_matches_prefix _s2039_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2040_ _) =>
           let _s2041_ := string_drop _s2039_ _s2040_ in
           (if string_startswith _s2041_ "i" then
              (match (string_drop _s2041_ (projT1 (string_length "i"))) with
               | _s2042_ =>
                  (spc_matches_prefix _s2042_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s2043_ _) =>
                      (match (string_drop _s2042_ _s2043_) with
                       | _s2044_ =>
                          (reg_name_matches_prefix _s2044_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s2045_ _) =>
                              (match (string_drop _s2044_ _s2045_) with
                               | _s2046_ =>
                                  (sep_matches_prefix _s2046_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s2047_ _) =>
                                      (match (string_drop _s2046_ _s2047_) with
                                       | _s2048_ =>
                                          (csr_name_map_matches_prefix _s2048_) >>= fun w__4 : option ((mword 12 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (csr, existT _ _s2049_ _) =>
                                              (match (string_drop _s2048_ _s2049_) with
                                               | _s2050_ =>
                                                  (sep_matches_prefix _s2050_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  returnm (match w__5 with
                                                           | Some (tt, existT _ _s2051_ _) =>
                                                              match (string_drop _s2050_ _s2051_) with
                                                              | _s2052_ =>
                                                                 match (hex_bits_5_matches_prefix
                                                                          _s2052_) with
                                                                 | Some (rs1, existT _ _s2053_ _) =>
                                                                    let p0_ :=
                                                                      string_drop _s2052_ _s2053_ in
                                                                    if generic_eq p0_ "" then
                                                                      Some (op, rd, csr, rs1)
                                                                    else None
                                                                 | _ => None
                                                                 end
                                                              end
                                                           | _ => None
                                                           end)
                                               end)
                                               : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((csrop * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((csrop * mword 5 * mword 12 * mword 5)))
            else returnm None)
            : M (option ((csrop * mword 5 * mword 12 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((csrop * mword 5 * mword 12 * mword 5)))
    end)
    : M (option ((csrop * mword 5 * mword 12 * mword 5))).

Definition _s2018_ (_s2019_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5))) :=
   let _s2020_ := _s2019_ in
   (if string_startswith _s2020_ "rem" then
      (match (string_drop _s2020_ (projT1 (string_length "rem"))) with
       | _s2021_ =>
          (maybe_not_u_matches_prefix _s2021_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s2022_ _) =>
              let _s2023_ := string_drop _s2021_ _s2022_ in
              (if string_startswith _s2023_ "w" then
                 (match (string_drop _s2023_ (projT1 (string_length "w"))) with
                  | _s2024_ =>
                     (spc_matches_prefix _s2024_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                       0)})) =>
                     (match w__1 with
                      | Some (tt, existT _ _s2025_ _) =>
                         (match (string_drop _s2024_ _s2025_) with
                          | _s2026_ =>
                             (reg_name_matches_prefix _s2026_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                               0)})) =>
                             (match w__2 with
                              | Some (rd, existT _ _s2027_ _) =>
                                 (match (string_drop _s2026_ _s2027_) with
                                  | _s2028_ =>
                                     (sep_matches_prefix _s2028_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                       0)})) =>
                                     (match w__3 with
                                      | Some (tt, existT _ _s2029_ _) =>
                                         (match (string_drop _s2028_ _s2029_) with
                                          | _s2030_ =>
                                             (reg_name_matches_prefix _s2030_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                               0)})) =>
                                             (match w__4 with
                                              | Some (rs1, existT _ _s2031_ _) =>
                                                 (match (string_drop _s2030_ _s2031_) with
                                                  | _s2032_ =>
                                                     (sep_matches_prefix _s2032_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                       0)})) =>
                                                     (match w__5 with
                                                      | Some (tt, existT _ _s2033_ _) =>
                                                         (match (string_drop _s2032_ _s2033_) with
                                                          | _s2034_ =>
                                                             (reg_name_matches_prefix _s2034_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             returnm (match w__6 with
                                                                      | Some
                                                                        (rs2, existT _ _s2035_ _) =>
                                                                         let p0_ :=
                                                                           string_drop _s2034_
                                                                             _s2035_ in
                                                                         if generic_eq p0_ "" then
                                                                           Some (s, rd, rs1, rs2)
                                                                         else None
                                                                      | _ => None
                                                                      end)
                                                          end)
                                                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                      | _ => returnm None
                                                      end)
                                                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                  end)
                                                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                              | _ => returnm None
                                              end)
                                              : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                          end)
                                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                      | _ => returnm None
                                      end)
                                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                  end)
                                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
                              | _ => returnm None
                              end)
                              : M (option ((bool * mword 5 * mword 5 * mword 5)))
                          end)
                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                      | _ => returnm None
                      end)
                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                  end)
                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
               else returnm None)
               : M (option ((bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5))).

Definition _s1999_ (_s2000_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5))) :=
   let _s2001_ := _s2000_ in
   (if string_startswith _s2001_ "div" then
      (match (string_drop _s2001_ (projT1 (string_length "div"))) with
       | _s2002_ =>
          (maybe_not_u_matches_prefix _s2002_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s2003_ _) =>
              let _s2004_ := string_drop _s2002_ _s2003_ in
              (if string_startswith _s2004_ "w" then
                 (match (string_drop _s2004_ (projT1 (string_length "w"))) with
                  | _s2005_ =>
                     (spc_matches_prefix _s2005_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                       0)})) =>
                     (match w__1 with
                      | Some (tt, existT _ _s2006_ _) =>
                         (match (string_drop _s2005_ _s2006_) with
                          | _s2007_ =>
                             (reg_name_matches_prefix _s2007_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                               0)})) =>
                             (match w__2 with
                              | Some (rd, existT _ _s2008_ _) =>
                                 (match (string_drop _s2007_ _s2008_) with
                                  | _s2009_ =>
                                     (sep_matches_prefix _s2009_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                       0)})) =>
                                     (match w__3 with
                                      | Some (tt, existT _ _s2010_ _) =>
                                         (match (string_drop _s2009_ _s2010_) with
                                          | _s2011_ =>
                                             (reg_name_matches_prefix _s2011_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                               0)})) =>
                                             (match w__4 with
                                              | Some (rs1, existT _ _s2012_ _) =>
                                                 (match (string_drop _s2011_ _s2012_) with
                                                  | _s2013_ =>
                                                     (sep_matches_prefix _s2013_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                       0)})) =>
                                                     (match w__5 with
                                                      | Some (tt, existT _ _s2014_ _) =>
                                                         (match (string_drop _s2013_ _s2014_) with
                                                          | _s2015_ =>
                                                             (reg_name_matches_prefix _s2015_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             returnm (match w__6 with
                                                                      | Some
                                                                        (rs2, existT _ _s2016_ _) =>
                                                                         let p0_ :=
                                                                           string_drop _s2015_
                                                                             _s2016_ in
                                                                         if generic_eq p0_ "" then
                                                                           Some (s, rd, rs1, rs2)
                                                                         else None
                                                                      | _ => None
                                                                      end)
                                                          end)
                                                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                      | _ => returnm None
                                                      end)
                                                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                  end)
                                                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                              | _ => returnm None
                                              end)
                                              : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                          end)
                                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                      | _ => returnm None
                                      end)
                                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                  end)
                                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
                              | _ => returnm None
                              end)
                              : M (option ((bool * mword 5 * mword 5 * mword 5)))
                          end)
                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                      | _ => returnm None
                      end)
                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                  end)
                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
               else returnm None)
               : M (option ((bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5))).

Definition _s1983_ (_s1984_ : string) : M (option ((mword 5 * mword 5 * mword 5))) :=
   let _s1985_ := _s1984_ in
   (if string_startswith _s1985_ "mulw" then
      (match (string_drop _s1985_ (projT1 (string_length "mulw"))) with
       | _s1986_ =>
          (spc_matches_prefix _s1986_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1987_ _) =>
              (match (string_drop _s1986_ _s1987_) with
               | _s1988_ =>
                  (reg_name_matches_prefix _s1988_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1989_ _) =>
                      (match (string_drop _s1988_ _s1989_) with
                       | _s1990_ =>
                          (sep_matches_prefix _s1990_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1991_ _) =>
                              (match (string_drop _s1990_ _s1991_) with
                               | _s1992_ =>
                                  (reg_name_matches_prefix _s1992_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rs1, existT _ _s1993_ _) =>
                                      (match (string_drop _s1992_ _s1993_) with
                                       | _s1994_ =>
                                          (sep_matches_prefix _s1994_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (tt, existT _ _s1995_ _) =>
                                              (match (string_drop _s1994_ _s1995_) with
                                               | _s1996_ =>
                                                  (reg_name_matches_prefix _s1996_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  returnm (match w__5 with
                                                           | Some (rs2, existT _ _s1997_ _) =>
                                                              let p0_ := string_drop _s1996_ _s1997_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rd, rs1, rs2)
                                                              else None
                                                           | _ => None
                                                           end)
                                               end)
                                               : M (option ((mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 5))).

Definition _s1965_ (_s1966_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5))) :=
   let _s1967_ := _s1966_ in
   (if string_startswith _s1967_ "rem" then
      (match (string_drop _s1967_ (projT1 (string_length "rem"))) with
       | _s1968_ =>
          (maybe_not_u_matches_prefix _s1968_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s1969_ _) =>
              (match (string_drop _s1968_ _s1969_) with
               | _s1970_ =>
                  (spc_matches_prefix _s1970_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s1971_ _) =>
                      (match (string_drop _s1970_ _s1971_) with
                       | _s1972_ =>
                          (reg_name_matches_prefix _s1972_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s1973_ _) =>
                              (match (string_drop _s1972_ _s1973_) with
                               | _s1974_ =>
                                  (sep_matches_prefix _s1974_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s1975_ _) =>
                                      (match (string_drop _s1974_ _s1975_) with
                                       | _s1976_ =>
                                          (reg_name_matches_prefix _s1976_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rs1, existT _ _s1977_ _) =>
                                              (match (string_drop _s1976_ _s1977_) with
                                               | _s1978_ =>
                                                  (sep_matches_prefix _s1978_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s1979_ _) =>
                                                      (match (string_drop _s1978_ _s1979_) with
                                                       | _s1980_ =>
                                                          (reg_name_matches_prefix _s1980_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          returnm (match w__6 with
                                                                   | Some (rs2, existT _ _s1981_ _) =>
                                                                      let p0_ :=
                                                                        string_drop _s1980_ _s1981_ in
                                                                      if generic_eq p0_ "" then
                                                                        Some (s, rd, rs1, rs2)
                                                                      else None
                                                                   | _ => None
                                                                   end)
                                                       end)
                                                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                               end)
                                               : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((bool * mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((bool * mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5))).

Definition _s1947_ (_s1948_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5))) :=
   let _s1949_ := _s1948_ in
   (if string_startswith _s1949_ "div" then
      (match (string_drop _s1949_ (projT1 (string_length "div"))) with
       | _s1950_ =>
          (maybe_not_u_matches_prefix _s1950_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s1951_ _) =>
              (match (string_drop _s1950_ _s1951_) with
               | _s1952_ =>
                  (spc_matches_prefix _s1952_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s1953_ _) =>
                      (match (string_drop _s1952_ _s1953_) with
                       | _s1954_ =>
                          (reg_name_matches_prefix _s1954_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s1955_ _) =>
                              (match (string_drop _s1954_ _s1955_) with
                               | _s1956_ =>
                                  (sep_matches_prefix _s1956_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s1957_ _) =>
                                      (match (string_drop _s1956_ _s1957_) with
                                       | _s1958_ =>
                                          (reg_name_matches_prefix _s1958_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rs1, existT _ _s1959_ _) =>
                                              (match (string_drop _s1958_ _s1959_) with
                                               | _s1960_ =>
                                                  (sep_matches_prefix _s1960_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s1961_ _) =>
                                                      (match (string_drop _s1960_ _s1961_) with
                                                       | _s1962_ =>
                                                          (reg_name_matches_prefix _s1962_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          returnm (match w__6 with
                                                                   | Some (rs2, existT _ _s1963_ _) =>
                                                                      let p0_ :=
                                                                        string_drop _s1962_ _s1963_ in
                                                                      if generic_eq p0_ "" then
                                                                        Some (s, rd, rs1, rs2)
                                                                      else None
                                                                   | _ => None
                                                                   end)
                                                       end)
                                                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                               end)
                                               : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((bool * mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((bool * mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5))).

Definition _s1930_ (_s1931_ : string)
: M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) :=
   (match _s1931_ with
    | _s1932_ =>
       (mul_mnemonic_matches_prefix _s1932_) >>= fun w__0 : option (((bool * bool * bool) * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some ((high, signed1, signed2), existT _ _s1933_ _) =>
           (match (string_drop _s1932_ _s1933_) with
            | _s1934_ =>
               (spc_matches_prefix _s1934_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s1935_ _) =>
                   (match (string_drop _s1934_ _s1935_) with
                    | _s1936_ =>
                       (reg_name_matches_prefix _s1936_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s1937_ _) =>
                           (match (string_drop _s1936_ _s1937_) with
                            | _s1938_ =>
                               (sep_matches_prefix _s1938_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s1939_ _) =>
                                   (match (string_drop _s1938_ _s1939_) with
                                    | _s1940_ =>
                                       (reg_name_matches_prefix _s1940_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s1941_ _) =>
                                           (match (string_drop _s1940_ _s1941_) with
                                            | _s1942_ =>
                                               (sep_matches_prefix _s1942_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s1943_ _) =>
                                                   (match (string_drop _s1942_ _s1943_) with
                                                    | _s1944_ =>
                                                       (reg_name_matches_prefix _s1944_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s1945_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s1944_ _s1945_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some
                                                                       (high, signed1, signed2, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))).

Definition _s1918_ (_s1919_ : string) : M (option ((mword 5 * mword 5))) :=
   let _s1920_ := _s1919_ in
   (if string_startswith _s1920_ "c.add" then
      (match (string_drop _s1920_ (projT1 (string_length "c.add"))) with
       | _s1921_ =>
          (spc_matches_prefix _s1921_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1922_ _) =>
              (match (string_drop _s1921_ _s1922_) with
               | _s1923_ =>
                  (reg_name_matches_prefix _s1923_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1924_ _) =>
                      (match (string_drop _s1923_ _s1924_) with
                       | _s1925_ =>
                          (sep_matches_prefix _s1925_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1926_ _) =>
                              (match (string_drop _s1925_ _s1926_) with
                               | _s1927_ =>
                                  (reg_name_matches_prefix _s1927_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s1928_ _) =>
                                              let p0_ := string_drop _s1927_ _s1928_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5)))
                       end)
                       : M (option ((mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5)))
               end)
               : M (option ((mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5)))
       end)
       : M (option ((mword 5 * mword 5)))
    else returnm None)
    : M (option ((mword 5 * mword 5))).

Definition _s1906_ (_s1907_ : string) : M (option ((mword 5 * mword 5))) :=
   let _s1908_ := _s1907_ in
   (if string_startswith _s1908_ "c.mv" then
      (match (string_drop _s1908_ (projT1 (string_length "c.mv"))) with
       | _s1909_ =>
          (spc_matches_prefix _s1909_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1910_ _) =>
              (match (string_drop _s1909_ _s1910_) with
               | _s1911_ =>
                  (reg_name_matches_prefix _s1911_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1912_ _) =>
                      (match (string_drop _s1911_ _s1912_) with
                       | _s1913_ =>
                          (sep_matches_prefix _s1913_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1914_ _) =>
                              (match (string_drop _s1913_ _s1914_) with
                               | _s1915_ =>
                                  (reg_name_matches_prefix _s1915_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s1916_ _) =>
                                              let p0_ := string_drop _s1915_ _s1916_ in
                                              if generic_eq p0_ "" then Some (rd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5)))
                       end)
                       : M (option ((mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5)))
               end)
               : M (option ((mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5)))
       end)
       : M (option ((mword 5 * mword 5)))
    else returnm None)
    : M (option ((mword 5 * mword 5))).

Definition _s1898_ (_s1899_ : string) : M (option (mword 5)) :=
   let _s1900_ := _s1899_ in
   (if string_startswith _s1900_ "c.jalr" then
      (match (string_drop _s1900_ (projT1 (string_length "c.jalr"))) with
       | _s1901_ =>
          (spc_matches_prefix _s1901_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1902_ _) =>
              (match (string_drop _s1901_ _s1902_) with
               | _s1903_ =>
                  (reg_name_matches_prefix _s1903_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  returnm (match w__1 with
                           | Some (rs1, existT _ _s1904_ _) =>
                              let p0_ := string_drop _s1903_ _s1904_ in
                              if generic_eq p0_ "" then Some rs1
                              else None
                           | _ => None
                           end)
               end)
               : M (option (mword 5))
           | _ => returnm None
           end)
           : M (option (mword 5))
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s1890_ (_s1891_ : string) : M (option (mword 5)) :=
   let _s1892_ := _s1891_ in
   (if string_startswith _s1892_ "c.jr" then
      (match (string_drop _s1892_ (projT1 (string_length "c.jr"))) with
       | _s1893_ =>
          (spc_matches_prefix _s1893_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1894_ _) =>
              (match (string_drop _s1893_ _s1894_) with
               | _s1895_ =>
                  (reg_name_matches_prefix _s1895_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  returnm (match w__1 with
                           | Some (rs1, existT _ _s1896_ _) =>
                              let p0_ := string_drop _s1895_ _s1896_ in
                              if generic_eq p0_ "" then Some rs1
                              else None
                           | _ => None
                           end)
               end)
               : M (option (mword 5))
           | _ => returnm None
           end)
           : M (option (mword 5))
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s1878_ (_s1879_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s1880_ := _s1879_ in
   (if string_startswith _s1880_ "c.sdsp" then
      (match (string_drop _s1880_ (projT1 (string_length "c.sdsp"))) with
       | _s1881_ =>
          (spc_matches_prefix _s1881_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1882_ _) =>
              (match (string_drop _s1881_ _s1882_) with
               | _s1883_ =>
                  (reg_name_matches_prefix _s1883_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs2, existT _ _s1884_ _) =>
                      (match (string_drop _s1883_ _s1884_) with
                       | _s1885_ =>
                          (sep_matches_prefix _s1885_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1886_ _) =>
                                      match (string_drop _s1885_ _s1886_) with
                                      | _s1887_ =>
                                         match (hex_bits_6_matches_prefix _s1887_) with
                                         | Some (uimm, existT _ _s1888_ _) =>
                                            let p0_ := string_drop _s1887_ _s1888_ in
                                            if generic_eq p0_ "" then Some (rs2, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s1866_ (_s1867_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s1868_ := _s1867_ in
   (if string_startswith _s1868_ "c.swsp" then
      (match (string_drop _s1868_ (projT1 (string_length "c.swsp"))) with
       | _s1869_ =>
          (spc_matches_prefix _s1869_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1870_ _) =>
              (match (string_drop _s1869_ _s1870_) with
               | _s1871_ =>
                  (reg_name_matches_prefix _s1871_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1872_ _) =>
                      (match (string_drop _s1871_ _s1872_) with
                       | _s1873_ =>
                          (sep_matches_prefix _s1873_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1874_ _) =>
                                      match (string_drop _s1873_ _s1874_) with
                                      | _s1875_ =>
                                         match (hex_bits_6_matches_prefix _s1875_) with
                                         | Some (uimm, existT _ _s1876_ _) =>
                                            let p0_ := string_drop _s1875_ _s1876_ in
                                            if generic_eq p0_ "" then Some (rd, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s1854_ (_s1855_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s1856_ := _s1855_ in
   (if string_startswith _s1856_ "c.ldsp" then
      (match (string_drop _s1856_ (projT1 (string_length "c.ldsp"))) with
       | _s1857_ =>
          (spc_matches_prefix _s1857_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1858_ _) =>
              (match (string_drop _s1857_ _s1858_) with
               | _s1859_ =>
                  (reg_name_matches_prefix _s1859_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1860_ _) =>
                      (match (string_drop _s1859_ _s1860_) with
                       | _s1861_ =>
                          (sep_matches_prefix _s1861_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1862_ _) =>
                                      match (string_drop _s1861_ _s1862_) with
                                      | _s1863_ =>
                                         match (hex_bits_6_matches_prefix _s1863_) with
                                         | Some (uimm, existT _ _s1864_ _) =>
                                            let p0_ := string_drop _s1863_ _s1864_ in
                                            if generic_eq p0_ "" then Some (rd, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s1842_ (_s1843_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s1844_ := _s1843_ in
   (if string_startswith _s1844_ "c.lwsp" then
      (match (string_drop _s1844_ (projT1 (string_length "c.lwsp"))) with
       | _s1845_ =>
          (spc_matches_prefix _s1845_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1846_ _) =>
              (match (string_drop _s1845_ _s1846_) with
               | _s1847_ =>
                  (reg_name_matches_prefix _s1847_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1848_ _) =>
                      (match (string_drop _s1847_ _s1848_) with
                       | _s1849_ =>
                          (sep_matches_prefix _s1849_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1850_ _) =>
                                      match (string_drop _s1849_ _s1850_) with
                                      | _s1851_ =>
                                         match (hex_bits_6_matches_prefix _s1851_) with
                                         | Some (uimm, existT _ _s1852_ _) =>
                                            let p0_ := string_drop _s1851_ _s1852_ in
                                            if generic_eq p0_ "" then Some (rd, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s1830_ (_s1831_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s1832_ := _s1831_ in
   (if string_startswith _s1832_ "c.slli" then
      (match (string_drop _s1832_ (projT1 (string_length "c.slli"))) with
       | _s1833_ =>
          (spc_matches_prefix _s1833_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1834_ _) =>
              (match (string_drop _s1833_ _s1834_) with
               | _s1835_ =>
                  (reg_name_matches_prefix _s1835_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1836_ _) =>
                      (match (string_drop _s1835_ _s1836_) with
                       | _s1837_ =>
                          (sep_matches_prefix _s1837_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1838_ _) =>
                                      match (string_drop _s1837_ _s1838_) with
                                      | _s1839_ =>
                                         match (hex_bits_6_matches_prefix _s1839_) with
                                         | Some (shamt, existT _ _s1840_ _) =>
                                            let p0_ := string_drop _s1839_ _s1840_ in
                                            if generic_eq p0_ "" then Some (rsd, shamt)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s1818_ (_s1819_ : string) : M (option ((mword 3 * mword 8))) :=
   let _s1820_ := _s1819_ in
   (if string_startswith _s1820_ "c.bnez" then
      (match (string_drop _s1820_ (projT1 (string_length "c.bnez"))) with
       | _s1821_ =>
          (spc_matches_prefix _s1821_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1822_ _) =>
              (match (string_drop _s1821_ _s1822_) with
               | _s1823_ =>
                  (creg_name_matches_prefix _s1823_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs, existT _ _s1824_ _) =>
                      (match (string_drop _s1823_ _s1824_) with
                       | _s1825_ =>
                          (sep_matches_prefix _s1825_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1826_ _) =>
                                      match (string_drop _s1825_ _s1826_) with
                                      | _s1827_ =>
                                         match (hex_bits_8_matches_prefix _s1827_) with
                                         | Some (imm, existT _ _s1828_ _) =>
                                            let p0_ := string_drop _s1827_ _s1828_ in
                                            if generic_eq p0_ "" then Some (rs, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 8)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 8)))
               end)
               : M (option ((mword 3 * mword 8)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 8)))
       end)
       : M (option ((mword 3 * mword 8)))
    else returnm None)
    : M (option ((mword 3 * mword 8))).

Definition _s1806_ (_s1807_ : string) : M (option ((mword 3 * mword 8))) :=
   let _s1808_ := _s1807_ in
   (if string_startswith _s1808_ "c.beqz" then
      (match (string_drop _s1808_ (projT1 (string_length "c.beqz"))) with
       | _s1809_ =>
          (spc_matches_prefix _s1809_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1810_ _) =>
              (match (string_drop _s1809_ _s1810_) with
               | _s1811_ =>
                  (creg_name_matches_prefix _s1811_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs, existT _ _s1812_ _) =>
                      (match (string_drop _s1811_ _s1812_) with
                       | _s1813_ =>
                          (sep_matches_prefix _s1813_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1814_ _) =>
                                      match (string_drop _s1813_ _s1814_) with
                                      | _s1815_ =>
                                         match (hex_bits_8_matches_prefix _s1815_) with
                                         | Some (imm, existT _ _s1816_ _) =>
                                            let p0_ := string_drop _s1815_ _s1816_ in
                                            if generic_eq p0_ "" then Some (rs, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 8)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 8)))
               end)
               : M (option ((mword 3 * mword 8)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 8)))
       end)
       : M (option ((mword 3 * mword 8)))
    else returnm None)
    : M (option ((mword 3 * mword 8))).

Definition _s1798_ (_s1799_ : string) : M (option (mword 11)) :=
   let _s1800_ := _s1799_ in
   (if string_startswith _s1800_ "c.j" then
      (match (string_drop _s1800_ (projT1 (string_length "c.j"))) with
       | _s1801_ =>
          (spc_matches_prefix _s1801_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s1802_ _) =>
                      match (string_drop _s1801_ _s1802_) with
                      | _s1803_ =>
                         match (hex_bits_11_matches_prefix _s1803_) with
                         | Some (imm, existT _ _s1804_ _) =>
                            let p0_ := string_drop _s1803_ _s1804_ in
                            if generic_eq p0_ "" then Some imm
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 11))
    else returnm None)
    : M (option (mword 11)).

Definition _s1786_ (_s1787_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s1788_ := _s1787_ in
   (if string_startswith _s1788_ "c.addw" then
      (match (string_drop _s1788_ (projT1 (string_length "c.addw"))) with
       | _s1789_ =>
          (spc_matches_prefix _s1789_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1790_ _) =>
              (match (string_drop _s1789_ _s1790_) with
               | _s1791_ =>
                  (creg_name_matches_prefix _s1791_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1792_ _) =>
                      (match (string_drop _s1791_ _s1792_) with
                       | _s1793_ =>
                          (sep_matches_prefix _s1793_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1794_ _) =>
                              (match (string_drop _s1793_ _s1794_) with
                               | _s1795_ =>
                                  (creg_name_matches_prefix _s1795_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s1796_ _) =>
                                              let p0_ := string_drop _s1795_ _s1796_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s1774_ (_s1775_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s1776_ := _s1775_ in
   (if string_startswith _s1776_ "c.subw" then
      (match (string_drop _s1776_ (projT1 (string_length "c.subw"))) with
       | _s1777_ =>
          (spc_matches_prefix _s1777_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1778_ _) =>
              (match (string_drop _s1777_ _s1778_) with
               | _s1779_ =>
                  (creg_name_matches_prefix _s1779_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1780_ _) =>
                      (match (string_drop _s1779_ _s1780_) with
                       | _s1781_ =>
                          (sep_matches_prefix _s1781_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1782_ _) =>
                              (match (string_drop _s1781_ _s1782_) with
                               | _s1783_ =>
                                  (creg_name_matches_prefix _s1783_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s1784_ _) =>
                                              let p0_ := string_drop _s1783_ _s1784_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s1762_ (_s1763_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s1764_ := _s1763_ in
   (if string_startswith _s1764_ "c.and" then
      (match (string_drop _s1764_ (projT1 (string_length "c.and"))) with
       | _s1765_ =>
          (spc_matches_prefix _s1765_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1766_ _) =>
              (match (string_drop _s1765_ _s1766_) with
               | _s1767_ =>
                  (creg_name_matches_prefix _s1767_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1768_ _) =>
                      (match (string_drop _s1767_ _s1768_) with
                       | _s1769_ =>
                          (sep_matches_prefix _s1769_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1770_ _) =>
                              (match (string_drop _s1769_ _s1770_) with
                               | _s1771_ =>
                                  (creg_name_matches_prefix _s1771_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s1772_ _) =>
                                              let p0_ := string_drop _s1771_ _s1772_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s1750_ (_s1751_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s1752_ := _s1751_ in
   (if string_startswith _s1752_ "c.or" then
      (match (string_drop _s1752_ (projT1 (string_length "c.or"))) with
       | _s1753_ =>
          (spc_matches_prefix _s1753_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1754_ _) =>
              (match (string_drop _s1753_ _s1754_) with
               | _s1755_ =>
                  (creg_name_matches_prefix _s1755_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1756_ _) =>
                      (match (string_drop _s1755_ _s1756_) with
                       | _s1757_ =>
                          (sep_matches_prefix _s1757_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1758_ _) =>
                              (match (string_drop _s1757_ _s1758_) with
                               | _s1759_ =>
                                  (creg_name_matches_prefix _s1759_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s1760_ _) =>
                                              let p0_ := string_drop _s1759_ _s1760_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s1738_ (_s1739_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s1740_ := _s1739_ in
   (if string_startswith _s1740_ "c.xor" then
      (match (string_drop _s1740_ (projT1 (string_length "c.xor"))) with
       | _s1741_ =>
          (spc_matches_prefix _s1741_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1742_ _) =>
              (match (string_drop _s1741_ _s1742_) with
               | _s1743_ =>
                  (creg_name_matches_prefix _s1743_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1744_ _) =>
                      (match (string_drop _s1743_ _s1744_) with
                       | _s1745_ =>
                          (sep_matches_prefix _s1745_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1746_ _) =>
                              (match (string_drop _s1745_ _s1746_) with
                               | _s1747_ =>
                                  (creg_name_matches_prefix _s1747_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s1748_ _) =>
                                              let p0_ := string_drop _s1747_ _s1748_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s1726_ (_s1727_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s1728_ := _s1727_ in
   (if string_startswith _s1728_ "c.sub" then
      (match (string_drop _s1728_ (projT1 (string_length "c.sub"))) with
       | _s1729_ =>
          (spc_matches_prefix _s1729_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1730_ _) =>
              (match (string_drop _s1729_ _s1730_) with
               | _s1731_ =>
                  (creg_name_matches_prefix _s1731_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1732_ _) =>
                      (match (string_drop _s1731_ _s1732_) with
                       | _s1733_ =>
                          (sep_matches_prefix _s1733_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1734_ _) =>
                              (match (string_drop _s1733_ _s1734_) with
                               | _s1735_ =>
                                  (creg_name_matches_prefix _s1735_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s1736_ _) =>
                                              let p0_ := string_drop _s1735_ _s1736_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s1714_ (_s1715_ : string) : M (option ((mword 3 * mword 6))) :=
   let _s1716_ := _s1715_ in
   (if string_startswith _s1716_ "c.andi" then
      (match (string_drop _s1716_ (projT1 (string_length "c.andi"))) with
       | _s1717_ =>
          (spc_matches_prefix _s1717_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1718_ _) =>
              (match (string_drop _s1717_ _s1718_) with
               | _s1719_ =>
                  (creg_name_matches_prefix _s1719_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1720_ _) =>
                      (match (string_drop _s1719_ _s1720_) with
                       | _s1721_ =>
                          (sep_matches_prefix _s1721_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1722_ _) =>
                                      match (string_drop _s1721_ _s1722_) with
                                      | _s1723_ =>
                                         match (hex_bits_6_matches_prefix _s1723_) with
                                         | Some (imm, existT _ _s1724_ _) =>
                                            let p0_ := string_drop _s1723_ _s1724_ in
                                            if generic_eq p0_ "" then Some (rsd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 6)))
               end)
               : M (option ((mword 3 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 6)))
       end)
       : M (option ((mword 3 * mword 6)))
    else returnm None)
    : M (option ((mword 3 * mword 6))).

Definition _s1702_ (_s1703_ : string) : M (option ((mword 3 * mword 6))) :=
   let _s1704_ := _s1703_ in
   (if string_startswith _s1704_ "c.srai" then
      (match (string_drop _s1704_ (projT1 (string_length "c.srai"))) with
       | _s1705_ =>
          (spc_matches_prefix _s1705_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1706_ _) =>
              (match (string_drop _s1705_ _s1706_) with
               | _s1707_ =>
                  (creg_name_matches_prefix _s1707_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1708_ _) =>
                      (match (string_drop _s1707_ _s1708_) with
                       | _s1709_ =>
                          (sep_matches_prefix _s1709_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1710_ _) =>
                                      match (string_drop _s1709_ _s1710_) with
                                      | _s1711_ =>
                                         match (hex_bits_6_matches_prefix _s1711_) with
                                         | Some (shamt, existT _ _s1712_ _) =>
                                            let p0_ := string_drop _s1711_ _s1712_ in
                                            if generic_eq p0_ "" then Some (rsd, shamt)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 6)))
               end)
               : M (option ((mword 3 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 6)))
       end)
       : M (option ((mword 3 * mword 6)))
    else returnm None)
    : M (option ((mword 3 * mword 6))).

Definition _s1690_ (_s1691_ : string) : M (option ((mword 3 * mword 6))) :=
   let _s1692_ := _s1691_ in
   (if string_startswith _s1692_ "c.srli" then
      (match (string_drop _s1692_ (projT1 (string_length "c.srli"))) with
       | _s1693_ =>
          (spc_matches_prefix _s1693_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1694_ _) =>
              (match (string_drop _s1693_ _s1694_) with
               | _s1695_ =>
                  (creg_name_matches_prefix _s1695_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1696_ _) =>
                      (match (string_drop _s1695_ _s1696_) with
                       | _s1697_ =>
                          (sep_matches_prefix _s1697_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1698_ _) =>
                                      match (string_drop _s1697_ _s1698_) with
                                      | _s1699_ =>
                                         match (hex_bits_6_matches_prefix _s1699_) with
                                         | Some (shamt, existT _ _s1700_ _) =>
                                            let p0_ := string_drop _s1699_ _s1700_ in
                                            if generic_eq p0_ "" then Some (rsd, shamt)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 6)))
               end)
               : M (option ((mword 3 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 6)))
       end)
       : M (option ((mword 3 * mword 6)))
    else returnm None)
    : M (option ((mword 3 * mword 6))).

Definition _s1678_ (_s1679_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s1680_ := _s1679_ in
   (if string_startswith _s1680_ "c.lui" then
      (match (string_drop _s1680_ (projT1 (string_length "c.lui"))) with
       | _s1681_ =>
          (spc_matches_prefix _s1681_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1682_ _) =>
              (match (string_drop _s1681_ _s1682_) with
               | _s1683_ =>
                  (reg_name_matches_prefix _s1683_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1684_ _) =>
                      (match (string_drop _s1683_ _s1684_) with
                       | _s1685_ =>
                          (sep_matches_prefix _s1685_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1686_ _) =>
                                      match (string_drop _s1685_ _s1686_) with
                                      | _s1687_ =>
                                         match (hex_bits_6_matches_prefix _s1687_) with
                                         | Some (imm, existT _ _s1688_ _) =>
                                            let p0_ := string_drop _s1687_ _s1688_ in
                                            if generic_eq p0_ "" then Some (rd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s1670_ (_s1671_ : string) : M (option (mword 6)) :=
   let _s1672_ := _s1671_ in
   (if string_startswith _s1672_ "c.addi16sp" then
      (match (string_drop _s1672_ (projT1 (string_length "c.addi16sp"))) with
       | _s1673_ =>
          (spc_matches_prefix _s1673_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s1674_ _) =>
                      match (string_drop _s1673_ _s1674_) with
                      | _s1675_ =>
                         match (hex_bits_6_matches_prefix _s1675_) with
                         | Some (imm, existT _ _s1676_ _) =>
                            let p0_ := string_drop _s1675_ _s1676_ in
                            if generic_eq p0_ "" then Some imm
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 6))
    else returnm None)
    : M (option (mword 6)).

Definition _s1658_ (_s1659_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s1660_ := _s1659_ in
   (if string_startswith _s1660_ "c.li" then
      (match (string_drop _s1660_ (projT1 (string_length "c.li"))) with
       | _s1661_ =>
          (spc_matches_prefix _s1661_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1662_ _) =>
              (match (string_drop _s1661_ _s1662_) with
               | _s1663_ =>
                  (reg_name_matches_prefix _s1663_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1664_ _) =>
                      (match (string_drop _s1663_ _s1664_) with
                       | _s1665_ =>
                          (sep_matches_prefix _s1665_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1666_ _) =>
                                      match (string_drop _s1665_ _s1666_) with
                                      | _s1667_ =>
                                         match (hex_bits_6_matches_prefix _s1667_) with
                                         | Some (imm, existT _ _s1668_ _) =>
                                            let p0_ := string_drop _s1667_ _s1668_ in
                                            if generic_eq p0_ "" then Some (rd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s1646_ (_s1647_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s1648_ := _s1647_ in
   (if string_startswith _s1648_ "c.addiw" then
      (match (string_drop _s1648_ (projT1 (string_length "c.addiw"))) with
       | _s1649_ =>
          (spc_matches_prefix _s1649_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1650_ _) =>
              (match (string_drop _s1649_ _s1650_) with
               | _s1651_ =>
                  (reg_name_matches_prefix _s1651_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1652_ _) =>
                      (match (string_drop _s1651_ _s1652_) with
                       | _s1653_ =>
                          (sep_matches_prefix _s1653_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1654_ _) =>
                                      match (string_drop _s1653_ _s1654_) with
                                      | _s1655_ =>
                                         match (hex_bits_6_matches_prefix _s1655_) with
                                         | Some (imm, existT _ _s1656_ _) =>
                                            let p0_ := string_drop _s1655_ _s1656_ in
                                            if generic_eq p0_ "" then Some (rsd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s1638_ (_s1639_ : string) : M (option (mword 11)) :=
   let _s1640_ := _s1639_ in
   (if string_startswith _s1640_ "c.jal" then
      (match (string_drop _s1640_ (projT1 (string_length "c.jal"))) with
       | _s1641_ =>
          (spc_matches_prefix _s1641_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s1642_ _) =>
                      match (string_drop _s1641_ _s1642_) with
                      | _s1643_ =>
                         match (hex_bits_12_matches_prefix _s1643_) with
                         | Some (v__1184, existT _ _s1644_ _) =>
                            if eq_vec (subrange_vec_dec v__1184 0 0) ('b"0"  : mword (0 - 0 + 1))
                            then
                              let imm : mword 11 := subrange_vec_dec v__1184 11 1 in
                              let imm : mword 11 := subrange_vec_dec v__1184 11 1 in
                              let p0_ := string_drop _s1643_ _s1644_ in
                              if generic_eq p0_ "" then Some imm
                              else None
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 11))
    else returnm None)
    : M (option (mword 11)).

Definition _s1626_ (_s1627_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s1628_ := _s1627_ in
   (if string_startswith _s1628_ "c.addi" then
      (match (string_drop _s1628_ (projT1 (string_length "c.addi"))) with
       | _s1629_ =>
          (spc_matches_prefix _s1629_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1630_ _) =>
              (match (string_drop _s1629_ _s1630_) with
               | _s1631_ =>
                  (reg_name_matches_prefix _s1631_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s1632_ _) =>
                      (match (string_drop _s1631_ _s1632_) with
                       | _s1633_ =>
                          (sep_matches_prefix _s1633_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1634_ _) =>
                                      match (string_drop _s1633_ _s1634_) with
                                      | _s1635_ =>
                                         match (hex_bits_6_matches_prefix _s1635_) with
                                         | Some (nzi, existT _ _s1636_ _) =>
                                            let p0_ := string_drop _s1635_ _s1636_ in
                                            if generic_eq p0_ "" then Some (rsd, nzi)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s1610_ (_s1611_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s1612_ := _s1611_ in
   (if string_startswith _s1612_ "c.sd" then
      (match (string_drop _s1612_ (projT1 (string_length "c.sd"))) with
       | _s1613_ =>
          (spc_matches_prefix _s1613_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1614_ _) =>
              (match (string_drop _s1613_ _s1614_) with
               | _s1615_ =>
                  (creg_name_matches_prefix _s1615_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsc1, existT _ _s1616_ _) =>
                      (match (string_drop _s1615_ _s1616_) with
                       | _s1617_ =>
                          (sep_matches_prefix _s1617_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1618_ _) =>
                              (match (string_drop _s1617_ _s1618_) with
                               | _s1619_ =>
                                  (creg_name_matches_prefix _s1619_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc2, existT _ _s1620_ _) =>
                                      (match (string_drop _s1619_ _s1620_) with
                                       | _s1621_ =>
                                          (sep_matches_prefix _s1621_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s1622_ _) =>
                                                      match (string_drop _s1621_ _s1622_) with
                                                      | _s1623_ =>
                                                         match (hex_bits_8_matches_prefix _s1623_) with
                                                         | Some (v__1186, existT _ _s1624_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1186 2 0)
                                                                 ('b"000"
                                                                  : mword (2 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1186 7 3 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1186 7 3 in
                                                              let p0_ := string_drop _s1623_ _s1624_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rsc1, rsc2, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s1594_ (_s1595_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s1596_ := _s1595_ in
   (if string_startswith _s1596_ "c.sw" then
      (match (string_drop _s1596_ (projT1 (string_length "c.sw"))) with
       | _s1597_ =>
          (spc_matches_prefix _s1597_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1598_ _) =>
              (match (string_drop _s1597_ _s1598_) with
               | _s1599_ =>
                  (creg_name_matches_prefix _s1599_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsc1, existT _ _s1600_ _) =>
                      (match (string_drop _s1599_ _s1600_) with
                       | _s1601_ =>
                          (sep_matches_prefix _s1601_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1602_ _) =>
                              (match (string_drop _s1601_ _s1602_) with
                               | _s1603_ =>
                                  (creg_name_matches_prefix _s1603_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc2, existT _ _s1604_ _) =>
                                      (match (string_drop _s1603_ _s1604_) with
                                       | _s1605_ =>
                                          (sep_matches_prefix _s1605_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s1606_ _) =>
                                                      match (string_drop _s1605_ _s1606_) with
                                                      | _s1607_ =>
                                                         match (hex_bits_7_matches_prefix _s1607_) with
                                                         | Some (v__1188, existT _ _s1608_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1188 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1188 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1188 6 2 in
                                                              let p0_ := string_drop _s1607_ _s1608_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rsc1, rsc2, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s1578_ (_s1579_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s1580_ := _s1579_ in
   (if string_startswith _s1580_ "c.ld" then
      (match (string_drop _s1580_ (projT1 (string_length "c.ld"))) with
       | _s1581_ =>
          (spc_matches_prefix _s1581_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1582_ _) =>
              (match (string_drop _s1581_ _s1582_) with
               | _s1583_ =>
                  (creg_name_matches_prefix _s1583_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s1584_ _) =>
                      (match (string_drop _s1583_ _s1584_) with
                       | _s1585_ =>
                          (sep_matches_prefix _s1585_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1586_ _) =>
                              (match (string_drop _s1585_ _s1586_) with
                               | _s1587_ =>
                                  (creg_name_matches_prefix _s1587_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc, existT _ _s1588_ _) =>
                                      (match (string_drop _s1587_ _s1588_) with
                                       | _s1589_ =>
                                          (sep_matches_prefix _s1589_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s1590_ _) =>
                                                      match (string_drop _s1589_ _s1590_) with
                                                      | _s1591_ =>
                                                         match (hex_bits_8_matches_prefix _s1591_) with
                                                         | Some (v__1190, existT _ _s1592_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1190 2 0)
                                                                 ('b"000"
                                                                  : mword (2 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1190 7 3 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1190 7 3 in
                                                              let p0_ := string_drop _s1591_ _s1592_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rdc, rsc, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s1562_ (_s1563_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s1564_ := _s1563_ in
   (if string_startswith _s1564_ "c.lw" then
      (match (string_drop _s1564_ (projT1 (string_length "c.lw"))) with
       | _s1565_ =>
          (spc_matches_prefix _s1565_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1566_ _) =>
              (match (string_drop _s1565_ _s1566_) with
               | _s1567_ =>
                  (creg_name_matches_prefix _s1567_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s1568_ _) =>
                      (match (string_drop _s1567_ _s1568_) with
                       | _s1569_ =>
                          (sep_matches_prefix _s1569_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1570_ _) =>
                              (match (string_drop _s1569_ _s1570_) with
                               | _s1571_ =>
                                  (creg_name_matches_prefix _s1571_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc, existT _ _s1572_ _) =>
                                      (match (string_drop _s1571_ _s1572_) with
                                       | _s1573_ =>
                                          (sep_matches_prefix _s1573_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s1574_ _) =>
                                                      match (string_drop _s1573_ _s1574_) with
                                                      | _s1575_ =>
                                                         match (hex_bits_7_matches_prefix _s1575_) with
                                                         | Some (v__1192, existT _ _s1576_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1192 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1192 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1192 6 2 in
                                                              let p0_ := string_drop _s1575_ _s1576_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rdc, rsc, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s1550_ (_s1551_ : string) : M (option ((mword 3 * mword 8))) :=
   let _s1552_ := _s1551_ in
   (if string_startswith _s1552_ "c.addi4spn" then
      (match (string_drop _s1552_ (projT1 (string_length "c.addi4spn"))) with
       | _s1553_ =>
          (spc_matches_prefix _s1553_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1554_ _) =>
              (match (string_drop _s1553_ _s1554_) with
               | _s1555_ =>
                  (creg_name_matches_prefix _s1555_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s1556_ _) =>
                      (match (string_drop _s1555_ _s1556_) with
                       | _s1557_ =>
                          (sep_matches_prefix _s1557_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1558_ _) =>
                                      match (string_drop _s1557_ _s1558_) with
                                      | _s1559_ =>
                                         match (hex_bits_10_matches_prefix _s1559_) with
                                         | Some (v__1194, existT _ _s1560_ _) =>
                                            if eq_vec (subrange_vec_dec v__1194 1 0)
                                                 ('b"00"
                                                  : mword (1 - 0 + 1)) then
                                              let nzimm : mword 8 := subrange_vec_dec v__1194 9 2 in
                                              let nzimm : mword 8 := subrange_vec_dec v__1194 9 2 in
                                              let p0_ := string_drop _s1559_ _s1560_ in
                                              if generic_eq p0_ "" then Some (rdc, nzimm)
                                              else None
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 8)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 8)))
               end)
               : M (option ((mword 3 * mword 8)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 8)))
       end)
       : M (option ((mword 3 * mword 8)))
    else returnm None)
    : M (option ((mword 3 * mword 8))).

Definition _s1524_ (_s1525_ : string)
: M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) :=
   (match _s1525_ with
    | _s1526_ =>
       (amo_mnemonic_matches_prefix _s1526_) >>= fun w__0 : option ((amoop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s1527_ _) =>
           let _s1528_ := string_drop _s1526_ _s1527_ in
           (if string_startswith _s1528_ "." then
              (match (string_drop _s1528_ (projT1 (string_length "."))) with
               | _s1529_ =>
                  (size_mnemonic_matches_prefix _s1529_) >>= fun w__1 : option ((word_width * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (width, existT _ _s1530_ _) =>
                      (match (string_drop _s1529_ _s1530_) with
                       | _s1531_ =>
                          (maybe_aq_matches_prefix _s1531_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (aq, existT _ _s1532_ _) =>
                              (match (string_drop _s1531_ _s1532_) with
                               | _s1533_ =>
                                  (maybe_rl_matches_prefix _s1533_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rl, existT _ _s1534_ _) =>
                                      (match (string_drop _s1533_ _s1534_) with
                                       | _s1535_ =>
                                          (spc_matches_prefix _s1535_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (tt, existT _ _s1536_ _) =>
                                              (match (string_drop _s1535_ _s1536_) with
                                               | _s1537_ =>
                                                  (reg_name_matches_prefix _s1537_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (rd, existT _ _s1538_ _) =>
                                                      (match (string_drop _s1537_ _s1538_) with
                                                       | _s1539_ =>
                                                          (sep_matches_prefix _s1539_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          (match w__6 with
                                                           | Some (tt, existT _ _s1540_ _) =>
                                                              (match (string_drop _s1539_ _s1540_) with
                                                               | _s1541_ =>
                                                                  (reg_name_matches_prefix _s1541_) >>= fun w__7 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                    0)})) =>
                                                                  (match w__7 with
                                                                   | Some (rs2, existT _ _s1542_ _) =>
                                                                      (match (string_drop _s1541_
                                                                                _s1542_) with
                                                                       | _s1543_ =>
                                                                          (sep_matches_prefix
                                                                             _s1543_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >=?
                                                                            0)})) =>
                                                                          (match w__8 with
                                                                           | Some
                                                                             (tt, existT _ _s1544_ _) =>
                                                                              let _s1545_ :=
                                                                                string_drop _s1543_
                                                                                  _s1544_ in
                                                                              (if string_startswith
                                                                                    _s1545_ "(" then
                                                                                 (match (string_drop
                                                                                           _s1545_
                                                                                           (projT1
                                                                                            (string_length
                                                                                               "("))) with
                                                                                  | _s1546_ =>
                                                                                     (reg_name_matches_prefix
                                                                                        _s1546_) >>= fun w__9 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                                       0)})) =>
                                                                                     returnm (match w__9 with
                                                                                              | Some
                                                                                                (rs1, existT _ _s1547_ _) =>
                                                                                                 let _s1548_ :=
                                                                                                   string_drop
                                                                                                     _s1546_
                                                                                                     _s1547_ in
                                                                                                 if string_startswith
                                                                                                      _s1548_
                                                                                                      ")"
                                                                                                 then
                                                                                                   let p0_ :=
                                                                                                     string_drop
                                                                                                       _s1548_
                                                                                                       (projT1
                                                                                                        (string_length
                                                                                                           ")")) in
                                                                                                   if
                                                                                                     generic_eq
                                                                                                       p0_
                                                                                                       ""
                                                                                                   then
                                                                                                     Some
                                                                                                       (op, width, aq, rl, rd, rs2, rs1)
                                                                                                   else
                                                                                                     None
                                                                                                 else
                                                                                                   None
                                                                                              | _ =>
                                                                                                 None
                                                                                              end)
                                                                                  end)
                                                                                  : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                               else returnm None)
                                                                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                           | _ => returnm None
                                                                           end)
                                                                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                       end)
                                                                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                               end)
                                                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                       end)
                                                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                               end)
                                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
            else returnm None)
            : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))).

Definition _s1502_ (_s1503_ : string)
: M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) :=
   let _s1504_ := _s1503_ in
   (if string_startswith _s1504_ "sc." then
      (match (string_drop _s1504_ (projT1 (string_length "sc."))) with
       | _s1505_ =>
          (size_mnemonic_matches_prefix _s1505_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s1506_ _) =>
              (match (string_drop _s1505_ _s1506_) with
               | _s1507_ =>
                  (maybe_aq_matches_prefix _s1507_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (aq, existT _ _s1508_ _) =>
                      (match (string_drop _s1507_ _s1508_) with
                       | _s1509_ =>
                          (maybe_rl_matches_prefix _s1509_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rl, existT _ _s1510_ _) =>
                              (match (string_drop _s1509_ _s1510_) with
                               | _s1511_ =>
                                  (spc_matches_prefix _s1511_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s1512_ _) =>
                                      (match (string_drop _s1511_ _s1512_) with
                                       | _s1513_ =>
                                          (reg_name_matches_prefix _s1513_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rd, existT _ _s1514_ _) =>
                                              (match (string_drop _s1513_ _s1514_) with
                                               | _s1515_ =>
                                                  (sep_matches_prefix _s1515_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s1516_ _) =>
                                                      (match (string_drop _s1515_ _s1516_) with
                                                       | _s1517_ =>
                                                          (reg_name_matches_prefix _s1517_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          (match w__6 with
                                                           | Some (rs1, existT _ _s1518_ _) =>
                                                              (match (string_drop _s1517_ _s1518_) with
                                                               | _s1519_ =>
                                                                  (sep_matches_prefix _s1519_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                    0)})) =>
                                                                  (match w__7 with
                                                                   | Some (tt, existT _ _s1520_ _) =>
                                                                      (match (string_drop _s1519_
                                                                                _s1520_) with
                                                                       | _s1521_ =>
                                                                          (reg_name_matches_prefix
                                                                             _s1521_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                            0)})) =>
                                                                          returnm (match w__8 with
                                                                                   | Some
                                                                                     (rs2, existT _ _s1522_ _) =>
                                                                                      let p0_ :=
                                                                                        string_drop
                                                                                          _s1521_
                                                                                          _s1522_ in
                                                                                      if generic_eq
                                                                                           p0_ ""
                                                                                      then
                                                                                        Some
                                                                                          (size, aq, rl, rd, rs1, rs2)
                                                                                      else None
                                                                                   | _ => None
                                                                                   end)
                                                                       end)
                                                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                               end)
                                                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                       end)
                                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                               end)
                                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))).

Definition _s1484_ (_s1485_ : string) : M (option ((word_width * bool * bool * mword 5 * mword 5))) :=
   let _s1486_ := _s1485_ in
   (if string_startswith _s1486_ "lr." then
      (match (string_drop _s1486_ (projT1 (string_length "lr."))) with
       | _s1487_ =>
          (size_mnemonic_matches_prefix _s1487_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s1488_ _) =>
              (match (string_drop _s1487_ _s1488_) with
               | _s1489_ =>
                  (maybe_aq_matches_prefix _s1489_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (aq, existT _ _s1490_ _) =>
                      (match (string_drop _s1489_ _s1490_) with
                       | _s1491_ =>
                          (maybe_rl_matches_prefix _s1491_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rl, existT _ _s1492_ _) =>
                              (match (string_drop _s1491_ _s1492_) with
                               | _s1493_ =>
                                  (spc_matches_prefix _s1493_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s1494_ _) =>
                                      (match (string_drop _s1493_ _s1494_) with
                                       | _s1495_ =>
                                          (reg_name_matches_prefix _s1495_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rd, existT _ _s1496_ _) =>
                                              (match (string_drop _s1495_ _s1496_) with
                                               | _s1497_ =>
                                                  (sep_matches_prefix _s1497_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s1498_ _) =>
                                                      (match (string_drop _s1497_ _s1498_) with
                                                       | _s1499_ =>
                                                          (reg_name_matches_prefix _s1499_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          returnm (match w__6 with
                                                                   | Some (rs1, existT _ _s1500_ _) =>
                                                                      let p0_ :=
                                                                        string_drop _s1499_ _s1500_ in
                                                                      if generic_eq p0_ "" then
                                                                        Some (size, aq, rl, rd, rs1)
                                                                      else None
                                                                   | _ => None
                                                                   end)
                                                       end)
                                                       : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                               end)
                                               : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                       end)
                                       : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                               end)
                               : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                       end)
                       : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * mword 5 * mword 5)))
               end)
               : M (option ((word_width * bool * bool * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * mword 5 * mword 5)))
       end)
       : M (option ((word_width * bool * bool * mword 5 * mword 5)))
    else returnm None)
    : M (option ((word_width * bool * bool * mword 5 * mword 5))).

Definition _s1472_ (_s1473_ : string) : M (option ((mword 5 * mword 5))) :=
   let _s1474_ := _s1473_ in
   (if string_startswith _s1474_ "sfence.vma" then
      (match (string_drop _s1474_ (projT1 (string_length "sfence.vma"))) with
       | _s1475_ =>
          (spc_matches_prefix _s1475_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1476_ _) =>
              (match (string_drop _s1475_ _s1476_) with
               | _s1477_ =>
                  (reg_name_matches_prefix _s1477_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs1, existT _ _s1478_ _) =>
                      (match (string_drop _s1477_ _s1478_) with
                       | _s1479_ =>
                          (sep_matches_prefix _s1479_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1480_ _) =>
                              (match (string_drop _s1479_ _s1480_) with
                               | _s1481_ =>
                                  (reg_name_matches_prefix _s1481_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s1482_ _) =>
                                              let p0_ := string_drop _s1481_ _s1482_ in
                                              if generic_eq p0_ "" then Some (rs1, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5)))
                       end)
                       : M (option ((mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5)))
               end)
               : M (option ((mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5)))
       end)
       : M (option ((mword 5 * mword 5)))
    else returnm None)
    : M (option ((mword 5 * mword 5))).

Definition _s1460_ (_s1461_ : string) : M (option ((mword 4 * mword 4))) :=
   let _s1462_ := _s1461_ in
   (if string_startswith _s1462_ "fence.tso" then
      (match (string_drop _s1462_ (projT1 (string_length "fence.tso"))) with
       | _s1463_ =>
          (spc_matches_prefix _s1463_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1464_ _) =>
              (match (string_drop _s1463_ _s1464_) with
               | _s1465_ =>
                  (fence_bits_matches_prefix _s1465_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (pred, existT _ _s1466_ _) =>
                      (match (string_drop _s1465_ _s1466_) with
                       | _s1467_ =>
                          (sep_matches_prefix _s1467_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1468_ _) =>
                              (match (string_drop _s1467_ _s1468_) with
                               | _s1469_ =>
                                  (fence_bits_matches_prefix _s1469_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (succ, existT _ _s1470_ _) =>
                                              let p0_ := string_drop _s1469_ _s1470_ in
                                              if generic_eq p0_ "" then Some (pred, succ)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 4 * mword 4)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 4 * mword 4)))
                       end)
                       : M (option ((mword 4 * mword 4)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 4 * mword 4)))
               end)
               : M (option ((mword 4 * mword 4)))
           | _ => returnm None
           end)
           : M (option ((mword 4 * mword 4)))
       end)
       : M (option ((mword 4 * mword 4)))
    else returnm None)
    : M (option ((mword 4 * mword 4))).

Definition _s1448_ (_s1449_ : string) : M (option ((mword 4 * mword 4))) :=
   let _s1450_ := _s1449_ in
   (if string_startswith _s1450_ "fence" then
      (match (string_drop _s1450_ (projT1 (string_length "fence"))) with
       | _s1451_ =>
          (spc_matches_prefix _s1451_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1452_ _) =>
              (match (string_drop _s1451_ _s1452_) with
               | _s1453_ =>
                  (fence_bits_matches_prefix _s1453_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (pred, existT _ _s1454_ _) =>
                      (match (string_drop _s1453_ _s1454_) with
                       | _s1455_ =>
                          (sep_matches_prefix _s1455_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1456_ _) =>
                              (match (string_drop _s1455_ _s1456_) with
                               | _s1457_ =>
                                  (fence_bits_matches_prefix _s1457_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (succ, existT _ _s1458_ _) =>
                                              let p0_ := string_drop _s1457_ _s1458_ in
                                              if generic_eq p0_ "" then Some (pred, succ)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 4 * mword 4)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 4 * mword 4)))
                       end)
                       : M (option ((mword 4 * mword 4)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 4 * mword 4)))
               end)
               : M (option ((mword 4 * mword 4)))
           | _ => returnm None
           end)
           : M (option ((mword 4 * mword 4)))
       end)
       : M (option ((mword 4 * mword 4)))
    else returnm None)
    : M (option ((mword 4 * mword 4))).

Definition _s1431_ (_s1432_ : string) : M (option ((sopw * mword 5 * mword 5 * mword 5))) :=
   (match _s1432_ with
    | _s1433_ =>
       (shiftiwop_mnemonic_matches_prefix _s1433_) >>= fun w__0 : option ((sopw * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s1434_ _) =>
           (match (string_drop _s1433_ _s1434_) with
            | _s1435_ =>
               (spc_matches_prefix _s1435_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s1436_ _) =>
                   (match (string_drop _s1435_ _s1436_) with
                    | _s1437_ =>
                       (reg_name_matches_prefix _s1437_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s1438_ _) =>
                           (match (string_drop _s1437_ _s1438_) with
                            | _s1439_ =>
                               (sep_matches_prefix _s1439_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s1440_ _) =>
                                   (match (string_drop _s1439_ _s1440_) with
                                    | _s1441_ =>
                                       (reg_name_matches_prefix _s1441_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s1442_ _) =>
                                           (match (string_drop _s1441_ _s1442_) with
                                            | _s1443_ =>
                                               (sep_matches_prefix _s1443_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s1444_ _) =>
                                                           match (string_drop _s1443_ _s1444_) with
                                                           | _s1445_ =>
                                                              match (hex_bits_5_matches_prefix
                                                                       _s1445_) with
                                                              | Some (shamt, existT _ _s1446_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s1445_ _s1446_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rd, rs1, shamt)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((sopw * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((sopw * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((sopw * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((sopw * mword 5 * mword 5 * mword 5))).

Definition _s1414_ (_s1415_ : string) : M (option ((ropw * mword 5 * mword 5 * mword 5))) :=
   (match _s1415_ with
    | _s1416_ =>
       (rtypew_mnemonic_matches_prefix _s1416_) >>= fun w__0 : option ((ropw * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s1417_ _) =>
           (match (string_drop _s1416_ _s1417_) with
            | _s1418_ =>
               (spc_matches_prefix _s1418_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s1419_ _) =>
                   (match (string_drop _s1418_ _s1419_) with
                    | _s1420_ =>
                       (reg_name_matches_prefix _s1420_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s1421_ _) =>
                           (match (string_drop _s1420_ _s1421_) with
                            | _s1422_ =>
                               (sep_matches_prefix _s1422_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s1423_ _) =>
                                   (match (string_drop _s1422_ _s1423_) with
                                    | _s1424_ =>
                                       (reg_name_matches_prefix _s1424_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s1425_ _) =>
                                           (match (string_drop _s1424_ _s1425_) with
                                            | _s1426_ =>
                                               (sep_matches_prefix _s1426_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s1427_ _) =>
                                                   (match (string_drop _s1426_ _s1427_) with
                                                    | _s1428_ =>
                                                       (reg_name_matches_prefix _s1428_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s1429_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s1428_ _s1429_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (op, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((ropw * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((ropw * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((ropw * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((ropw * mword 5 * mword 5 * mword 5))).

Definition _s1397_ (_s1398_ : string) : M (option ((sop * mword 5 * mword 5 * mword 5))) :=
   (match _s1398_ with
    | _s1399_ =>
       (shiftw_mnemonic_matches_prefix _s1399_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s1400_ _) =>
           (match (string_drop _s1399_ _s1400_) with
            | _s1401_ =>
               (spc_matches_prefix _s1401_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s1402_ _) =>
                   (match (string_drop _s1401_ _s1402_) with
                    | _s1403_ =>
                       (reg_name_matches_prefix _s1403_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s1404_ _) =>
                           (match (string_drop _s1403_ _s1404_) with
                            | _s1405_ =>
                               (sep_matches_prefix _s1405_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s1406_ _) =>
                                   (match (string_drop _s1405_ _s1406_) with
                                    | _s1407_ =>
                                       (reg_name_matches_prefix _s1407_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s1408_ _) =>
                                           (match (string_drop _s1407_ _s1408_) with
                                            | _s1409_ =>
                                               (sep_matches_prefix _s1409_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s1410_ _) =>
                                                           match (string_drop _s1409_ _s1410_) with
                                                           | _s1411_ =>
                                                              match (hex_bits_5_matches_prefix
                                                                       _s1411_) with
                                                              | Some (shamt, existT _ _s1412_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s1411_ _s1412_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rd, rs1, shamt)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((sop * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((sop * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((sop * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((sop * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((sop * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((sop * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((sop * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((sop * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((sop * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((sop * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((sop * mword 5 * mword 5 * mword 5))).

Definition _s1381_ (_s1382_ : string) : M (option ((mword 5 * mword 5 * mword 12))) :=
   let _s1383_ := _s1382_ in
   (if string_startswith _s1383_ "addiw" then
      (match (string_drop _s1383_ (projT1 (string_length "addiw"))) with
       | _s1384_ =>
          (spc_matches_prefix _s1384_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1385_ _) =>
              (match (string_drop _s1384_ _s1385_) with
               | _s1386_ =>
                  (reg_name_matches_prefix _s1386_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1387_ _) =>
                      (match (string_drop _s1386_ _s1387_) with
                       | _s1388_ =>
                          (sep_matches_prefix _s1388_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1389_ _) =>
                              (match (string_drop _s1388_ _s1389_) with
                               | _s1390_ =>
                                  (reg_name_matches_prefix _s1390_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rs1, existT _ _s1391_ _) =>
                                      (match (string_drop _s1390_ _s1391_) with
                                       | _s1392_ =>
                                          (sep_matches_prefix _s1392_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s1393_ _) =>
                                                      match (string_drop _s1392_ _s1393_) with
                                                      | _s1394_ =>
                                                         match (hex_bits_12_matches_prefix _s1394_) with
                                                         | Some (imm, existT _ _s1395_ _) =>
                                                            let p0_ := string_drop _s1394_ _s1395_ in
                                                            if generic_eq p0_ "" then
                                                              Some (rd, rs1, imm)
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 5 * mword 5 * mword 12)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 5 * mword 5 * mword 12)))
                               end)
                               : M (option ((mword 5 * mword 5 * mword 12)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * mword 12)))
                       end)
                       : M (option ((mword 5 * mword 5 * mword 12)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * mword 12)))
               end)
               : M (option ((mword 5 * mword 5 * mword 12)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 12)))
       end)
       : M (option ((mword 5 * mword 5 * mword 12)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 12))).

Definition _s1353_ (_s1354_ : string)
: M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5))) :=
   let _s1355_ := _s1354_ in
   (if string_startswith _s1355_ "s" then
      (match (string_drop _s1355_ (projT1 (string_length "s"))) with
       | _s1356_ =>
          (size_mnemonic_matches_prefix _s1356_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s1357_ _) =>
              (match (string_drop _s1356_ _s1357_) with
               | _s1358_ =>
                  (maybe_aq_matches_prefix _s1358_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (aq, existT _ _s1359_ _) =>
                      (match (string_drop _s1358_ _s1359_) with
                       | _s1360_ =>
                          (maybe_rl_matches_prefix _s1360_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rl, existT _ _s1361_ _) =>
                              (match (string_drop _s1360_ _s1361_) with
                               | _s1362_ =>
                                  (spc_matches_prefix _s1362_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s1363_ _) =>
                                      (match (string_drop _s1362_ _s1363_) with
                                       | _s1364_ =>
                                          (reg_name_matches_prefix _s1364_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rs2, existT _ _s1365_ _) =>
                                              (match (string_drop _s1364_ _s1365_) with
                                               | _s1366_ =>
                                                  (sep_matches_prefix _s1366_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s1367_ _) =>
                                                      (match (string_drop _s1366_ _s1367_) with
                                                       | _s1368_ =>
                                                          (match (hex_bits_12_matches_prefix _s1368_) with
                                                           | Some (imm, existT _ _s1369_ _) =>
                                                              (match (string_drop _s1368_ _s1369_) with
                                                               | _s1370_ =>
                                                                  (opt_spc_matches_prefix _s1370_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >=?
                                                                    0)})) =>
                                                                  (match w__6 with
                                                                   | Some (tt, existT _ _s1371_ _) =>
                                                                      let _s1372_ :=
                                                                        string_drop _s1370_ _s1371_ in
                                                                      (if string_startswith _s1372_
                                                                            "(" then
                                                                         (match (string_drop _s1372_
                                                                                   (projT1
                                                                                    (string_length
                                                                                       "("))) with
                                                                          | _s1373_ =>
                                                                             (opt_spc_matches_prefix
                                                                                _s1373_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                               0)})) =>
                                                                             (match w__7 with
                                                                              | Some
                                                                                (tt, existT _ _s1374_ _) =>
                                                                                 (match (string_drop
                                                                                           _s1373_
                                                                                           _s1374_) with
                                                                                  | _s1375_ =>
                                                                                     (reg_name_matches_prefix
                                                                                        _s1375_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                                       0)})) =>
                                                                                     (match w__8 with
                                                                                      | Some
                                                                                        (rs1, existT _ _s1376_ _) =>
                                                                                         (match (string_drop
                                                                                                   _s1375_
                                                                                                   _s1376_) with
                                                                                          | _s1377_ =>
                                                                                             (opt_spc_matches_prefix
                                                                                                _s1377_) >>= fun w__9 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                               0)})) =>
                                                                                             returnm (match w__9 with
                                                                                                      | Some
                                                                                                        (tt, existT _ _s1378_ _) =>
                                                                                                         let _s1379_ :=
                                                                                                           string_drop
                                                                                                             _s1377_
                                                                                                             _s1378_ in
                                                                                                         if
                                                                                                           string_startswith
                                                                                                             _s1379_
                                                                                                             ")"
                                                                                                         then
                                                                                                           let p0_ :=
                                                                                                             string_drop
                                                                                                               _s1379_
                                                                                                               (projT1
                                                                                                                (string_length
                                                                                                                   ")")) in
                                                                                                           if
                                                                                                             generic_eq
                                                                                                               p0_
                                                                                                               ""
                                                                                                           then
                                                                                                             Some
                                                                                                               (size, aq, rl, rs2, imm, rs1)
                                                                                                           else
                                                                                                             None
                                                                                                         else
                                                                                                           None
                                                                                                      | _ =>
                                                                                                         None
                                                                                                      end)
                                                                                          end)
                                                                                          : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                      | _ =>
                                                                                         returnm None
                                                                                      end)
                                                                                      : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                  end)
                                                                                  : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                              | _ => returnm None
                                                                              end)
                                                                              : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                          end)
                                                                          : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                       else returnm None)
                                                                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                               end)
                                                               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                       end)
                                                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                               end)
                                               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
       end)
       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
    else returnm None)
    : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5))).

Definition _s1323_ (_s1324_ : string)
: M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5))) :=
   let _s1325_ := _s1324_ in
   (if string_startswith _s1325_ "l" then
      (match (string_drop _s1325_ (projT1 (string_length "l"))) with
       | _s1326_ =>
          (size_mnemonic_matches_prefix _s1326_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s1327_ _) =>
              (match (string_drop _s1326_ _s1327_) with
               | _s1328_ =>
                  (maybe_u_matches_prefix _s1328_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (is_unsigned, existT _ _s1329_ _) =>
                      (match (string_drop _s1328_ _s1329_) with
                       | _s1330_ =>
                          (maybe_aq_matches_prefix _s1330_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (aq, existT _ _s1331_ _) =>
                              (match (string_drop _s1330_ _s1331_) with
                               | _s1332_ =>
                                  (maybe_rl_matches_prefix _s1332_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rl, existT _ _s1333_ _) =>
                                      (match (string_drop _s1332_ _s1333_) with
                                       | _s1334_ =>
                                          (spc_matches_prefix _s1334_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (tt, existT _ _s1335_ _) =>
                                              (match (string_drop _s1334_ _s1335_) with
                                               | _s1336_ =>
                                                  (reg_name_matches_prefix _s1336_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (rd, existT _ _s1337_ _) =>
                                                      (match (string_drop _s1336_ _s1337_) with
                                                       | _s1338_ =>
                                                          (sep_matches_prefix _s1338_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          (match w__6 with
                                                           | Some (tt, existT _ _s1339_ _) =>
                                                              (match (string_drop _s1338_ _s1339_) with
                                                               | _s1340_ =>
                                                                  (match (hex_bits_12_matches_prefix
                                                                            _s1340_) with
                                                                   | Some (imm, existT _ _s1341_ _) =>
                                                                      (match (string_drop _s1340_
                                                                                _s1341_) with
                                                                       | _s1342_ =>
                                                                          (opt_spc_matches_prefix
                                                                             _s1342_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                            0)})) =>
                                                                          (match w__7 with
                                                                           | Some
                                                                             (tt, existT _ _s1343_ _) =>
                                                                              let _s1344_ :=
                                                                                string_drop _s1342_
                                                                                  _s1343_ in
                                                                              (if string_startswith
                                                                                    _s1344_ "(" then
                                                                                 (match (string_drop
                                                                                           _s1344_
                                                                                           (projT1
                                                                                            (string_length
                                                                                               "("))) with
                                                                                  | _s1345_ =>
                                                                                     (opt_spc_matches_prefix
                                                                                        _s1345_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                       0)})) =>
                                                                                     (match w__8 with
                                                                                      | Some
                                                                                        (tt, existT _ _s1346_ _) =>
                                                                                         (match (string_drop
                                                                                                   _s1345_
                                                                                                   _s1346_) with
                                                                                          | _s1347_ =>
                                                                                             (reg_name_matches_prefix
                                                                                                _s1347_) >>= fun w__9 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                                               0)})) =>
                                                                                             (match w__9 with
                                                                                              | Some
                                                                                                (rs1, existT _ _s1348_ _) =>
                                                                                                 (match (string_drop
                                                                                                           _s1347_
                                                                                                           _s1348_) with
                                                                                                  | _s1349_ =>
                                                                                                     (opt_spc_matches_prefix
                                                                                                        _s1349_) >>= fun w__10 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                                       0)})) =>
                                                                                                     returnm (match w__10 with
                                                                                                              | Some
                                                                                                                (tt, existT _ _s1350_ _) =>
                                                                                                                 let _s1351_ :=
                                                                                                                   string_drop
                                                                                                                     _s1349_
                                                                                                                     _s1350_ in
                                                                                                                 if
                                                                                                                   string_startswith
                                                                                                                     _s1351_
                                                                                                                     ")"
                                                                                                                 then
                                                                                                                   let p0_ :=
                                                                                                                     string_drop
                                                                                                                       _s1351_
                                                                                                                       (projT1
                                                                                                                        (string_length
                                                                                                                           ")")) in
                                                                                                                   if
                                                                                                                     generic_eq
                                                                                                                       p0_
                                                                                                                       ""
                                                                                                                   then
                                                                                                                     Some
                                                                                                                       (size, is_unsigned, aq, rl, rd, imm, rs1)
                                                                                                                   else
                                                                                                                     None
                                                                                                                 else
                                                                                                                   None
                                                                                                              | _ =>
                                                                                                                 None
                                                                                                              end)
                                                                                                  end)
                                                                                                  : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                              | _ =>
                                                                                                 returnm None
                                                                                              end)
                                                                                              : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                          end)
                                                                                          : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                      | _ =>
                                                                                         returnm None
                                                                                      end)
                                                                                      : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                  end)
                                                                                  : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                               else returnm None)
                                                                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                           | _ => returnm None
                                                                           end)
                                                                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                       end)
                                                                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                               end)
                                                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                       end)
                                                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                               end)
                                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
       end)
       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
    else returnm None)
    : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5))).

Definition _s1306_ (_s1307_ : string) : M (option ((rop * mword 5 * mword 5 * mword 5))) :=
   (match _s1307_ with
    | _s1308_ =>
       (rtype_mnemonic_matches_prefix _s1308_) >>= fun w__0 : option ((rop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s1309_ _) =>
           (match (string_drop _s1308_ _s1309_) with
            | _s1310_ =>
               (spc_matches_prefix _s1310_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s1311_ _) =>
                   (match (string_drop _s1310_ _s1311_) with
                    | _s1312_ =>
                       (reg_name_matches_prefix _s1312_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s1313_ _) =>
                           (match (string_drop _s1312_ _s1313_) with
                            | _s1314_ =>
                               (sep_matches_prefix _s1314_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s1315_ _) =>
                                   (match (string_drop _s1314_ _s1315_) with
                                    | _s1316_ =>
                                       (reg_name_matches_prefix _s1316_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s1317_ _) =>
                                           (match (string_drop _s1316_ _s1317_) with
                                            | _s1318_ =>
                                               (sep_matches_prefix _s1318_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s1319_ _) =>
                                                   (match (string_drop _s1318_ _s1319_) with
                                                    | _s1320_ =>
                                                       (reg_name_matches_prefix _s1320_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s1321_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s1320_ _s1321_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (op, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((rop * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((rop * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((rop * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((rop * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((rop * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((rop * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((rop * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((rop * mword 5 * mword 5 * mword 5))).

Definition _s1289_ (_s1290_ : string) : M (option ((sop * mword 5 * mword 5 * mword 6))) :=
   (match _s1290_ with
    | _s1291_ =>
       (shiftiop_mnemonic_matches_prefix _s1291_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s1292_ _) =>
           (match (string_drop _s1291_ _s1292_) with
            | _s1293_ =>
               (spc_matches_prefix _s1293_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s1294_ _) =>
                   (match (string_drop _s1293_ _s1294_) with
                    | _s1295_ =>
                       (reg_name_matches_prefix _s1295_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s1296_ _) =>
                           (match (string_drop _s1295_ _s1296_) with
                            | _s1297_ =>
                               (sep_matches_prefix _s1297_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s1298_ _) =>
                                   (match (string_drop _s1297_ _s1298_) with
                                    | _s1299_ =>
                                       (reg_name_matches_prefix _s1299_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s1300_ _) =>
                                           (match (string_drop _s1299_ _s1300_) with
                                            | _s1301_ =>
                                               (sep_matches_prefix _s1301_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s1302_ _) =>
                                                           match (string_drop _s1301_ _s1302_) with
                                                           | _s1303_ =>
                                                              match (hex_bits_6_matches_prefix
                                                                       _s1303_) with
                                                              | Some (shamt, existT _ _s1304_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s1303_ _s1304_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rd, rs1, shamt)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((sop * mword 5 * mword 5 * mword 6)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((sop * mword 5 * mword 5 * mword 6)))
                                    end)
                                    : M (option ((sop * mword 5 * mword 5 * mword 6)))
                                | _ => returnm None
                                end)
                                : M (option ((sop * mword 5 * mword 5 * mword 6)))
                            end)
                            : M (option ((sop * mword 5 * mword 5 * mword 6)))
                        | _ => returnm None
                        end)
                        : M (option ((sop * mword 5 * mword 5 * mword 6)))
                    end)
                    : M (option ((sop * mword 5 * mword 5 * mword 6)))
                | _ => returnm None
                end)
                : M (option ((sop * mword 5 * mword 5 * mword 6)))
            end)
            : M (option ((sop * mword 5 * mword 5 * mword 6)))
        | _ => returnm None
        end)
        : M (option ((sop * mword 5 * mword 5 * mword 6)))
    end)
    : M (option ((sop * mword 5 * mword 5 * mword 6))).

Definition _s1272_ (_s1273_ : string) : M (option ((iop * mword 5 * mword 5 * mword 12))) :=
   (match _s1273_ with
    | _s1274_ =>
       (itype_mnemonic_matches_prefix _s1274_) >>= fun w__0 : option ((iop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s1275_ _) =>
           (match (string_drop _s1274_ _s1275_) with
            | _s1276_ =>
               (spc_matches_prefix _s1276_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s1277_ _) =>
                   (match (string_drop _s1276_ _s1277_) with
                    | _s1278_ =>
                       (reg_name_matches_prefix _s1278_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s1279_ _) =>
                           (match (string_drop _s1278_ _s1279_) with
                            | _s1280_ =>
                               (sep_matches_prefix _s1280_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s1281_ _) =>
                                   (match (string_drop _s1280_ _s1281_) with
                                    | _s1282_ =>
                                       (reg_name_matches_prefix _s1282_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s1283_ _) =>
                                           (match (string_drop _s1282_ _s1283_) with
                                            | _s1284_ =>
                                               (sep_matches_prefix _s1284_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s1285_ _) =>
                                                           match (string_drop _s1284_ _s1285_) with
                                                           | _s1286_ =>
                                                              match (hex_bits_12_matches_prefix
                                                                       _s1286_) with
                                                              | Some (imm, existT _ _s1287_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s1286_ _s1287_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rd, rs1, imm)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((iop * mword 5 * mword 5 * mword 12)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((iop * mword 5 * mword 5 * mword 12)))
                                    end)
                                    : M (option ((iop * mword 5 * mword 5 * mword 12)))
                                | _ => returnm None
                                end)
                                : M (option ((iop * mword 5 * mword 5 * mword 12)))
                            end)
                            : M (option ((iop * mword 5 * mword 5 * mword 12)))
                        | _ => returnm None
                        end)
                        : M (option ((iop * mword 5 * mword 5 * mword 12)))
                    end)
                    : M (option ((iop * mword 5 * mword 5 * mword 12)))
                | _ => returnm None
                end)
                : M (option ((iop * mword 5 * mword 5 * mword 12)))
            end)
            : M (option ((iop * mword 5 * mword 5 * mword 12)))
        | _ => returnm None
        end)
        : M (option ((iop * mword 5 * mword 5 * mword 12)))
    end)
    : M (option ((iop * mword 5 * mword 5 * mword 12))).

Definition _s1255_ (_s1256_ : string) : M (option ((bop * mword 5 * mword 5 * mword 13))) :=
   (match _s1256_ with
    | _s1257_ =>
       (btype_mnemonic_matches_prefix _s1257_) >>= fun w__0 : option ((bop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s1258_ _) =>
           (match (string_drop _s1257_ _s1258_) with
            | _s1259_ =>
               (spc_matches_prefix _s1259_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s1260_ _) =>
                   (match (string_drop _s1259_ _s1260_) with
                    | _s1261_ =>
                       (reg_name_matches_prefix _s1261_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rs1, existT _ _s1262_ _) =>
                           (match (string_drop _s1261_ _s1262_) with
                            | _s1263_ =>
                               (sep_matches_prefix _s1263_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s1264_ _) =>
                                   (match (string_drop _s1263_ _s1264_) with
                                    | _s1265_ =>
                                       (reg_name_matches_prefix _s1265_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs2, existT _ _s1266_ _) =>
                                           (match (string_drop _s1265_ _s1266_) with
                                            | _s1267_ =>
                                               (sep_matches_prefix _s1267_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s1268_ _) =>
                                                           match (string_drop _s1267_ _s1268_) with
                                                           | _s1269_ =>
                                                              match (hex_bits_13_matches_prefix
                                                                       _s1269_) with
                                                              | Some (imm, existT _ _s1270_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s1269_ _s1270_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rs1, rs2, imm)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((bop * mword 5 * mword 5 * mword 13)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((bop * mword 5 * mword 5 * mword 13)))
                                    end)
                                    : M (option ((bop * mword 5 * mword 5 * mword 13)))
                                | _ => returnm None
                                end)
                                : M (option ((bop * mword 5 * mword 5 * mword 13)))
                            end)
                            : M (option ((bop * mword 5 * mword 5 * mword 13)))
                        | _ => returnm None
                        end)
                        : M (option ((bop * mword 5 * mword 5 * mword 13)))
                    end)
                    : M (option ((bop * mword 5 * mword 5 * mword 13)))
                | _ => returnm None
                end)
                : M (option ((bop * mword 5 * mword 5 * mword 13)))
            end)
            : M (option ((bop * mword 5 * mword 5 * mword 13)))
        | _ => returnm None
        end)
        : M (option ((bop * mword 5 * mword 5 * mword 13)))
    end)
    : M (option ((bop * mword 5 * mword 5 * mword 13))).

Definition _s1239_ (_s1240_ : string) : M (option ((mword 5 * mword 5 * mword 12))) :=
   let _s1241_ := _s1240_ in
   (if string_startswith _s1241_ "jalr" then
      (match (string_drop _s1241_ (projT1 (string_length "jalr"))) with
       | _s1242_ =>
          (spc_matches_prefix _s1242_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1243_ _) =>
              (match (string_drop _s1242_ _s1243_) with
               | _s1244_ =>
                  (reg_name_matches_prefix _s1244_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1245_ _) =>
                      (match (string_drop _s1244_ _s1245_) with
                       | _s1246_ =>
                          (sep_matches_prefix _s1246_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s1247_ _) =>
                              (match (string_drop _s1246_ _s1247_) with
                               | _s1248_ =>
                                  (reg_name_matches_prefix _s1248_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rs1, existT _ _s1249_ _) =>
                                      (match (string_drop _s1248_ _s1249_) with
                                       | _s1250_ =>
                                          (sep_matches_prefix _s1250_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s1251_ _) =>
                                                      match (string_drop _s1250_ _s1251_) with
                                                      | _s1252_ =>
                                                         match (hex_bits_12_matches_prefix _s1252_) with
                                                         | Some (imm, existT _ _s1253_ _) =>
                                                            let p0_ := string_drop _s1252_ _s1253_ in
                                                            if generic_eq p0_ "" then
                                                              Some (rd, rs1, imm)
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 5 * mword 5 * mword 12)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 5 * mword 5 * mword 12)))
                               end)
                               : M (option ((mword 5 * mword 5 * mword 12)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * mword 12)))
                       end)
                       : M (option ((mword 5 * mword 5 * mword 12)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * mword 12)))
               end)
               : M (option ((mword 5 * mword 5 * mword 12)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 12)))
       end)
       : M (option ((mword 5 * mword 5 * mword 12)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 12))).

Definition _s1227_ (_s1228_ : string) : M (option ((mword 5 * mword 21))) :=
   let _s1229_ := _s1228_ in
   (if string_startswith _s1229_ "jal" then
      (match (string_drop _s1229_ (projT1 (string_length "jal"))) with
       | _s1230_ =>
          (spc_matches_prefix _s1230_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s1231_ _) =>
              (match (string_drop _s1230_ _s1231_) with
               | _s1232_ =>
                  (reg_name_matches_prefix _s1232_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s1233_ _) =>
                      (match (string_drop _s1232_ _s1233_) with
                       | _s1234_ =>
                          (sep_matches_prefix _s1234_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s1235_ _) =>
                                      match (string_drop _s1234_ _s1235_) with
                                      | _s1236_ =>
                                         match (hex_bits_21_matches_prefix _s1236_) with
                                         | Some (imm, existT _ _s1237_ _) =>
                                            let p0_ := string_drop _s1236_ _s1237_ in
                                            if generic_eq p0_ "" then Some (rd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 21)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 21)))
               end)
               : M (option ((mword 5 * mword 21)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 21)))
       end)
       : M (option ((mword 5 * mword 21)))
    else returnm None)
    : M (option ((mword 5 * mword 21))).

Definition _s1214_ (_s1215_ : string) : M (option ((uop * mword 5 * mword 20))) :=
   (match _s1215_ with
    | _s1216_ =>
       (utype_mnemonic_matches_prefix _s1216_) >>= fun w__0 : option ((uop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s1217_ _) =>
           (match (string_drop _s1216_ _s1217_) with
            | _s1218_ =>
               (spc_matches_prefix _s1218_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s1219_ _) =>
                   (match (string_drop _s1218_ _s1219_) with
                    | _s1220_ =>
                       (reg_name_matches_prefix _s1220_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s1221_ _) =>
                           (match (string_drop _s1220_ _s1221_) with
                            | _s1222_ =>
                               (sep_matches_prefix _s1222_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               returnm (match w__3 with
                                        | Some (tt, existT _ _s1223_ _) =>
                                           match (string_drop _s1222_ _s1223_) with
                                           | _s1224_ =>
                                              match (hex_bits_20_matches_prefix _s1224_) with
                                              | Some (imm, existT _ _s1225_ _) =>
                                                 let p0_ := string_drop _s1224_ _s1225_ in
                                                 if generic_eq p0_ "" then Some (op, rd, imm)
                                                 else None
                                              | _ => None
                                              end
                                           end
                                        | _ => None
                                        end)
                            end)
                            : M (option ((uop * mword 5 * mword 20)))
                        | _ => returnm None
                        end)
                        : M (option ((uop * mword 5 * mword 20)))
                    end)
                    : M (option ((uop * mword 5 * mword 20)))
                | _ => returnm None
                end)
                : M (option ((uop * mword 5 * mword 20)))
            end)
            : M (option ((uop * mword 5 * mword 20)))
        | _ => returnm None
        end)
        : M (option ((uop * mword 5 * mword 20)))
    end)
    : M (option ((uop * mword 5 * mword 20))).

Definition assembly_backwards (arg_ : string) : M (ast) :=
   let _s1226_ := arg_ in
   (_s1214_ _s1226_) >>= fun w__0 : option ((uop * mword 5 * mword 20)) =>
   (if match w__0 with | Some (op, rd, imm) => true | _ => false end then
      (_s1214_ _s1226_) >>= fun w__1 : option ((uop * mword 5 * mword 20)) =>
      (match w__1 with
       | Some (op, rd, imm) => returnm (UTYPE (imm, rd, op))
       | _ => exit tt  : M (ast)
       end)
       : M (ast)
    else
      (_s1227_ _s1226_) >>= fun w__4 : option ((mword 5 * mword 21)) =>
      (if match w__4 with | Some (rd, imm) => true | _ => false end then
         (_s1227_ _s1226_) >>= fun w__5 : option ((mword 5 * mword 21)) =>
         (match w__5 with
          | Some (rd, imm) => returnm (RISCV_JAL (imm, rd))
          | _ => exit tt  : M (ast)
          end)
          : M (ast)
       else
         (_s1239_ _s1226_) >>= fun w__8 : option ((mword 5 * mword 5 * mword 12)) =>
         (if match w__8 with | Some (rd, rs1, imm) => true | _ => false end then
            (_s1239_ _s1226_) >>= fun w__9 : option ((mword 5 * mword 5 * mword 12)) =>
            (match w__9 with
             | Some (rd, rs1, imm) => returnm (RISCV_JALR (imm, rs1, rd))
             | _ => exit tt  : M (ast)
             end)
             : M (ast)
          else
            (_s1255_ _s1226_) >>= fun w__12 : option ((bop * mword 5 * mword 5 * mword 13)) =>
            (if match w__12 with | Some (op, rs1, rs2, imm) => true | _ => false end then
               (_s1255_ _s1226_) >>= fun w__13 : option ((bop * mword 5 * mword 5 * mword 13)) =>
               (match w__13 with
                | Some (op, rs1, rs2, imm) => returnm (BTYPE (imm, rs2, rs1, op))
                | _ => exit tt  : M (ast)
                end)
                : M (ast)
             else
               (_s1272_ _s1226_) >>= fun w__16 : option ((iop * mword 5 * mword 5 * mword 12)) =>
               (if match w__16 with | Some (op, rd, rs1, imm) => true | _ => false end then
                  (_s1272_ _s1226_) >>= fun w__17 : option ((iop * mword 5 * mword 5 * mword 12)) =>
                  (match w__17 with
                   | Some (op, rd, rs1, imm) => returnm (ITYPE (imm, rs1, rd, op))
                   | _ => exit tt  : M (ast)
                   end)
                   : M (ast)
                else
                  (_s1289_ _s1226_) >>= fun w__20 : option ((sop * mword 5 * mword 5 * mword 6)) =>
                  (if match w__20 with | Some (op, rd, rs1, shamt) => true | _ => false end then
                     (_s1289_ _s1226_) >>= fun w__21 : option ((sop * mword 5 * mword 5 * mword 6)) =>
                     (match w__21 with
                      | Some (op, rd, rs1, shamt) => returnm (SHIFTIOP (shamt, rs1, rd, op))
                      | _ => exit tt  : M (ast)
                      end)
                      : M (ast)
                   else
                     (_s1306_ _s1226_) >>= fun w__24 : option ((rop * mword 5 * mword 5 * mword 5)) =>
                     (if match w__24 with | Some (op, rd, rs1, rs2) => true | _ => false end then
                        (_s1306_ _s1226_) >>= fun w__25 : option ((rop * mword 5 * mword 5 * mword 5)) =>
                        (match w__25 with
                         | Some (op, rd, rs1, rs2) => returnm (RTYPE (rs2, rs1, rd, op))
                         | _ => exit tt  : M (ast)
                         end)
                         : M (ast)
                      else
                        (_s1323_ _s1226_) >>= fun w__28 : option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)) =>
                        (if match w__28 with
                            | Some (size, is_unsigned, aq, rl, rd, imm, rs1) => true
                            | _ => false
                            end then
                           (_s1323_ _s1226_) >>= fun w__29 : option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)) =>
                           (match w__29 with
                            | Some (size, is_unsigned, aq, rl, rd, imm, rs1) =>
                               returnm (LOAD (imm, rs1, rd, is_unsigned, size, aq, rl))
                            | _ => exit tt  : M (ast)
                            end)
                            : M (ast)
                         else
                           (_s1353_ _s1226_) >>= fun w__32 : option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)) =>
                           (if match w__32 with
                               | Some (size, aq, rl, rs2, imm, rs1) => true
                               | _ => false
                               end then
                              (_s1353_ _s1226_) >>= fun w__33 : option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)) =>
                              (match w__33 with
                               | Some (size, aq, rl, rs2, imm, rs1) =>
                                  returnm (STORE (imm, rs2, rs1, size, aq, rl))
                               | _ => exit tt  : M (ast)
                               end)
                               : M (ast)
                            else
                              (_s1381_ _s1226_) >>= fun w__36 : option ((mword 5 * mword 5 * mword 12)) =>
                              (if match w__36 with
                                  | Some (rd, rs1, imm) => Z.eqb 32 64
                                  | _ => false
                                  end then
                                 (_s1381_ _s1226_) >>= fun w__37 : option ((mword 5 * mword 5 * mword 12)) =>
                                 (match w__37 with
                                  | Some (rd, rs1, imm) => returnm (ADDIW (imm, rs1, rd))
                                  | _ => exit tt  : M (ast)
                                  end)
                                  : M (ast)
                               else
                                 (_s1397_ _s1226_) >>= fun w__40 : option ((sop * mword 5 * mword 5 * mword 5)) =>
                                 (if match w__40 with
                                     | Some (op, rd, rs1, shamt) => Z.eqb 32 64
                                     | _ => false
                                     end then
                                    (_s1397_ _s1226_) >>= fun w__41 : option ((sop * mword 5 * mword 5 * mword 5)) =>
                                    (match w__41 with
                                     | Some (op, rd, rs1, shamt) =>
                                        returnm (SHIFTW (shamt, rs1, rd, op))
                                     | _ => exit tt  : M (ast)
                                     end)
                                     : M (ast)
                                  else
                                    (_s1414_ _s1226_) >>= fun w__44 : option ((ropw * mword 5 * mword 5 * mword 5)) =>
                                    (if match w__44 with
                                        | Some (op, rd, rs1, rs2) => Z.eqb 32 64
                                        | _ => false
                                        end then
                                       (_s1414_ _s1226_) >>= fun w__45 : option ((ropw * mword 5 * mword 5 * mword 5)) =>
                                       (match w__45 with
                                        | Some (op, rd, rs1, rs2) =>
                                           returnm (RTYPEW (rs2, rs1, rd, op))
                                        | _ => exit tt  : M (ast)
                                        end)
                                        : M (ast)
                                     else
                                       (_s1431_ _s1226_) >>= fun w__48 : option ((sopw * mword 5 * mword 5 * mword 5)) =>
                                       (if match w__48 with
                                           | Some (op, rd, rs1, shamt) => Z.eqb 32 64
                                           | _ => false
                                           end then
                                          (_s1431_ _s1226_) >>= fun w__49 : option ((sopw * mword 5 * mword 5 * mword 5)) =>
                                          (match w__49 with
                                           | Some (op, rd, rs1, shamt) =>
                                              returnm (SHIFTIWOP (shamt, rs1, rd, op))
                                           | _ => exit tt  : M (ast)
                                           end)
                                           : M (ast)
                                        else
                                          (_s1448_ _s1226_) >>= fun w__52 : option ((mword 4 * mword 4)) =>
                                          (if match w__52 with
                                              | Some (pred, succ) => true
                                              | _ => false
                                              end then
                                             (_s1448_ _s1226_) >>= fun w__53 : option ((mword 4 * mword 4)) =>
                                             (match w__53 with
                                              | Some (pred, succ) => returnm (FENCE (pred, succ))
                                              | _ => exit tt  : M (ast)
                                              end)
                                              : M (ast)
                                           else
                                             (_s1460_ _s1226_) >>= fun w__56 : option ((mword 4 * mword 4)) =>
                                             (if match w__56 with
                                                 | Some (pred, succ) => true
                                                 | _ => false
                                                 end then
                                                (_s1460_ _s1226_) >>= fun w__57 : option ((mword 4 * mword 4)) =>
                                                (match w__57 with
                                                 | Some (pred, succ) =>
                                                    returnm (FENCE_TSO (pred, succ))
                                                 | _ => exit tt  : M (ast)
                                                 end)
                                                 : M (ast)
                                              else if generic_eq _s1226_ "fence.i" then
                                                returnm (FENCEI tt)
                                              else if generic_eq _s1226_ "ecall" then
                                                returnm (ECALL tt)
                                              else if generic_eq _s1226_ "mret" then
                                                returnm (MRET tt)
                                              else if generic_eq _s1226_ "sret" then
                                                returnm (SRET tt)
                                              else if generic_eq _s1226_ "ebreak" then
                                                returnm (EBREAK tt)
                                              else if generic_eq _s1226_ "wfi" then returnm (WFI tt)
                                              else
                                                (_s1472_ _s1226_) >>= fun w__60 : option ((mword 5 * mword 5)) =>
                                                (if match w__60 with
                                                    | Some (rs1, rs2) => true
                                                    | _ => false
                                                    end then
                                                   (_s1472_ _s1226_) >>= fun w__61 : option ((mword 5 * mword 5)) =>
                                                   (match w__61 with
                                                    | Some (rs1, rs2) =>
                                                       returnm (SFENCE_VMA (rs1, rs2))
                                                    | _ => exit tt  : M (ast)
                                                    end)
                                                    : M (ast)
                                                 else
                                                   (_s1484_ _s1226_) >>= fun w__64 : option ((word_width * bool * bool * mword 5 * mword 5)) =>
                                                   (if match w__64 with
                                                       | Some (size, aq, rl, rd, rs1) => true
                                                       | _ => false
                                                       end then
                                                      (_s1484_ _s1226_) >>= fun w__65 : option ((word_width * bool * bool * mword 5 * mword 5)) =>
                                                      (match w__65 with
                                                       | Some (size, aq, rl, rd, rs1) =>
                                                          returnm (LOADRES (aq, rl, rs1, size, rd))
                                                       | _ => exit tt  : M (ast)
                                                       end)
                                                       : M (ast)
                                                    else
                                                      (_s1502_ _s1226_) >>= fun w__68 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                      (if match w__68 with
                                                          | Some (size, aq, rl, rd, rs1, rs2) =>
                                                             true
                                                          | _ => false
                                                          end then
                                                         (_s1502_ _s1226_) >>= fun w__69 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                         (match w__69 with
                                                          | Some (size, aq, rl, rd, rs1, rs2) =>
                                                             returnm (STORECON
                                                                        (aq, rl, rs2, rs1, size, rd))
                                                          | _ => exit tt  : M (ast)
                                                          end)
                                                          : M (ast)
                                                       else
                                                         (_s1524_ _s1226_) >>= fun w__72 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                         (if match w__72 with
                                                             | Some
                                                               (op, width, aq, rl, rd, rs2, rs1) =>
                                                                true
                                                             | _ => false
                                                             end then
                                                            (_s1524_ _s1226_) >>= fun w__73 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                            (match w__73 with
                                                             | Some
                                                               (op, width, aq, rl, rd, rs2, rs1) =>
                                                                returnm (AMO
                                                                           (op, aq, rl, rs2, rs1, width, rd))
                                                             | _ => exit tt  : M (ast)
                                                             end)
                                                             : M (ast)
                                                          else if generic_eq _s1226_ "c.nop" then
                                                            returnm (C_NOP tt)
                                                          else
                                                            (_s1550_ _s1226_) >>= fun w__76 : option ((mword 3 * mword 8)) =>
                                                            (if match w__76 with
                                                                | Some (rdc, nzimm) =>
                                                                   neq_vec nzimm (Ox"00"  : mword 8)
                                                                | _ => false
                                                                end then
                                                               (_s1550_ _s1226_) >>= fun w__77 : option ((mword 3 * mword 8)) =>
                                                               (match w__77 with
                                                                | Some (rdc, nzimm) =>
                                                                   returnm (C_ADDI4SPN (rdc, nzimm))
                                                                | _ => exit tt  : M (ast)
                                                                end)
                                                                : M (ast)
                                                             else
                                                               (_s1562_ _s1226_) >>= fun w__80 : option ((mword 3 * mword 3 * mword 5)) =>
                                                               (if match w__80 with
                                                                   | Some (rdc, rsc, uimm) => true
                                                                   | _ => false
                                                                   end then
                                                                  (_s1562_ _s1226_) >>= fun w__81 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                  (match w__81 with
                                                                   | Some (rdc, rsc, uimm) =>
                                                                      returnm (C_LW (uimm, rsc, rdc))
                                                                   | _ => exit tt  : M (ast)
                                                                   end)
                                                                   : M (ast)
                                                                else
                                                                  (_s1578_ _s1226_) >>= fun w__84 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                  (if match w__84 with
                                                                      | Some (rdc, rsc, uimm) =>
                                                                         Z.eqb 32 64
                                                                      | _ => false
                                                                      end then
                                                                     (_s1578_ _s1226_) >>= fun w__85 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                     (match w__85 with
                                                                      | Some (rdc, rsc, uimm) =>
                                                                         returnm (C_LD
                                                                                    (uimm, rsc, rdc))
                                                                      | _ => exit tt  : M (ast)
                                                                      end)
                                                                      : M (ast)
                                                                   else
                                                                     (_s1594_ _s1226_) >>= fun w__88 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                     (if match w__88 with
                                                                         | Some (rsc1, rsc2, uimm) =>
                                                                            true
                                                                         | _ => false
                                                                         end then
                                                                        (_s1594_ _s1226_) >>= fun w__89 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                        (match w__89 with
                                                                         | Some (rsc1, rsc2, uimm) =>
                                                                            returnm (C_SW
                                                                                       (uimm, rsc1, rsc2))
                                                                         | _ => exit tt  : M (ast)
                                                                         end)
                                                                         : M (ast)
                                                                      else
                                                                        (_s1610_ _s1226_) >>= fun w__92 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                        (if match w__92 with
                                                                            | Some
                                                                              (rsc1, rsc2, uimm) =>
                                                                               Z.eqb 32 64
                                                                            | _ => false
                                                                            end then
                                                                           (_s1610_ _s1226_) >>= fun w__93 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                           (match w__93 with
                                                                            | Some
                                                                              (rsc1, rsc2, uimm) =>
                                                                               returnm (C_SD
                                                                                          (uimm, rsc1, rsc2))
                                                                            | _ =>
                                                                               exit tt  : M (ast)
                                                                            end)
                                                                            : M (ast)
                                                                         else
                                                                           (_s1626_ _s1226_) >>= fun w__96 : option ((mword 5 * mword 6)) =>
                                                                           (if match w__96 with
                                                                               | Some (rsd, nzi) =>
                                                                                  andb
                                                                                    (neq_vec nzi
                                                                                       ('b"000000"
                                                                                        : mword 6))
                                                                                    (neq_vec rsd
                                                                                       zreg)
                                                                               | _ => false
                                                                               end then
                                                                              (_s1626_ _s1226_) >>= fun w__97 : option ((mword 5 * mword 6)) =>
                                                                              (match w__97 with
                                                                               | Some (rsd, nzi) =>
                                                                                  returnm (C_ADDI
                                                                                             (nzi, rsd))
                                                                               | _ =>
                                                                                  exit tt  : M (ast)
                                                                               end)
                                                                               : M (ast)
                                                                            else
                                                                              (_s1638_ _s1226_) >>= fun w__100 : option (mword 11) =>
                                                                              (if match w__100 with
                                                                                  | Some imm =>
                                                                                     Z.eqb 32 32
                                                                                  | _ => false
                                                                                  end then
                                                                                 (_s1638_ _s1226_) >>= fun w__101 : option (mword 11) =>
                                                                                 (match w__101 with
                                                                                  | Some imm =>
                                                                                     returnm (C_JAL
                                                                                                imm)
                                                                                  | _ =>
                                                                                     exit tt
                                                                                      : M (ast)
                                                                                  end)
                                                                                  : M (ast)
                                                                               else
                                                                                 (_s1646_ _s1226_) >>= fun w__104 : option ((mword 5 * mword 6)) =>
                                                                                 (if match w__104 with
                                                                                     | Some
                                                                                       (rsd, imm) =>
                                                                                        Z.eqb 32 64
                                                                                     | _ => false
                                                                                     end then
                                                                                    (_s1646_ _s1226_) >>= fun w__105 : option ((mword 5 * mword 6)) =>
                                                                                    (match w__105 with
                                                                                     | Some
                                                                                       (rsd, imm) =>
                                                                                        returnm (C_ADDIW
                                                                                                   (imm, rsd))
                                                                                     | _ =>
                                                                                        exit tt
                                                                                         : M (ast)
                                                                                     end)
                                                                                     : M (ast)
                                                                                  else
                                                                                    (_s1658_ _s1226_) >>= fun w__108 : option ((mword 5 * mword 6)) =>
                                                                                    (if match w__108 with
                                                                                        | Some
                                                                                          (rd, imm) =>
                                                                                           neq_vec
                                                                                             rd zreg
                                                                                        | _ => false
                                                                                        end then
                                                                                       (_s1658_
                                                                                          _s1226_) >>= fun w__109 : option ((mword 5 * mword 6)) =>
                                                                                       (match w__109 with
                                                                                        | Some
                                                                                          (rd, imm) =>
                                                                                           returnm (C_LI
                                                                                                      (imm, rd))
                                                                                        | _ =>
                                                                                           exit tt
                                                                                            : M (ast)
                                                                                        end)
                                                                                        : M (ast)
                                                                                     else
                                                                                       (_s1670_
                                                                                          _s1226_) >>= fun w__112 : option (mword 6) =>
                                                                                       (if match w__112 with
                                                                                           | Some
                                                                                             imm =>
                                                                                              neq_vec
                                                                                                imm
                                                                                                ('b"000000"
                                                                                                 : mword 6)
                                                                                           | _ =>
                                                                                              false
                                                                                           end then
                                                                                          (_s1670_
                                                                                             _s1226_) >>= fun w__113 : option (mword 6) =>
                                                                                          (match w__113 with
                                                                                           | Some
                                                                                             imm =>
                                                                                              returnm (C_ADDI16SP
                                                                                                         imm)
                                                                                           | _ =>
                                                                                              exit tt
                                                                                               : M (ast)
                                                                                           end)
                                                                                           : M (ast)
                                                                                        else
                                                                                          (_s1678_
                                                                                             _s1226_) >>= fun w__116 : option ((mword 5 * mword 6)) =>
                                                                                          (if match w__116 with
                                                                                              | Some
                                                                                                (rd, imm) =>
                                                                                                 andb
                                                                                                   (neq_vec
                                                                                                      rd
                                                                                                      zreg)
                                                                                                   (andb
                                                                                                      (neq_vec
                                                                                                         rd
                                                                                                         sp)
                                                                                                      (neq_vec
                                                                                                         imm
                                                                                                         ('b"000000"
                                                                                                          : mword 6)))
                                                                                              | _ =>
                                                                                                 false
                                                                                              end
                                                                                           then
                                                                                             (_s1678_
                                                                                                _s1226_) >>= fun w__117 : option ((mword 5 * mword 6)) =>
                                                                                             (match w__117 with
                                                                                              | Some
                                                                                                (rd, imm) =>
                                                                                                 returnm (C_LUI
                                                                                                            (imm, rd))
                                                                                              | _ =>
                                                                                                 exit tt
                                                                                                  : M (ast)
                                                                                              end)
                                                                                              : M (ast)
                                                                                           else
                                                                                             (_s1690_
                                                                                                _s1226_) >>= fun w__120 : option ((mword 3 * mword 6)) =>
                                                                                             (if match w__120 with
                                                                                                 | Some
                                                                                                   (rsd, shamt) =>
                                                                                                    neq_vec
                                                                                                      shamt
                                                                                                      ('b"000000"
                                                                                                       : mword 6)
                                                                                                 | _ =>
                                                                                                    false
                                                                                                 end
                                                                                              then
                                                                                                (_s1690_
                                                                                                   _s1226_) >>= fun w__121 : option ((mword 3 * mword 6)) =>
                                                                                                (match w__121 with
                                                                                                 | Some
                                                                                                   (rsd, shamt) =>
                                                                                                    returnm (C_SRLI
                                                                                                               (shamt, rsd))
                                                                                                 | _ =>
                                                                                                    exit tt
                                                                                                     : M (ast)
                                                                                                 end)
                                                                                                 : M (ast)
                                                                                              else
                                                                                                (_s1702_
                                                                                                   _s1226_) >>= fun w__124 : option ((mword 3 * mword 6)) =>
                                                                                                (if match w__124 with
                                                                                                    | Some
                                                                                                      (rsd, shamt) =>
                                                                                                       neq_vec
                                                                                                         shamt
                                                                                                         ('b"000000"
                                                                                                          : mword 6)
                                                                                                    | _ =>
                                                                                                       false
                                                                                                    end
                                                                                                 then
                                                                                                   (_s1702_
                                                                                                      _s1226_) >>= fun w__125 : option ((mword 3 * mword 6)) =>
                                                                                                   (match w__125 with
                                                                                                    | Some
                                                                                                      (rsd, shamt) =>
                                                                                                       returnm (C_SRAI
                                                                                                                  (shamt, rsd))
                                                                                                    | _ =>
                                                                                                       exit tt
                                                                                                        : M (ast)
                                                                                                    end)
                                                                                                    : M (ast)
                                                                                                 else
                                                                                                   (_s1714_
                                                                                                      _s1226_) >>= fun w__128 : option ((mword 3 * mword 6)) =>
                                                                                                   (if
                                                                                                      match w__128 with
                                                                                                      | Some
                                                                                                        (rsd, imm) =>
                                                                                                         true
                                                                                                      | _ =>
                                                                                                         false
                                                                                                      end
                                                                                                    then
                                                                                                      (_s1714_
                                                                                                         _s1226_) >>= fun w__129 : option ((mword 3 * mword 6)) =>
                                                                                                      (match w__129 with
                                                                                                       | Some
                                                                                                         (rsd, imm) =>
                                                                                                          returnm (C_ANDI
                                                                                                                     (imm, rsd))
                                                                                                       | _ =>
                                                                                                          exit tt
                                                                                                           : M (ast)
                                                                                                       end)
                                                                                                       : M (ast)
                                                                                                    else
                                                                                                      (_s1726_
                                                                                                         _s1226_) >>= fun w__132 : option ((mword 3 * mword 3)) =>
                                                                                                      (if
                                                                                                         match w__132 with
                                                                                                         | Some
                                                                                                           (rsd, rs2) =>
                                                                                                            true
                                                                                                         | _ =>
                                                                                                            false
                                                                                                         end
                                                                                                       then
                                                                                                         (_s1726_
                                                                                                            _s1226_) >>= fun w__133 : option ((mword 3 * mword 3)) =>
                                                                                                         (match w__133 with
                                                                                                          | Some
                                                                                                            (rsd, rs2) =>
                                                                                                             returnm (C_SUB
                                                                                                                        (rsd, rs2))
                                                                                                          | _ =>
                                                                                                             exit tt
                                                                                                              : M (ast)
                                                                                                          end)
                                                                                                          : M (ast)
                                                                                                       else
                                                                                                         (_s1738_
                                                                                                            _s1226_) >>= fun w__136 : option ((mword 3 * mword 3)) =>
                                                                                                         (if
                                                                                                            match w__136 with
                                                                                                            | Some
                                                                                                              (rsd, rs2) =>
                                                                                                               true
                                                                                                            | _ =>
                                                                                                               false
                                                                                                            end
                                                                                                          then
                                                                                                            (_s1738_
                                                                                                               _s1226_) >>= fun w__137 : option ((mword 3 * mword 3)) =>
                                                                                                            (match w__137 with
                                                                                                             | Some
                                                                                                               (rsd, rs2) =>
                                                                                                                returnm (C_XOR
                                                                                                                           (rsd, rs2))
                                                                                                             | _ =>
                                                                                                                exit tt
                                                                                                                 : M (ast)
                                                                                                             end)
                                                                                                             : M (ast)
                                                                                                          else
                                                                                                            (_s1750_
                                                                                                               _s1226_) >>= fun w__140 : option ((mword 3 * mword 3)) =>
                                                                                                            (if
                                                                                                               match w__140 with
                                                                                                               | Some
                                                                                                                 (rsd, rs2) =>
                                                                                                                  true
                                                                                                               | _ =>
                                                                                                                  false
                                                                                                               end
                                                                                                             then
                                                                                                               (_s1750_
                                                                                                                  _s1226_) >>= fun w__141 : option ((mword 3 * mword 3)) =>
                                                                                                               (match w__141 with
                                                                                                                | Some
                                                                                                                  (rsd, rs2) =>
                                                                                                                   returnm (C_OR
                                                                                                                              (rsd, rs2))
                                                                                                                | _ =>
                                                                                                                   exit tt
                                                                                                                    : M (ast)
                                                                                                                end)
                                                                                                                : M (ast)
                                                                                                             else
                                                                                                               (_s1762_
                                                                                                                  _s1226_) >>= fun w__144 : option ((mword 3 * mword 3)) =>
                                                                                                               (if
                                                                                                                  match w__144 with
                                                                                                                  | Some
                                                                                                                    (rsd, rs2) =>
                                                                                                                     true
                                                                                                                  | _ =>
                                                                                                                     false
                                                                                                                  end
                                                                                                                then
                                                                                                                  (_s1762_
                                                                                                                     _s1226_) >>= fun w__145 : option ((mword 3 * mword 3)) =>
                                                                                                                  (match w__145 with
                                                                                                                   | Some
                                                                                                                     (rsd, rs2) =>
                                                                                                                      returnm (C_AND
                                                                                                                                 (rsd, rs2))
                                                                                                                   | _ =>
                                                                                                                      exit tt
                                                                                                                       : M (ast)
                                                                                                                   end)
                                                                                                                   : M (ast)
                                                                                                                else
                                                                                                                  (_s1774_
                                                                                                                     _s1226_) >>= fun w__148 : option ((mword 3 * mword 3)) =>
                                                                                                                  (if
                                                                                                                     match w__148 with
                                                                                                                     | Some
                                                                                                                       (rsd, rs2) =>
                                                                                                                        Z.eqb
                                                                                                                          32
                                                                                                                          64
                                                                                                                     | _ =>
                                                                                                                        false
                                                                                                                     end
                                                                                                                   then
                                                                                                                     (_s1774_
                                                                                                                        _s1226_) >>= fun w__149 : option ((mword 3 * mword 3)) =>
                                                                                                                     (match w__149 with
                                                                                                                      | Some
                                                                                                                        (rsd, rs2) =>
                                                                                                                         returnm (C_SUBW
                                                                                                                                    (rsd, rs2))
                                                                                                                      | _ =>
                                                                                                                         exit tt
                                                                                                                          : M (ast)
                                                                                                                      end)
                                                                                                                      : M (ast)
                                                                                                                   else
                                                                                                                     (_s1786_
                                                                                                                        _s1226_) >>= fun w__152 : option ((mword 3 * mword 3)) =>
                                                                                                                     (if
                                                                                                                        match w__152 with
                                                                                                                        | Some
                                                                                                                          (rsd, rs2) =>
                                                                                                                           Z.eqb
                                                                                                                             32
                                                                                                                             64
                                                                                                                        | _ =>
                                                                                                                           false
                                                                                                                        end
                                                                                                                      then
                                                                                                                        (_s1786_
                                                                                                                           _s1226_) >>= fun w__153 : option ((mword 3 * mword 3)) =>
                                                                                                                        (match w__153 with
                                                                                                                         | Some
                                                                                                                           (rsd, rs2) =>
                                                                                                                            returnm (C_ADDW
                                                                                                                                       (rsd, rs2))
                                                                                                                         | _ =>
                                                                                                                            exit tt
                                                                                                                             : M (ast)
                                                                                                                         end)
                                                                                                                         : M (ast)
                                                                                                                      else
                                                                                                                        (_s1798_
                                                                                                                           _s1226_) >>= fun w__156 : option (mword 11) =>
                                                                                                                        (if
                                                                                                                           match w__156 with
                                                                                                                           | Some
                                                                                                                             imm =>
                                                                                                                              true
                                                                                                                           | _ =>
                                                                                                                              false
                                                                                                                           end
                                                                                                                         then
                                                                                                                           (_s1798_
                                                                                                                              _s1226_) >>= fun w__157 : option (mword 11) =>
                                                                                                                           (match w__157 with
                                                                                                                            | Some
                                                                                                                              imm =>
                                                                                                                               returnm (C_J
                                                                                                                                          imm)
                                                                                                                            | _ =>
                                                                                                                               exit tt
                                                                                                                                : M (ast)
                                                                                                                            end)
                                                                                                                            : M (ast)
                                                                                                                         else
                                                                                                                           (_s1806_
                                                                                                                              _s1226_) >>= fun w__160 : option ((mword 3 * mword 8)) =>
                                                                                                                           (if
                                                                                                                              match w__160 with
                                                                                                                              | Some
                                                                                                                                (rs, imm) =>
                                                                                                                                 true
                                                                                                                              | _ =>
                                                                                                                                 false
                                                                                                                              end
                                                                                                                            then
                                                                                                                              (_s1806_
                                                                                                                                 _s1226_) >>= fun w__161 : option ((mword 3 * mword 8)) =>
                                                                                                                              (match w__161 with
                                                                                                                               | Some
                                                                                                                                 (rs, imm) =>
                                                                                                                                  returnm (C_BEQZ
                                                                                                                                             (imm, rs))
                                                                                                                               | _ =>
                                                                                                                                  exit tt
                                                                                                                                   : M (ast)
                                                                                                                               end)
                                                                                                                               : M (ast)
                                                                                                                            else
                                                                                                                              (_s1818_
                                                                                                                                 _s1226_) >>= fun w__164 : option ((mword 3 * mword 8)) =>
                                                                                                                              (if
                                                                                                                                 match w__164 with
                                                                                                                                 | Some
                                                                                                                                   (rs, imm) =>
                                                                                                                                    true
                                                                                                                                 | _ =>
                                                                                                                                    false
                                                                                                                                 end
                                                                                                                               then
                                                                                                                                 (_s1818_
                                                                                                                                    _s1226_) >>= fun w__165 : option ((mword 3 * mword 8)) =>
                                                                                                                                 (match w__165 with
                                                                                                                                  | Some
                                                                                                                                    (rs, imm) =>
                                                                                                                                     returnm (C_BNEZ
                                                                                                                                                (imm, rs))
                                                                                                                                  | _ =>
                                                                                                                                     exit tt
                                                                                                                                      : M (ast)
                                                                                                                                  end)
                                                                                                                                  : M (ast)
                                                                                                                               else
                                                                                                                                 (_s1830_
                                                                                                                                    _s1226_) >>= fun w__168 : option ((mword 5 * mword 6)) =>
                                                                                                                                 (if
                                                                                                                                    match w__168 with
                                                                                                                                    | Some
                                                                                                                                      (rsd, shamt) =>
                                                                                                                                       andb
                                                                                                                                         (neq_vec
                                                                                                                                            shamt
                                                                                                                                            ('b"000000"
                                                                                                                                             : mword 6))
                                                                                                                                         (neq_vec
                                                                                                                                            rsd
                                                                                                                                            zreg)
                                                                                                                                    | _ =>
                                                                                                                                       false
                                                                                                                                    end
                                                                                                                                  then
                                                                                                                                    (_s1830_
                                                                                                                                       _s1226_) >>= fun w__169 : option ((mword 5 * mword 6)) =>
                                                                                                                                    (match w__169 with
                                                                                                                                     | Some
                                                                                                                                       (rsd, shamt) =>
                                                                                                                                        returnm (C_SLLI
                                                                                                                                                   (shamt, rsd))
                                                                                                                                     | _ =>
                                                                                                                                        exit tt
                                                                                                                                         : M (ast)
                                                                                                                                     end)
                                                                                                                                     : M (ast)
                                                                                                                                  else
                                                                                                                                    (_s1842_
                                                                                                                                       _s1226_) >>= fun w__172 : option ((mword 5 * mword 6)) =>
                                                                                                                                    (if
                                                                                                                                       match w__172 with
                                                                                                                                       | Some
                                                                                                                                         (rd, uimm) =>
                                                                                                                                          neq_vec
                                                                                                                                            rd
                                                                                                                                            zreg
                                                                                                                                       | _ =>
                                                                                                                                          false
                                                                                                                                       end
                                                                                                                                     then
                                                                                                                                       (_s1842_
                                                                                                                                          _s1226_) >>= fun w__173 : option ((mword 5 * mword 6)) =>
                                                                                                                                       (match w__173 with
                                                                                                                                        | Some
                                                                                                                                          (rd, uimm) =>
                                                                                                                                           returnm (C_LWSP
                                                                                                                                                      (uimm, rd))
                                                                                                                                        | _ =>
                                                                                                                                           exit tt
                                                                                                                                            : M (ast)
                                                                                                                                        end)
                                                                                                                                        : M (ast)
                                                                                                                                     else
                                                                                                                                       (_s1854_
                                                                                                                                          _s1226_) >>= fun w__176 : option ((mword 5 * mword 6)) =>
                                                                                                                                       (if
                                                                                                                                          match w__176 with
                                                                                                                                          | Some
                                                                                                                                            (rd, uimm) =>
                                                                                                                                             andb
                                                                                                                                               (neq_vec
                                                                                                                                                  rd
                                                                                                                                                  zreg)
                                                                                                                                               (Z.eqb
                                                                                                                                                  32
                                                                                                                                                  64)
                                                                                                                                          | _ =>
                                                                                                                                             false
                                                                                                                                          end
                                                                                                                                        then
                                                                                                                                          (_s1854_
                                                                                                                                             _s1226_) >>= fun w__177 : option ((mword 5 * mword 6)) =>
                                                                                                                                          (match w__177 with
                                                                                                                                           | Some
                                                                                                                                             (rd, uimm) =>
                                                                                                                                              returnm (C_LDSP
                                                                                                                                                         (uimm, rd))
                                                                                                                                           | _ =>
                                                                                                                                              exit tt
                                                                                                                                               : M (ast)
                                                                                                                                           end)
                                                                                                                                           : M (ast)
                                                                                                                                        else
                                                                                                                                          (_s1866_
                                                                                                                                             _s1226_) >>= fun w__180 : option ((mword 5 * mword 6)) =>
                                                                                                                                          (if
                                                                                                                                             match w__180 with
                                                                                                                                             | Some
                                                                                                                                               (rd, uimm) =>
                                                                                                                                                true
                                                                                                                                             | _ =>
                                                                                                                                                false
                                                                                                                                             end
                                                                                                                                           then
                                                                                                                                             (_s1866_
                                                                                                                                                _s1226_) >>= fun w__181 : option ((mword 5 * mword 6)) =>
                                                                                                                                             (match w__181 with
                                                                                                                                              | Some
                                                                                                                                                (rd, uimm) =>
                                                                                                                                                 returnm (C_SWSP
                                                                                                                                                            (uimm, rd))
                                                                                                                                              | _ =>
                                                                                                                                                 exit tt
                                                                                                                                                  : M (ast)
                                                                                                                                              end)
                                                                                                                                              : M (ast)
                                                                                                                                           else
                                                                                                                                             (_s1878_
                                                                                                                                                _s1226_) >>= fun w__184 : option ((mword 5 * mword 6)) =>
                                                                                                                                             (if
                                                                                                                                                match w__184 with
                                                                                                                                                | Some
                                                                                                                                                  (rs2, uimm) =>
                                                                                                                                                   Z.eqb
                                                                                                                                                     32
                                                                                                                                                     64
                                                                                                                                                | _ =>
                                                                                                                                                   false
                                                                                                                                                end
                                                                                                                                              then
                                                                                                                                                (_s1878_
                                                                                                                                                   _s1226_) >>= fun w__185 : option ((mword 5 * mword 6)) =>
                                                                                                                                                (match w__185 with
                                                                                                                                                 | Some
                                                                                                                                                   (rs2, uimm) =>
                                                                                                                                                    returnm (C_SDSP
                                                                                                                                                               (uimm, rs2))
                                                                                                                                                 | _ =>
                                                                                                                                                    exit tt
                                                                                                                                                     : M (ast)
                                                                                                                                                 end)
                                                                                                                                                 : M (ast)
                                                                                                                                              else
                                                                                                                                                (_s1890_
                                                                                                                                                   _s1226_) >>= fun w__188 : option (mword 5) =>
                                                                                                                                                (if
                                                                                                                                                   match w__188 with
                                                                                                                                                   | Some
                                                                                                                                                     rs1 =>
                                                                                                                                                      neq_vec
                                                                                                                                                        rs1
                                                                                                                                                        zreg
                                                                                                                                                   | _ =>
                                                                                                                                                      false
                                                                                                                                                   end
                                                                                                                                                 then
                                                                                                                                                   (_s1890_
                                                                                                                                                      _s1226_) >>= fun w__189 : option (mword 5) =>
                                                                                                                                                   (match w__189 with
                                                                                                                                                    | Some
                                                                                                                                                      rs1 =>
                                                                                                                                                       returnm (C_JR
                                                                                                                                                                  rs1)
                                                                                                                                                    | _ =>
                                                                                                                                                       exit tt
                                                                                                                                                        : M (ast)
                                                                                                                                                    end)
                                                                                                                                                    : M (ast)
                                                                                                                                                 else
                                                                                                                                                   (_s1898_
                                                                                                                                                      _s1226_) >>= fun w__192 : option (mword 5) =>
                                                                                                                                                   (if
                                                                                                                                                      match w__192 with
                                                                                                                                                      | Some
                                                                                                                                                        rs1 =>
                                                                                                                                                         neq_vec
                                                                                                                                                           rs1
                                                                                                                                                           zreg
                                                                                                                                                      | _ =>
                                                                                                                                                         false
                                                                                                                                                      end
                                                                                                                                                    then
                                                                                                                                                      (_s1898_
                                                                                                                                                         _s1226_) >>= fun w__193 : option (mword 5) =>
                                                                                                                                                      (match w__193 with
                                                                                                                                                       | Some
                                                                                                                                                         rs1 =>
                                                                                                                                                          returnm (C_JALR
                                                                                                                                                                     rs1)
                                                                                                                                                       | _ =>
                                                                                                                                                          exit tt
                                                                                                                                                           : M (ast)
                                                                                                                                                       end)
                                                                                                                                                       : M (ast)
                                                                                                                                                    else
                                                                                                                                                      (_s1906_
                                                                                                                                                         _s1226_) >>= fun w__196 : option ((mword 5 * mword 5)) =>
                                                                                                                                                      (if
                                                                                                                                                         match w__196 with
                                                                                                                                                         | Some
                                                                                                                                                           (rd, rs2) =>
                                                                                                                                                            andb
                                                                                                                                                              (neq_vec
                                                                                                                                                                 rd
                                                                                                                                                                 zreg)
                                                                                                                                                              (neq_vec
                                                                                                                                                                 rs2
                                                                                                                                                                 zreg)
                                                                                                                                                         | _ =>
                                                                                                                                                            false
                                                                                                                                                         end
                                                                                                                                                       then
                                                                                                                                                         (_s1906_
                                                                                                                                                            _s1226_) >>= fun w__197 : option ((mword 5 * mword 5)) =>
                                                                                                                                                         (match w__197 with
                                                                                                                                                          | Some
                                                                                                                                                            (rd, rs2) =>
                                                                                                                                                             returnm (C_MV
                                                                                                                                                                        (rd, rs2))
                                                                                                                                                          | _ =>
                                                                                                                                                             exit tt
                                                                                                                                                              : M (ast)
                                                                                                                                                          end)
                                                                                                                                                          : M (ast)
                                                                                                                                                       else if
                                                                                                                                                         generic_eq
                                                                                                                                                           _s1226_
                                                                                                                                                           "c.ebreak"
                                                                                                                                                       then
                                                                                                                                                         returnm (C_EBREAK
                                                                                                                                                                    tt)
                                                                                                                                                       else
                                                                                                                                                         (_s1918_
                                                                                                                                                            _s1226_) >>= fun w__200 : option ((mword 5 * mword 5)) =>
                                                                                                                                                         (if
                                                                                                                                                            match w__200 with
                                                                                                                                                            | Some
                                                                                                                                                              (rsd, rs2) =>
                                                                                                                                                               andb
                                                                                                                                                                 (neq_vec
                                                                                                                                                                    rsd
                                                                                                                                                                    zreg)
                                                                                                                                                                 (neq_vec
                                                                                                                                                                    rs2
                                                                                                                                                                    zreg)
                                                                                                                                                            | _ =>
                                                                                                                                                               false
                                                                                                                                                            end
                                                                                                                                                          then
                                                                                                                                                            (_s1918_
                                                                                                                                                               _s1226_) >>= fun w__201 : option ((mword 5 * mword 5)) =>
                                                                                                                                                            (match w__201 with
                                                                                                                                                             | Some
                                                                                                                                                               (rsd, rs2) =>
                                                                                                                                                                returnm (C_ADD
                                                                                                                                                                           (rsd, rs2))
                                                                                                                                                             | _ =>
                                                                                                                                                                exit tt
                                                                                                                                                                 : M (ast)
                                                                                                                                                             end)
                                                                                                                                                             : M (ast)
                                                                                                                                                          else
                                                                                                                                                            (_s1930_
                                                                                                                                                               _s1226_) >>= fun w__204 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                            (if
                                                                                                                                                               match w__204 with
                                                                                                                                                               | Some
                                                                                                                                                                 (high, signed1, signed2, rd, rs1, rs2) =>
                                                                                                                                                                  true
                                                                                                                                                               | _ =>
                                                                                                                                                                  false
                                                                                                                                                               end
                                                                                                                                                             then
                                                                                                                                                               (_s1930_
                                                                                                                                                                  _s1226_) >>= fun w__205 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                               (match w__205 with
                                                                                                                                                                | Some
                                                                                                                                                                  (high, signed1, signed2, rd, rs1, rs2) =>
                                                                                                                                                                   returnm (MUL
                                                                                                                                                                              (rs2, rs1, rd, high, signed1, signed2))
                                                                                                                                                                | _ =>
                                                                                                                                                                   exit tt
                                                                                                                                                                    : M (ast)
                                                                                                                                                                end)
                                                                                                                                                                : M (ast)
                                                                                                                                                             else
                                                                                                                                                               (_s1947_
                                                                                                                                                                  _s1226_) >>= fun w__208 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                               (if
                                                                                                                                                                  match w__208 with
                                                                                                                                                                  | Some
                                                                                                                                                                    (s, rd, rs1, rs2) =>
                                                                                                                                                                     true
                                                                                                                                                                  | _ =>
                                                                                                                                                                     false
                                                                                                                                                                  end
                                                                                                                                                                then
                                                                                                                                                                  (_s1947_
                                                                                                                                                                     _s1226_) >>= fun w__209 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                  (match w__209 with
                                                                                                                                                                   | Some
                                                                                                                                                                     (s, rd, rs1, rs2) =>
                                                                                                                                                                      returnm (DIV
                                                                                                                                                                                 (rs2, rs1, rd, s))
                                                                                                                                                                   | _ =>
                                                                                                                                                                      exit tt
                                                                                                                                                                       : M (ast)
                                                                                                                                                                   end)
                                                                                                                                                                   : M (ast)
                                                                                                                                                                else
                                                                                                                                                                  (_s1965_
                                                                                                                                                                     _s1226_) >>= fun w__212 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                  (if
                                                                                                                                                                     match w__212 with
                                                                                                                                                                     | Some
                                                                                                                                                                       (s, rd, rs1, rs2) =>
                                                                                                                                                                        true
                                                                                                                                                                     | _ =>
                                                                                                                                                                        false
                                                                                                                                                                     end
                                                                                                                                                                   then
                                                                                                                                                                     (_s1965_
                                                                                                                                                                        _s1226_) >>= fun w__213 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                     (match w__213 with
                                                                                                                                                                      | Some
                                                                                                                                                                        (s, rd, rs1, rs2) =>
                                                                                                                                                                         returnm (REM
                                                                                                                                                                                    (rs2, rs1, rd, s))
                                                                                                                                                                      | _ =>
                                                                                                                                                                         exit tt
                                                                                                                                                                          : M (ast)
                                                                                                                                                                      end)
                                                                                                                                                                      : M (ast)
                                                                                                                                                                   else
                                                                                                                                                                     (_s1983_
                                                                                                                                                                        _s1226_) >>= fun w__216 : option ((mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                     (if
                                                                                                                                                                        match w__216 with
                                                                                                                                                                        | Some
                                                                                                                                                                          (rd, rs1, rs2) =>
                                                                                                                                                                           Z.eqb
                                                                                                                                                                             32
                                                                                                                                                                             64
                                                                                                                                                                        | _ =>
                                                                                                                                                                           false
                                                                                                                                                                        end
                                                                                                                                                                      then
                                                                                                                                                                        (_s1983_
                                                                                                                                                                           _s1226_) >>= fun w__217 : option ((mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                        (match w__217 with
                                                                                                                                                                         | Some
                                                                                                                                                                           (rd, rs1, rs2) =>
                                                                                                                                                                            returnm (MULW
                                                                                                                                                                                       (rs2, rs1, rd))
                                                                                                                                                                         | _ =>
                                                                                                                                                                            exit tt
                                                                                                                                                                             : M (ast)
                                                                                                                                                                         end)
                                                                                                                                                                         : M (ast)
                                                                                                                                                                      else
                                                                                                                                                                        (_s1999_
                                                                                                                                                                           _s1226_) >>= fun w__220 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                        (if
                                                                                                                                                                           match w__220 with
                                                                                                                                                                           | Some
                                                                                                                                                                             (s, rd, rs1, rs2) =>
                                                                                                                                                                              Z.eqb
                                                                                                                                                                                32
                                                                                                                                                                                64
                                                                                                                                                                           | _ =>
                                                                                                                                                                              false
                                                                                                                                                                           end
                                                                                                                                                                         then
                                                                                                                                                                           (_s1999_
                                                                                                                                                                              _s1226_) >>= fun w__221 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                           (match w__221 with
                                                                                                                                                                            | Some
                                                                                                                                                                              (s, rd, rs1, rs2) =>
                                                                                                                                                                               returnm (DIVW
                                                                                                                                                                                          (rs2, rs1, rd, s))
                                                                                                                                                                            | _ =>
                                                                                                                                                                               exit tt
                                                                                                                                                                                : M (ast)
                                                                                                                                                                            end)
                                                                                                                                                                            : M (ast)
                                                                                                                                                                         else
                                                                                                                                                                           (_s2018_
                                                                                                                                                                              _s1226_) >>= fun w__224 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                           (if
                                                                                                                                                                              match w__224 with
                                                                                                                                                                              | Some
                                                                                                                                                                                (s, rd, rs1, rs2) =>
                                                                                                                                                                                 Z.eqb
                                                                                                                                                                                   32
                                                                                                                                                                                   64
                                                                                                                                                                              | _ =>
                                                                                                                                                                                 false
                                                                                                                                                                              end
                                                                                                                                                                            then
                                                                                                                                                                              (_s2018_
                                                                                                                                                                                 _s1226_) >>= fun w__225 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                              (match w__225 with
                                                                                                                                                                               | Some
                                                                                                                                                                                 (s, rd, rs1, rs2) =>
                                                                                                                                                                                  returnm (REMW
                                                                                                                                                                                             (rs2, rs1, rd, s))
                                                                                                                                                                               | _ =>
                                                                                                                                                                                  exit tt
                                                                                                                                                                                   : M (ast)
                                                                                                                                                                               end)
                                                                                                                                                                               : M (ast)
                                                                                                                                                                            else
                                                                                                                                                                              (_s2037_
                                                                                                                                                                                 _s1226_) >>= fun w__228 : option ((csrop * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                              (if
                                                                                                                                                                                 match w__228 with
                                                                                                                                                                                 | Some
                                                                                                                                                                                   (op, rd, csr, rs1) =>
                                                                                                                                                                                    true
                                                                                                                                                                                 | _ =>
                                                                                                                                                                                    false
                                                                                                                                                                                 end
                                                                                                                                                                               then
                                                                                                                                                                                 (_s2037_
                                                                                                                                                                                    _s1226_) >>= fun w__229 : option ((csrop * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                 (match w__229 with
                                                                                                                                                                                  | Some
                                                                                                                                                                                    (op, rd, csr, rs1) =>
                                                                                                                                                                                     returnm (CSR
                                                                                                                                                                                                (csr, rs1, rd, true, op))
                                                                                                                                                                                  | _ =>
                                                                                                                                                                                     exit tt
                                                                                                                                                                                      : M (ast)
                                                                                                                                                                                  end)
                                                                                                                                                                                  : M (ast)
                                                                                                                                                                               else
                                                                                                                                                                                 (_s2055_
                                                                                                                                                                                    _s1226_) >>= fun w__232 : option ((csrop * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                 (if
                                                                                                                                                                                    match w__232 with
                                                                                                                                                                                    | Some
                                                                                                                                                                                      (op, rd, csr, rs1) =>
                                                                                                                                                                                       true
                                                                                                                                                                                    | _ =>
                                                                                                                                                                                       false
                                                                                                                                                                                    end
                                                                                                                                                                                  then
                                                                                                                                                                                    (_s2055_
                                                                                                                                                                                       _s1226_) >>= fun w__233 : option ((csrop * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                    (match w__233 with
                                                                                                                                                                                     | Some
                                                                                                                                                                                       (op, rd, csr, rs1) =>
                                                                                                                                                                                        returnm (CSR
                                                                                                                                                                                                   (csr, rs1, rd, false, op))
                                                                                                                                                                                     | _ =>
                                                                                                                                                                                        exit tt
                                                                                                                                                                                         : M (ast)
                                                                                                                                                                                     end)
                                                                                                                                                                                     : M (ast)
                                                                                                                                                                                  else if
                                                                                                                                                                                    generic_eq
                                                                                                                                                                                      _s1226_
                                                                                                                                                                                      "uret"
                                                                                                                                                                                  then
                                                                                                                                                                                    returnm (URET
                                                                                                                                                                                               tt)
                                                                                                                                                                                  else if
                                                                                                                                                                                    match (_s2072_
                                                                                                                                                                                             _s1226_) with
                                                                                                                                                                                    | Some
                                                                                                                                                                                      imm =>
                                                                                                                                                                                       true
                                                                                                                                                                                    | _ =>
                                                                                                                                                                                       false
                                                                                                                                                                                    end
                                                                                                                                                                                  then
                                                                                                                                                                                    (match (_s2072_
                                                                                                                                                                                              _s1226_) with
                                                                                                                                                                                     | Some
                                                                                                                                                                                       imm =>
                                                                                                                                                                                        returnm (C_NOP_HINT
                                                                                                                                                                                                   imm)
                                                                                                                                                                                     | _ =>
                                                                                                                                                                                        exit tt
                                                                                                                                                                                         : M (ast)
                                                                                                                                                                                     end)
                                                                                                                                                                                     : M (ast)
                                                                                                                                                                                  else
                                                                                                                                                                                    (_s2078_
                                                                                                                                                                                       _s1226_) >>= fun w__238 : option (mword 5) =>
                                                                                                                                                                                    (if
                                                                                                                                                                                       match w__238 with
                                                                                                                                                                                       | Some
                                                                                                                                                                                         rsd =>
                                                                                                                                                                                          neq_vec
                                                                                                                                                                                            rsd
                                                                                                                                                                                            zreg
                                                                                                                                                                                       | _ =>
                                                                                                                                                                                          false
                                                                                                                                                                                       end
                                                                                                                                                                                     then
                                                                                                                                                                                       (_s2078_
                                                                                                                                                                                          _s1226_) >>= fun w__239 : option (mword 5) =>
                                                                                                                                                                                       (match w__239 with
                                                                                                                                                                                        | Some
                                                                                                                                                                                          rsd =>
                                                                                                                                                                                           returnm (C_ADDI_HINT
                                                                                                                                                                                                      rsd)
                                                                                                                                                                                        | _ =>
                                                                                                                                                                                           exit tt
                                                                                                                                                                                            : M (ast)
                                                                                                                                                                                        end)
                                                                                                                                                                                        : M (ast)
                                                                                                                                                                                     else if
                                                                                                                                                                                       match (_s2084_
                                                                                                                                                                                                _s1226_) with
                                                                                                                                                                                       | Some
                                                                                                                                                                                         imm =>
                                                                                                                                                                                          true
                                                                                                                                                                                       | _ =>
                                                                                                                                                                                          false
                                                                                                                                                                                       end
                                                                                                                                                                                     then
                                                                                                                                                                                       (match (_s2084_
                                                                                                                                                                                                 _s1226_) with
                                                                                                                                                                                        | Some
                                                                                                                                                                                          imm =>
                                                                                                                                                                                           returnm (C_LI_HINT
                                                                                                                                                                                                      imm)
                                                                                                                                                                                        | _ =>
                                                                                                                                                                                           exit tt
                                                                                                                                                                                            : M (ast)
                                                                                                                                                                                        end)
                                                                                                                                                                                        : M (ast)
                                                                                                                                                                                     else if
                                                                                                                                                                                       match (_s2090_
                                                                                                                                                                                                _s1226_) with
                                                                                                                                                                                       | Some
                                                                                                                                                                                         imm =>
                                                                                                                                                                                          neq_vec
                                                                                                                                                                                            imm
                                                                                                                                                                                            ('b"000000"
                                                                                                                                                                                             : mword 6)
                                                                                                                                                                                       | _ =>
                                                                                                                                                                                          false
                                                                                                                                                                                       end
                                                                                                                                                                                     then
                                                                                                                                                                                       (match (_s2090_
                                                                                                                                                                                                 _s1226_) with
                                                                                                                                                                                        | Some
                                                                                                                                                                                          imm =>
                                                                                                                                                                                           returnm (C_LUI_HINT
                                                                                                                                                                                                      imm)
                                                                                                                                                                                        | _ =>
                                                                                                                                                                                           exit tt
                                                                                                                                                                                            : M (ast)
                                                                                                                                                                                        end)
                                                                                                                                                                                        : M (ast)
                                                                                                                                                                                     else
                                                                                                                                                                                       (_s2096_
                                                                                                                                                                                          _s1226_) >>= fun w__246 : option (mword 5) =>
                                                                                                                                                                                       (if
                                                                                                                                                                                          match w__246 with
                                                                                                                                                                                          | Some
                                                                                                                                                                                            rs2 =>
                                                                                                                                                                                             neq_vec
                                                                                                                                                                                               rs2
                                                                                                                                                                                               zreg
                                                                                                                                                                                          | _ =>
                                                                                                                                                                                             false
                                                                                                                                                                                          end
                                                                                                                                                                                        then
                                                                                                                                                                                          (_s2096_
                                                                                                                                                                                             _s1226_) >>= fun w__247 : option (mword 5) =>
                                                                                                                                                                                          (match w__247 with
                                                                                                                                                                                           | Some
                                                                                                                                                                                             rs2 =>
                                                                                                                                                                                              returnm (C_MV_HINT
                                                                                                                                                                                                         rs2)
                                                                                                                                                                                           | _ =>
                                                                                                                                                                                              exit tt
                                                                                                                                                                                               : M (ast)
                                                                                                                                                                                           end)
                                                                                                                                                                                           : M (ast)
                                                                                                                                                                                        else
                                                                                                                                                                                          (_s2102_
                                                                                                                                                                                             _s1226_) >>= fun w__250 : option (mword 5) =>
                                                                                                                                                                                          (if
                                                                                                                                                                                             match w__250 with
                                                                                                                                                                                             | Some
                                                                                                                                                                                               rs2 =>
                                                                                                                                                                                                neq_vec
                                                                                                                                                                                                  rs2
                                                                                                                                                                                                  zreg
                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                false
                                                                                                                                                                                             end
                                                                                                                                                                                           then
                                                                                                                                                                                             (_s2102_
                                                                                                                                                                                                _s1226_) >>= fun w__251 : option (mword 5) =>
                                                                                                                                                                                             (match w__251 with
                                                                                                                                                                                              | Some
                                                                                                                                                                                                rs2 =>
                                                                                                                                                                                                 returnm (C_ADD_HINT
                                                                                                                                                                                                            rs2)
                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                 exit tt
                                                                                                                                                                                                  : M (ast)
                                                                                                                                                                                              end)
                                                                                                                                                                                              : M (ast)
                                                                                                                                                                                           else
                                                                                                                                                                                             (_s2108_
                                                                                                                                                                                                _s1226_) >>= fun w__254 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                             (if
                                                                                                                                                                                                match w__254 with
                                                                                                                                                                                                | Some
                                                                                                                                                                                                  (rsd, shamt) =>
                                                                                                                                                                                                   orb
                                                                                                                                                                                                     (eq_vec
                                                                                                                                                                                                        shamt
                                                                                                                                                                                                        ('b"000000"
                                                                                                                                                                                                         : mword 6))
                                                                                                                                                                                                     (eq_vec
                                                                                                                                                                                                        rsd
                                                                                                                                                                                                        zreg)
                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                   false
                                                                                                                                                                                                end
                                                                                                                                                                                              then
                                                                                                                                                                                                (_s2108_
                                                                                                                                                                                                   _s1226_) >>= fun w__255 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                (match w__255 with
                                                                                                                                                                                                 | Some
                                                                                                                                                                                                   (rsd, shamt) =>
                                                                                                                                                                                                    returnm (C_SLLI_HINT
                                                                                                                                                                                                               (shamt, rsd))
                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                    exit tt
                                                                                                                                                                                                     : M (ast)
                                                                                                                                                                                                 end)
                                                                                                                                                                                                 : M (ast)
                                                                                                                                                                                              else
                                                                                                                                                                                                (_s2117_
                                                                                                                                                                                                   _s1226_) >>= fun w__258 : option (mword 3) =>
                                                                                                                                                                                                (if
                                                                                                                                                                                                   match w__258 with
                                                                                                                                                                                                   | Some
                                                                                                                                                                                                     rsd =>
                                                                                                                                                                                                      true
                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                      false
                                                                                                                                                                                                   end
                                                                                                                                                                                                 then
                                                                                                                                                                                                   (_s2117_
                                                                                                                                                                                                      _s1226_) >>= fun w__259 : option (mword 3) =>
                                                                                                                                                                                                   (match w__259 with
                                                                                                                                                                                                    | Some
                                                                                                                                                                                                      rsd =>
                                                                                                                                                                                                       returnm (C_SRLI_HINT
                                                                                                                                                                                                                  rsd)
                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                       exit tt
                                                                                                                                                                                                        : M (ast)
                                                                                                                                                                                                    end)
                                                                                                                                                                                                    : M (ast)
                                                                                                                                                                                                 else
                                                                                                                                                                                                   (_s2123_
                                                                                                                                                                                                      _s1226_) >>= fun w__262 : option (mword 3) =>
                                                                                                                                                                                                   (if
                                                                                                                                                                                                      match w__262 with
                                                                                                                                                                                                      | Some
                                                                                                                                                                                                        rsd =>
                                                                                                                                                                                                         true
                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                         false
                                                                                                                                                                                                      end
                                                                                                                                                                                                    then
                                                                                                                                                                                                      (_s2123_
                                                                                                                                                                                                         _s1226_) >>= fun w__263 : option (mword 3) =>
                                                                                                                                                                                                      (match w__263 with
                                                                                                                                                                                                       | Some
                                                                                                                                                                                                         rsd =>
                                                                                                                                                                                                          returnm (C_SRAI_HINT
                                                                                                                                                                                                                     rsd)
                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                          exit tt
                                                                                                                                                                                                           : M (ast)
                                                                                                                                                                                                       end)
                                                                                                                                                                                                       : M (ast)
                                                                                                                                                                                                    else
                                                                                                                                                                                                      (_s2129_
                                                                                                                                                                                                         _s1226_) >>= fun w__266 : option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)) =>
                                                                                                                                                                                                      (if
                                                                                                                                                                                                         match w__266 with
                                                                                                                                                                                                         | Some
                                                                                                                                                                                                           (pred, succ, rs, rd, fm) =>
                                                                                                                                                                                                            orb
                                                                                                                                                                                                              (andb
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    fm
                                                                                                                                                                                                                    (Ox"0"
                                                                                                                                                                                                                     : mword 4))
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    fm
                                                                                                                                                                                                                    (Ox"8"
                                                                                                                                                                                                                     : mword 4)))
                                                                                                                                                                                                              (orb
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    rs
                                                                                                                                                                                                                    ('b"00000"
                                                                                                                                                                                                                     : mword 5))
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    rd
                                                                                                                                                                                                                    ('b"00000"
                                                                                                                                                                                                                     : mword 5)))
                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                            false
                                                                                                                                                                                                         end
                                                                                                                                                                                                       then
                                                                                                                                                                                                         (_s2129_
                                                                                                                                                                                                            _s1226_) >>= fun w__267 : option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)) =>
                                                                                                                                                                                                         (match w__267 with
                                                                                                                                                                                                          | Some
                                                                                                                                                                                                            (pred, succ, rs, rd, fm) =>
                                                                                                                                                                                                             returnm (FENCE_RESERVED
                                                                                                                                                                                                                        (fm, pred, succ, rs, rd))
                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                             exit tt
                                                                                                                                                                                                              : M (ast)
                                                                                                                                                                                                          end)
                                                                                                                                                                                                          : M (ast)
                                                                                                                                                                                                       else
                                                                                                                                                                                                         (_s2147_
                                                                                                                                                                                                            _s1226_) >>= fun w__270 : option ((mword 5 * mword 5 * mword 12)) =>
                                                                                                                                                                                                         (if
                                                                                                                                                                                                            match w__270 with
                                                                                                                                                                                                            | Some
                                                                                                                                                                                                              (rd, rs, imm) =>
                                                                                                                                                                                                               orb
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    imm
                                                                                                                                                                                                                    (Ox"000"
                                                                                                                                                                                                                     : mword 12))
                                                                                                                                                                                                                 (orb
                                                                                                                                                                                                                    (neq_vec
                                                                                                                                                                                                                       rs
                                                                                                                                                                                                                       zreg)
                                                                                                                                                                                                                    (neq_vec
                                                                                                                                                                                                                       rd
                                                                                                                                                                                                                       zreg))
                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                               false
                                                                                                                                                                                                            end
                                                                                                                                                                                                          then
                                                                                                                                                                                                            (_s2147_
                                                                                                                                                                                                               _s1226_) >>= fun w__271 : option ((mword 5 * mword 5 * mword 12)) =>
                                                                                                                                                                                                            (match w__271 with
                                                                                                                                                                                                             | Some
                                                                                                                                                                                                               (rd, rs, imm) =>
                                                                                                                                                                                                                returnm (FENCEI_RESERVED
                                                                                                                                                                                                                           (imm, rs, rd))
                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                exit tt
                                                                                                                                                                                                                 : M (ast)
                                                                                                                                                                                                             end)
                                                                                                                                                                                                             : M (ast)
                                                                                                                                                                                                          else
                                                                                                                                                                                                            (_s2159_
                                                                                                                                                                                                               _s1226_) >>= fun w__274 : option ((word_width * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                                            (if
                                                                                                                                                                                                               match w__274 with
                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                 (width, rd, imm, rs1) =>
                                                                                                                                                                                                                  true
                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                  false
                                                                                                                                                                                                               end
                                                                                                                                                                                                             then
                                                                                                                                                                                                               (_s2159_
                                                                                                                                                                                                                  _s1226_) >>= fun w__275 : option ((word_width * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                                               (match w__275 with
                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                  (width, rd, imm, rs1) =>
                                                                                                                                                                                                                   returnm (LOAD_FP
                                                                                                                                                                                                                              (imm, rs1, rd, width))
                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                   exit tt
                                                                                                                                                                                                                    : M (ast)
                                                                                                                                                                                                                end)
                                                                                                                                                                                                                : M (ast)
                                                                                                                                                                                                             else
                                                                                                                                                                                                               (_s2183_
                                                                                                                                                                                                                  _s1226_) >>= fun w__278 : option ((word_width * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                                               (if
                                                                                                                                                                                                                  match w__278 with
                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                    (width, rs2, imm, rs1) =>
                                                                                                                                                                                                                     true
                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                     false
                                                                                                                                                                                                                  end
                                                                                                                                                                                                                then
                                                                                                                                                                                                                  (_s2183_
                                                                                                                                                                                                                     _s1226_) >>= fun w__279 : option ((word_width * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                                                  (match w__279 with
                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                     (width, rs2, imm, rs1) =>
                                                                                                                                                                                                                      returnm (STORE_FP
                                                                                                                                                                                                                                 (imm, rs2, rs1, width))
                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                      exit tt
                                                                                                                                                                                                                       : M (ast)
                                                                                                                                                                                                                   end)
                                                                                                                                                                                                                   : M (ast)
                                                                                                                                                                                                                else
                                                                                                                                                                                                                  (_s2207_
                                                                                                                                                                                                                     _s1226_) >>= fun w__282 : option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                  (if
                                                                                                                                                                                                                     match w__282 with
                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                       (op, rd, rs1, rs2, rs3, rm) =>
                                                                                                                                                                                                                        true
                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                        false
                                                                                                                                                                                                                     end
                                                                                                                                                                                                                   then
                                                                                                                                                                                                                     (_s2207_
                                                                                                                                                                                                                        _s1226_) >>= fun w__283 : option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                     (match w__283 with
                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                        (op, rd, rs1, rs2, rs3, rm) =>
                                                                                                                                                                                                                         returnm (F_MADD_TYPE_S
                                                                                                                                                                                                                                    (rs3, rs2, rs1, rm, rd, op))
                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                         exit tt
                                                                                                                                                                                                                          : M (ast)
                                                                                                                                                                                                                      end)
                                                                                                                                                                                                                      : M (ast)
                                                                                                                                                                                                                   else
                                                                                                                                                                                                                     (_s2232_
                                                                                                                                                                                                                        _s1226_) >>= fun w__286 : option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                     (if
                                                                                                                                                                                                                        match w__286 with
                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                          (op, rd, rs1, rs2, rm) =>
                                                                                                                                                                                                                           true
                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                           false
                                                                                                                                                                                                                        end
                                                                                                                                                                                                                      then
                                                                                                                                                                                                                        (_s2232_
                                                                                                                                                                                                                           _s1226_) >>= fun w__287 : option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                        (match w__287 with
                                                                                                                                                                                                                         | Some
                                                                                                                                                                                                                           (op, rd, rs1, rs2, rm) =>
                                                                                                                                                                                                                            returnm (F_BIN_RM_TYPE_S
                                                                                                                                                                                                                                       (rs2, rs1, rm, rd, op))
                                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                                            exit tt
                                                                                                                                                                                                                             : M (ast)
                                                                                                                                                                                                                         end)
                                                                                                                                                                                                                         : M (ast)
                                                                                                                                                                                                                      else
                                                                                                                                                                                                                        (_s2253_
                                                                                                                                                                                                                           _s1226_) >>= fun w__290 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                        (if
                                                                                                                                                                                                                           match w__290 with
                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                             (FSQRT_S, rd, rs1, rm) =>
                                                                                                                                                                                                                              true
                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                              false
                                                                                                                                                                                                                           end
                                                                                                                                                                                                                         then
                                                                                                                                                                                                                           (_s2253_
                                                                                                                                                                                                                              _s1226_) >>= fun w__291 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                           (match w__291 with
                                                                                                                                                                                                                            | Some
                                                                                                                                                                                                                              (FSQRT_S, rd, rs1, rm) =>
                                                                                                                                                                                                                               returnm (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                          (rs1, rm, rd, FSQRT_S))
                                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                                               exit tt
                                                                                                                                                                                                                                : M (ast)
                                                                                                                                                                                                                            end)
                                                                                                                                                                                                                            : M (ast)
                                                                                                                                                                                                                         else
                                                                                                                                                                                                                           (_s2270_
                                                                                                                                                                                                                              _s1226_) >>= fun w__294 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                           (if
                                                                                                                                                                                                                              match w__294 with
                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                (FCVT_W_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                 true
                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                 false
                                                                                                                                                                                                                              end
                                                                                                                                                                                                                            then
                                                                                                                                                                                                                              (_s2270_
                                                                                                                                                                                                                                 _s1226_) >>= fun w__295 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                              (match w__295 with
                                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                                 (FCVT_W_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                  returnm (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                             (rs1, rm, rd, FCVT_W_S))
                                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                                  exit tt
                                                                                                                                                                                                                                   : M (ast)
                                                                                                                                                                                                                               end)
                                                                                                                                                                                                                               : M (ast)
                                                                                                                                                                                                                            else
                                                                                                                                                                                                                              (_s2287_
                                                                                                                                                                                                                                 _s1226_) >>= fun w__298 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                              (if
                                                                                                                                                                                                                                 match w__298 with
                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                   (FCVT_WU_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                    true
                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                    false
                                                                                                                                                                                                                                 end
                                                                                                                                                                                                                               then
                                                                                                                                                                                                                                 (_s2287_
                                                                                                                                                                                                                                    _s1226_) >>= fun w__299 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                 (match w__299 with
                                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                                    (FCVT_WU_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                     returnm (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                (rs1, rm, rd, FCVT_WU_S))
                                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                                     exit tt
                                                                                                                                                                                                                                      : M (ast)
                                                                                                                                                                                                                                  end)
                                                                                                                                                                                                                                  : M (ast)
                                                                                                                                                                                                                               else
                                                                                                                                                                                                                                 (_s2304_
                                                                                                                                                                                                                                    _s1226_) >>= fun w__302 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                 (if
                                                                                                                                                                                                                                    match w__302 with
                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                      (FCVT_S_W, rd, rs1, rm) =>
                                                                                                                                                                                                                                       true
                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                       false
                                                                                                                                                                                                                                    end
                                                                                                                                                                                                                                  then
                                                                                                                                                                                                                                    (_s2304_
                                                                                                                                                                                                                                       _s1226_) >>= fun w__303 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                    (match w__303 with
                                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                                       (FCVT_S_W, rd, rs1, rm) =>
                                                                                                                                                                                                                                        returnm (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                   (rs1, rm, rd, FCVT_S_W))
                                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                                        exit tt
                                                                                                                                                                                                                                         : M (ast)
                                                                                                                                                                                                                                     end)
                                                                                                                                                                                                                                     : M (ast)
                                                                                                                                                                                                                                  else
                                                                                                                                                                                                                                    (_s2321_
                                                                                                                                                                                                                                       _s1226_) >>= fun w__306 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                    (if
                                                                                                                                                                                                                                       match w__306 with
                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                         (FCVT_S_WU, rd, rs1, rm) =>
                                                                                                                                                                                                                                          true
                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                          false
                                                                                                                                                                                                                                       end
                                                                                                                                                                                                                                     then
                                                                                                                                                                                                                                       (_s2321_
                                                                                                                                                                                                                                          _s1226_) >>= fun w__307 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                       (match w__307 with
                                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                                          (FCVT_S_WU, rd, rs1, rm) =>
                                                                                                                                                                                                                                           returnm (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                      (rs1, rm, rd, FCVT_S_WU))
                                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                                           exit tt
                                                                                                                                                                                                                                            : M (ast)
                                                                                                                                                                                                                                        end)
                                                                                                                                                                                                                                        : M (ast)
                                                                                                                                                                                                                                     else
                                                                                                                                                                                                                                       (_s2338_
                                                                                                                                                                                                                                          _s1226_) >>= fun w__310 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                       (if
                                                                                                                                                                                                                                          match w__310 with
                                                                                                                                                                                                                                          | Some
                                                                                                                                                                                                                                            (FCVT_L_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                             true
                                                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                                                             false
                                                                                                                                                                                                                                          end
                                                                                                                                                                                                                                        then
                                                                                                                                                                                                                                          (_s2338_
                                                                                                                                                                                                                                             _s1226_) >>= fun w__311 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                          (match w__311 with
                                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                                             (FCVT_L_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                              returnm (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                         (rs1, rm, rd, FCVT_L_S))
                                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                                              exit tt
                                                                                                                                                                                                                                               : M (ast)
                                                                                                                                                                                                                                           end)
                                                                                                                                                                                                                                           : M (ast)
                                                                                                                                                                                                                                        else
                                                                                                                                                                                                                                          (_s2355_
                                                                                                                                                                                                                                             _s1226_) >>= fun w__314 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                          (if
                                                                                                                                                                                                                                             match w__314 with
                                                                                                                                                                                                                                             | Some
                                                                                                                                                                                                                                               (FCVT_LU_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                                true
                                                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                                                false
                                                                                                                                                                                                                                             end
                                                                                                                                                                                                                                           then
                                                                                                                                                                                                                                             (_s2355_
                                                                                                                                                                                                                                                _s1226_) >>= fun w__315 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                             (match w__315 with
                                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                                (FCVT_LU_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                                 returnm (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                            (rs1, rm, rd, FCVT_LU_S))
                                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                                 exit tt
                                                                                                                                                                                                                                                  : M (ast)
                                                                                                                                                                                                                                              end)
                                                                                                                                                                                                                                              : M (ast)
                                                                                                                                                                                                                                           else
                                                                                                                                                                                                                                             (_s2372_
                                                                                                                                                                                                                                                _s1226_) >>= fun w__318 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                             (if
                                                                                                                                                                                                                                                match w__318 with
                                                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                                                  (FCVT_S_L, rd, rs1, rm) =>
                                                                                                                                                                                                                                                   true
                                                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                                                   false
                                                                                                                                                                                                                                                end
                                                                                                                                                                                                                                              then
                                                                                                                                                                                                                                                (_s2372_
                                                                                                                                                                                                                                                   _s1226_) >>= fun w__319 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                                (match w__319 with
                                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                                   (FCVT_S_L, rd, rs1, rm) =>
                                                                                                                                                                                                                                                    returnm (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                               (rs1, rm, rd, FCVT_S_L))
                                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                                    exit tt
                                                                                                                                                                                                                                                     : M (ast)
                                                                                                                                                                                                                                                 end)
                                                                                                                                                                                                                                                 : M (ast)
                                                                                                                                                                                                                                              else
                                                                                                                                                                                                                                                (_s2389_
                                                                                                                                                                                                                                                   _s1226_) >>= fun w__322 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                                (if
                                                                                                                                                                                                                                                   match w__322 with
                                                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                                                     (FCVT_S_LU, rd, rs1, rm) =>
                                                                                                                                                                                                                                                      true
                                                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                                                      false
                                                                                                                                                                                                                                                   end
                                                                                                                                                                                                                                                 then
                                                                                                                                                                                                                                                   (_s2389_
                                                                                                                                                                                                                                                      _s1226_) >>= fun w__323 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                                   (match w__323 with
                                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                                      (FCVT_S_LU, rd, rs1, rm) =>
                                                                                                                                                                                                                                                       returnm (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                                  (rs1, rm, rd, FCVT_S_LU))
                                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                                       exit tt
                                                                                                                                                                                                                                                        : M (ast)
                                                                                                                                                                                                                                                    end)
                                                                                                                                                                                                                                                    : M (ast)
                                                                                                                                                                                                                                                 else
                                                                                                                                                                                                                                                   (_s2406_
                                                                                                                                                                                                                                                      _s1226_) >>= fun w__326 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                   (if
                                                                                                                                                                                                                                                      match w__326 with
                                                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                                                        (FSGNJ_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                         true
                                                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                                                         false
                                                                                                                                                                                                                                                      end
                                                                                                                                                                                                                                                    then
                                                                                                                                                                                                                                                      (_s2406_
                                                                                                                                                                                                                                                         _s1226_) >>= fun w__327 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                      (match w__327 with
                                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                                         (FSGNJ_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                          returnm (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                     (rs2, rs1, rd, FSGNJ_S))
                                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                                          exit tt
                                                                                                                                                                                                                                                           : M (ast)
                                                                                                                                                                                                                                                       end)
                                                                                                                                                                                                                                                       : M (ast)
                                                                                                                                                                                                                                                    else
                                                                                                                                                                                                                                                      (_s2423_
                                                                                                                                                                                                                                                         _s1226_) >>= fun w__330 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                      (if
                                                                                                                                                                                                                                                         match w__330 with
                                                                                                                                                                                                                                                         | Some
                                                                                                                                                                                                                                                           (FSGNJN_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                            true
                                                                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                                                                            false
                                                                                                                                                                                                                                                         end
                                                                                                                                                                                                                                                       then
                                                                                                                                                                                                                                                         (_s2423_
                                                                                                                                                                                                                                                            _s1226_) >>= fun w__331 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                         (match w__331 with
                                                                                                                                                                                                                                                          | Some
                                                                                                                                                                                                                                                            (FSGNJN_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                             returnm (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                        (rs2, rs1, rd, FSGNJN_S))
                                                                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                                                                             exit tt
                                                                                                                                                                                                                                                              : M (ast)
                                                                                                                                                                                                                                                          end)
                                                                                                                                                                                                                                                          : M (ast)
                                                                                                                                                                                                                                                       else
                                                                                                                                                                                                                                                         (_s2440_
                                                                                                                                                                                                                                                            _s1226_) >>= fun w__334 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                         (if
                                                                                                                                                                                                                                                            match w__334 with
                                                                                                                                                                                                                                                            | Some
                                                                                                                                                                                                                                                              (FSGNJX_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                               true
                                                                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                                                                               false
                                                                                                                                                                                                                                                            end
                                                                                                                                                                                                                                                          then
                                                                                                                                                                                                                                                            (_s2440_
                                                                                                                                                                                                                                                               _s1226_) >>= fun w__335 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                            (match w__335 with
                                                                                                                                                                                                                                                             | Some
                                                                                                                                                                                                                                                               (FSGNJX_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                returnm (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                           (rs2, rs1, rd, FSGNJX_S))
                                                                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                                                                exit tt
                                                                                                                                                                                                                                                                 : M (ast)
                                                                                                                                                                                                                                                             end)
                                                                                                                                                                                                                                                             : M (ast)
                                                                                                                                                                                                                                                          else
                                                                                                                                                                                                                                                            (_s2457_
                                                                                                                                                                                                                                                               _s1226_) >>= fun w__338 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                            (if
                                                                                                                                                                                                                                                               match w__338 with
                                                                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                                                                 (FMIN_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                  true
                                                                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                                                                  false
                                                                                                                                                                                                                                                               end
                                                                                                                                                                                                                                                             then
                                                                                                                                                                                                                                                               (_s2457_
                                                                                                                                                                                                                                                                  _s1226_) >>= fun w__339 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                               (match w__339 with
                                                                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                                                                  (FMIN_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                   returnm (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                              (rs2, rs1, rd, FMIN_S))
                                                                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                                                                   exit tt
                                                                                                                                                                                                                                                                    : M (ast)
                                                                                                                                                                                                                                                                end)
                                                                                                                                                                                                                                                                : M (ast)
                                                                                                                                                                                                                                                             else
                                                                                                                                                                                                                                                               (_s2474_
                                                                                                                                                                                                                                                                  _s1226_) >>= fun w__342 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                               (if
                                                                                                                                                                                                                                                                  match w__342 with
                                                                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                                                                    (FMAX_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                     true
                                                                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                                                                     false
                                                                                                                                                                                                                                                                  end
                                                                                                                                                                                                                                                                then
                                                                                                                                                                                                                                                                  (_s2474_
                                                                                                                                                                                                                                                                     _s1226_) >>= fun w__343 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                  (match w__343 with
                                                                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                                                                     (FMAX_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                      returnm (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                                 (rs2, rs1, rd, FMAX_S))
                                                                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                                                                      exit tt
                                                                                                                                                                                                                                                                       : M (ast)
                                                                                                                                                                                                                                                                   end)
                                                                                                                                                                                                                                                                   : M (ast)
                                                                                                                                                                                                                                                                else
                                                                                                                                                                                                                                                                  (_s2491_
                                                                                                                                                                                                                                                                     _s1226_) >>= fun w__346 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                  (if
                                                                                                                                                                                                                                                                     match w__346 with
                                                                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                                                                       (FEQ_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                        true
                                                                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                                                                        false
                                                                                                                                                                                                                                                                     end
                                                                                                                                                                                                                                                                   then
                                                                                                                                                                                                                                                                     (_s2491_
                                                                                                                                                                                                                                                                        _s1226_) >>= fun w__347 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                     (match w__347 with
                                                                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                                                                        (FEQ_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                         returnm (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                                    (rs2, rs1, rd, FEQ_S))
                                                                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                                                                         exit tt
                                                                                                                                                                                                                                                                          : M (ast)
                                                                                                                                                                                                                                                                      end)
                                                                                                                                                                                                                                                                      : M (ast)
                                                                                                                                                                                                                                                                   else
                                                                                                                                                                                                                                                                     (_s2508_
                                                                                                                                                                                                                                                                        _s1226_) >>= fun w__350 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                     (if
                                                                                                                                                                                                                                                                        match w__350 with
                                                                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                                                                          (FLT_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                           true
                                                                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                                                                           false
                                                                                                                                                                                                                                                                        end
                                                                                                                                                                                                                                                                      then
                                                                                                                                                                                                                                                                        (_s2508_
                                                                                                                                                                                                                                                                           _s1226_) >>= fun w__351 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                        (match w__351 with
                                                                                                                                                                                                                                                                         | Some
                                                                                                                                                                                                                                                                           (FLT_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                            returnm (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                                       (rs2, rs1, rd, FLT_S))
                                                                                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                                                                                            exit tt
                                                                                                                                                                                                                                                                             : M (ast)
                                                                                                                                                                                                                                                                         end)
                                                                                                                                                                                                                                                                         : M (ast)
                                                                                                                                                                                                                                                                      else
                                                                                                                                                                                                                                                                        (_s2525_
                                                                                                                                                                                                                                                                           _s1226_) >>= fun w__354 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                        (if
                                                                                                                                                                                                                                                                           match w__354 with
                                                                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                                                                             (FLE_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                              true
                                                                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                                                                              false
                                                                                                                                                                                                                                                                           end
                                                                                                                                                                                                                                                                         then
                                                                                                                                                                                                                                                                           (_s2525_
                                                                                                                                                                                                                                                                              _s1226_) >>= fun w__355 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                           (match w__355 with
                                                                                                                                                                                                                                                                            | Some
                                                                                                                                                                                                                                                                              (FLE_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                               returnm (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                                          (rs2, rs1, rd, FLE_S))
                                                                                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                                                                                               exit tt
                                                                                                                                                                                                                                                                                : M (ast)
                                                                                                                                                                                                                                                                            end)
                                                                                                                                                                                                                                                                            : M (ast)
                                                                                                                                                                                                                                                                         else
                                                                                                                                                                                                                                                                           (_s2542_
                                                                                                                                                                                                                                                                              _s1226_) >>= fun w__358 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                           (if
                                                                                                                                                                                                                                                                              match w__358 with
                                                                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                                                                (FMV_X_W, rd, rs1) =>
                                                                                                                                                                                                                                                                                 true
                                                                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                                                                 false
                                                                                                                                                                                                                                                                              end
                                                                                                                                                                                                                                                                            then
                                                                                                                                                                                                                                                                              (_s2542_
                                                                                                                                                                                                                                                                                 _s1226_) >>= fun w__359 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                              (match w__359 with
                                                                                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                                                                                 (FMV_X_W, rd, rs1) =>
                                                                                                                                                                                                                                                                                  returnm (F_UN_TYPE_S
                                                                                                                                                                                                                                                                                             (rs1, rd, FMV_X_W))
                                                                                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                                                                                  exit tt
                                                                                                                                                                                                                                                                                   : M (ast)
                                                                                                                                                                                                                                                                               end)
                                                                                                                                                                                                                                                                               : M (ast)
                                                                                                                                                                                                                                                                            else
                                                                                                                                                                                                                                                                              (_s2555_
                                                                                                                                                                                                                                                                                 _s1226_) >>= fun w__362 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                              (if
                                                                                                                                                                                                                                                                                 match w__362 with
                                                                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                                                                   (FMV_W_X, rd, rs1) =>
                                                                                                                                                                                                                                                                                    true
                                                                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                                                                    false
                                                                                                                                                                                                                                                                                 end
                                                                                                                                                                                                                                                                               then
                                                                                                                                                                                                                                                                                 (_s2555_
                                                                                                                                                                                                                                                                                    _s1226_) >>= fun w__363 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                                 (match w__363 with
                                                                                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                                                                                    (FMV_W_X, rd, rs1) =>
                                                                                                                                                                                                                                                                                     returnm (F_UN_TYPE_S
                                                                                                                                                                                                                                                                                                (rs1, rd, FMV_W_X))
                                                                                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                                                                                     exit tt
                                                                                                                                                                                                                                                                                      : M (ast)
                                                                                                                                                                                                                                                                                  end)
                                                                                                                                                                                                                                                                                  : M (ast)
                                                                                                                                                                                                                                                                               else
                                                                                                                                                                                                                                                                                 (_s2568_
                                                                                                                                                                                                                                                                                    _s1226_) >>= fun w__366 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                                 (if
                                                                                                                                                                                                                                                                                    match w__366 with
                                                                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                                                                      (FCLASS_S, rd, rs1) =>
                                                                                                                                                                                                                                                                                       true
                                                                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                                                                       false
                                                                                                                                                                                                                                                                                    end
                                                                                                                                                                                                                                                                                  then
                                                                                                                                                                                                                                                                                    (_s2568_
                                                                                                                                                                                                                                                                                       _s1226_) >>= fun w__367 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                                    (match w__367 with
                                                                                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                                                                                       (FCLASS_S, rd, rs1) =>
                                                                                                                                                                                                                                                                                        returnm (F_UN_TYPE_S
                                                                                                                                                                                                                                                                                                   (rs1, rd, FCLASS_S))
                                                                                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                                                                                        exit tt
                                                                                                                                                                                                                                                                                         : M (ast)
                                                                                                                                                                                                                                                                                     end)
                                                                                                                                                                                                                                                                                     : M (ast)
                                                                                                                                                                                                                                                                                  else
                                                                                                                                                                                                                                                                                    (_s2581_
                                                                                                                                                                                                                                                                                       _s1226_) >>= fun w__370 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                                                                                                    (if
                                                                                                                                                                                                                                                                                       match w__370 with
                                                                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                                                                         (rd, imm) =>
                                                                                                                                                                                                                                                                                          Z.eqb
                                                                                                                                                                                                                                                                                            32
                                                                                                                                                                                                                                                                                            32
                                                                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                                                                          false
                                                                                                                                                                                                                                                                                       end
                                                                                                                                                                                                                                                                                     then
                                                                                                                                                                                                                                                                                       (_s2581_
                                                                                                                                                                                                                                                                                          _s1226_) >>= fun w__371 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                                                                                                       (match w__371 with
                                                                                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                                                                                          (rd, imm) =>
                                                                                                                                                                                                                                                                                           returnm (C_FLWSP
                                                                                                                                                                                                                                                                                                      (imm, rd))
                                                                                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                                                                                           exit tt
                                                                                                                                                                                                                                                                                            : M (ast)
                                                                                                                                                                                                                                                                                        end)
                                                                                                                                                                                                                                                                                        : M (ast)
                                                                                                                                                                                                                                                                                     else
                                                                                                                                                                                                                                                                                       (_s2593_
                                                                                                                                                                                                                                                                                          _s1226_) >>= fun w__374 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                                                                                                       (if
                                                                                                                                                                                                                                                                                          match w__374 with
                                                                                                                                                                                                                                                                                          | Some
                                                                                                                                                                                                                                                                                            (rd, uimm) =>
                                                                                                                                                                                                                                                                                             Z.eqb
                                                                                                                                                                                                                                                                                               32
                                                                                                                                                                                                                                                                                               32
                                                                                                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                                                                                                             false
                                                                                                                                                                                                                                                                                          end
                                                                                                                                                                                                                                                                                        then
                                                                                                                                                                                                                                                                                          (_s2593_
                                                                                                                                                                                                                                                                                             _s1226_) >>= fun w__375 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                                                                                                          (match w__375 with
                                                                                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                                                                                             (rd, uimm) =>
                                                                                                                                                                                                                                                                                              returnm (C_FSWSP
                                                                                                                                                                                                                                                                                                         (uimm, rd))
                                                                                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                                                                                              exit tt
                                                                                                                                                                                                                                                                                               : M (ast)
                                                                                                                                                                                                                                                                                           end)
                                                                                                                                                                                                                                                                                           : M (ast)
                                                                                                                                                                                                                                                                                        else
                                                                                                                                                                                                                                                                                          (_s2605_
                                                                                                                                                                                                                                                                                             _s1226_) >>= fun w__378 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                                                                                                                                                                                                                                          (if
                                                                                                                                                                                                                                                                                             match w__378 with
                                                                                                                                                                                                                                                                                             | Some
                                                                                                                                                                                                                                                                                               (rdc, rsc, uimm) =>
                                                                                                                                                                                                                                                                                                Z.eqb
                                                                                                                                                                                                                                                                                                  32
                                                                                                                                                                                                                                                                                                  32
                                                                                                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                                                                                                false
                                                                                                                                                                                                                                                                                             end
                                                                                                                                                                                                                                                                                           then
                                                                                                                                                                                                                                                                                             (_s2605_
                                                                                                                                                                                                                                                                                                _s1226_) >>= fun w__379 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                                                                                                                                                                                                                                             (match w__379 with
                                                                                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                                                                                (rdc, rsc, uimm) =>
                                                                                                                                                                                                                                                                                                 returnm (C_FLW
                                                                                                                                                                                                                                                                                                            (uimm, rsc, rdc))
                                                                                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                                                                                 exit tt
                                                                                                                                                                                                                                                                                                  : M (ast)
                                                                                                                                                                                                                                                                                              end)
                                                                                                                                                                                                                                                                                              : M (ast)
                                                                                                                                                                                                                                                                                           else
                                                                                                                                                                                                                                                                                             (_s2621_
                                                                                                                                                                                                                                                                                                _s1226_) >>= fun w__382 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                                                                                                                                                                                                                                             (if
                                                                                                                                                                                                                                                                                                match w__382 with
                                                                                                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                                                                                                  (rsc1, rsc2, uimm) =>
                                                                                                                                                                                                                                                                                                   Z.eqb
                                                                                                                                                                                                                                                                                                     32
                                                                                                                                                                                                                                                                                                     32
                                                                                                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                                                                                                   false
                                                                                                                                                                                                                                                                                                end
                                                                                                                                                                                                                                                                                              then
                                                                                                                                                                                                                                                                                                (_s2621_
                                                                                                                                                                                                                                                                                                   _s1226_) >>= fun w__383 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                                                                                                                                                                                                                                                (match w__383 with
                                                                                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                                                                                   (rsc1, rsc2, uimm) =>
                                                                                                                                                                                                                                                                                                    returnm (C_FSW
                                                                                                                                                                                                                                                                                                               (uimm, rsc1, rsc2))
                                                                                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                                                                                    exit tt
                                                                                                                                                                                                                                                                                                     : M (ast)
                                                                                                                                                                                                                                                                                                 end)
                                                                                                                                                                                                                                                                                                 : M (ast)
                                                                                                                                                                                                                                                                                              else
                                                                                                                                                                                                                                                                                                (_s2637_
                                                                                                                                                                                                                                                                                                   _s1226_) >>= fun w__386 : option (mword 32) =>
                                                                                                                                                                                                                                                                                                (if
                                                                                                                                                                                                                                                                                                   match w__386 with
                                                                                                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                                                                                                     s =>
                                                                                                                                                                                                                                                                                                      true
                                                                                                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                                                                                                      false
                                                                                                                                                                                                                                                                                                   end
                                                                                                                                                                                                                                                                                                 then
                                                                                                                                                                                                                                                                                                   (_s2637_
                                                                                                                                                                                                                                                                                                      _s1226_) >>= fun w__387 : option (mword 32) =>
                                                                                                                                                                                                                                                                                                   (match w__387 with
                                                                                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                                                                                      s =>
                                                                                                                                                                                                                                                                                                       returnm (ILLEGAL
                                                                                                                                                                                                                                                                                                                  s)
                                                                                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                                                                                       exit tt
                                                                                                                                                                                                                                                                                                        : M (ast)
                                                                                                                                                                                                                                                                                                    end)
                                                                                                                                                                                                                                                                                                    : M (ast)
                                                                                                                                                                                                                                                                                                 else
                                                                                                                                                                                                                                                                                                   (_s2645_
                                                                                                                                                                                                                                                                                                      _s1226_) >>= fun w__390 : option (mword 16) =>
                                                                                                                                                                                                                                                                                                   (if
                                                                                                                                                                                                                                                                                                      match w__390 with
                                                                                                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                                                                                                        s =>
                                                                                                                                                                                                                                                                                                         true
                                                                                                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                                                                                                         false
                                                                                                                                                                                                                                                                                                      end
                                                                                                                                                                                                                                                                                                    then
                                                                                                                                                                                                                                                                                                      (_s2645_
                                                                                                                                                                                                                                                                                                         _s1226_) >>= fun w__391 : option (mword 16) =>
                                                                                                                                                                                                                                                                                                      (match w__391 with
                                                                                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                                                                                         s =>
                                                                                                                                                                                                                                                                                                          returnm (C_ILLEGAL
                                                                                                                                                                                                                                                                                                                     s)
                                                                                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                                                                                          exit tt
                                                                                                                                                                                                                                                                                                           : M (ast)
                                                                                                                                                                                                                                                                                                       end)
                                                                                                                                                                                                                                                                                                       : M (ast)
                                                                                                                                                                                                                                                                                                    else
                                                                                                                                                                                                                                                                                                      assert_exp' false "Pattern match failure at unknown location" >>= fun _ =>
                                                                                                                                                                                                                                                                                                      exit tt)
                                                                                                                                                                                                                                                                                                    : M (ast))
                                                                                                                                                                                                                                                                                                 : M (ast))
                                                                                                                                                                                                                                                                                              : M (ast))
                                                                                                                                                                                                                                                                                           : M (ast))
                                                                                                                                                                                                                                                                                        : M (ast))
                                                                                                                                                                                                                                                                                     : M (ast))
                                                                                                                                                                                                                                                                                  : M (ast))
                                                                                                                                                                                                                                                                               : M (ast))
                                                                                                                                                                                                                                                                            : M (ast))
                                                                                                                                                                                                                                                                         : M (ast))
                                                                                                                                                                                                                                                                      : M (ast))
                                                                                                                                                                                                                                                                   : M (ast))
                                                                                                                                                                                                                                                                : M (ast))
                                                                                                                                                                                                                                                             : M (ast))
                                                                                                                                                                                                                                                          : M (ast))
                                                                                                                                                                                                                                                       : M (ast))
                                                                                                                                                                                                                                                    : M (ast))
                                                                                                                                                                                                                                                 : M (ast))
                                                                                                                                                                                                                                              : M (ast))
                                                                                                                                                                                                                                           : M (ast))
                                                                                                                                                                                                                                        : M (ast))
                                                                                                                                                                                                                                     : M (ast))
                                                                                                                                                                                                                                  : M (ast))
                                                                                                                                                                                                                               : M (ast))
                                                                                                                                                                                                                            : M (ast))
                                                                                                                                                                                                                         : M (ast))
                                                                                                                                                                                                                      : M (ast))
                                                                                                                                                                                                                   : M (ast))
                                                                                                                                                                                                                : M (ast))
                                                                                                                                                                                                             : M (ast))
                                                                                                                                                                                                          : M (ast))
                                                                                                                                                                                                       : M (ast))
                                                                                                                                                                                                    : M (ast))
                                                                                                                                                                                                 : M (ast))
                                                                                                                                                                                              : M (ast))
                                                                                                                                                                                           : M (ast))
                                                                                                                                                                                        : M (ast))
                                                                                                                                                                                     : M (ast))
                                                                                                                                                                                  : M (ast))
                                                                                                                                                                               : M (ast))
                                                                                                                                                                            : M (ast))
                                                                                                                                                                         : M (ast))
                                                                                                                                                                      : M (ast))
                                                                                                                                                                   : M (ast))
                                                                                                                                                                : M (ast))
                                                                                                                                                             : M (ast))
                                                                                                                                                          : M (ast))
                                                                                                                                                       : M (ast))
                                                                                                                                                    : M (ast))
                                                                                                                                                 : M (ast))
                                                                                                                                              : M (ast))
                                                                                                                                           : M (ast))
                                                                                                                                        : M (ast))
                                                                                                                                     : M (ast))
                                                                                                                                  : M (ast))
                                                                                                                               : M (ast))
                                                                                                                            : M (ast))
                                                                                                                         : M (ast))
                                                                                                                      : M (ast))
                                                                                                                   : M (ast))
                                                                                                                : M (ast))
                                                                                                             : M (ast))
                                                                                                          : M (ast))
                                                                                                       : M (ast))
                                                                                                    : M (ast))
                                                                                                 : M (ast))
                                                                                              : M (ast))
                                                                                           : M (ast))
                                                                                        : M (ast))
                                                                                     : M (ast))
                                                                                  : M (ast))
                                                                               : M (ast))
                                                                            : M (ast))
                                                                         : M (ast))
                                                                      : M (ast))
                                                                   : M (ast))
                                                                : M (ast))
                                                             : M (ast))
                                                          : M (ast))
                                                       : M (ast))
                                                    : M (ast))
                                                 : M (ast))
                                              : M (ast))
                                           : M (ast))
                                        : M (ast))
                                     : M (ast))
                                  : M (ast))
                               : M (ast))
                            : M (ast))
                         : M (ast))
                      : M (ast))
                   : M (ast))
                : M (ast))
             : M (ast))
          : M (ast))
       : M (ast))
    : M (ast).

Definition assembly_forwards_matches (arg_ : ast) : bool :=
   match arg_ with
   | UTYPE (imm, rd, op) => true
   | RISCV_JAL (imm, rd) => true
   | RISCV_JALR (imm, rs1, rd) => true
   | BTYPE (imm, rs2, rs1, op) => true
   | ITYPE (imm, rs1, rd, op) => true
   | SHIFTIOP (shamt, rs1, rd, op) => true
   | RTYPE (rs2, rs1, rd, op) => true
   | LOAD (imm, rs1, rd, is_unsigned, size, aq, rl) => true
   | STORE (imm, rs2, rs1, size, aq, rl) => true
   | ADDIW (imm, rs1, rd) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | SHIFTW (shamt, rs1, rd, op) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | RTYPEW (rs2, rs1, rd, op) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | SHIFTIWOP (shamt, rs1, rd, op) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | FENCE (pred, succ) => true
   | FENCE_TSO (pred, succ) => true
   | FENCEI tt => true
   | ECALL tt => true
   | MRET tt => true
   | SRET tt => true
   | EBREAK tt => true
   | WFI tt => true
   | SFENCE_VMA (rs1, rs2) => true
   | LOADRES (aq, rl, rs1, size, rd) => true
   | STORECON (aq, rl, rs2, rs1, size, rd) => true
   | AMO (op, aq, rl, rs2, rs1, width, rd) => true
   | C_NOP tt => true
   | C_ADDI4SPN (rdc, nzimm) => if neq_vec nzimm (Ox"00"  : mword 8) then true else false
   | C_LW (uimm, rsc, rdc) => true
   | C_LD (uimm, rsc, rdc) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | C_SW (uimm, rsc1, rsc2) => true
   | C_SD (uimm, rsc1, rsc2) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | C_ADDI (nzi, rsd) =>
      if andb (neq_vec nzi ('b"000000"  : mword 6)) (neq_vec rsd zreg) then true else false
   | C_JAL imm => if sumbool_of_bool (Z.eqb 32 32) then true else false
   | C_ADDIW (imm, rsd) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | C_LI (imm, rd) => if neq_vec rd zreg then true else false
   | C_ADDI16SP imm => if neq_vec imm ('b"000000"  : mword 6) then true else false
   | C_LUI (imm, rd) =>
      if andb (neq_vec rd zreg) (andb (neq_vec rd sp) (neq_vec imm ('b"000000"  : mword 6))) then
        true
      else false
   | C_SRLI (shamt, rsd) => if neq_vec shamt ('b"000000"  : mword 6) then true else false
   | C_SRAI (shamt, rsd) => if neq_vec shamt ('b"000000"  : mword 6) then true else false
   | C_ANDI (imm, rsd) => true
   | C_SUB (rsd, rs2) => true
   | C_XOR (rsd, rs2) => true
   | C_OR (rsd, rs2) => true
   | C_AND (rsd, rs2) => true
   | C_SUBW (rsd, rs2) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | C_ADDW (rsd, rs2) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | C_J imm => true
   | C_BEQZ (imm, rs) => true
   | C_BNEZ (imm, rs) => true
   | C_SLLI (shamt, rsd) =>
      if andb (neq_vec shamt ('b"000000"  : mword 6)) (neq_vec rsd zreg) then true else false
   | C_LWSP (uimm, rd) => if neq_vec rd zreg then true else false
   | C_LDSP (uimm, rd) =>
      if sumbool_of_bool (andb (neq_vec rd zreg) (Z.eqb 32 64)) then true else false
   | C_SWSP (uimm, rd) => true
   | C_SDSP (uimm, rs2) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | C_JR rs1 => if neq_vec rs1 zreg then true else false
   | C_JALR rs1 => if neq_vec rs1 zreg then true else false
   | C_MV (rd, rs2) => if andb (neq_vec rd zreg) (neq_vec rs2 zreg) then true else false
   | C_EBREAK tt => true
   | C_ADD (rsd, rs2) => if andb (neq_vec rsd zreg) (neq_vec rs2 zreg) then true else false
   | MUL (rs2, rs1, rd, high, signed1, signed2) => true
   | DIV (rs2, rs1, rd, s) => true
   | REM (rs2, rs1, rd, s) => true
   | MULW (rs2, rs1, rd) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | DIVW (rs2, rs1, rd, s) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | REMW (rs2, rs1, rd, s) => if sumbool_of_bool (Z.eqb 32 64) then true else false
   | CSR (csr, rs1, rd, true, op) => true
   | CSR (csr, rs1, rd, false, op) => true
   | URET tt => true
   | C_NOP_HINT imm => true
   | C_ADDI_HINT rsd => if neq_vec rsd zreg then true else false
   | C_LI_HINT imm => true
   | C_LUI_HINT imm => if neq_vec imm ('b"000000"  : mword 6) then true else false
   | C_MV_HINT rs2 => if neq_vec rs2 zreg then true else false
   | C_ADD_HINT rs2 => if neq_vec rs2 zreg then true else false
   | C_SLLI_HINT (shamt, rsd) =>
      if orb (eq_vec shamt ('b"000000"  : mword 6)) (eq_vec rsd zreg) then true else false
   | C_SRLI_HINT rsd => true
   | C_SRAI_HINT rsd => true
   | FENCE_RESERVED (fm, pred, succ, rs, rd) =>
      if orb (andb (neq_vec fm (Ox"0"  : mword 4)) (neq_vec fm (Ox"8"  : mword 4)))
           (orb (neq_vec rs ('b"00000"  : mword 5)) (neq_vec rd ('b"00000"  : mword 5))) then
        true
      else false
   | FENCEI_RESERVED (imm, rs, rd) =>
      if orb (neq_vec imm (Ox"000"  : mword 12)) (orb (neq_vec rs zreg) (neq_vec rd zreg)) then true
      else false
   | LOAD_FP (imm, rs1, rd, width) => true
   | STORE_FP (imm, rs2, rs1, width) => true
   | F_MADD_TYPE_S (rs3, rs2, rs1, rm, rd, op) => true
   | F_BIN_RM_TYPE_S (rs2, rs1, rm, rd, op) => true
   | F_UN_RM_TYPE_S (rs1, rm, rd, FSQRT_S) => true
   | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_W_S) => true
   | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_WU_S) => true
   | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_W) => true
   | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_WU) => true
   | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_L_S) => true
   | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_LU_S) => true
   | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_L) => true
   | F_UN_RM_TYPE_S (rs1, rm, rd, FCVT_S_LU) => true
   | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJ_S) => true
   | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJN_S) => true
   | F_BIN_TYPE_S (rs2, rs1, rd, FSGNJX_S) => true
   | F_BIN_TYPE_S (rs2, rs1, rd, FMIN_S) => true
   | F_BIN_TYPE_S (rs2, rs1, rd, FMAX_S) => true
   | F_BIN_TYPE_S (rs2, rs1, rd, FEQ_S) => true
   | F_BIN_TYPE_S (rs2, rs1, rd, FLT_S) => true
   | F_BIN_TYPE_S (rs2, rs1, rd, FLE_S) => true
   | F_UN_TYPE_S (rs1, rd, FMV_X_W) => true
   | F_UN_TYPE_S (rs1, rd, FMV_W_X) => true
   | F_UN_TYPE_S (rs1, rd, FCLASS_S) => true
   | C_FLWSP (imm, rd) => if sumbool_of_bool (Z.eqb 32 32) then true else false
   | C_FSWSP (uimm, rd) => if sumbool_of_bool (Z.eqb 32 32) then true else false
   | C_FLW (uimm, rsc, rdc) => if sumbool_of_bool (Z.eqb 32 32) then true else false
   | C_FSW (uimm, rsc1, rsc2) => if sumbool_of_bool (Z.eqb 32 32) then true else false
   | ILLEGAL s => true
   | C_ILLEGAL s => true
   end.

Definition _s4084_ (_s4085_ : string) : M (option (mword 16)) :=
   let _s4086_ := _s4085_ in
   (if string_startswith _s4086_ "c.illegal" then
      (match (string_drop _s4086_ (projT1 (string_length "c.illegal"))) with
       | _s4087_ =>
          (spc_matches_prefix _s4087_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s4088_ _) =>
                      match (string_drop _s4087_ _s4088_) with
                      | _s4089_ =>
                         match (hex_bits_16_matches_prefix _s4089_) with
                         | Some (s, existT _ _s4090_ _) =>
                            let p0_ := string_drop _s4089_ _s4090_ in
                            if generic_eq p0_ "" then Some s
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 16))
    else returnm None)
    : M (option (mword 16)).

Definition _s4076_ (_s4077_ : string) : M (option (mword 32)) :=
   let _s4078_ := _s4077_ in
   (if string_startswith _s4078_ "illegal" then
      (match (string_drop _s4078_ (projT1 (string_length "illegal"))) with
       | _s4079_ =>
          (spc_matches_prefix _s4079_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s4080_ _) =>
                      match (string_drop _s4079_ _s4080_) with
                      | _s4081_ =>
                         match (hex_bits_32_matches_prefix _s4081_) with
                         | Some (s, existT _ _s4082_ _) =>
                            let p0_ := string_drop _s4081_ _s4082_ in
                            if generic_eq p0_ "" then Some s
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 32))
    else returnm None)
    : M (option (mword 32)).

Definition _s4060_ (_s4061_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s4062_ := _s4061_ in
   (if string_startswith _s4062_ "c.fsw" then
      (match (string_drop _s4062_ (projT1 (string_length "c.fsw"))) with
       | _s4063_ =>
          (spc_matches_prefix _s4063_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4064_ _) =>
              (match (string_drop _s4063_ _s4064_) with
               | _s4065_ =>
                  (creg_name_matches_prefix _s4065_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsc1, existT _ _s4066_ _) =>
                      (match (string_drop _s4065_ _s4066_) with
                       | _s4067_ =>
                          (sep_matches_prefix _s4067_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4068_ _) =>
                              (match (string_drop _s4067_ _s4068_) with
                               | _s4069_ =>
                                  (creg_name_matches_prefix _s4069_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc2, existT _ _s4070_ _) =>
                                      (match (string_drop _s4069_ _s4070_) with
                                       | _s4071_ =>
                                          (sep_matches_prefix _s4071_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s4072_ _) =>
                                                      match (string_drop _s4071_ _s4072_) with
                                                      | _s4073_ =>
                                                         match (hex_bits_7_matches_prefix _s4073_) with
                                                         | Some (v__1196, existT _ _s4074_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1196 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1196 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1196 6 2 in
                                                              let p0_ := string_drop _s4073_ _s4074_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rsc1, rsc2, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s4044_ (_s4045_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s4046_ := _s4045_ in
   (if string_startswith _s4046_ "c.flw" then
      (match (string_drop _s4046_ (projT1 (string_length "c.flw"))) with
       | _s4047_ =>
          (spc_matches_prefix _s4047_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4048_ _) =>
              (match (string_drop _s4047_ _s4048_) with
               | _s4049_ =>
                  (creg_name_matches_prefix _s4049_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s4050_ _) =>
                      (match (string_drop _s4049_ _s4050_) with
                       | _s4051_ =>
                          (sep_matches_prefix _s4051_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4052_ _) =>
                              (match (string_drop _s4051_ _s4052_) with
                               | _s4053_ =>
                                  (creg_name_matches_prefix _s4053_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc, existT _ _s4054_ _) =>
                                      (match (string_drop _s4053_ _s4054_) with
                                       | _s4055_ =>
                                          (sep_matches_prefix _s4055_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s4056_ _) =>
                                                      match (string_drop _s4055_ _s4056_) with
                                                      | _s4057_ =>
                                                         match (hex_bits_7_matches_prefix _s4057_) with
                                                         | Some (v__1198, existT _ _s4058_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1198 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1198 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1198 6 2 in
                                                              let p0_ := string_drop _s4057_ _s4058_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rdc, rsc, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s4032_ (_s4033_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s4034_ := _s4033_ in
   (if string_startswith _s4034_ "c.fswsp" then
      (match (string_drop _s4034_ (projT1 (string_length "c.fswsp"))) with
       | _s4035_ =>
          (spc_matches_prefix _s4035_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4036_ _) =>
              (match (string_drop _s4035_ _s4036_) with
               | _s4037_ =>
                  (reg_name_matches_prefix _s4037_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4038_ _) =>
                      (match (string_drop _s4037_ _s4038_) with
                       | _s4039_ =>
                          (sep_matches_prefix _s4039_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4040_ _) =>
                                      match (string_drop _s4039_ _s4040_) with
                                      | _s4041_ =>
                                         match (hex_bits_6_matches_prefix _s4041_) with
                                         | Some (uimm, existT _ _s4042_ _) =>
                                            let p0_ := string_drop _s4041_ _s4042_ in
                                            if generic_eq p0_ "" then Some (rd, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s4020_ (_s4021_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s4022_ := _s4021_ in
   (if string_startswith _s4022_ "c.flwsp" then
      (match (string_drop _s4022_ (projT1 (string_length "c.flwsp"))) with
       | _s4023_ =>
          (spc_matches_prefix _s4023_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4024_ _) =>
              (match (string_drop _s4023_ _s4024_) with
               | _s4025_ =>
                  (reg_name_matches_prefix _s4025_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4026_ _) =>
                      (match (string_drop _s4025_ _s4026_) with
                       | _s4027_ =>
                          (sep_matches_prefix _s4027_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4028_ _) =>
                                      match (string_drop _s4027_ _s4028_) with
                                      | _s4029_ =>
                                         match (hex_bits_6_matches_prefix _s4029_) with
                                         | Some (imm, existT _ _s4030_ _) =>
                                            let p0_ := string_drop _s4029_ _s4030_ in
                                            if generic_eq p0_ "" then Some (rd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s4007_ (_s4008_ : string) : M (option ((f_un_op_S * mword 5 * mword 5))) :=
   (match _s4008_ with
    | _s4009_ =>
       (f_un_type_mnemonic_S_matches_prefix _s4009_) >>= fun w__0 : option ((f_un_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCLASS_S, existT _ _s4010_ _) =>
           (match (string_drop _s4009_ _s4010_) with
            | _s4011_ =>
               (spc_matches_prefix _s4011_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4012_ _) =>
                   (match (string_drop _s4011_ _s4012_) with
                    | _s4013_ =>
                       (reg_name_matches_prefix _s4013_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4014_ _) =>
                           (match (string_drop _s4013_ _s4014_) with
                            | _s4015_ =>
                               (sep_matches_prefix _s4015_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4016_ _) =>
                                   (match (string_drop _s4015_ _s4016_) with
                                    | _s4017_ =>
                                       (freg_name_matches_prefix _s4017_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       returnm (match w__4 with
                                                | Some (rs1, existT _ _s4018_ _) =>
                                                   let p0_ := string_drop _s4017_ _s4018_ in
                                                   if generic_eq p0_ "" then
                                                     Some (FCLASS_S, rd, rs1)
                                                   else None
                                                | _ => None
                                                end)
                                    end)
                                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_op_S * mword 5 * mword 5)))
                            end)
                            : M (option ((f_un_op_S * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_op_S * mword 5 * mword 5)))
                    end)
                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_un_op_S * mword 5 * mword 5)))
            end)
            : M (option ((f_un_op_S * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_un_op_S * mword 5 * mword 5)))
    end)
    : M (option ((f_un_op_S * mword 5 * mword 5))).

Definition _s3994_ (_s3995_ : string) : M (option ((f_un_op_S * mword 5 * mword 5))) :=
   (match _s3995_ with
    | _s3996_ =>
       (f_un_type_mnemonic_S_matches_prefix _s3996_) >>= fun w__0 : option ((f_un_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMV_W_X, existT _ _s3997_ _) =>
           (match (string_drop _s3996_ _s3997_) with
            | _s3998_ =>
               (spc_matches_prefix _s3998_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3999_ _) =>
                   (match (string_drop _s3998_ _s3999_) with
                    | _s4000_ =>
                       (freg_name_matches_prefix _s4000_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4001_ _) =>
                           (match (string_drop _s4000_ _s4001_) with
                            | _s4002_ =>
                               (sep_matches_prefix _s4002_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4003_ _) =>
                                   (match (string_drop _s4002_ _s4003_) with
                                    | _s4004_ =>
                                       (reg_name_matches_prefix _s4004_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       returnm (match w__4 with
                                                | Some (rs1, existT _ _s4005_ _) =>
                                                   let p0_ := string_drop _s4004_ _s4005_ in
                                                   if generic_eq p0_ "" then Some (FMV_W_X, rd, rs1)
                                                   else None
                                                | _ => None
                                                end)
                                    end)
                                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_op_S * mword 5 * mword 5)))
                            end)
                            : M (option ((f_un_op_S * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_op_S * mword 5 * mword 5)))
                    end)
                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_un_op_S * mword 5 * mword 5)))
            end)
            : M (option ((f_un_op_S * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_un_op_S * mword 5 * mword 5)))
    end)
    : M (option ((f_un_op_S * mword 5 * mword 5))).

Definition _s3981_ (_s3982_ : string) : M (option ((f_un_op_S * mword 5 * mword 5))) :=
   (match _s3982_ with
    | _s3983_ =>
       (f_un_type_mnemonic_S_matches_prefix _s3983_) >>= fun w__0 : option ((f_un_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMV_X_W, existT _ _s3984_ _) =>
           (match (string_drop _s3983_ _s3984_) with
            | _s3985_ =>
               (spc_matches_prefix _s3985_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3986_ _) =>
                   (match (string_drop _s3985_ _s3986_) with
                    | _s3987_ =>
                       (reg_name_matches_prefix _s3987_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3988_ _) =>
                           (match (string_drop _s3987_ _s3988_) with
                            | _s3989_ =>
                               (sep_matches_prefix _s3989_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3990_ _) =>
                                   (match (string_drop _s3989_ _s3990_) with
                                    | _s3991_ =>
                                       (freg_name_matches_prefix _s3991_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       returnm (match w__4 with
                                                | Some (rs1, existT _ _s3992_ _) =>
                                                   let p0_ := string_drop _s3991_ _s3992_ in
                                                   if generic_eq p0_ "" then Some (FMV_X_W, rd, rs1)
                                                   else None
                                                | _ => None
                                                end)
                                    end)
                                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_op_S * mword 5 * mword 5)))
                            end)
                            : M (option ((f_un_op_S * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_op_S * mword 5 * mword 5)))
                    end)
                    : M (option ((f_un_op_S * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_un_op_S * mword 5 * mword 5)))
            end)
            : M (option ((f_un_op_S * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_un_op_S * mword 5 * mword 5)))
    end)
    : M (option ((f_un_op_S * mword 5 * mword 5))).

Definition _s3964_ (_s3965_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s3965_ with
    | _s3966_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s3966_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FLE_S, existT _ _s3967_ _) =>
           (match (string_drop _s3966_ _s3967_) with
            | _s3968_ =>
               (spc_matches_prefix _s3968_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3969_ _) =>
                   (match (string_drop _s3968_ _s3969_) with
                    | _s3970_ =>
                       (reg_name_matches_prefix _s3970_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3971_ _) =>
                           (match (string_drop _s3970_ _s3971_) with
                            | _s3972_ =>
                               (sep_matches_prefix _s3972_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3973_ _) =>
                                   (match (string_drop _s3972_ _s3973_) with
                                    | _s3974_ =>
                                       (freg_name_matches_prefix _s3974_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3975_ _) =>
                                           (match (string_drop _s3974_ _s3975_) with
                                            | _s3976_ =>
                                               (sep_matches_prefix _s3976_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3977_ _) =>
                                                   (match (string_drop _s3976_ _s3977_) with
                                                    | _s3978_ =>
                                                       (freg_name_matches_prefix _s3978_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s3979_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3978_ _s3979_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FLE_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s3947_ (_s3948_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s3948_ with
    | _s3949_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s3949_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FLT_S, existT _ _s3950_ _) =>
           (match (string_drop _s3949_ _s3950_) with
            | _s3951_ =>
               (spc_matches_prefix _s3951_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3952_ _) =>
                   (match (string_drop _s3951_ _s3952_) with
                    | _s3953_ =>
                       (reg_name_matches_prefix _s3953_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3954_ _) =>
                           (match (string_drop _s3953_ _s3954_) with
                            | _s3955_ =>
                               (sep_matches_prefix _s3955_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3956_ _) =>
                                   (match (string_drop _s3955_ _s3956_) with
                                    | _s3957_ =>
                                       (freg_name_matches_prefix _s3957_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3958_ _) =>
                                           (match (string_drop _s3957_ _s3958_) with
                                            | _s3959_ =>
                                               (sep_matches_prefix _s3959_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3960_ _) =>
                                                   (match (string_drop _s3959_ _s3960_) with
                                                    | _s3961_ =>
                                                       (freg_name_matches_prefix _s3961_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s3962_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3961_ _s3962_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FLT_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s3930_ (_s3931_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s3931_ with
    | _s3932_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s3932_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FEQ_S, existT _ _s3933_ _) =>
           (match (string_drop _s3932_ _s3933_) with
            | _s3934_ =>
               (spc_matches_prefix _s3934_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3935_ _) =>
                   (match (string_drop _s3934_ _s3935_) with
                    | _s3936_ =>
                       (reg_name_matches_prefix _s3936_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3937_ _) =>
                           (match (string_drop _s3936_ _s3937_) with
                            | _s3938_ =>
                               (sep_matches_prefix _s3938_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3939_ _) =>
                                   (match (string_drop _s3938_ _s3939_) with
                                    | _s3940_ =>
                                       (freg_name_matches_prefix _s3940_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3941_ _) =>
                                           (match (string_drop _s3940_ _s3941_) with
                                            | _s3942_ =>
                                               (sep_matches_prefix _s3942_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3943_ _) =>
                                                   (match (string_drop _s3942_ _s3943_) with
                                                    | _s3944_ =>
                                                       (freg_name_matches_prefix _s3944_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s3945_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3944_ _s3945_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FEQ_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s3913_ (_s3914_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s3914_ with
    | _s3915_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s3915_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMAX_S, existT _ _s3916_ _) =>
           (match (string_drop _s3915_ _s3916_) with
            | _s3917_ =>
               (spc_matches_prefix _s3917_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3918_ _) =>
                   (match (string_drop _s3917_ _s3918_) with
                    | _s3919_ =>
                       (freg_name_matches_prefix _s3919_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3920_ _) =>
                           (match (string_drop _s3919_ _s3920_) with
                            | _s3921_ =>
                               (sep_matches_prefix _s3921_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3922_ _) =>
                                   (match (string_drop _s3921_ _s3922_) with
                                    | _s3923_ =>
                                       (freg_name_matches_prefix _s3923_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3924_ _) =>
                                           (match (string_drop _s3923_ _s3924_) with
                                            | _s3925_ =>
                                               (sep_matches_prefix _s3925_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3926_ _) =>
                                                   (match (string_drop _s3925_ _s3926_) with
                                                    | _s3927_ =>
                                                       (freg_name_matches_prefix _s3927_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s3928_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3927_ _s3928_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FMAX_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s3896_ (_s3897_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s3897_ with
    | _s3898_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s3898_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMIN_S, existT _ _s3899_ _) =>
           (match (string_drop _s3898_ _s3899_) with
            | _s3900_ =>
               (spc_matches_prefix _s3900_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3901_ _) =>
                   (match (string_drop _s3900_ _s3901_) with
                    | _s3902_ =>
                       (freg_name_matches_prefix _s3902_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3903_ _) =>
                           (match (string_drop _s3902_ _s3903_) with
                            | _s3904_ =>
                               (sep_matches_prefix _s3904_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3905_ _) =>
                                   (match (string_drop _s3904_ _s3905_) with
                                    | _s3906_ =>
                                       (freg_name_matches_prefix _s3906_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3907_ _) =>
                                           (match (string_drop _s3906_ _s3907_) with
                                            | _s3908_ =>
                                               (sep_matches_prefix _s3908_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3909_ _) =>
                                                   (match (string_drop _s3908_ _s3909_) with
                                                    | _s3910_ =>
                                                       (freg_name_matches_prefix _s3910_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s3911_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3910_ _s3911_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FMIN_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s3879_ (_s3880_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s3880_ with
    | _s3881_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s3881_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSGNJX_S, existT _ _s3882_ _) =>
           (match (string_drop _s3881_ _s3882_) with
            | _s3883_ =>
               (spc_matches_prefix _s3883_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3884_ _) =>
                   (match (string_drop _s3883_ _s3884_) with
                    | _s3885_ =>
                       (freg_name_matches_prefix _s3885_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3886_ _) =>
                           (match (string_drop _s3885_ _s3886_) with
                            | _s3887_ =>
                               (sep_matches_prefix _s3887_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3888_ _) =>
                                   (match (string_drop _s3887_ _s3888_) with
                                    | _s3889_ =>
                                       (freg_name_matches_prefix _s3889_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3890_ _) =>
                                           (match (string_drop _s3889_ _s3890_) with
                                            | _s3891_ =>
                                               (sep_matches_prefix _s3891_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3892_ _) =>
                                                   (match (string_drop _s3891_ _s3892_) with
                                                    | _s3893_ =>
                                                       (freg_name_matches_prefix _s3893_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s3894_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3893_ _s3894_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FSGNJX_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s3862_ (_s3863_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s3863_ with
    | _s3864_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s3864_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSGNJN_S, existT _ _s3865_ _) =>
           (match (string_drop _s3864_ _s3865_) with
            | _s3866_ =>
               (spc_matches_prefix _s3866_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3867_ _) =>
                   (match (string_drop _s3866_ _s3867_) with
                    | _s3868_ =>
                       (freg_name_matches_prefix _s3868_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3869_ _) =>
                           (match (string_drop _s3868_ _s3869_) with
                            | _s3870_ =>
                               (sep_matches_prefix _s3870_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3871_ _) =>
                                   (match (string_drop _s3870_ _s3871_) with
                                    | _s3872_ =>
                                       (freg_name_matches_prefix _s3872_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3873_ _) =>
                                           (match (string_drop _s3872_ _s3873_) with
                                            | _s3874_ =>
                                               (sep_matches_prefix _s3874_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3875_ _) =>
                                                   (match (string_drop _s3874_ _s3875_) with
                                                    | _s3876_ =>
                                                       (freg_name_matches_prefix _s3876_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s3877_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3876_ _s3877_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FSGNJN_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s3845_ (_s3846_ : string) : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))) :=
   (match _s3846_ with
    | _s3847_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s3847_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSGNJ_S, existT _ _s3848_ _) =>
           (match (string_drop _s3847_ _s3848_) with
            | _s3849_ =>
               (spc_matches_prefix _s3849_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3850_ _) =>
                   (match (string_drop _s3849_ _s3850_) with
                    | _s3851_ =>
                       (freg_name_matches_prefix _s3851_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3852_ _) =>
                           (match (string_drop _s3851_ _s3852_) with
                            | _s3853_ =>
                               (sep_matches_prefix _s3853_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3854_ _) =>
                                   (match (string_drop _s3853_ _s3854_) with
                                    | _s3855_ =>
                                       (freg_name_matches_prefix _s3855_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3856_ _) =>
                                           (match (string_drop _s3855_ _s3856_) with
                                            | _s3857_ =>
                                               (sep_matches_prefix _s3857_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3858_ _) =>
                                                   (match (string_drop _s3857_ _s3858_) with
                                                    | _s3859_ =>
                                                       (freg_name_matches_prefix _s3859_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s3860_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3859_ _s3860_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FSGNJ_S, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5))).

Definition _s3828_ (_s3829_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3829_ with
    | _s3830_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s3830_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_LU, existT _ _s3831_ _) =>
           (match (string_drop _s3830_ _s3831_) with
            | _s3832_ =>
               (spc_matches_prefix _s3832_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3833_ _) =>
                   (match (string_drop _s3832_ _s3833_) with
                    | _s3834_ =>
                       (freg_name_matches_prefix _s3834_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3835_ _) =>
                           (match (string_drop _s3834_ _s3835_) with
                            | _s3836_ =>
                               (sep_matches_prefix _s3836_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3837_ _) =>
                                   (match (string_drop _s3836_ _s3837_) with
                                    | _s3838_ =>
                                       (reg_name_matches_prefix _s3838_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3839_ _) =>
                                           (match (string_drop _s3838_ _s3839_) with
                                            | _s3840_ =>
                                               (sep_matches_prefix _s3840_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3841_ _) =>
                                                   (match (string_drop _s3840_ _s3841_) with
                                                    | _s3842_ =>
                                                       (frm_mnemonic_matches_prefix _s3842_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s3843_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3842_ _s3843_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_S_LU, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s3811_ (_s3812_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3812_ with
    | _s3813_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s3813_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_L, existT _ _s3814_ _) =>
           (match (string_drop _s3813_ _s3814_) with
            | _s3815_ =>
               (spc_matches_prefix _s3815_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3816_ _) =>
                   (match (string_drop _s3815_ _s3816_) with
                    | _s3817_ =>
                       (freg_name_matches_prefix _s3817_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3818_ _) =>
                           (match (string_drop _s3817_ _s3818_) with
                            | _s3819_ =>
                               (sep_matches_prefix _s3819_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3820_ _) =>
                                   (match (string_drop _s3819_ _s3820_) with
                                    | _s3821_ =>
                                       (reg_name_matches_prefix _s3821_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3822_ _) =>
                                           (match (string_drop _s3821_ _s3822_) with
                                            | _s3823_ =>
                                               (sep_matches_prefix _s3823_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3824_ _) =>
                                                   (match (string_drop _s3823_ _s3824_) with
                                                    | _s3825_ =>
                                                       (frm_mnemonic_matches_prefix _s3825_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s3826_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3825_ _s3826_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_S_L, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s3794_ (_s3795_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3795_ with
    | _s3796_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s3796_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_LU_S, existT _ _s3797_ _) =>
           (match (string_drop _s3796_ _s3797_) with
            | _s3798_ =>
               (spc_matches_prefix _s3798_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3799_ _) =>
                   (match (string_drop _s3798_ _s3799_) with
                    | _s3800_ =>
                       (reg_name_matches_prefix _s3800_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3801_ _) =>
                           (match (string_drop _s3800_ _s3801_) with
                            | _s3802_ =>
                               (sep_matches_prefix _s3802_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3803_ _) =>
                                   (match (string_drop _s3802_ _s3803_) with
                                    | _s3804_ =>
                                       (freg_name_matches_prefix _s3804_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3805_ _) =>
                                           (match (string_drop _s3804_ _s3805_) with
                                            | _s3806_ =>
                                               (sep_matches_prefix _s3806_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3807_ _) =>
                                                   (match (string_drop _s3806_ _s3807_) with
                                                    | _s3808_ =>
                                                       (frm_mnemonic_matches_prefix _s3808_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s3809_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3808_ _s3809_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_LU_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s3777_ (_s3778_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3778_ with
    | _s3779_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s3779_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_L_S, existT _ _s3780_ _) =>
           (match (string_drop _s3779_ _s3780_) with
            | _s3781_ =>
               (spc_matches_prefix _s3781_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3782_ _) =>
                   (match (string_drop _s3781_ _s3782_) with
                    | _s3783_ =>
                       (reg_name_matches_prefix _s3783_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3784_ _) =>
                           (match (string_drop _s3783_ _s3784_) with
                            | _s3785_ =>
                               (sep_matches_prefix _s3785_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3786_ _) =>
                                   (match (string_drop _s3785_ _s3786_) with
                                    | _s3787_ =>
                                       (freg_name_matches_prefix _s3787_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3788_ _) =>
                                           (match (string_drop _s3787_ _s3788_) with
                                            | _s3789_ =>
                                               (sep_matches_prefix _s3789_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3790_ _) =>
                                                   (match (string_drop _s3789_ _s3790_) with
                                                    | _s3791_ =>
                                                       (frm_mnemonic_matches_prefix _s3791_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s3792_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3791_ _s3792_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_L_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s3760_ (_s3761_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3761_ with
    | _s3762_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s3762_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_WU, existT _ _s3763_ _) =>
           (match (string_drop _s3762_ _s3763_) with
            | _s3764_ =>
               (spc_matches_prefix _s3764_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3765_ _) =>
                   (match (string_drop _s3764_ _s3765_) with
                    | _s3766_ =>
                       (freg_name_matches_prefix _s3766_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3767_ _) =>
                           (match (string_drop _s3766_ _s3767_) with
                            | _s3768_ =>
                               (sep_matches_prefix _s3768_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3769_ _) =>
                                   (match (string_drop _s3768_ _s3769_) with
                                    | _s3770_ =>
                                       (reg_name_matches_prefix _s3770_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3771_ _) =>
                                           (match (string_drop _s3770_ _s3771_) with
                                            | _s3772_ =>
                                               (sep_matches_prefix _s3772_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3773_ _) =>
                                                   (match (string_drop _s3772_ _s3773_) with
                                                    | _s3774_ =>
                                                       (frm_mnemonic_matches_prefix _s3774_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s3775_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3774_ _s3775_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_S_WU, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s3743_ (_s3744_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3744_ with
    | _s3745_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s3745_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_W, existT _ _s3746_ _) =>
           (match (string_drop _s3745_ _s3746_) with
            | _s3747_ =>
               (spc_matches_prefix _s3747_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3748_ _) =>
                   (match (string_drop _s3747_ _s3748_) with
                    | _s3749_ =>
                       (freg_name_matches_prefix _s3749_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3750_ _) =>
                           (match (string_drop _s3749_ _s3750_) with
                            | _s3751_ =>
                               (sep_matches_prefix _s3751_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3752_ _) =>
                                   (match (string_drop _s3751_ _s3752_) with
                                    | _s3753_ =>
                                       (reg_name_matches_prefix _s3753_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3754_ _) =>
                                           (match (string_drop _s3753_ _s3754_) with
                                            | _s3755_ =>
                                               (sep_matches_prefix _s3755_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3756_ _) =>
                                                   (match (string_drop _s3755_ _s3756_) with
                                                    | _s3757_ =>
                                                       (frm_mnemonic_matches_prefix _s3757_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s3758_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3757_ _s3758_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_S_W, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s3726_ (_s3727_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3727_ with
    | _s3728_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s3728_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_WU_S, existT _ _s3729_ _) =>
           (match (string_drop _s3728_ _s3729_) with
            | _s3730_ =>
               (spc_matches_prefix _s3730_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3731_ _) =>
                   (match (string_drop _s3730_ _s3731_) with
                    | _s3732_ =>
                       (reg_name_matches_prefix _s3732_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3733_ _) =>
                           (match (string_drop _s3732_ _s3733_) with
                            | _s3734_ =>
                               (sep_matches_prefix _s3734_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3735_ _) =>
                                   (match (string_drop _s3734_ _s3735_) with
                                    | _s3736_ =>
                                       (freg_name_matches_prefix _s3736_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3737_ _) =>
                                           (match (string_drop _s3736_ _s3737_) with
                                            | _s3738_ =>
                                               (sep_matches_prefix _s3738_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3739_ _) =>
                                                   (match (string_drop _s3738_ _s3739_) with
                                                    | _s3740_ =>
                                                       (frm_mnemonic_matches_prefix _s3740_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s3741_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3740_ _s3741_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_WU_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s3709_ (_s3710_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3710_ with
    | _s3711_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s3711_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_W_S, existT _ _s3712_ _) =>
           (match (string_drop _s3711_ _s3712_) with
            | _s3713_ =>
               (spc_matches_prefix _s3713_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3714_ _) =>
                   (match (string_drop _s3713_ _s3714_) with
                    | _s3715_ =>
                       (reg_name_matches_prefix _s3715_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3716_ _) =>
                           (match (string_drop _s3715_ _s3716_) with
                            | _s3717_ =>
                               (sep_matches_prefix _s3717_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3718_ _) =>
                                   (match (string_drop _s3717_ _s3718_) with
                                    | _s3719_ =>
                                       (freg_name_matches_prefix _s3719_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3720_ _) =>
                                           (match (string_drop _s3719_ _s3720_) with
                                            | _s3721_ =>
                                               (sep_matches_prefix _s3721_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3722_ _) =>
                                                   (match (string_drop _s3721_ _s3722_) with
                                                    | _s3723_ =>
                                                       (frm_mnemonic_matches_prefix _s3723_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s3724_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3723_ _s3724_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FCVT_W_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s3692_ (_s3693_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3693_ with
    | _s3694_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s3694_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSQRT_S, existT _ _s3695_ _) =>
           (match (string_drop _s3694_ _s3695_) with
            | _s3696_ =>
               (spc_matches_prefix _s3696_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3697_ _) =>
                   (match (string_drop _s3696_ _s3697_) with
                    | _s3698_ =>
                       (freg_name_matches_prefix _s3698_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3699_ _) =>
                           (match (string_drop _s3698_ _s3699_) with
                            | _s3700_ =>
                               (sep_matches_prefix _s3700_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3701_ _) =>
                                   (match (string_drop _s3700_ _s3701_) with
                                    | _s3702_ =>
                                       (freg_name_matches_prefix _s3702_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3703_ _) =>
                                           (match (string_drop _s3702_ _s3703_) with
                                            | _s3704_ =>
                                               (sep_matches_prefix _s3704_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3705_ _) =>
                                                   (match (string_drop _s3704_ _s3705_) with
                                                    | _s3706_ =>
                                                       (frm_mnemonic_matches_prefix _s3706_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s3707_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3706_ _s3707_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (FSQRT_S, rd, rs1, rm)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode))).

Definition _s3671_ (_s3672_ : string)
: M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3672_ with
    | _s3673_ =>
       (f_bin_rm_type_mnemonic_S_matches_prefix _s3673_) >>= fun w__0 : option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s3674_ _) =>
           (match (string_drop _s3673_ _s3674_) with
            | _s3675_ =>
               (spc_matches_prefix _s3675_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3676_ _) =>
                   (match (string_drop _s3675_ _s3676_) with
                    | _s3677_ =>
                       (freg_name_matches_prefix _s3677_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3678_ _) =>
                           (match (string_drop _s3677_ _s3678_) with
                            | _s3679_ =>
                               (sep_matches_prefix _s3679_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3680_ _) =>
                                   (match (string_drop _s3679_ _s3680_) with
                                    | _s3681_ =>
                                       (freg_name_matches_prefix _s3681_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3682_ _) =>
                                           (match (string_drop _s3681_ _s3682_) with
                                            | _s3683_ =>
                                               (sep_matches_prefix _s3683_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3684_ _) =>
                                                   (match (string_drop _s3683_ _s3684_) with
                                                    | _s3685_ =>
                                                       (freg_name_matches_prefix _s3685_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       (match w__6 with
                                                        | Some (rs2, existT _ _s3686_ _) =>
                                                           (match (string_drop _s3685_ _s3686_) with
                                                            | _s3687_ =>
                                                               (sep_matches_prefix _s3687_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                 0)})) =>
                                                               (match w__7 with
                                                                | Some (tt, existT _ _s3688_ _) =>
                                                                   (match (string_drop _s3687_
                                                                             _s3688_) with
                                                                    | _s3689_ =>
                                                                       (frm_mnemonic_matches_prefix
                                                                          _s3689_) >>= fun w__8 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                                         0)})) =>
                                                                       returnm (match w__8 with
                                                                                | Some
                                                                                  (rm, existT _ _s3690_ _) =>
                                                                                   let p0_ :=
                                                                                     string_drop
                                                                                       _s3689_
                                                                                       _s3690_ in
                                                                                   if generic_eq p0_
                                                                                        "" then
                                                                                     Some
                                                                                       (op, rd, rs1, rs2, rm)
                                                                                   else None
                                                                                | _ => None
                                                                                end)
                                                                    end)
                                                                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                | _ => returnm None
                                                                end)
                                                                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                            end)
                                                            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                        | _ => returnm None
                                                        end)
                                                        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                    end)
                                                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode))).

Definition _s3646_ (_s3647_ : string)
: M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode))) :=
   (match _s3647_ with
    | _s3648_ =>
       (f_madd_type_mnemonic_S_matches_prefix _s3648_) >>= fun w__0 : option ((f_madd_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s3649_ _) =>
           (match (string_drop _s3648_ _s3649_) with
            | _s3650_ =>
               (spc_matches_prefix _s3650_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3651_ _) =>
                   (match (string_drop _s3650_ _s3651_) with
                    | _s3652_ =>
                       (freg_name_matches_prefix _s3652_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3653_ _) =>
                           (match (string_drop _s3652_ _s3653_) with
                            | _s3654_ =>
                               (sep_matches_prefix _s3654_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3655_ _) =>
                                   (match (string_drop _s3654_ _s3655_) with
                                    | _s3656_ =>
                                       (freg_name_matches_prefix _s3656_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3657_ _) =>
                                           (match (string_drop _s3656_ _s3657_) with
                                            | _s3658_ =>
                                               (sep_matches_prefix _s3658_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3659_ _) =>
                                                   (match (string_drop _s3658_ _s3659_) with
                                                    | _s3660_ =>
                                                       (freg_name_matches_prefix _s3660_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       (match w__6 with
                                                        | Some (rs2, existT _ _s3661_ _) =>
                                                           (match (string_drop _s3660_ _s3661_) with
                                                            | _s3662_ =>
                                                               (sep_matches_prefix _s3662_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                 0)})) =>
                                                               (match w__7 with
                                                                | Some (tt, existT _ _s3663_ _) =>
                                                                   (match (string_drop _s3662_
                                                                             _s3663_) with
                                                                    | _s3664_ =>
                                                                       (freg_name_matches_prefix
                                                                          _s3664_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                         0)})) =>
                                                                       (match w__8 with
                                                                        | Some
                                                                          (rs3, existT _ _s3665_ _) =>
                                                                           (match (string_drop
                                                                                     _s3664_ _s3665_) with
                                                                            | _s3666_ =>
                                                                               (sep_matches_prefix
                                                                                  _s3666_) >>= fun w__9 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                 0)})) =>
                                                                               (match w__9 with
                                                                                | Some
                                                                                  (tt, existT _ _s3667_ _) =>
                                                                                   (match (string_drop
                                                                                             _s3666_
                                                                                             _s3667_) with
                                                                                    | _s3668_ =>
                                                                                       (frm_mnemonic_matches_prefix
                                                                                          _s3668_) >>= fun w__10 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                                                         0)})) =>
                                                                                       returnm (match w__10 with
                                                                                                | Some
                                                                                                  (rm, existT _ _s3669_ _) =>
                                                                                                   let p0_ :=
                                                                                                     string_drop
                                                                                                       _s3668_
                                                                                                       _s3669_ in
                                                                                                   if
                                                                                                     generic_eq
                                                                                                       p0_
                                                                                                       ""
                                                                                                   then
                                                                                                     Some
                                                                                                       (op, rd, rs1, rs2, rs3, rm)
                                                                                                   else
                                                                                                     None
                                                                                                | _ =>
                                                                                                   None
                                                                                                end)
                                                                                    end)
                                                                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                                | _ => returnm None
                                                                                end)
                                                                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                            end)
                                                                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                        | _ => returnm None
                                                                        end)
                                                                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                    end)
                                                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                                | _ => returnm None
                                                                end)
                                                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                            end)
                                                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                        | _ => returnm None
                                                        end)
                                                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                    end)
                                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                            end)
                                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                    end)
                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                                | _ => returnm None
                                end)
                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                            end)
                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                        | _ => returnm None
                        end)
                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                    end)
                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
                | _ => returnm None
                end)
                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
            end)
            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
        | _ => returnm None
        end)
        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)))
    end)
    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode))).

Definition _s3622_ (_s3623_ : string) : M (option ((word_width * mword 5 * mword 12 * mword 5))) :=
   let _s3624_ := _s3623_ in
   (if string_startswith _s3624_ "fs" then
      (match (string_drop _s3624_ (projT1 (string_length "fs"))) with
       | _s3625_ =>
          (size_mnemonic_matches_prefix _s3625_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (width, existT _ _s3626_ _) =>
              (match (string_drop _s3625_ _s3626_) with
               | _s3627_ =>
                  (spc_matches_prefix _s3627_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s3628_ _) =>
                      (match (string_drop _s3627_ _s3628_) with
                       | _s3629_ =>
                          (freg_name_matches_prefix _s3629_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rs2, existT _ _s3630_ _) =>
                              (match (string_drop _s3629_ _s3630_) with
                               | _s3631_ =>
                                  (sep_matches_prefix _s3631_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s3632_ _) =>
                                      (match (string_drop _s3631_ _s3632_) with
                                       | _s3633_ =>
                                          (match (hex_bits_12_matches_prefix _s3633_) with
                                           | Some (imm, existT _ _s3634_ _) =>
                                              (match (string_drop _s3633_ _s3634_) with
                                               | _s3635_ =>
                                                  (opt_spc_matches_prefix _s3635_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__4 with
                                                   | Some (tt, existT _ _s3636_ _) =>
                                                      let _s3637_ := string_drop _s3635_ _s3636_ in
                                                      (if string_startswith _s3637_ "(" then
                                                         (match (string_drop _s3637_
                                                                   (projT1
                                                                    (string_length "("))) with
                                                          | _s3638_ =>
                                                             (opt_spc_matches_prefix _s3638_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             (match w__5 with
                                                              | Some (tt, existT _ _s3639_ _) =>
                                                                 (match (string_drop _s3638_ _s3639_) with
                                                                  | _s3640_ =>
                                                                     (reg_name_matches_prefix
                                                                        _s3640_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                       0)})) =>
                                                                     (match w__6 with
                                                                      | Some
                                                                        (rs1, existT _ _s3641_ _) =>
                                                                         (match (string_drop _s3640_
                                                                                   _s3641_) with
                                                                          | _s3642_ =>
                                                                             (opt_spc_matches_prefix
                                                                                _s3642_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                               0)})) =>
                                                                             returnm (match w__7 with
                                                                                      | Some
                                                                                        (tt, existT _ _s3643_ _) =>
                                                                                         let _s3644_ :=
                                                                                           string_drop
                                                                                             _s3642_
                                                                                             _s3643_ in
                                                                                         if string_startswith
                                                                                              _s3644_
                                                                                              ")"
                                                                                         then
                                                                                           let p0_ :=
                                                                                             string_drop
                                                                                               _s3644_
                                                                                               (projT1
                                                                                                (string_length
                                                                                                   ")")) in
                                                                                           if generic_eq
                                                                                                p0_
                                                                                                ""
                                                                                           then
                                                                                             Some
                                                                                               (width, rs2, imm, rs1)
                                                                                           else None
                                                                                         else None
                                                                                      | _ => None
                                                                                      end)
                                                                          end)
                                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                                      | _ => returnm None
                                                                      end)
                                                                      : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                                  end)
                                                                  : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                              | _ => returnm None
                                                              end)
                                                              : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                          end)
                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                       else returnm None)
                                                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                               end)
                                               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
       end)
       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
    else returnm None)
    : M (option ((word_width * mword 5 * mword 12 * mword 5))).

Definition _s3598_ (_s3599_ : string) : M (option ((word_width * mword 5 * mword 12 * mword 5))) :=
   let _s3600_ := _s3599_ in
   (if string_startswith _s3600_ "fl" then
      (match (string_drop _s3600_ (projT1 (string_length "fl"))) with
       | _s3601_ =>
          (size_mnemonic_matches_prefix _s3601_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (width, existT _ _s3602_ _) =>
              (match (string_drop _s3601_ _s3602_) with
               | _s3603_ =>
                  (spc_matches_prefix _s3603_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s3604_ _) =>
                      (match (string_drop _s3603_ _s3604_) with
                       | _s3605_ =>
                          (freg_name_matches_prefix _s3605_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s3606_ _) =>
                              (match (string_drop _s3605_ _s3606_) with
                               | _s3607_ =>
                                  (sep_matches_prefix _s3607_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s3608_ _) =>
                                      (match (string_drop _s3607_ _s3608_) with
                                       | _s3609_ =>
                                          (match (hex_bits_12_matches_prefix _s3609_) with
                                           | Some (imm, existT _ _s3610_ _) =>
                                              (match (string_drop _s3609_ _s3610_) with
                                               | _s3611_ =>
                                                  (opt_spc_matches_prefix _s3611_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__4 with
                                                   | Some (tt, existT _ _s3612_ _) =>
                                                      let _s3613_ := string_drop _s3611_ _s3612_ in
                                                      (if string_startswith _s3613_ "(" then
                                                         (match (string_drop _s3613_
                                                                   (projT1
                                                                    (string_length "("))) with
                                                          | _s3614_ =>
                                                             (opt_spc_matches_prefix _s3614_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             (match w__5 with
                                                              | Some (tt, existT _ _s3615_ _) =>
                                                                 (match (string_drop _s3614_ _s3615_) with
                                                                  | _s3616_ =>
                                                                     (reg_name_matches_prefix
                                                                        _s3616_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                       0)})) =>
                                                                     (match w__6 with
                                                                      | Some
                                                                        (rs1, existT _ _s3617_ _) =>
                                                                         (match (string_drop _s3616_
                                                                                   _s3617_) with
                                                                          | _s3618_ =>
                                                                             (opt_spc_matches_prefix
                                                                                _s3618_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                               0)})) =>
                                                                             returnm (match w__7 with
                                                                                      | Some
                                                                                        (tt, existT _ _s3619_ _) =>
                                                                                         let _s3620_ :=
                                                                                           string_drop
                                                                                             _s3618_
                                                                                             _s3619_ in
                                                                                         if string_startswith
                                                                                              _s3620_
                                                                                              ")"
                                                                                         then
                                                                                           let p0_ :=
                                                                                             string_drop
                                                                                               _s3620_
                                                                                               (projT1
                                                                                                (string_length
                                                                                                   ")")) in
                                                                                           if generic_eq
                                                                                                p0_
                                                                                                ""
                                                                                           then
                                                                                             Some
                                                                                               (width, rd, imm, rs1)
                                                                                           else None
                                                                                         else None
                                                                                      | _ => None
                                                                                      end)
                                                                          end)
                                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                                      | _ => returnm None
                                                                      end)
                                                                      : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                                  end)
                                                                  : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                              | _ => returnm None
                                                              end)
                                                              : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                          end)
                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                       else returnm None)
                                                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                               end)
                                               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((word_width * mword 5 * mword 12 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * mword 5 * mword 12 * mword 5)))
       end)
       : M (option ((word_width * mword 5 * mword 12 * mword 5)))
    else returnm None)
    : M (option ((word_width * mword 5 * mword 12 * mword 5))).

Definition _s3586_ (_s3587_ : string) : M (option ((mword 5 * mword 5 * mword 12))) :=
   let _s3588_ := _s3587_ in
   (if string_startswith _s3588_ "fence.i.reserved." then
      (match (string_drop _s3588_ (projT1 (string_length "fence.i.reserved."))) with
       | _s3589_ =>
          (reg_name_matches_prefix _s3589_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (rd, existT _ _s3590_ _) =>
              let _s3591_ := string_drop _s3589_ _s3590_ in
              (if string_startswith _s3591_ "." then
                 (match (string_drop _s3591_ (projT1 (string_length "."))) with
                  | _s3592_ =>
                     (reg_name_matches_prefix _s3592_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                       0)})) =>
                     returnm (match w__1 with
                              | Some (rs, existT _ _s3593_ _) =>
                                 let _s3594_ := string_drop _s3592_ _s3593_ in
                                 if string_startswith _s3594_ "." then
                                   match (string_drop _s3594_ (projT1 (string_length "."))) with
                                   | _s3595_ =>
                                      match (hex_bits_12_matches_prefix _s3595_) with
                                      | Some (imm, existT _ _s3596_ _) =>
                                         let p0_ := string_drop _s3595_ _s3596_ in
                                         if generic_eq p0_ "" then Some (rd, rs, imm)
                                         else None
                                      | _ => None
                                      end
                                   end
                                 else None
                              | _ => None
                              end)
                  end)
                  : M (option ((mword 5 * mword 5 * mword 12)))
               else returnm None)
               : M (option ((mword 5 * mword 5 * mword 12)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 12)))
       end)
       : M (option ((mword 5 * mword 5 * mword 12)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 12))).

Definition _s3568_ (_s3569_ : string)
: M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4))) :=
   let _s3570_ := _s3569_ in
   (if string_startswith _s3570_ "fence.reserved." then
      (match (string_drop _s3570_ (projT1 (string_length "fence.reserved."))) with
       | _s3571_ =>
          (fence_bits_matches_prefix _s3571_) >>= fun w__0 : option ((mword 4 * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (pred, existT _ _s3572_ _) =>
              let _s3573_ := string_drop _s3571_ _s3572_ in
              (if string_startswith _s3573_ "." then
                 (match (string_drop _s3573_ (projT1 (string_length "."))) with
                  | _s3574_ =>
                     (fence_bits_matches_prefix _s3574_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >=?
                       0)})) =>
                     (match w__1 with
                      | Some (succ, existT _ _s3575_ _) =>
                         let _s3576_ := string_drop _s3574_ _s3575_ in
                         (if string_startswith _s3576_ "." then
                            (match (string_drop _s3576_ (projT1 (string_length "."))) with
                             | _s3577_ =>
                                (reg_name_matches_prefix _s3577_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                  0)})) =>
                                (match w__2 with
                                 | Some (rs, existT _ _s3578_ _) =>
                                    let _s3579_ := string_drop _s3577_ _s3578_ in
                                    (if string_startswith _s3579_ "." then
                                       (match (string_drop _s3579_ (projT1 (string_length "."))) with
                                        | _s3580_ =>
                                           (reg_name_matches_prefix _s3580_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                             0)})) =>
                                           returnm (match w__3 with
                                                    | Some (rd, existT _ _s3581_ _) =>
                                                       let _s3582_ := string_drop _s3580_ _s3581_ in
                                                       if string_startswith _s3582_ "." then
                                                         match (string_drop _s3582_
                                                                  (projT1
                                                                   (string_length "."))) with
                                                         | _s3583_ =>
                                                            match (hex_bits_4_matches_prefix _s3583_) with
                                                            | Some (fm, existT _ _s3584_ _) =>
                                                               let p0_ :=
                                                                 string_drop _s3583_ _s3584_ in
                                                               if generic_eq p0_ "" then
                                                                 Some (pred, succ, rs, rd, fm)
                                                               else None
                                                            | _ => None
                                                            end
                                                         end
                                                       else None
                                                    | _ => None
                                                    end)
                                        end)
                                        : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                                     else returnm None)
                                     : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                                 | _ => returnm None
                                 end)
                                 : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                             end)
                             : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                          else returnm None)
                          : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                      | _ => returnm None
                      end)
                      : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
                  end)
                  : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
               else returnm None)
               : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
           | _ => returnm None
           end)
           : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
       end)
       : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)))
    else returnm None)
    : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4))).

Definition _s3562_ (_s3563_ : string) : M (option (mword 3)) :=
   let _s3564_ := _s3563_ in
   (if string_startswith _s3564_ "c.srai.hint." then
      (match (string_drop _s3564_ (projT1 (string_length "c.srai.hint."))) with
       | _s3565_ =>
          (creg_name_matches_prefix _s3565_) >>= fun w__0 : option ((mword 3 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s3566_ _) =>
                      let p0_ := string_drop _s3565_ _s3566_ in
                      if generic_eq p0_ "" then Some rsd
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 3))
    else returnm None)
    : M (option (mword 3)).

Definition _s3556_ (_s3557_ : string) : M (option (mword 3)) :=
   let _s3558_ := _s3557_ in
   (if string_startswith _s3558_ "c.srli.hint." then
      (match (string_drop _s3558_ (projT1 (string_length "c.srli.hint."))) with
       | _s3559_ =>
          (creg_name_matches_prefix _s3559_) >>= fun w__0 : option ((mword 3 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s3560_ _) =>
                      let p0_ := string_drop _s3559_ _s3560_ in
                      if generic_eq p0_ "" then Some rsd
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 3))
    else returnm None)
    : M (option (mword 3)).

Definition _s3547_ (_s3548_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3549_ := _s3548_ in
   (if string_startswith _s3549_ "c.slli.hint." then
      (match (string_drop _s3549_ (projT1 (string_length "c.slli.hint."))) with
       | _s3550_ =>
          (reg_name_matches_prefix _s3550_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s3551_ _) =>
                      let _s3552_ := string_drop _s3550_ _s3551_ in
                      if string_startswith _s3552_ "." then
                        match (string_drop _s3552_ (projT1 (string_length "."))) with
                        | _s3553_ =>
                           match (hex_bits_6_matches_prefix _s3553_) with
                           | Some (shamt, existT _ _s3554_ _) =>
                              let p0_ := string_drop _s3553_ _s3554_ in
                              if generic_eq p0_ "" then Some (rsd, shamt)
                              else None
                           | _ => None
                           end
                        end
                      else None
                   | _ => None
                   end)
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3541_ (_s3542_ : string) : M (option (mword 5)) :=
   let _s3543_ := _s3542_ in
   (if string_startswith _s3543_ "c.add.hint." then
      (match (string_drop _s3543_ (projT1 (string_length "c.add.hint."))) with
       | _s3544_ =>
          (reg_name_matches_prefix _s3544_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rs2, existT _ _s3545_ _) =>
                      let p0_ := string_drop _s3544_ _s3545_ in
                      if generic_eq p0_ "" then Some rs2
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s3535_ (_s3536_ : string) : M (option (mword 5)) :=
   let _s3537_ := _s3536_ in
   (if string_startswith _s3537_ "c.mv.hint." then
      (match (string_drop _s3537_ (projT1 (string_length "c.mv.hint."))) with
       | _s3538_ =>
          (reg_name_matches_prefix _s3538_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rs2, existT _ _s3539_ _) =>
                      let p0_ := string_drop _s3538_ _s3539_ in
                      if generic_eq p0_ "" then Some rs2
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s3529_ (_s3530_ : string) : option (mword 6) :=
   let _s3531_ := _s3530_ in
   if string_startswith _s3531_ "c.lui.hint." then
     match (string_drop _s3531_ (projT1 (string_length "c.lui.hint."))) with
     | _s3532_ =>
        match (hex_bits_6_matches_prefix _s3532_) with
        | Some (imm, existT _ _s3533_ _) =>
           let p0_ := string_drop _s3532_ _s3533_ in
           if generic_eq p0_ "" then Some imm
           else None
        | _ => None
        end
     end
   else None.

Definition _s3523_ (_s3524_ : string) : option (mword 6) :=
   let _s3525_ := _s3524_ in
   if string_startswith _s3525_ "c.li.hint." then
     match (string_drop _s3525_ (projT1 (string_length "c.li.hint."))) with
     | _s3526_ =>
        match (hex_bits_6_matches_prefix _s3526_) with
        | Some (imm, existT _ _s3527_ _) =>
           let p0_ := string_drop _s3526_ _s3527_ in
           if generic_eq p0_ "" then Some imm
           else None
        | _ => None
        end
     end
   else None.

Definition _s3517_ (_s3518_ : string) : M (option (mword 5)) :=
   let _s3519_ := _s3518_ in
   (if string_startswith _s3519_ "c.addi.hint." then
      (match (string_drop _s3519_ (projT1 (string_length "c.addi.hint."))) with
       | _s3520_ =>
          (reg_name_matches_prefix _s3520_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s3521_ _) =>
                      let p0_ := string_drop _s3520_ _s3521_ in
                      if generic_eq p0_ "" then Some rsd
                      else None
                   | _ => None
                   end)
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s3511_ (_s3512_ : string) : option (mword 6) :=
   let _s3513_ := _s3512_ in
   if string_startswith _s3513_ "c.nop.hint." then
     match (string_drop _s3513_ (projT1 (string_length "c.nop.hint."))) with
     | _s3514_ =>
        match (hex_bits_6_matches_prefix _s3514_) with
        | Some (imm, existT _ _s3515_ _) =>
           let p0_ := string_drop _s3514_ _s3515_ in
           if generic_eq p0_ "" then Some imm
           else None
        | _ => None
        end
     end
   else None.

Definition _s3494_ (_s3495_ : string) : M (option ((csrop * mword 5 * mword 12 * mword 5))) :=
   (match _s3495_ with
    | _s3496_ =>
       (csr_mnemonic_matches_prefix _s3496_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s3497_ _) =>
           (match (string_drop _s3496_ _s3497_) with
            | _s3498_ =>
               (spc_matches_prefix _s3498_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3499_ _) =>
                   (match (string_drop _s3498_ _s3499_) with
                    | _s3500_ =>
                       (reg_name_matches_prefix _s3500_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3501_ _) =>
                           (match (string_drop _s3500_ _s3501_) with
                            | _s3502_ =>
                               (sep_matches_prefix _s3502_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3503_ _) =>
                                   (match (string_drop _s3502_ _s3503_) with
                                    | _s3504_ =>
                                       (csr_name_map_matches_prefix _s3504_) >>= fun w__4 : option ((mword 12 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (csr, existT _ _s3505_ _) =>
                                           (match (string_drop _s3504_ _s3505_) with
                                            | _s3506_ =>
                                               (sep_matches_prefix _s3506_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3507_ _) =>
                                                   (match (string_drop _s3506_ _s3507_) with
                                                    | _s3508_ =>
                                                       (reg_name_matches_prefix _s3508_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs1, existT _ _s3509_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3508_ _s3509_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (op, rd, csr, rs1)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                            end)
                                            : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                    end)
                                    : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                            end)
                            : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                    end)
                    : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((csrop * mword 5 * mword 12 * mword 5)))
            end)
            : M (option ((csrop * mword 5 * mword 12 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((csrop * mword 5 * mword 12 * mword 5)))
    end)
    : M (option ((csrop * mword 5 * mword 12 * mword 5))).

Definition _s3476_ (_s3477_ : string) : M (option ((csrop * mword 5 * mword 12 * mword 5))) :=
   (match _s3477_ with
    | _s3478_ =>
       (csr_mnemonic_matches_prefix _s3478_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s3479_ _) =>
           let _s3480_ := string_drop _s3478_ _s3479_ in
           (if string_startswith _s3480_ "i" then
              (match (string_drop _s3480_ (projT1 (string_length "i"))) with
               | _s3481_ =>
                  (spc_matches_prefix _s3481_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s3482_ _) =>
                      (match (string_drop _s3481_ _s3482_) with
                       | _s3483_ =>
                          (reg_name_matches_prefix _s3483_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s3484_ _) =>
                              (match (string_drop _s3483_ _s3484_) with
                               | _s3485_ =>
                                  (sep_matches_prefix _s3485_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s3486_ _) =>
                                      (match (string_drop _s3485_ _s3486_) with
                                       | _s3487_ =>
                                          (csr_name_map_matches_prefix _s3487_) >>= fun w__4 : option ((mword 12 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (csr, existT _ _s3488_ _) =>
                                              (match (string_drop _s3487_ _s3488_) with
                                               | _s3489_ =>
                                                  (sep_matches_prefix _s3489_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  returnm (match w__5 with
                                                           | Some (tt, existT _ _s3490_ _) =>
                                                              match (string_drop _s3489_ _s3490_) with
                                                              | _s3491_ =>
                                                                 match (hex_bits_5_matches_prefix
                                                                          _s3491_) with
                                                                 | Some (rs1, existT _ _s3492_ _) =>
                                                                    let p0_ :=
                                                                      string_drop _s3491_ _s3492_ in
                                                                    if generic_eq p0_ "" then
                                                                      Some (op, rd, csr, rs1)
                                                                    else None
                                                                 | _ => None
                                                                 end
                                                              end
                                                           | _ => None
                                                           end)
                                               end)
                                               : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((csrop * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((csrop * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((csrop * mword 5 * mword 12 * mword 5)))
            else returnm None)
            : M (option ((csrop * mword 5 * mword 12 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((csrop * mword 5 * mword 12 * mword 5)))
    end)
    : M (option ((csrop * mword 5 * mword 12 * mword 5))).

Definition _s3457_ (_s3458_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5))) :=
   let _s3459_ := _s3458_ in
   (if string_startswith _s3459_ "rem" then
      (match (string_drop _s3459_ (projT1 (string_length "rem"))) with
       | _s3460_ =>
          (maybe_not_u_matches_prefix _s3460_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s3461_ _) =>
              let _s3462_ := string_drop _s3460_ _s3461_ in
              (if string_startswith _s3462_ "w" then
                 (match (string_drop _s3462_ (projT1 (string_length "w"))) with
                  | _s3463_ =>
                     (spc_matches_prefix _s3463_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                       0)})) =>
                     (match w__1 with
                      | Some (tt, existT _ _s3464_ _) =>
                         (match (string_drop _s3463_ _s3464_) with
                          | _s3465_ =>
                             (reg_name_matches_prefix _s3465_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                               0)})) =>
                             (match w__2 with
                              | Some (rd, existT _ _s3466_ _) =>
                                 (match (string_drop _s3465_ _s3466_) with
                                  | _s3467_ =>
                                     (sep_matches_prefix _s3467_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                       0)})) =>
                                     (match w__3 with
                                      | Some (tt, existT _ _s3468_ _) =>
                                         (match (string_drop _s3467_ _s3468_) with
                                          | _s3469_ =>
                                             (reg_name_matches_prefix _s3469_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                               0)})) =>
                                             (match w__4 with
                                              | Some (rs1, existT _ _s3470_ _) =>
                                                 (match (string_drop _s3469_ _s3470_) with
                                                  | _s3471_ =>
                                                     (sep_matches_prefix _s3471_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                       0)})) =>
                                                     (match w__5 with
                                                      | Some (tt, existT _ _s3472_ _) =>
                                                         (match (string_drop _s3471_ _s3472_) with
                                                          | _s3473_ =>
                                                             (reg_name_matches_prefix _s3473_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             returnm (match w__6 with
                                                                      | Some
                                                                        (rs2, existT _ _s3474_ _) =>
                                                                         let p0_ :=
                                                                           string_drop _s3473_
                                                                             _s3474_ in
                                                                         if generic_eq p0_ "" then
                                                                           Some (s, rd, rs1, rs2)
                                                                         else None
                                                                      | _ => None
                                                                      end)
                                                          end)
                                                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                      | _ => returnm None
                                                      end)
                                                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                  end)
                                                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                              | _ => returnm None
                                              end)
                                              : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                          end)
                                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                      | _ => returnm None
                                      end)
                                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                  end)
                                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
                              | _ => returnm None
                              end)
                              : M (option ((bool * mword 5 * mword 5 * mword 5)))
                          end)
                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                      | _ => returnm None
                      end)
                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                  end)
                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
               else returnm None)
               : M (option ((bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5))).

Definition _s3438_ (_s3439_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5))) :=
   let _s3440_ := _s3439_ in
   (if string_startswith _s3440_ "div" then
      (match (string_drop _s3440_ (projT1 (string_length "div"))) with
       | _s3441_ =>
          (maybe_not_u_matches_prefix _s3441_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s3442_ _) =>
              let _s3443_ := string_drop _s3441_ _s3442_ in
              (if string_startswith _s3443_ "w" then
                 (match (string_drop _s3443_ (projT1 (string_length "w"))) with
                  | _s3444_ =>
                     (spc_matches_prefix _s3444_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                       0)})) =>
                     (match w__1 with
                      | Some (tt, existT _ _s3445_ _) =>
                         (match (string_drop _s3444_ _s3445_) with
                          | _s3446_ =>
                             (reg_name_matches_prefix _s3446_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                               0)})) =>
                             (match w__2 with
                              | Some (rd, existT _ _s3447_ _) =>
                                 (match (string_drop _s3446_ _s3447_) with
                                  | _s3448_ =>
                                     (sep_matches_prefix _s3448_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                       0)})) =>
                                     (match w__3 with
                                      | Some (tt, existT _ _s3449_ _) =>
                                         (match (string_drop _s3448_ _s3449_) with
                                          | _s3450_ =>
                                             (reg_name_matches_prefix _s3450_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                               0)})) =>
                                             (match w__4 with
                                              | Some (rs1, existT _ _s3451_ _) =>
                                                 (match (string_drop _s3450_ _s3451_) with
                                                  | _s3452_ =>
                                                     (sep_matches_prefix _s3452_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                       0)})) =>
                                                     (match w__5 with
                                                      | Some (tt, existT _ _s3453_ _) =>
                                                         (match (string_drop _s3452_ _s3453_) with
                                                          | _s3454_ =>
                                                             (reg_name_matches_prefix _s3454_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             returnm (match w__6 with
                                                                      | Some
                                                                        (rs2, existT _ _s3455_ _) =>
                                                                         let p0_ :=
                                                                           string_drop _s3454_
                                                                             _s3455_ in
                                                                         if generic_eq p0_ "" then
                                                                           Some (s, rd, rs1, rs2)
                                                                         else None
                                                                      | _ => None
                                                                      end)
                                                          end)
                                                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                      | _ => returnm None
                                                      end)
                                                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                  end)
                                                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                              | _ => returnm None
                                              end)
                                              : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                          end)
                                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                      | _ => returnm None
                                      end)
                                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                  end)
                                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
                              | _ => returnm None
                              end)
                              : M (option ((bool * mword 5 * mword 5 * mword 5)))
                          end)
                          : M (option ((bool * mword 5 * mword 5 * mword 5)))
                      | _ => returnm None
                      end)
                      : M (option ((bool * mword 5 * mword 5 * mword 5)))
                  end)
                  : M (option ((bool * mword 5 * mword 5 * mword 5)))
               else returnm None)
               : M (option ((bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5))).

Definition _s3422_ (_s3423_ : string) : M (option ((mword 5 * mword 5 * mword 5))) :=
   let _s3424_ := _s3423_ in
   (if string_startswith _s3424_ "mulw" then
      (match (string_drop _s3424_ (projT1 (string_length "mulw"))) with
       | _s3425_ =>
          (spc_matches_prefix _s3425_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3426_ _) =>
              (match (string_drop _s3425_ _s3426_) with
               | _s3427_ =>
                  (reg_name_matches_prefix _s3427_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s3428_ _) =>
                      (match (string_drop _s3427_ _s3428_) with
                       | _s3429_ =>
                          (sep_matches_prefix _s3429_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3430_ _) =>
                              (match (string_drop _s3429_ _s3430_) with
                               | _s3431_ =>
                                  (reg_name_matches_prefix _s3431_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rs1, existT _ _s3432_ _) =>
                                      (match (string_drop _s3431_ _s3432_) with
                                       | _s3433_ =>
                                          (sep_matches_prefix _s3433_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (tt, existT _ _s3434_ _) =>
                                              (match (string_drop _s3433_ _s3434_) with
                                               | _s3435_ =>
                                                  (reg_name_matches_prefix _s3435_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  returnm (match w__5 with
                                                           | Some (rs2, existT _ _s3436_ _) =>
                                                              let p0_ := string_drop _s3435_ _s3436_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rd, rs1, rs2)
                                                              else None
                                                           | _ => None
                                                           end)
                                               end)
                                               : M (option ((mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 5))).

Definition _s3404_ (_s3405_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5))) :=
   let _s3406_ := _s3405_ in
   (if string_startswith _s3406_ "rem" then
      (match (string_drop _s3406_ (projT1 (string_length "rem"))) with
       | _s3407_ =>
          (maybe_not_u_matches_prefix _s3407_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s3408_ _) =>
              (match (string_drop _s3407_ _s3408_) with
               | _s3409_ =>
                  (spc_matches_prefix _s3409_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s3410_ _) =>
                      (match (string_drop _s3409_ _s3410_) with
                       | _s3411_ =>
                          (reg_name_matches_prefix _s3411_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s3412_ _) =>
                              (match (string_drop _s3411_ _s3412_) with
                               | _s3413_ =>
                                  (sep_matches_prefix _s3413_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s3414_ _) =>
                                      (match (string_drop _s3413_ _s3414_) with
                                       | _s3415_ =>
                                          (reg_name_matches_prefix _s3415_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rs1, existT _ _s3416_ _) =>
                                              (match (string_drop _s3415_ _s3416_) with
                                               | _s3417_ =>
                                                  (sep_matches_prefix _s3417_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s3418_ _) =>
                                                      (match (string_drop _s3417_ _s3418_) with
                                                       | _s3419_ =>
                                                          (reg_name_matches_prefix _s3419_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          returnm (match w__6 with
                                                                   | Some (rs2, existT _ _s3420_ _) =>
                                                                      let p0_ :=
                                                                        string_drop _s3419_ _s3420_ in
                                                                      if generic_eq p0_ "" then
                                                                        Some (s, rd, rs1, rs2)
                                                                      else None
                                                                   | _ => None
                                                                   end)
                                                       end)
                                                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                               end)
                                               : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((bool * mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((bool * mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5))).

Definition _s3386_ (_s3387_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5))) :=
   let _s3388_ := _s3387_ in
   (if string_startswith _s3388_ "div" then
      (match (string_drop _s3388_ (projT1 (string_length "div"))) with
       | _s3389_ =>
          (maybe_not_u_matches_prefix _s3389_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s3390_ _) =>
              (match (string_drop _s3389_ _s3390_) with
               | _s3391_ =>
                  (spc_matches_prefix _s3391_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s3392_ _) =>
                      (match (string_drop _s3391_ _s3392_) with
                       | _s3393_ =>
                          (reg_name_matches_prefix _s3393_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s3394_ _) =>
                              (match (string_drop _s3393_ _s3394_) with
                               | _s3395_ =>
                                  (sep_matches_prefix _s3395_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s3396_ _) =>
                                      (match (string_drop _s3395_ _s3396_) with
                                       | _s3397_ =>
                                          (reg_name_matches_prefix _s3397_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rs1, existT _ _s3398_ _) =>
                                              (match (string_drop _s3397_ _s3398_) with
                                               | _s3399_ =>
                                                  (sep_matches_prefix _s3399_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s3400_ _) =>
                                                      (match (string_drop _s3399_ _s3400_) with
                                                       | _s3401_ =>
                                                          (reg_name_matches_prefix _s3401_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          returnm (match w__6 with
                                                                   | Some (rs2, existT _ _s3402_ _) =>
                                                                      let p0_ :=
                                                                        string_drop _s3401_ _s3402_ in
                                                                      if generic_eq p0_ "" then
                                                                        Some (s, rd, rs1, rs2)
                                                                      else None
                                                                   | _ => None
                                                                   end)
                                                       end)
                                                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                               end)
                                               : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((bool * mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((bool * mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((bool * mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((bool * mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5))).

Definition _s3369_ (_s3370_ : string)
: M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))) :=
   (match _s3370_ with
    | _s3371_ =>
       (mul_mnemonic_matches_prefix _s3371_) >>= fun w__0 : option (((bool * bool * bool) * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some ((high, signed1, signed2), existT _ _s3372_ _) =>
           (match (string_drop _s3371_ _s3372_) with
            | _s3373_ =>
               (spc_matches_prefix _s3373_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s3374_ _) =>
                   (match (string_drop _s3373_ _s3374_) with
                    | _s3375_ =>
                       (reg_name_matches_prefix _s3375_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s3376_ _) =>
                           (match (string_drop _s3375_ _s3376_) with
                            | _s3377_ =>
                               (sep_matches_prefix _s3377_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s3378_ _) =>
                                   (match (string_drop _s3377_ _s3378_) with
                                    | _s3379_ =>
                                       (reg_name_matches_prefix _s3379_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s3380_ _) =>
                                           (match (string_drop _s3379_ _s3380_) with
                                            | _s3381_ =>
                                               (sep_matches_prefix _s3381_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s3382_ _) =>
                                                   (match (string_drop _s3381_ _s3382_) with
                                                    | _s3383_ =>
                                                       (reg_name_matches_prefix _s3383_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s3384_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s3383_ _s3384_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some
                                                                       (high, signed1, signed2, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5))).

Definition _s3357_ (_s3358_ : string) : M (option ((mword 5 * mword 5))) :=
   let _s3359_ := _s3358_ in
   (if string_startswith _s3359_ "c.add" then
      (match (string_drop _s3359_ (projT1 (string_length "c.add"))) with
       | _s3360_ =>
          (spc_matches_prefix _s3360_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3361_ _) =>
              (match (string_drop _s3360_ _s3361_) with
               | _s3362_ =>
                  (reg_name_matches_prefix _s3362_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3363_ _) =>
                      (match (string_drop _s3362_ _s3363_) with
                       | _s3364_ =>
                          (sep_matches_prefix _s3364_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3365_ _) =>
                              (match (string_drop _s3364_ _s3365_) with
                               | _s3366_ =>
                                  (reg_name_matches_prefix _s3366_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s3367_ _) =>
                                              let p0_ := string_drop _s3366_ _s3367_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5)))
                       end)
                       : M (option ((mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5)))
               end)
               : M (option ((mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5)))
       end)
       : M (option ((mword 5 * mword 5)))
    else returnm None)
    : M (option ((mword 5 * mword 5))).

Definition _s3345_ (_s3346_ : string) : M (option ((mword 5 * mword 5))) :=
   let _s3347_ := _s3346_ in
   (if string_startswith _s3347_ "c.mv" then
      (match (string_drop _s3347_ (projT1 (string_length "c.mv"))) with
       | _s3348_ =>
          (spc_matches_prefix _s3348_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3349_ _) =>
              (match (string_drop _s3348_ _s3349_) with
               | _s3350_ =>
                  (reg_name_matches_prefix _s3350_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s3351_ _) =>
                      (match (string_drop _s3350_ _s3351_) with
                       | _s3352_ =>
                          (sep_matches_prefix _s3352_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3353_ _) =>
                              (match (string_drop _s3352_ _s3353_) with
                               | _s3354_ =>
                                  (reg_name_matches_prefix _s3354_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s3355_ _) =>
                                              let p0_ := string_drop _s3354_ _s3355_ in
                                              if generic_eq p0_ "" then Some (rd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5)))
                       end)
                       : M (option ((mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5)))
               end)
               : M (option ((mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5)))
       end)
       : M (option ((mword 5 * mword 5)))
    else returnm None)
    : M (option ((mword 5 * mword 5))).

Definition _s3337_ (_s3338_ : string) : M (option (mword 5)) :=
   let _s3339_ := _s3338_ in
   (if string_startswith _s3339_ "c.jalr" then
      (match (string_drop _s3339_ (projT1 (string_length "c.jalr"))) with
       | _s3340_ =>
          (spc_matches_prefix _s3340_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3341_ _) =>
              (match (string_drop _s3340_ _s3341_) with
               | _s3342_ =>
                  (reg_name_matches_prefix _s3342_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  returnm (match w__1 with
                           | Some (rs1, existT _ _s3343_ _) =>
                              let p0_ := string_drop _s3342_ _s3343_ in
                              if generic_eq p0_ "" then Some rs1
                              else None
                           | _ => None
                           end)
               end)
               : M (option (mword 5))
           | _ => returnm None
           end)
           : M (option (mword 5))
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s3329_ (_s3330_ : string) : M (option (mword 5)) :=
   let _s3331_ := _s3330_ in
   (if string_startswith _s3331_ "c.jr" then
      (match (string_drop _s3331_ (projT1 (string_length "c.jr"))) with
       | _s3332_ =>
          (spc_matches_prefix _s3332_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3333_ _) =>
              (match (string_drop _s3332_ _s3333_) with
               | _s3334_ =>
                  (reg_name_matches_prefix _s3334_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  returnm (match w__1 with
                           | Some (rs1, existT _ _s3335_ _) =>
                              let p0_ := string_drop _s3334_ _s3335_ in
                              if generic_eq p0_ "" then Some rs1
                              else None
                           | _ => None
                           end)
               end)
               : M (option (mword 5))
           | _ => returnm None
           end)
           : M (option (mword 5))
       end)
       : M (option (mword 5))
    else returnm None)
    : M (option (mword 5)).

Definition _s3317_ (_s3318_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3319_ := _s3318_ in
   (if string_startswith _s3319_ "c.sdsp" then
      (match (string_drop _s3319_ (projT1 (string_length "c.sdsp"))) with
       | _s3320_ =>
          (spc_matches_prefix _s3320_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3321_ _) =>
              (match (string_drop _s3320_ _s3321_) with
               | _s3322_ =>
                  (reg_name_matches_prefix _s3322_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs2, existT _ _s3323_ _) =>
                      (match (string_drop _s3322_ _s3323_) with
                       | _s3324_ =>
                          (sep_matches_prefix _s3324_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3325_ _) =>
                                      match (string_drop _s3324_ _s3325_) with
                                      | _s3326_ =>
                                         match (hex_bits_6_matches_prefix _s3326_) with
                                         | Some (uimm, existT _ _s3327_ _) =>
                                            let p0_ := string_drop _s3326_ _s3327_ in
                                            if generic_eq p0_ "" then Some (rs2, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3305_ (_s3306_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3307_ := _s3306_ in
   (if string_startswith _s3307_ "c.swsp" then
      (match (string_drop _s3307_ (projT1 (string_length "c.swsp"))) with
       | _s3308_ =>
          (spc_matches_prefix _s3308_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3309_ _) =>
              (match (string_drop _s3308_ _s3309_) with
               | _s3310_ =>
                  (reg_name_matches_prefix _s3310_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s3311_ _) =>
                      (match (string_drop _s3310_ _s3311_) with
                       | _s3312_ =>
                          (sep_matches_prefix _s3312_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3313_ _) =>
                                      match (string_drop _s3312_ _s3313_) with
                                      | _s3314_ =>
                                         match (hex_bits_6_matches_prefix _s3314_) with
                                         | Some (uimm, existT _ _s3315_ _) =>
                                            let p0_ := string_drop _s3314_ _s3315_ in
                                            if generic_eq p0_ "" then Some (rd, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3293_ (_s3294_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3295_ := _s3294_ in
   (if string_startswith _s3295_ "c.ldsp" then
      (match (string_drop _s3295_ (projT1 (string_length "c.ldsp"))) with
       | _s3296_ =>
          (spc_matches_prefix _s3296_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3297_ _) =>
              (match (string_drop _s3296_ _s3297_) with
               | _s3298_ =>
                  (reg_name_matches_prefix _s3298_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s3299_ _) =>
                      (match (string_drop _s3298_ _s3299_) with
                       | _s3300_ =>
                          (sep_matches_prefix _s3300_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3301_ _) =>
                                      match (string_drop _s3300_ _s3301_) with
                                      | _s3302_ =>
                                         match (hex_bits_6_matches_prefix _s3302_) with
                                         | Some (uimm, existT _ _s3303_ _) =>
                                            let p0_ := string_drop _s3302_ _s3303_ in
                                            if generic_eq p0_ "" then Some (rd, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3281_ (_s3282_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3283_ := _s3282_ in
   (if string_startswith _s3283_ "c.lwsp" then
      (match (string_drop _s3283_ (projT1 (string_length "c.lwsp"))) with
       | _s3284_ =>
          (spc_matches_prefix _s3284_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3285_ _) =>
              (match (string_drop _s3284_ _s3285_) with
               | _s3286_ =>
                  (reg_name_matches_prefix _s3286_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s3287_ _) =>
                      (match (string_drop _s3286_ _s3287_) with
                       | _s3288_ =>
                          (sep_matches_prefix _s3288_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3289_ _) =>
                                      match (string_drop _s3288_ _s3289_) with
                                      | _s3290_ =>
                                         match (hex_bits_6_matches_prefix _s3290_) with
                                         | Some (uimm, existT _ _s3291_ _) =>
                                            let p0_ := string_drop _s3290_ _s3291_ in
                                            if generic_eq p0_ "" then Some (rd, uimm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3269_ (_s3270_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3271_ := _s3270_ in
   (if string_startswith _s3271_ "c.slli" then
      (match (string_drop _s3271_ (projT1 (string_length "c.slli"))) with
       | _s3272_ =>
          (spc_matches_prefix _s3272_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3273_ _) =>
              (match (string_drop _s3272_ _s3273_) with
               | _s3274_ =>
                  (reg_name_matches_prefix _s3274_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3275_ _) =>
                      (match (string_drop _s3274_ _s3275_) with
                       | _s3276_ =>
                          (sep_matches_prefix _s3276_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3277_ _) =>
                                      match (string_drop _s3276_ _s3277_) with
                                      | _s3278_ =>
                                         match (hex_bits_6_matches_prefix _s3278_) with
                                         | Some (shamt, existT _ _s3279_ _) =>
                                            let p0_ := string_drop _s3278_ _s3279_ in
                                            if generic_eq p0_ "" then Some (rsd, shamt)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3257_ (_s3258_ : string) : M (option ((mword 3 * mword 8))) :=
   let _s3259_ := _s3258_ in
   (if string_startswith _s3259_ "c.bnez" then
      (match (string_drop _s3259_ (projT1 (string_length "c.bnez"))) with
       | _s3260_ =>
          (spc_matches_prefix _s3260_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3261_ _) =>
              (match (string_drop _s3260_ _s3261_) with
               | _s3262_ =>
                  (creg_name_matches_prefix _s3262_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs, existT _ _s3263_ _) =>
                      (match (string_drop _s3262_ _s3263_) with
                       | _s3264_ =>
                          (sep_matches_prefix _s3264_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3265_ _) =>
                                      match (string_drop _s3264_ _s3265_) with
                                      | _s3266_ =>
                                         match (hex_bits_8_matches_prefix _s3266_) with
                                         | Some (imm, existT _ _s3267_ _) =>
                                            let p0_ := string_drop _s3266_ _s3267_ in
                                            if generic_eq p0_ "" then Some (rs, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 8)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 8)))
               end)
               : M (option ((mword 3 * mword 8)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 8)))
       end)
       : M (option ((mword 3 * mword 8)))
    else returnm None)
    : M (option ((mword 3 * mword 8))).

Definition _s3245_ (_s3246_ : string) : M (option ((mword 3 * mword 8))) :=
   let _s3247_ := _s3246_ in
   (if string_startswith _s3247_ "c.beqz" then
      (match (string_drop _s3247_ (projT1 (string_length "c.beqz"))) with
       | _s3248_ =>
          (spc_matches_prefix _s3248_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3249_ _) =>
              (match (string_drop _s3248_ _s3249_) with
               | _s3250_ =>
                  (creg_name_matches_prefix _s3250_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs, existT _ _s3251_ _) =>
                      (match (string_drop _s3250_ _s3251_) with
                       | _s3252_ =>
                          (sep_matches_prefix _s3252_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3253_ _) =>
                                      match (string_drop _s3252_ _s3253_) with
                                      | _s3254_ =>
                                         match (hex_bits_8_matches_prefix _s3254_) with
                                         | Some (imm, existT _ _s3255_ _) =>
                                            let p0_ := string_drop _s3254_ _s3255_ in
                                            if generic_eq p0_ "" then Some (rs, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 8)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 8)))
               end)
               : M (option ((mword 3 * mword 8)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 8)))
       end)
       : M (option ((mword 3 * mword 8)))
    else returnm None)
    : M (option ((mword 3 * mword 8))).

Definition _s3237_ (_s3238_ : string) : M (option (mword 11)) :=
   let _s3239_ := _s3238_ in
   (if string_startswith _s3239_ "c.j" then
      (match (string_drop _s3239_ (projT1 (string_length "c.j"))) with
       | _s3240_ =>
          (spc_matches_prefix _s3240_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s3241_ _) =>
                      match (string_drop _s3240_ _s3241_) with
                      | _s3242_ =>
                         match (hex_bits_11_matches_prefix _s3242_) with
                         | Some (imm, existT _ _s3243_ _) =>
                            let p0_ := string_drop _s3242_ _s3243_ in
                            if generic_eq p0_ "" then Some imm
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 11))
    else returnm None)
    : M (option (mword 11)).

Definition _s3225_ (_s3226_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s3227_ := _s3226_ in
   (if string_startswith _s3227_ "c.addw" then
      (match (string_drop _s3227_ (projT1 (string_length "c.addw"))) with
       | _s3228_ =>
          (spc_matches_prefix _s3228_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3229_ _) =>
              (match (string_drop _s3228_ _s3229_) with
               | _s3230_ =>
                  (creg_name_matches_prefix _s3230_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3231_ _) =>
                      (match (string_drop _s3230_ _s3231_) with
                       | _s3232_ =>
                          (sep_matches_prefix _s3232_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3233_ _) =>
                              (match (string_drop _s3232_ _s3233_) with
                               | _s3234_ =>
                                  (creg_name_matches_prefix _s3234_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s3235_ _) =>
                                              let p0_ := string_drop _s3234_ _s3235_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s3213_ (_s3214_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s3215_ := _s3214_ in
   (if string_startswith _s3215_ "c.subw" then
      (match (string_drop _s3215_ (projT1 (string_length "c.subw"))) with
       | _s3216_ =>
          (spc_matches_prefix _s3216_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3217_ _) =>
              (match (string_drop _s3216_ _s3217_) with
               | _s3218_ =>
                  (creg_name_matches_prefix _s3218_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3219_ _) =>
                      (match (string_drop _s3218_ _s3219_) with
                       | _s3220_ =>
                          (sep_matches_prefix _s3220_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3221_ _) =>
                              (match (string_drop _s3220_ _s3221_) with
                               | _s3222_ =>
                                  (creg_name_matches_prefix _s3222_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s3223_ _) =>
                                              let p0_ := string_drop _s3222_ _s3223_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s3201_ (_s3202_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s3203_ := _s3202_ in
   (if string_startswith _s3203_ "c.and" then
      (match (string_drop _s3203_ (projT1 (string_length "c.and"))) with
       | _s3204_ =>
          (spc_matches_prefix _s3204_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3205_ _) =>
              (match (string_drop _s3204_ _s3205_) with
               | _s3206_ =>
                  (creg_name_matches_prefix _s3206_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3207_ _) =>
                      (match (string_drop _s3206_ _s3207_) with
                       | _s3208_ =>
                          (sep_matches_prefix _s3208_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3209_ _) =>
                              (match (string_drop _s3208_ _s3209_) with
                               | _s3210_ =>
                                  (creg_name_matches_prefix _s3210_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s3211_ _) =>
                                              let p0_ := string_drop _s3210_ _s3211_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s3189_ (_s3190_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s3191_ := _s3190_ in
   (if string_startswith _s3191_ "c.or" then
      (match (string_drop _s3191_ (projT1 (string_length "c.or"))) with
       | _s3192_ =>
          (spc_matches_prefix _s3192_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3193_ _) =>
              (match (string_drop _s3192_ _s3193_) with
               | _s3194_ =>
                  (creg_name_matches_prefix _s3194_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3195_ _) =>
                      (match (string_drop _s3194_ _s3195_) with
                       | _s3196_ =>
                          (sep_matches_prefix _s3196_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3197_ _) =>
                              (match (string_drop _s3196_ _s3197_) with
                               | _s3198_ =>
                                  (creg_name_matches_prefix _s3198_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s3199_ _) =>
                                              let p0_ := string_drop _s3198_ _s3199_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s3177_ (_s3178_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s3179_ := _s3178_ in
   (if string_startswith _s3179_ "c.xor" then
      (match (string_drop _s3179_ (projT1 (string_length "c.xor"))) with
       | _s3180_ =>
          (spc_matches_prefix _s3180_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3181_ _) =>
              (match (string_drop _s3180_ _s3181_) with
               | _s3182_ =>
                  (creg_name_matches_prefix _s3182_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3183_ _) =>
                      (match (string_drop _s3182_ _s3183_) with
                       | _s3184_ =>
                          (sep_matches_prefix _s3184_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3185_ _) =>
                              (match (string_drop _s3184_ _s3185_) with
                               | _s3186_ =>
                                  (creg_name_matches_prefix _s3186_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s3187_ _) =>
                                              let p0_ := string_drop _s3186_ _s3187_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s3165_ (_s3166_ : string) : M (option ((mword 3 * mword 3))) :=
   let _s3167_ := _s3166_ in
   (if string_startswith _s3167_ "c.sub" then
      (match (string_drop _s3167_ (projT1 (string_length "c.sub"))) with
       | _s3168_ =>
          (spc_matches_prefix _s3168_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3169_ _) =>
              (match (string_drop _s3168_ _s3169_) with
               | _s3170_ =>
                  (creg_name_matches_prefix _s3170_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3171_ _) =>
                      (match (string_drop _s3170_ _s3171_) with
                       | _s3172_ =>
                          (sep_matches_prefix _s3172_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3173_ _) =>
                              (match (string_drop _s3172_ _s3173_) with
                               | _s3174_ =>
                                  (creg_name_matches_prefix _s3174_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s3175_ _) =>
                                              let p0_ := string_drop _s3174_ _s3175_ in
                                              if generic_eq p0_ "" then Some (rsd, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3)))
                       end)
                       : M (option ((mword 3 * mword 3)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3)))
               end)
               : M (option ((mword 3 * mword 3)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3)))
       end)
       : M (option ((mword 3 * mword 3)))
    else returnm None)
    : M (option ((mword 3 * mword 3))).

Definition _s3153_ (_s3154_ : string) : M (option ((mword 3 * mword 6))) :=
   let _s3155_ := _s3154_ in
   (if string_startswith _s3155_ "c.andi" then
      (match (string_drop _s3155_ (projT1 (string_length "c.andi"))) with
       | _s3156_ =>
          (spc_matches_prefix _s3156_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3157_ _) =>
              (match (string_drop _s3156_ _s3157_) with
               | _s3158_ =>
                  (creg_name_matches_prefix _s3158_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3159_ _) =>
                      (match (string_drop _s3158_ _s3159_) with
                       | _s3160_ =>
                          (sep_matches_prefix _s3160_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3161_ _) =>
                                      match (string_drop _s3160_ _s3161_) with
                                      | _s3162_ =>
                                         match (hex_bits_6_matches_prefix _s3162_) with
                                         | Some (imm, existT _ _s3163_ _) =>
                                            let p0_ := string_drop _s3162_ _s3163_ in
                                            if generic_eq p0_ "" then Some (rsd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 6)))
               end)
               : M (option ((mword 3 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 6)))
       end)
       : M (option ((mword 3 * mword 6)))
    else returnm None)
    : M (option ((mword 3 * mword 6))).

Definition _s3141_ (_s3142_ : string) : M (option ((mword 3 * mword 6))) :=
   let _s3143_ := _s3142_ in
   (if string_startswith _s3143_ "c.srai" then
      (match (string_drop _s3143_ (projT1 (string_length "c.srai"))) with
       | _s3144_ =>
          (spc_matches_prefix _s3144_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3145_ _) =>
              (match (string_drop _s3144_ _s3145_) with
               | _s3146_ =>
                  (creg_name_matches_prefix _s3146_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3147_ _) =>
                      (match (string_drop _s3146_ _s3147_) with
                       | _s3148_ =>
                          (sep_matches_prefix _s3148_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3149_ _) =>
                                      match (string_drop _s3148_ _s3149_) with
                                      | _s3150_ =>
                                         match (hex_bits_6_matches_prefix _s3150_) with
                                         | Some (shamt, existT _ _s3151_ _) =>
                                            let p0_ := string_drop _s3150_ _s3151_ in
                                            if generic_eq p0_ "" then Some (rsd, shamt)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 6)))
               end)
               : M (option ((mword 3 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 6)))
       end)
       : M (option ((mword 3 * mword 6)))
    else returnm None)
    : M (option ((mword 3 * mword 6))).

Definition _s3129_ (_s3130_ : string) : M (option ((mword 3 * mword 6))) :=
   let _s3131_ := _s3130_ in
   (if string_startswith _s3131_ "c.srli" then
      (match (string_drop _s3131_ (projT1 (string_length "c.srli"))) with
       | _s3132_ =>
          (spc_matches_prefix _s3132_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3133_ _) =>
              (match (string_drop _s3132_ _s3133_) with
               | _s3134_ =>
                  (creg_name_matches_prefix _s3134_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3135_ _) =>
                      (match (string_drop _s3134_ _s3135_) with
                       | _s3136_ =>
                          (sep_matches_prefix _s3136_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3137_ _) =>
                                      match (string_drop _s3136_ _s3137_) with
                                      | _s3138_ =>
                                         match (hex_bits_6_matches_prefix _s3138_) with
                                         | Some (shamt, existT _ _s3139_ _) =>
                                            let p0_ := string_drop _s3138_ _s3139_ in
                                            if generic_eq p0_ "" then Some (rsd, shamt)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 6)))
               end)
               : M (option ((mword 3 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 6)))
       end)
       : M (option ((mword 3 * mword 6)))
    else returnm None)
    : M (option ((mword 3 * mword 6))).

Definition _s3117_ (_s3118_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3119_ := _s3118_ in
   (if string_startswith _s3119_ "c.lui" then
      (match (string_drop _s3119_ (projT1 (string_length "c.lui"))) with
       | _s3120_ =>
          (spc_matches_prefix _s3120_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3121_ _) =>
              (match (string_drop _s3120_ _s3121_) with
               | _s3122_ =>
                  (reg_name_matches_prefix _s3122_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s3123_ _) =>
                      (match (string_drop _s3122_ _s3123_) with
                       | _s3124_ =>
                          (sep_matches_prefix _s3124_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3125_ _) =>
                                      match (string_drop _s3124_ _s3125_) with
                                      | _s3126_ =>
                                         match (hex_bits_6_matches_prefix _s3126_) with
                                         | Some (imm, existT _ _s3127_ _) =>
                                            let p0_ := string_drop _s3126_ _s3127_ in
                                            if generic_eq p0_ "" then Some (rd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3109_ (_s3110_ : string) : M (option (mword 6)) :=
   let _s3111_ := _s3110_ in
   (if string_startswith _s3111_ "c.addi16sp" then
      (match (string_drop _s3111_ (projT1 (string_length "c.addi16sp"))) with
       | _s3112_ =>
          (spc_matches_prefix _s3112_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s3113_ _) =>
                      match (string_drop _s3112_ _s3113_) with
                      | _s3114_ =>
                         match (hex_bits_6_matches_prefix _s3114_) with
                         | Some (imm, existT _ _s3115_ _) =>
                            let p0_ := string_drop _s3114_ _s3115_ in
                            if generic_eq p0_ "" then Some imm
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 6))
    else returnm None)
    : M (option (mword 6)).

Definition _s3097_ (_s3098_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3099_ := _s3098_ in
   (if string_startswith _s3099_ "c.li" then
      (match (string_drop _s3099_ (projT1 (string_length "c.li"))) with
       | _s3100_ =>
          (spc_matches_prefix _s3100_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3101_ _) =>
              (match (string_drop _s3100_ _s3101_) with
               | _s3102_ =>
                  (reg_name_matches_prefix _s3102_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s3103_ _) =>
                      (match (string_drop _s3102_ _s3103_) with
                       | _s3104_ =>
                          (sep_matches_prefix _s3104_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3105_ _) =>
                                      match (string_drop _s3104_ _s3105_) with
                                      | _s3106_ =>
                                         match (hex_bits_6_matches_prefix _s3106_) with
                                         | Some (imm, existT _ _s3107_ _) =>
                                            let p0_ := string_drop _s3106_ _s3107_ in
                                            if generic_eq p0_ "" then Some (rd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3085_ (_s3086_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3087_ := _s3086_ in
   (if string_startswith _s3087_ "c.addiw" then
      (match (string_drop _s3087_ (projT1 (string_length "c.addiw"))) with
       | _s3088_ =>
          (spc_matches_prefix _s3088_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3089_ _) =>
              (match (string_drop _s3088_ _s3089_) with
               | _s3090_ =>
                  (reg_name_matches_prefix _s3090_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3091_ _) =>
                      (match (string_drop _s3090_ _s3091_) with
                       | _s3092_ =>
                          (sep_matches_prefix _s3092_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3093_ _) =>
                                      match (string_drop _s3092_ _s3093_) with
                                      | _s3094_ =>
                                         match (hex_bits_6_matches_prefix _s3094_) with
                                         | Some (imm, existT _ _s3095_ _) =>
                                            let p0_ := string_drop _s3094_ _s3095_ in
                                            if generic_eq p0_ "" then Some (rsd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3077_ (_s3078_ : string) : M (option (mword 11)) :=
   let _s3079_ := _s3078_ in
   (if string_startswith _s3079_ "c.jal" then
      (match (string_drop _s3079_ (projT1 (string_length "c.jal"))) with
       | _s3080_ =>
          (spc_matches_prefix _s3080_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s3081_ _) =>
                      match (string_drop _s3080_ _s3081_) with
                      | _s3082_ =>
                         match (hex_bits_12_matches_prefix _s3082_) with
                         | Some (v__1200, existT _ _s3083_ _) =>
                            if eq_vec (subrange_vec_dec v__1200 0 0) ('b"0"  : mword (0 - 0 + 1))
                            then
                              let imm : mword 11 := subrange_vec_dec v__1200 11 1 in
                              let imm : mword 11 := subrange_vec_dec v__1200 11 1 in
                              let p0_ := string_drop _s3082_ _s3083_ in
                              if generic_eq p0_ "" then Some imm
                              else None
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option (mword 11))
    else returnm None)
    : M (option (mword 11)).

Definition _s3065_ (_s3066_ : string) : M (option ((mword 5 * mword 6))) :=
   let _s3067_ := _s3066_ in
   (if string_startswith _s3067_ "c.addi" then
      (match (string_drop _s3067_ (projT1 (string_length "c.addi"))) with
       | _s3068_ =>
          (spc_matches_prefix _s3068_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3069_ _) =>
              (match (string_drop _s3068_ _s3069_) with
               | _s3070_ =>
                  (reg_name_matches_prefix _s3070_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s3071_ _) =>
                      (match (string_drop _s3070_ _s3071_) with
                       | _s3072_ =>
                          (sep_matches_prefix _s3072_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s3073_ _) =>
                                      match (string_drop _s3072_ _s3073_) with
                                      | _s3074_ =>
                                         match (hex_bits_6_matches_prefix _s3074_) with
                                         | Some (nzi, existT _ _s3075_ _) =>
                                            let p0_ := string_drop _s3074_ _s3075_ in
                                            if generic_eq p0_ "" then Some (rsd, nzi)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6)))
               end)
               : M (option ((mword 5 * mword 6)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6)))
       end)
       : M (option ((mword 5 * mword 6)))
    else returnm None)
    : M (option ((mword 5 * mword 6))).

Definition _s3049_ (_s3050_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s3051_ := _s3050_ in
   (if string_startswith _s3051_ "c.sd" then
      (match (string_drop _s3051_ (projT1 (string_length "c.sd"))) with
       | _s3052_ =>
          (spc_matches_prefix _s3052_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3053_ _) =>
              (match (string_drop _s3052_ _s3053_) with
               | _s3054_ =>
                  (creg_name_matches_prefix _s3054_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsc1, existT _ _s3055_ _) =>
                      (match (string_drop _s3054_ _s3055_) with
                       | _s3056_ =>
                          (sep_matches_prefix _s3056_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3057_ _) =>
                              (match (string_drop _s3056_ _s3057_) with
                               | _s3058_ =>
                                  (creg_name_matches_prefix _s3058_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc2, existT _ _s3059_ _) =>
                                      (match (string_drop _s3058_ _s3059_) with
                                       | _s3060_ =>
                                          (sep_matches_prefix _s3060_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s3061_ _) =>
                                                      match (string_drop _s3060_ _s3061_) with
                                                      | _s3062_ =>
                                                         match (hex_bits_8_matches_prefix _s3062_) with
                                                         | Some (v__1202, existT _ _s3063_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1202 2 0)
                                                                 ('b"000"
                                                                  : mword (2 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1202 7 3 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1202 7 3 in
                                                              let p0_ := string_drop _s3062_ _s3063_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rsc1, rsc2, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s3033_ (_s3034_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s3035_ := _s3034_ in
   (if string_startswith _s3035_ "c.sw" then
      (match (string_drop _s3035_ (projT1 (string_length "c.sw"))) with
       | _s3036_ =>
          (spc_matches_prefix _s3036_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3037_ _) =>
              (match (string_drop _s3036_ _s3037_) with
               | _s3038_ =>
                  (creg_name_matches_prefix _s3038_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsc1, existT _ _s3039_ _) =>
                      (match (string_drop _s3038_ _s3039_) with
                       | _s3040_ =>
                          (sep_matches_prefix _s3040_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3041_ _) =>
                              (match (string_drop _s3040_ _s3041_) with
                               | _s3042_ =>
                                  (creg_name_matches_prefix _s3042_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc2, existT _ _s3043_ _) =>
                                      (match (string_drop _s3042_ _s3043_) with
                                       | _s3044_ =>
                                          (sep_matches_prefix _s3044_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s3045_ _) =>
                                                      match (string_drop _s3044_ _s3045_) with
                                                      | _s3046_ =>
                                                         match (hex_bits_7_matches_prefix _s3046_) with
                                                         | Some (v__1204, existT _ _s3047_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1204 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1204 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1204 6 2 in
                                                              let p0_ := string_drop _s3046_ _s3047_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rsc1, rsc2, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s3017_ (_s3018_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s3019_ := _s3018_ in
   (if string_startswith _s3019_ "c.ld" then
      (match (string_drop _s3019_ (projT1 (string_length "c.ld"))) with
       | _s3020_ =>
          (spc_matches_prefix _s3020_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3021_ _) =>
              (match (string_drop _s3020_ _s3021_) with
               | _s3022_ =>
                  (creg_name_matches_prefix _s3022_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s3023_ _) =>
                      (match (string_drop _s3022_ _s3023_) with
                       | _s3024_ =>
                          (sep_matches_prefix _s3024_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3025_ _) =>
                              (match (string_drop _s3024_ _s3025_) with
                               | _s3026_ =>
                                  (creg_name_matches_prefix _s3026_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc, existT _ _s3027_ _) =>
                                      (match (string_drop _s3026_ _s3027_) with
                                       | _s3028_ =>
                                          (sep_matches_prefix _s3028_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s3029_ _) =>
                                                      match (string_drop _s3028_ _s3029_) with
                                                      | _s3030_ =>
                                                         match (hex_bits_8_matches_prefix _s3030_) with
                                                         | Some (v__1206, existT _ _s3031_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1206 2 0)
                                                                 ('b"000"
                                                                  : mword (2 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1206 7 3 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1206 7 3 in
                                                              let p0_ := string_drop _s3030_ _s3031_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rdc, rsc, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s3001_ (_s3002_ : string) : M (option ((mword 3 * mword 3 * mword 5))) :=
   let _s3003_ := _s3002_ in
   (if string_startswith _s3003_ "c.lw" then
      (match (string_drop _s3003_ (projT1 (string_length "c.lw"))) with
       | _s3004_ =>
          (spc_matches_prefix _s3004_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s3005_ _) =>
              (match (string_drop _s3004_ _s3005_) with
               | _s3006_ =>
                  (creg_name_matches_prefix _s3006_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s3007_ _) =>
                      (match (string_drop _s3006_ _s3007_) with
                       | _s3008_ =>
                          (sep_matches_prefix _s3008_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s3009_ _) =>
                              (match (string_drop _s3008_ _s3009_) with
                               | _s3010_ =>
                                  (creg_name_matches_prefix _s3010_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc, existT _ _s3011_ _) =>
                                      (match (string_drop _s3010_ _s3011_) with
                                       | _s3012_ =>
                                          (sep_matches_prefix _s3012_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s3013_ _) =>
                                                      match (string_drop _s3012_ _s3013_) with
                                                      | _s3014_ =>
                                                         match (hex_bits_7_matches_prefix _s3014_) with
                                                         | Some (v__1208, existT _ _s3015_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1208 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1208 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1208 6 2 in
                                                              let p0_ := string_drop _s3014_ _s3015_ in
                                                              if generic_eq p0_ "" then
                                                                Some (rdc, rsc, uimm)
                                                              else None
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5))).

Definition _s2989_ (_s2990_ : string) : M (option ((mword 3 * mword 8))) :=
   let _s2991_ := _s2990_ in
   (if string_startswith _s2991_ "c.addi4spn" then
      (match (string_drop _s2991_ (projT1 (string_length "c.addi4spn"))) with
       | _s2992_ =>
          (spc_matches_prefix _s2992_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2993_ _) =>
              (match (string_drop _s2992_ _s2993_) with
               | _s2994_ =>
                  (creg_name_matches_prefix _s2994_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s2995_ _) =>
                      (match (string_drop _s2994_ _s2995_) with
                       | _s2996_ =>
                          (sep_matches_prefix _s2996_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s2997_ _) =>
                                      match (string_drop _s2996_ _s2997_) with
                                      | _s2998_ =>
                                         match (hex_bits_10_matches_prefix _s2998_) with
                                         | Some (v__1210, existT _ _s2999_ _) =>
                                            if eq_vec (subrange_vec_dec v__1210 1 0)
                                                 ('b"00"
                                                  : mword (1 - 0 + 1)) then
                                              let nzimm : mword 8 := subrange_vec_dec v__1210 9 2 in
                                              let nzimm : mword 8 := subrange_vec_dec v__1210 9 2 in
                                              let p0_ := string_drop _s2998_ _s2999_ in
                                              if generic_eq p0_ "" then Some (rdc, nzimm)
                                              else None
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 8)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 8)))
               end)
               : M (option ((mword 3 * mword 8)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 8)))
       end)
       : M (option ((mword 3 * mword 8)))
    else returnm None)
    : M (option ((mword 3 * mword 8))).

Definition _s2963_ (_s2964_ : string)
: M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))) :=
   (match _s2964_ with
    | _s2965_ =>
       (amo_mnemonic_matches_prefix _s2965_) >>= fun w__0 : option ((amoop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2966_ _) =>
           let _s2967_ := string_drop _s2965_ _s2966_ in
           (if string_startswith _s2967_ "." then
              (match (string_drop _s2967_ (projT1 (string_length "."))) with
               | _s2968_ =>
                  (size_mnemonic_matches_prefix _s2968_) >>= fun w__1 : option ((word_width * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (width, existT _ _s2969_ _) =>
                      (match (string_drop _s2968_ _s2969_) with
                       | _s2970_ =>
                          (maybe_aq_matches_prefix _s2970_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (aq, existT _ _s2971_ _) =>
                              (match (string_drop _s2970_ _s2971_) with
                               | _s2972_ =>
                                  (maybe_rl_matches_prefix _s2972_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rl, existT _ _s2973_ _) =>
                                      (match (string_drop _s2972_ _s2973_) with
                                       | _s2974_ =>
                                          (spc_matches_prefix _s2974_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (tt, existT _ _s2975_ _) =>
                                              (match (string_drop _s2974_ _s2975_) with
                                               | _s2976_ =>
                                                  (reg_name_matches_prefix _s2976_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (rd, existT _ _s2977_ _) =>
                                                      (match (string_drop _s2976_ _s2977_) with
                                                       | _s2978_ =>
                                                          (sep_matches_prefix _s2978_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          (match w__6 with
                                                           | Some (tt, existT _ _s2979_ _) =>
                                                              (match (string_drop _s2978_ _s2979_) with
                                                               | _s2980_ =>
                                                                  (reg_name_matches_prefix _s2980_) >>= fun w__7 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                    0)})) =>
                                                                  (match w__7 with
                                                                   | Some (rs2, existT _ _s2981_ _) =>
                                                                      (match (string_drop _s2980_
                                                                                _s2981_) with
                                                                       | _s2982_ =>
                                                                          (sep_matches_prefix
                                                                             _s2982_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >=?
                                                                            0)})) =>
                                                                          (match w__8 with
                                                                           | Some
                                                                             (tt, existT _ _s2983_ _) =>
                                                                              let _s2984_ :=
                                                                                string_drop _s2982_
                                                                                  _s2983_ in
                                                                              (if string_startswith
                                                                                    _s2984_ "(" then
                                                                                 (match (string_drop
                                                                                           _s2984_
                                                                                           (projT1
                                                                                            (string_length
                                                                                               "("))) with
                                                                                  | _s2985_ =>
                                                                                     (reg_name_matches_prefix
                                                                                        _s2985_) >>= fun w__9 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                                       0)})) =>
                                                                                     returnm (match w__9 with
                                                                                              | Some
                                                                                                (rs1, existT _ _s2986_ _) =>
                                                                                                 let _s2987_ :=
                                                                                                   string_drop
                                                                                                     _s2985_
                                                                                                     _s2986_ in
                                                                                                 if string_startswith
                                                                                                      _s2987_
                                                                                                      ")"
                                                                                                 then
                                                                                                   let p0_ :=
                                                                                                     string_drop
                                                                                                       _s2987_
                                                                                                       (projT1
                                                                                                        (string_length
                                                                                                           ")")) in
                                                                                                   if
                                                                                                     generic_eq
                                                                                                       p0_
                                                                                                       ""
                                                                                                   then
                                                                                                     Some
                                                                                                       (op, width, aq, rl, rd, rs2, rs1)
                                                                                                   else
                                                                                                     None
                                                                                                 else
                                                                                                   None
                                                                                              | _ =>
                                                                                                 None
                                                                                              end)
                                                                                  end)
                                                                                  : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                               else returnm None)
                                                                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                           | _ => returnm None
                                                                           end)
                                                                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                       end)
                                                                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                               end)
                                                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                       end)
                                                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                               end)
                                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
            else returnm None)
            : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5))).

Definition _s2941_ (_s2942_ : string)
: M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))) :=
   let _s2943_ := _s2942_ in
   (if string_startswith _s2943_ "sc." then
      (match (string_drop _s2943_ (projT1 (string_length "sc."))) with
       | _s2944_ =>
          (size_mnemonic_matches_prefix _s2944_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s2945_ _) =>
              (match (string_drop _s2944_ _s2945_) with
               | _s2946_ =>
                  (maybe_aq_matches_prefix _s2946_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (aq, existT _ _s2947_ _) =>
                      (match (string_drop _s2946_ _s2947_) with
                       | _s2948_ =>
                          (maybe_rl_matches_prefix _s2948_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rl, existT _ _s2949_ _) =>
                              (match (string_drop _s2948_ _s2949_) with
                               | _s2950_ =>
                                  (spc_matches_prefix _s2950_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s2951_ _) =>
                                      (match (string_drop _s2950_ _s2951_) with
                                       | _s2952_ =>
                                          (reg_name_matches_prefix _s2952_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rd, existT _ _s2953_ _) =>
                                              (match (string_drop _s2952_ _s2953_) with
                                               | _s2954_ =>
                                                  (sep_matches_prefix _s2954_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s2955_ _) =>
                                                      (match (string_drop _s2954_ _s2955_) with
                                                       | _s2956_ =>
                                                          (reg_name_matches_prefix _s2956_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          (match w__6 with
                                                           | Some (rs1, existT _ _s2957_ _) =>
                                                              (match (string_drop _s2956_ _s2957_) with
                                                               | _s2958_ =>
                                                                  (sep_matches_prefix _s2958_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                    0)})) =>
                                                                  (match w__7 with
                                                                   | Some (tt, existT _ _s2959_ _) =>
                                                                      (match (string_drop _s2958_
                                                                                _s2959_) with
                                                                       | _s2960_ =>
                                                                          (reg_name_matches_prefix
                                                                             _s2960_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                            0)})) =>
                                                                          returnm (match w__8 with
                                                                                   | Some
                                                                                     (rs2, existT _ _s2961_ _) =>
                                                                                      let p0_ :=
                                                                                        string_drop
                                                                                          _s2960_
                                                                                          _s2961_ in
                                                                                      if generic_eq
                                                                                           p0_ ""
                                                                                      then
                                                                                        Some
                                                                                          (size, aq, rl, rd, rs1, rs2)
                                                                                      else None
                                                                                   | _ => None
                                                                                   end)
                                                                       end)
                                                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                               end)
                                                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                       end)
                                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                               end)
                                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                       end)
                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                               end)
                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                       end)
                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
               end)
               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
       end)
       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)))
    else returnm None)
    : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5))).

Definition _s2923_ (_s2924_ : string) : M (option ((word_width * bool * bool * mword 5 * mword 5))) :=
   let _s2925_ := _s2924_ in
   (if string_startswith _s2925_ "lr." then
      (match (string_drop _s2925_ (projT1 (string_length "lr."))) with
       | _s2926_ =>
          (size_mnemonic_matches_prefix _s2926_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s2927_ _) =>
              (match (string_drop _s2926_ _s2927_) with
               | _s2928_ =>
                  (maybe_aq_matches_prefix _s2928_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (aq, existT _ _s2929_ _) =>
                      (match (string_drop _s2928_ _s2929_) with
                       | _s2930_ =>
                          (maybe_rl_matches_prefix _s2930_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rl, existT _ _s2931_ _) =>
                              (match (string_drop _s2930_ _s2931_) with
                               | _s2932_ =>
                                  (spc_matches_prefix _s2932_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s2933_ _) =>
                                      (match (string_drop _s2932_ _s2933_) with
                                       | _s2934_ =>
                                          (reg_name_matches_prefix _s2934_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rd, existT _ _s2935_ _) =>
                                              (match (string_drop _s2934_ _s2935_) with
                                               | _s2936_ =>
                                                  (sep_matches_prefix _s2936_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s2937_ _) =>
                                                      (match (string_drop _s2936_ _s2937_) with
                                                       | _s2938_ =>
                                                          (reg_name_matches_prefix _s2938_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          returnm (match w__6 with
                                                                   | Some (rs1, existT _ _s2939_ _) =>
                                                                      let p0_ :=
                                                                        string_drop _s2938_ _s2939_ in
                                                                      if generic_eq p0_ "" then
                                                                        Some (size, aq, rl, rd, rs1)
                                                                      else None
                                                                   | _ => None
                                                                   end)
                                                       end)
                                                       : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                               end)
                                               : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                       end)
                                       : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                               end)
                               : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                       end)
                       : M (option ((word_width * bool * bool * mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * mword 5 * mword 5)))
               end)
               : M (option ((word_width * bool * bool * mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * mword 5 * mword 5)))
       end)
       : M (option ((word_width * bool * bool * mword 5 * mword 5)))
    else returnm None)
    : M (option ((word_width * bool * bool * mword 5 * mword 5))).

Definition _s2911_ (_s2912_ : string) : M (option ((mword 5 * mword 5))) :=
   let _s2913_ := _s2912_ in
   (if string_startswith _s2913_ "sfence.vma" then
      (match (string_drop _s2913_ (projT1 (string_length "sfence.vma"))) with
       | _s2914_ =>
          (spc_matches_prefix _s2914_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2915_ _) =>
              (match (string_drop _s2914_ _s2915_) with
               | _s2916_ =>
                  (reg_name_matches_prefix _s2916_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs1, existT _ _s2917_ _) =>
                      (match (string_drop _s2916_ _s2917_) with
                       | _s2918_ =>
                          (sep_matches_prefix _s2918_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s2919_ _) =>
                              (match (string_drop _s2918_ _s2919_) with
                               | _s2920_ =>
                                  (reg_name_matches_prefix _s2920_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s2921_ _) =>
                                              let p0_ := string_drop _s2920_ _s2921_ in
                                              if generic_eq p0_ "" then Some (rs1, rs2)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 5 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5)))
                       end)
                       : M (option ((mword 5 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5)))
               end)
               : M (option ((mword 5 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5)))
       end)
       : M (option ((mword 5 * mword 5)))
    else returnm None)
    : M (option ((mword 5 * mword 5))).

Definition _s2899_ (_s2900_ : string) : M (option ((mword 4 * mword 4))) :=
   let _s2901_ := _s2900_ in
   (if string_startswith _s2901_ "fence.tso" then
      (match (string_drop _s2901_ (projT1 (string_length "fence.tso"))) with
       | _s2902_ =>
          (spc_matches_prefix _s2902_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2903_ _) =>
              (match (string_drop _s2902_ _s2903_) with
               | _s2904_ =>
                  (fence_bits_matches_prefix _s2904_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (pred, existT _ _s2905_ _) =>
                      (match (string_drop _s2904_ _s2905_) with
                       | _s2906_ =>
                          (sep_matches_prefix _s2906_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s2907_ _) =>
                              (match (string_drop _s2906_ _s2907_) with
                               | _s2908_ =>
                                  (fence_bits_matches_prefix _s2908_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (succ, existT _ _s2909_ _) =>
                                              let p0_ := string_drop _s2908_ _s2909_ in
                                              if generic_eq p0_ "" then Some (pred, succ)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 4 * mword 4)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 4 * mword 4)))
                       end)
                       : M (option ((mword 4 * mword 4)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 4 * mword 4)))
               end)
               : M (option ((mword 4 * mword 4)))
           | _ => returnm None
           end)
           : M (option ((mword 4 * mword 4)))
       end)
       : M (option ((mword 4 * mword 4)))
    else returnm None)
    : M (option ((mword 4 * mword 4))).

Definition _s2887_ (_s2888_ : string) : M (option ((mword 4 * mword 4))) :=
   let _s2889_ := _s2888_ in
   (if string_startswith _s2889_ "fence" then
      (match (string_drop _s2889_ (projT1 (string_length "fence"))) with
       | _s2890_ =>
          (spc_matches_prefix _s2890_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2891_ _) =>
              (match (string_drop _s2890_ _s2891_) with
               | _s2892_ =>
                  (fence_bits_matches_prefix _s2892_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (pred, existT _ _s2893_ _) =>
                      (match (string_drop _s2892_ _s2893_) with
                       | _s2894_ =>
                          (sep_matches_prefix _s2894_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s2895_ _) =>
                              (match (string_drop _s2894_ _s2895_) with
                               | _s2896_ =>
                                  (fence_bits_matches_prefix _s2896_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (succ, existT _ _s2897_ _) =>
                                              let p0_ := string_drop _s2896_ _s2897_ in
                                              if generic_eq p0_ "" then Some (pred, succ)
                                              else None
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 4 * mword 4)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 4 * mword 4)))
                       end)
                       : M (option ((mword 4 * mword 4)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 4 * mword 4)))
               end)
               : M (option ((mword 4 * mword 4)))
           | _ => returnm None
           end)
           : M (option ((mword 4 * mword 4)))
       end)
       : M (option ((mword 4 * mword 4)))
    else returnm None)
    : M (option ((mword 4 * mword 4))).

Definition _s2870_ (_s2871_ : string) : M (option ((sopw * mword 5 * mword 5 * mword 5))) :=
   (match _s2871_ with
    | _s2872_ =>
       (shiftiwop_mnemonic_matches_prefix _s2872_) >>= fun w__0 : option ((sopw * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2873_ _) =>
           (match (string_drop _s2872_ _s2873_) with
            | _s2874_ =>
               (spc_matches_prefix _s2874_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2875_ _) =>
                   (match (string_drop _s2874_ _s2875_) with
                    | _s2876_ =>
                       (reg_name_matches_prefix _s2876_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2877_ _) =>
                           (match (string_drop _s2876_ _s2877_) with
                            | _s2878_ =>
                               (sep_matches_prefix _s2878_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2879_ _) =>
                                   (match (string_drop _s2878_ _s2879_) with
                                    | _s2880_ =>
                                       (reg_name_matches_prefix _s2880_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2881_ _) =>
                                           (match (string_drop _s2880_ _s2881_) with
                                            | _s2882_ =>
                                               (sep_matches_prefix _s2882_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s2883_ _) =>
                                                           match (string_drop _s2882_ _s2883_) with
                                                           | _s2884_ =>
                                                              match (hex_bits_5_matches_prefix
                                                                       _s2884_) with
                                                              | Some (shamt, existT _ _s2885_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s2884_ _s2885_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rd, rs1, shamt)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((sopw * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((sopw * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((sopw * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((sopw * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((sopw * mword 5 * mword 5 * mword 5))).

Definition _s2853_ (_s2854_ : string) : M (option ((ropw * mword 5 * mword 5 * mword 5))) :=
   (match _s2854_ with
    | _s2855_ =>
       (rtypew_mnemonic_matches_prefix _s2855_) >>= fun w__0 : option ((ropw * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2856_ _) =>
           (match (string_drop _s2855_ _s2856_) with
            | _s2857_ =>
               (spc_matches_prefix _s2857_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2858_ _) =>
                   (match (string_drop _s2857_ _s2858_) with
                    | _s2859_ =>
                       (reg_name_matches_prefix _s2859_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2860_ _) =>
                           (match (string_drop _s2859_ _s2860_) with
                            | _s2861_ =>
                               (sep_matches_prefix _s2861_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2862_ _) =>
                                   (match (string_drop _s2861_ _s2862_) with
                                    | _s2863_ =>
                                       (reg_name_matches_prefix _s2863_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2864_ _) =>
                                           (match (string_drop _s2863_ _s2864_) with
                                            | _s2865_ =>
                                               (sep_matches_prefix _s2865_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2866_ _) =>
                                                   (match (string_drop _s2865_ _s2866_) with
                                                    | _s2867_ =>
                                                       (reg_name_matches_prefix _s2867_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2868_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2867_ _s2868_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (op, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((ropw * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((ropw * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((ropw * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((ropw * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((ropw * mword 5 * mword 5 * mword 5))).

Definition _s2836_ (_s2837_ : string) : M (option ((sop * mword 5 * mword 5 * mword 5))) :=
   (match _s2837_ with
    | _s2838_ =>
       (shiftw_mnemonic_matches_prefix _s2838_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2839_ _) =>
           (match (string_drop _s2838_ _s2839_) with
            | _s2840_ =>
               (spc_matches_prefix _s2840_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2841_ _) =>
                   (match (string_drop _s2840_ _s2841_) with
                    | _s2842_ =>
                       (reg_name_matches_prefix _s2842_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2843_ _) =>
                           (match (string_drop _s2842_ _s2843_) with
                            | _s2844_ =>
                               (sep_matches_prefix _s2844_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2845_ _) =>
                                   (match (string_drop _s2844_ _s2845_) with
                                    | _s2846_ =>
                                       (reg_name_matches_prefix _s2846_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2847_ _) =>
                                           (match (string_drop _s2846_ _s2847_) with
                                            | _s2848_ =>
                                               (sep_matches_prefix _s2848_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s2849_ _) =>
                                                           match (string_drop _s2848_ _s2849_) with
                                                           | _s2850_ =>
                                                              match (hex_bits_5_matches_prefix
                                                                       _s2850_) with
                                                              | Some (shamt, existT _ _s2851_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s2850_ _s2851_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rd, rs1, shamt)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((sop * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((sop * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((sop * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((sop * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((sop * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((sop * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((sop * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((sop * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((sop * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((sop * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((sop * mword 5 * mword 5 * mword 5))).

Definition _s2820_ (_s2821_ : string) : M (option ((mword 5 * mword 5 * mword 12))) :=
   let _s2822_ := _s2821_ in
   (if string_startswith _s2822_ "addiw" then
      (match (string_drop _s2822_ (projT1 (string_length "addiw"))) with
       | _s2823_ =>
          (spc_matches_prefix _s2823_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2824_ _) =>
              (match (string_drop _s2823_ _s2824_) with
               | _s2825_ =>
                  (reg_name_matches_prefix _s2825_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s2826_ _) =>
                      (match (string_drop _s2825_ _s2826_) with
                       | _s2827_ =>
                          (sep_matches_prefix _s2827_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s2828_ _) =>
                              (match (string_drop _s2827_ _s2828_) with
                               | _s2829_ =>
                                  (reg_name_matches_prefix _s2829_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rs1, existT _ _s2830_ _) =>
                                      (match (string_drop _s2829_ _s2830_) with
                                       | _s2831_ =>
                                          (sep_matches_prefix _s2831_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s2832_ _) =>
                                                      match (string_drop _s2831_ _s2832_) with
                                                      | _s2833_ =>
                                                         match (hex_bits_12_matches_prefix _s2833_) with
                                                         | Some (imm, existT _ _s2834_ _) =>
                                                            let p0_ := string_drop _s2833_ _s2834_ in
                                                            if generic_eq p0_ "" then
                                                              Some (rd, rs1, imm)
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 5 * mword 5 * mword 12)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 5 * mword 5 * mword 12)))
                               end)
                               : M (option ((mword 5 * mword 5 * mword 12)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * mword 12)))
                       end)
                       : M (option ((mword 5 * mword 5 * mword 12)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * mword 12)))
               end)
               : M (option ((mword 5 * mword 5 * mword 12)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 12)))
       end)
       : M (option ((mword 5 * mword 5 * mword 12)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 12))).

Definition _s2792_ (_s2793_ : string)
: M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5))) :=
   let _s2794_ := _s2793_ in
   (if string_startswith _s2794_ "s" then
      (match (string_drop _s2794_ (projT1 (string_length "s"))) with
       | _s2795_ =>
          (size_mnemonic_matches_prefix _s2795_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s2796_ _) =>
              (match (string_drop _s2795_ _s2796_) with
               | _s2797_ =>
                  (maybe_aq_matches_prefix _s2797_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (aq, existT _ _s2798_ _) =>
                      (match (string_drop _s2797_ _s2798_) with
                       | _s2799_ =>
                          (maybe_rl_matches_prefix _s2799_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rl, existT _ _s2800_ _) =>
                              (match (string_drop _s2799_ _s2800_) with
                               | _s2801_ =>
                                  (spc_matches_prefix _s2801_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s2802_ _) =>
                                      (match (string_drop _s2801_ _s2802_) with
                                       | _s2803_ =>
                                          (reg_name_matches_prefix _s2803_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rs2, existT _ _s2804_ _) =>
                                              (match (string_drop _s2803_ _s2804_) with
                                               | _s2805_ =>
                                                  (sep_matches_prefix _s2805_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s2806_ _) =>
                                                      (match (string_drop _s2805_ _s2806_) with
                                                       | _s2807_ =>
                                                          (match (hex_bits_12_matches_prefix _s2807_) with
                                                           | Some (imm, existT _ _s2808_ _) =>
                                                              (match (string_drop _s2807_ _s2808_) with
                                                               | _s2809_ =>
                                                                  (opt_spc_matches_prefix _s2809_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >=?
                                                                    0)})) =>
                                                                  (match w__6 with
                                                                   | Some (tt, existT _ _s2810_ _) =>
                                                                      let _s2811_ :=
                                                                        string_drop _s2809_ _s2810_ in
                                                                      (if string_startswith _s2811_
                                                                            "(" then
                                                                         (match (string_drop _s2811_
                                                                                   (projT1
                                                                                    (string_length
                                                                                       "("))) with
                                                                          | _s2812_ =>
                                                                             (opt_spc_matches_prefix
                                                                                _s2812_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                               0)})) =>
                                                                             (match w__7 with
                                                                              | Some
                                                                                (tt, existT _ _s2813_ _) =>
                                                                                 (match (string_drop
                                                                                           _s2812_
                                                                                           _s2813_) with
                                                                                  | _s2814_ =>
                                                                                     (reg_name_matches_prefix
                                                                                        _s2814_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                                       0)})) =>
                                                                                     (match w__8 with
                                                                                      | Some
                                                                                        (rs1, existT _ _s2815_ _) =>
                                                                                         (match (string_drop
                                                                                                   _s2814_
                                                                                                   _s2815_) with
                                                                                          | _s2816_ =>
                                                                                             (opt_spc_matches_prefix
                                                                                                _s2816_) >>= fun w__9 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                               0)})) =>
                                                                                             returnm (match w__9 with
                                                                                                      | Some
                                                                                                        (tt, existT _ _s2817_ _) =>
                                                                                                         let _s2818_ :=
                                                                                                           string_drop
                                                                                                             _s2816_
                                                                                                             _s2817_ in
                                                                                                         if
                                                                                                           string_startswith
                                                                                                             _s2818_
                                                                                                             ")"
                                                                                                         then
                                                                                                           let p0_ :=
                                                                                                             string_drop
                                                                                                               _s2818_
                                                                                                               (projT1
                                                                                                                (string_length
                                                                                                                   ")")) in
                                                                                                           if
                                                                                                             generic_eq
                                                                                                               p0_
                                                                                                               ""
                                                                                                           then
                                                                                                             Some
                                                                                                               (size, aq, rl, rs2, imm, rs1)
                                                                                                           else
                                                                                                             None
                                                                                                         else
                                                                                                           None
                                                                                                      | _ =>
                                                                                                         None
                                                                                                      end)
                                                                                          end)
                                                                                          : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                      | _ =>
                                                                                         returnm None
                                                                                      end)
                                                                                      : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                  end)
                                                                                  : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                              | _ => returnm None
                                                                              end)
                                                                              : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                          end)
                                                                          : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                       else returnm None)
                                                                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                               end)
                                                               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                       end)
                                                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                               end)
                                               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
       end)
       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)))
    else returnm None)
    : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5))).

Definition _s2762_ (_s2763_ : string)
: M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5))) :=
   let _s2764_ := _s2763_ in
   (if string_startswith _s2764_ "l" then
      (match (string_drop _s2764_ (projT1 (string_length "l"))) with
       | _s2765_ =>
          (size_mnemonic_matches_prefix _s2765_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s2766_ _) =>
              (match (string_drop _s2765_ _s2766_) with
               | _s2767_ =>
                  (maybe_u_matches_prefix _s2767_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (is_unsigned, existT _ _s2768_ _) =>
                      (match (string_drop _s2767_ _s2768_) with
                       | _s2769_ =>
                          (maybe_aq_matches_prefix _s2769_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (aq, existT _ _s2770_ _) =>
                              (match (string_drop _s2769_ _s2770_) with
                               | _s2771_ =>
                                  (maybe_rl_matches_prefix _s2771_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rl, existT _ _s2772_ _) =>
                                      (match (string_drop _s2771_ _s2772_) with
                                       | _s2773_ =>
                                          (spc_matches_prefix _s2773_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (tt, existT _ _s2774_ _) =>
                                              (match (string_drop _s2773_ _s2774_) with
                                               | _s2775_ =>
                                                  (reg_name_matches_prefix _s2775_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (rd, existT _ _s2776_ _) =>
                                                      (match (string_drop _s2775_ _s2776_) with
                                                       | _s2777_ =>
                                                          (sep_matches_prefix _s2777_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          (match w__6 with
                                                           | Some (tt, existT _ _s2778_ _) =>
                                                              (match (string_drop _s2777_ _s2778_) with
                                                               | _s2779_ =>
                                                                  (match (hex_bits_12_matches_prefix
                                                                            _s2779_) with
                                                                   | Some (imm, existT _ _s2780_ _) =>
                                                                      (match (string_drop _s2779_
                                                                                _s2780_) with
                                                                       | _s2781_ =>
                                                                          (opt_spc_matches_prefix
                                                                             _s2781_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                            0)})) =>
                                                                          (match w__7 with
                                                                           | Some
                                                                             (tt, existT _ _s2782_ _) =>
                                                                              let _s2783_ :=
                                                                                string_drop _s2781_
                                                                                  _s2782_ in
                                                                              (if string_startswith
                                                                                    _s2783_ "(" then
                                                                                 (match (string_drop
                                                                                           _s2783_
                                                                                           (projT1
                                                                                            (string_length
                                                                                               "("))) with
                                                                                  | _s2784_ =>
                                                                                     (opt_spc_matches_prefix
                                                                                        _s2784_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                       0)})) =>
                                                                                     (match w__8 with
                                                                                      | Some
                                                                                        (tt, existT _ _s2785_ _) =>
                                                                                         (match (string_drop
                                                                                                   _s2784_
                                                                                                   _s2785_) with
                                                                                          | _s2786_ =>
                                                                                             (reg_name_matches_prefix
                                                                                                _s2786_) >>= fun w__9 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                                               0)})) =>
                                                                                             (match w__9 with
                                                                                              | Some
                                                                                                (rs1, existT _ _s2787_ _) =>
                                                                                                 (match (string_drop
                                                                                                           _s2786_
                                                                                                           _s2787_) with
                                                                                                  | _s2788_ =>
                                                                                                     (opt_spc_matches_prefix
                                                                                                        _s2788_) >>= fun w__10 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                                       0)})) =>
                                                                                                     returnm (match w__10 with
                                                                                                              | Some
                                                                                                                (tt, existT _ _s2789_ _) =>
                                                                                                                 let _s2790_ :=
                                                                                                                   string_drop
                                                                                                                     _s2788_
                                                                                                                     _s2789_ in
                                                                                                                 if
                                                                                                                   string_startswith
                                                                                                                     _s2790_
                                                                                                                     ")"
                                                                                                                 then
                                                                                                                   let p0_ :=
                                                                                                                     string_drop
                                                                                                                       _s2790_
                                                                                                                       (projT1
                                                                                                                        (string_length
                                                                                                                           ")")) in
                                                                                                                   if
                                                                                                                     generic_eq
                                                                                                                       p0_
                                                                                                                       ""
                                                                                                                   then
                                                                                                                     Some
                                                                                                                       (size, is_unsigned, aq, rl, rd, imm, rs1)
                                                                                                                   else
                                                                                                                     None
                                                                                                                 else
                                                                                                                   None
                                                                                                              | _ =>
                                                                                                                 None
                                                                                                              end)
                                                                                                  end)
                                                                                                  : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                              | _ =>
                                                                                                 returnm None
                                                                                              end)
                                                                                              : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                          end)
                                                                                          : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                      | _ =>
                                                                                         returnm None
                                                                                      end)
                                                                                      : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                                  end)
                                                                                  : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                               else returnm None)
                                                                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                           | _ => returnm None
                                                                           end)
                                                                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                       end)
                                                                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                               end)
                                                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                       end)
                                                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                               end)
                                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                       end)
                                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                               end)
                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                       end)
                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
               end)
               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
       end)
       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)))
    else returnm None)
    : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5))).

Definition _s2745_ (_s2746_ : string) : M (option ((rop * mword 5 * mword 5 * mword 5))) :=
   (match _s2746_ with
    | _s2747_ =>
       (rtype_mnemonic_matches_prefix _s2747_) >>= fun w__0 : option ((rop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2748_ _) =>
           (match (string_drop _s2747_ _s2748_) with
            | _s2749_ =>
               (spc_matches_prefix _s2749_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2750_ _) =>
                   (match (string_drop _s2749_ _s2750_) with
                    | _s2751_ =>
                       (reg_name_matches_prefix _s2751_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2752_ _) =>
                           (match (string_drop _s2751_ _s2752_) with
                            | _s2753_ =>
                               (sep_matches_prefix _s2753_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2754_ _) =>
                                   (match (string_drop _s2753_ _s2754_) with
                                    | _s2755_ =>
                                       (reg_name_matches_prefix _s2755_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2756_ _) =>
                                           (match (string_drop _s2755_ _s2756_) with
                                            | _s2757_ =>
                                               (sep_matches_prefix _s2757_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s2758_ _) =>
                                                   (match (string_drop _s2757_ _s2758_) with
                                                    | _s2759_ =>
                                                       (reg_name_matches_prefix _s2759_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s2760_ _) =>
                                                                   let p0_ :=
                                                                     string_drop _s2759_ _s2760_ in
                                                                   if generic_eq p0_ "" then
                                                                     Some (op, rd, rs1, rs2)
                                                                   else None
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                            end)
                                            : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                    end)
                                    : M (option ((rop * mword 5 * mword 5 * mword 5)))
                                | _ => returnm None
                                end)
                                : M (option ((rop * mword 5 * mword 5 * mword 5)))
                            end)
                            : M (option ((rop * mword 5 * mword 5 * mword 5)))
                        | _ => returnm None
                        end)
                        : M (option ((rop * mword 5 * mword 5 * mword 5)))
                    end)
                    : M (option ((rop * mword 5 * mword 5 * mword 5)))
                | _ => returnm None
                end)
                : M (option ((rop * mword 5 * mword 5 * mword 5)))
            end)
            : M (option ((rop * mword 5 * mword 5 * mword 5)))
        | _ => returnm None
        end)
        : M (option ((rop * mword 5 * mword 5 * mword 5)))
    end)
    : M (option ((rop * mword 5 * mword 5 * mword 5))).

Definition _s2728_ (_s2729_ : string) : M (option ((sop * mword 5 * mword 5 * mword 6))) :=
   (match _s2729_ with
    | _s2730_ =>
       (shiftiop_mnemonic_matches_prefix _s2730_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2731_ _) =>
           (match (string_drop _s2730_ _s2731_) with
            | _s2732_ =>
               (spc_matches_prefix _s2732_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2733_ _) =>
                   (match (string_drop _s2732_ _s2733_) with
                    | _s2734_ =>
                       (reg_name_matches_prefix _s2734_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2735_ _) =>
                           (match (string_drop _s2734_ _s2735_) with
                            | _s2736_ =>
                               (sep_matches_prefix _s2736_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2737_ _) =>
                                   (match (string_drop _s2736_ _s2737_) with
                                    | _s2738_ =>
                                       (reg_name_matches_prefix _s2738_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2739_ _) =>
                                           (match (string_drop _s2738_ _s2739_) with
                                            | _s2740_ =>
                                               (sep_matches_prefix _s2740_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s2741_ _) =>
                                                           match (string_drop _s2740_ _s2741_) with
                                                           | _s2742_ =>
                                                              match (hex_bits_6_matches_prefix
                                                                       _s2742_) with
                                                              | Some (shamt, existT _ _s2743_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s2742_ _s2743_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rd, rs1, shamt)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((sop * mword 5 * mword 5 * mword 6)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((sop * mword 5 * mword 5 * mword 6)))
                                    end)
                                    : M (option ((sop * mword 5 * mword 5 * mword 6)))
                                | _ => returnm None
                                end)
                                : M (option ((sop * mword 5 * mword 5 * mword 6)))
                            end)
                            : M (option ((sop * mword 5 * mword 5 * mword 6)))
                        | _ => returnm None
                        end)
                        : M (option ((sop * mword 5 * mword 5 * mword 6)))
                    end)
                    : M (option ((sop * mword 5 * mword 5 * mword 6)))
                | _ => returnm None
                end)
                : M (option ((sop * mword 5 * mword 5 * mword 6)))
            end)
            : M (option ((sop * mword 5 * mword 5 * mword 6)))
        | _ => returnm None
        end)
        : M (option ((sop * mword 5 * mword 5 * mword 6)))
    end)
    : M (option ((sop * mword 5 * mword 5 * mword 6))).

Definition _s2711_ (_s2712_ : string) : M (option ((iop * mword 5 * mword 5 * mword 12))) :=
   (match _s2712_ with
    | _s2713_ =>
       (itype_mnemonic_matches_prefix _s2713_) >>= fun w__0 : option ((iop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2714_ _) =>
           (match (string_drop _s2713_ _s2714_) with
            | _s2715_ =>
               (spc_matches_prefix _s2715_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2716_ _) =>
                   (match (string_drop _s2715_ _s2716_) with
                    | _s2717_ =>
                       (reg_name_matches_prefix _s2717_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2718_ _) =>
                           (match (string_drop _s2717_ _s2718_) with
                            | _s2719_ =>
                               (sep_matches_prefix _s2719_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2720_ _) =>
                                   (match (string_drop _s2719_ _s2720_) with
                                    | _s2721_ =>
                                       (reg_name_matches_prefix _s2721_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s2722_ _) =>
                                           (match (string_drop _s2721_ _s2722_) with
                                            | _s2723_ =>
                                               (sep_matches_prefix _s2723_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s2724_ _) =>
                                                           match (string_drop _s2723_ _s2724_) with
                                                           | _s2725_ =>
                                                              match (hex_bits_12_matches_prefix
                                                                       _s2725_) with
                                                              | Some (imm, existT _ _s2726_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s2725_ _s2726_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rd, rs1, imm)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((iop * mword 5 * mword 5 * mword 12)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((iop * mword 5 * mword 5 * mword 12)))
                                    end)
                                    : M (option ((iop * mword 5 * mword 5 * mword 12)))
                                | _ => returnm None
                                end)
                                : M (option ((iop * mword 5 * mword 5 * mword 12)))
                            end)
                            : M (option ((iop * mword 5 * mword 5 * mword 12)))
                        | _ => returnm None
                        end)
                        : M (option ((iop * mword 5 * mword 5 * mword 12)))
                    end)
                    : M (option ((iop * mword 5 * mword 5 * mword 12)))
                | _ => returnm None
                end)
                : M (option ((iop * mword 5 * mword 5 * mword 12)))
            end)
            : M (option ((iop * mword 5 * mword 5 * mword 12)))
        | _ => returnm None
        end)
        : M (option ((iop * mword 5 * mword 5 * mword 12)))
    end)
    : M (option ((iop * mword 5 * mword 5 * mword 12))).

Definition _s2694_ (_s2695_ : string) : M (option ((bop * mword 5 * mword 5 * mword 13))) :=
   (match _s2695_ with
    | _s2696_ =>
       (btype_mnemonic_matches_prefix _s2696_) >>= fun w__0 : option ((bop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2697_ _) =>
           (match (string_drop _s2696_ _s2697_) with
            | _s2698_ =>
               (spc_matches_prefix _s2698_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2699_ _) =>
                   (match (string_drop _s2698_ _s2699_) with
                    | _s2700_ =>
                       (reg_name_matches_prefix _s2700_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rs1, existT _ _s2701_ _) =>
                           (match (string_drop _s2700_ _s2701_) with
                            | _s2702_ =>
                               (sep_matches_prefix _s2702_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s2703_ _) =>
                                   (match (string_drop _s2702_ _s2703_) with
                                    | _s2704_ =>
                                       (reg_name_matches_prefix _s2704_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs2, existT _ _s2705_ _) =>
                                           (match (string_drop _s2704_ _s2705_) with
                                            | _s2706_ =>
                                               (sep_matches_prefix _s2706_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s2707_ _) =>
                                                           match (string_drop _s2706_ _s2707_) with
                                                           | _s2708_ =>
                                                              match (hex_bits_13_matches_prefix
                                                                       _s2708_) with
                                                              | Some (imm, existT _ _s2709_ _) =>
                                                                 let p0_ :=
                                                                   string_drop _s2708_ _s2709_ in
                                                                 if generic_eq p0_ "" then
                                                                   Some (op, rs1, rs2, imm)
                                                                 else None
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((bop * mword 5 * mword 5 * mword 13)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((bop * mword 5 * mword 5 * mword 13)))
                                    end)
                                    : M (option ((bop * mword 5 * mword 5 * mword 13)))
                                | _ => returnm None
                                end)
                                : M (option ((bop * mword 5 * mword 5 * mword 13)))
                            end)
                            : M (option ((bop * mword 5 * mword 5 * mword 13)))
                        | _ => returnm None
                        end)
                        : M (option ((bop * mword 5 * mword 5 * mword 13)))
                    end)
                    : M (option ((bop * mword 5 * mword 5 * mword 13)))
                | _ => returnm None
                end)
                : M (option ((bop * mword 5 * mword 5 * mword 13)))
            end)
            : M (option ((bop * mword 5 * mword 5 * mword 13)))
        | _ => returnm None
        end)
        : M (option ((bop * mword 5 * mword 5 * mword 13)))
    end)
    : M (option ((bop * mword 5 * mword 5 * mword 13))).

Definition _s2678_ (_s2679_ : string) : M (option ((mword 5 * mword 5 * mword 12))) :=
   let _s2680_ := _s2679_ in
   (if string_startswith _s2680_ "jalr" then
      (match (string_drop _s2680_ (projT1 (string_length "jalr"))) with
       | _s2681_ =>
          (spc_matches_prefix _s2681_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2682_ _) =>
              (match (string_drop _s2681_ _s2682_) with
               | _s2683_ =>
                  (reg_name_matches_prefix _s2683_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s2684_ _) =>
                      (match (string_drop _s2683_ _s2684_) with
                       | _s2685_ =>
                          (sep_matches_prefix _s2685_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s2686_ _) =>
                              (match (string_drop _s2685_ _s2686_) with
                               | _s2687_ =>
                                  (reg_name_matches_prefix _s2687_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rs1, existT _ _s2688_ _) =>
                                      (match (string_drop _s2687_ _s2688_) with
                                       | _s2689_ =>
                                          (sep_matches_prefix _s2689_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s2690_ _) =>
                                                      match (string_drop _s2689_ _s2690_) with
                                                      | _s2691_ =>
                                                         match (hex_bits_12_matches_prefix _s2691_) with
                                                         | Some (imm, existT _ _s2692_ _) =>
                                                            let p0_ := string_drop _s2691_ _s2692_ in
                                                            if generic_eq p0_ "" then
                                                              Some (rd, rs1, imm)
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 5 * mword 5 * mword 12)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 5 * mword 5 * mword 12)))
                               end)
                               : M (option ((mword 5 * mword 5 * mword 12)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * mword 12)))
                       end)
                       : M (option ((mword 5 * mword 5 * mword 12)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * mword 12)))
               end)
               : M (option ((mword 5 * mword 5 * mword 12)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 12)))
       end)
       : M (option ((mword 5 * mword 5 * mword 12)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 12))).

Definition _s2666_ (_s2667_ : string) : M (option ((mword 5 * mword 21))) :=
   let _s2668_ := _s2667_ in
   (if string_startswith _s2668_ "jal" then
      (match (string_drop _s2668_ (projT1 (string_length "jal"))) with
       | _s2669_ =>
          (spc_matches_prefix _s2669_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s2670_ _) =>
              (match (string_drop _s2669_ _s2670_) with
               | _s2671_ =>
                  (reg_name_matches_prefix _s2671_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s2672_ _) =>
                      (match (string_drop _s2671_ _s2672_) with
                       | _s2673_ =>
                          (sep_matches_prefix _s2673_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s2674_ _) =>
                                      match (string_drop _s2673_ _s2674_) with
                                      | _s2675_ =>
                                         match (hex_bits_21_matches_prefix _s2675_) with
                                         | Some (imm, existT _ _s2676_ _) =>
                                            let p0_ := string_drop _s2675_ _s2676_ in
                                            if generic_eq p0_ "" then Some (rd, imm)
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 21)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 21)))
               end)
               : M (option ((mword 5 * mword 21)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 21)))
       end)
       : M (option ((mword 5 * mword 21)))
    else returnm None)
    : M (option ((mword 5 * mword 21))).

Definition _s2653_ (_s2654_ : string) : M (option ((uop * mword 5 * mword 20))) :=
   (match _s2654_ with
    | _s2655_ =>
       (utype_mnemonic_matches_prefix _s2655_) >>= fun w__0 : option ((uop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s2656_ _) =>
           (match (string_drop _s2655_ _s2656_) with
            | _s2657_ =>
               (spc_matches_prefix _s2657_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s2658_ _) =>
                   (match (string_drop _s2657_ _s2658_) with
                    | _s2659_ =>
                       (reg_name_matches_prefix _s2659_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s2660_ _) =>
                           (match (string_drop _s2659_ _s2660_) with
                            | _s2661_ =>
                               (sep_matches_prefix _s2661_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               returnm (match w__3 with
                                        | Some (tt, existT _ _s2662_ _) =>
                                           match (string_drop _s2661_ _s2662_) with
                                           | _s2663_ =>
                                              match (hex_bits_20_matches_prefix _s2663_) with
                                              | Some (imm, existT _ _s2664_ _) =>
                                                 let p0_ := string_drop _s2663_ _s2664_ in
                                                 if generic_eq p0_ "" then Some (op, rd, imm)
                                                 else None
                                              | _ => None
                                              end
                                           end
                                        | _ => None
                                        end)
                            end)
                            : M (option ((uop * mword 5 * mword 20)))
                        | _ => returnm None
                        end)
                        : M (option ((uop * mword 5 * mword 20)))
                    end)
                    : M (option ((uop * mword 5 * mword 20)))
                | _ => returnm None
                end)
                : M (option ((uop * mword 5 * mword 20)))
            end)
            : M (option ((uop * mword 5 * mword 20)))
        | _ => returnm None
        end)
        : M (option ((uop * mword 5 * mword 20)))
    end)
    : M (option ((uop * mword 5 * mword 20))).

Definition assembly_backwards_matches (arg_ : string) : M (bool) :=
   let _s2665_ := arg_ in
   (_s2653_ _s2665_) >>= fun w__0 : option ((uop * mword 5 * mword 20)) =>
   (if match w__0 with | Some (op, rd, imm) => true | _ => false end then
      (_s2653_ _s2665_) >>= fun w__1 : option ((uop * mword 5 * mword 20)) =>
      (match w__1 with | Some (op, rd, imm) => returnm true | _ => exit tt  : M (bool) end)
       : M (bool)
    else
      (_s2666_ _s2665_) >>= fun w__4 : option ((mword 5 * mword 21)) =>
      (if match w__4 with | Some (rd, imm) => true | _ => false end then
         (_s2666_ _s2665_) >>= fun w__5 : option ((mword 5 * mword 21)) =>
         (match w__5 with | Some (rd, imm) => returnm true | _ => exit tt  : M (bool) end)
          : M (bool)
       else
         (_s2678_ _s2665_) >>= fun w__8 : option ((mword 5 * mword 5 * mword 12)) =>
         (if match w__8 with | Some (rd, rs1, imm) => true | _ => false end then
            (_s2678_ _s2665_) >>= fun w__9 : option ((mword 5 * mword 5 * mword 12)) =>
            (match w__9 with | Some (rd, rs1, imm) => returnm true | _ => exit tt  : M (bool) end)
             : M (bool)
          else
            (_s2694_ _s2665_) >>= fun w__12 : option ((bop * mword 5 * mword 5 * mword 13)) =>
            (if match w__12 with | Some (op, rs1, rs2, imm) => true | _ => false end then
               (_s2694_ _s2665_) >>= fun w__13 : option ((bop * mword 5 * mword 5 * mword 13)) =>
               (match w__13 with
                | Some (op, rs1, rs2, imm) => returnm true
                | _ => exit tt  : M (bool)
                end)
                : M (bool)
             else
               (_s2711_ _s2665_) >>= fun w__16 : option ((iop * mword 5 * mword 5 * mword 12)) =>
               (if match w__16 with | Some (op, rd, rs1, imm) => true | _ => false end then
                  (_s2711_ _s2665_) >>= fun w__17 : option ((iop * mword 5 * mword 5 * mword 12)) =>
                  (match w__17 with
                   | Some (op, rd, rs1, imm) => returnm true
                   | _ => exit tt  : M (bool)
                   end)
                   : M (bool)
                else
                  (_s2728_ _s2665_) >>= fun w__20 : option ((sop * mword 5 * mword 5 * mword 6)) =>
                  (if match w__20 with | Some (op, rd, rs1, shamt) => true | _ => false end then
                     (_s2728_ _s2665_) >>= fun w__21 : option ((sop * mword 5 * mword 5 * mword 6)) =>
                     (match w__21 with
                      | Some (op, rd, rs1, shamt) => returnm true
                      | _ => exit tt  : M (bool)
                      end)
                      : M (bool)
                   else
                     (_s2745_ _s2665_) >>= fun w__24 : option ((rop * mword 5 * mword 5 * mword 5)) =>
                     (if match w__24 with | Some (op, rd, rs1, rs2) => true | _ => false end then
                        (_s2745_ _s2665_) >>= fun w__25 : option ((rop * mword 5 * mword 5 * mword 5)) =>
                        (match w__25 with
                         | Some (op, rd, rs1, rs2) => returnm true
                         | _ => exit tt  : M (bool)
                         end)
                         : M (bool)
                      else
                        (_s2762_ _s2665_) >>= fun w__28 : option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)) =>
                        (if match w__28 with
                            | Some (size, is_unsigned, aq, rl, rd, imm, rs1) => true
                            | _ => false
                            end then
                           (_s2762_ _s2665_) >>= fun w__29 : option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5)) =>
                           (match w__29 with
                            | Some (size, is_unsigned, aq, rl, rd, imm, rs1) => returnm true
                            | _ => exit tt  : M (bool)
                            end)
                            : M (bool)
                         else
                           (_s2792_ _s2665_) >>= fun w__32 : option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)) =>
                           (if match w__32 with
                               | Some (size, aq, rl, rs2, imm, rs1) => true
                               | _ => false
                               end then
                              (_s2792_ _s2665_) >>= fun w__33 : option ((word_width * bool * bool * mword 5 * mword 12 * mword 5)) =>
                              (match w__33 with
                               | Some (size, aq, rl, rs2, imm, rs1) => returnm true
                               | _ => exit tt  : M (bool)
                               end)
                               : M (bool)
                            else
                              (_s2820_ _s2665_) >>= fun w__36 : option ((mword 5 * mword 5 * mword 12)) =>
                              (if match w__36 with
                                  | Some (rd, rs1, imm) => Z.eqb 32 64
                                  | _ => false
                                  end then
                                 (_s2820_ _s2665_) >>= fun w__37 : option ((mword 5 * mword 5 * mword 12)) =>
                                 (match w__37 with
                                  | Some (rd, rs1, imm) => returnm true
                                  | _ => exit tt  : M (bool)
                                  end)
                                  : M (bool)
                               else
                                 (_s2836_ _s2665_) >>= fun w__40 : option ((sop * mword 5 * mword 5 * mword 5)) =>
                                 (if match w__40 with
                                     | Some (op, rd, rs1, shamt) => Z.eqb 32 64
                                     | _ => false
                                     end then
                                    (_s2836_ _s2665_) >>= fun w__41 : option ((sop * mword 5 * mword 5 * mword 5)) =>
                                    (match w__41 with
                                     | Some (op, rd, rs1, shamt) => returnm true
                                     | _ => exit tt  : M (bool)
                                     end)
                                     : M (bool)
                                  else
                                    (_s2853_ _s2665_) >>= fun w__44 : option ((ropw * mword 5 * mword 5 * mword 5)) =>
                                    (if match w__44 with
                                        | Some (op, rd, rs1, rs2) => Z.eqb 32 64
                                        | _ => false
                                        end then
                                       (_s2853_ _s2665_) >>= fun w__45 : option ((ropw * mword 5 * mword 5 * mword 5)) =>
                                       (match w__45 with
                                        | Some (op, rd, rs1, rs2) => returnm true
                                        | _ => exit tt  : M (bool)
                                        end)
                                        : M (bool)
                                     else
                                       (_s2870_ _s2665_) >>= fun w__48 : option ((sopw * mword 5 * mword 5 * mword 5)) =>
                                       (if match w__48 with
                                           | Some (op, rd, rs1, shamt) => Z.eqb 32 64
                                           | _ => false
                                           end then
                                          (_s2870_ _s2665_) >>= fun w__49 : option ((sopw * mword 5 * mword 5 * mword 5)) =>
                                          (match w__49 with
                                           | Some (op, rd, rs1, shamt) => returnm true
                                           | _ => exit tt  : M (bool)
                                           end)
                                           : M (bool)
                                        else
                                          (_s2887_ _s2665_) >>= fun w__52 : option ((mword 4 * mword 4)) =>
                                          (if match w__52 with
                                              | Some (pred, succ) => true
                                              | _ => false
                                              end then
                                             (_s2887_ _s2665_) >>= fun w__53 : option ((mword 4 * mword 4)) =>
                                             (match w__53 with
                                              | Some (pred, succ) => returnm true
                                              | _ => exit tt  : M (bool)
                                              end)
                                              : M (bool)
                                           else
                                             (_s2899_ _s2665_) >>= fun w__56 : option ((mword 4 * mword 4)) =>
                                             (if match w__56 with
                                                 | Some (pred, succ) => true
                                                 | _ => false
                                                 end then
                                                (_s2899_ _s2665_) >>= fun w__57 : option ((mword 4 * mword 4)) =>
                                                (match w__57 with
                                                 | Some (pred, succ) => returnm true
                                                 | _ => exit tt  : M (bool)
                                                 end)
                                                 : M (bool)
                                              else if generic_eq _s2665_ "fence.i" then returnm true
                                              else if generic_eq _s2665_ "ecall" then returnm true
                                              else if generic_eq _s2665_ "mret" then returnm true
                                              else if generic_eq _s2665_ "sret" then returnm true
                                              else if generic_eq _s2665_ "ebreak" then returnm true
                                              else if generic_eq _s2665_ "wfi" then returnm true
                                              else
                                                (_s2911_ _s2665_) >>= fun w__60 : option ((mword 5 * mword 5)) =>
                                                (if match w__60 with
                                                    | Some (rs1, rs2) => true
                                                    | _ => false
                                                    end then
                                                   (_s2911_ _s2665_) >>= fun w__61 : option ((mword 5 * mword 5)) =>
                                                   (match w__61 with
                                                    | Some (rs1, rs2) => returnm true
                                                    | _ => exit tt  : M (bool)
                                                    end)
                                                    : M (bool)
                                                 else
                                                   (_s2923_ _s2665_) >>= fun w__64 : option ((word_width * bool * bool * mword 5 * mword 5)) =>
                                                   (if match w__64 with
                                                       | Some (size, aq, rl, rd, rs1) => true
                                                       | _ => false
                                                       end then
                                                      (_s2923_ _s2665_) >>= fun w__65 : option ((word_width * bool * bool * mword 5 * mword 5)) =>
                                                      (match w__65 with
                                                       | Some (size, aq, rl, rd, rs1) =>
                                                          returnm true
                                                       | _ => exit tt  : M (bool)
                                                       end)
                                                       : M (bool)
                                                    else
                                                      (_s2941_ _s2665_) >>= fun w__68 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                      (if match w__68 with
                                                          | Some (size, aq, rl, rd, rs1, rs2) =>
                                                             true
                                                          | _ => false
                                                          end then
                                                         (_s2941_ _s2665_) >>= fun w__69 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                         (match w__69 with
                                                          | Some (size, aq, rl, rd, rs1, rs2) =>
                                                             returnm true
                                                          | _ => exit tt  : M (bool)
                                                          end)
                                                          : M (bool)
                                                       else
                                                         (_s2963_ _s2665_) >>= fun w__72 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                         (if match w__72 with
                                                             | Some
                                                               (op, width, aq, rl, rd, rs2, rs1) =>
                                                                true
                                                             | _ => false
                                                             end then
                                                            (_s2963_ _s2665_) >>= fun w__73 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                            (match w__73 with
                                                             | Some
                                                               (op, width, aq, rl, rd, rs2, rs1) =>
                                                                returnm true
                                                             | _ => exit tt  : M (bool)
                                                             end)
                                                             : M (bool)
                                                          else if generic_eq _s2665_ "c.nop" then
                                                            returnm true
                                                          else
                                                            (_s2989_ _s2665_) >>= fun w__76 : option ((mword 3 * mword 8)) =>
                                                            (if match w__76 with
                                                                | Some (rdc, nzimm) =>
                                                                   neq_vec nzimm (Ox"00"  : mword 8)
                                                                | _ => false
                                                                end then
                                                               (_s2989_ _s2665_) >>= fun w__77 : option ((mword 3 * mword 8)) =>
                                                               (match w__77 with
                                                                | Some (rdc, nzimm) => returnm true
                                                                | _ => exit tt  : M (bool)
                                                                end)
                                                                : M (bool)
                                                             else
                                                               (_s3001_ _s2665_) >>= fun w__80 : option ((mword 3 * mword 3 * mword 5)) =>
                                                               (if match w__80 with
                                                                   | Some (rdc, rsc, uimm) => true
                                                                   | _ => false
                                                                   end then
                                                                  (_s3001_ _s2665_) >>= fun w__81 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                  (match w__81 with
                                                                   | Some (rdc, rsc, uimm) =>
                                                                      returnm true
                                                                   | _ => exit tt  : M (bool)
                                                                   end)
                                                                   : M (bool)
                                                                else
                                                                  (_s3017_ _s2665_) >>= fun w__84 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                  (if match w__84 with
                                                                      | Some (rdc, rsc, uimm) =>
                                                                         Z.eqb 32 64
                                                                      | _ => false
                                                                      end then
                                                                     (_s3017_ _s2665_) >>= fun w__85 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                     (match w__85 with
                                                                      | Some (rdc, rsc, uimm) =>
                                                                         returnm true
                                                                      | _ => exit tt  : M (bool)
                                                                      end)
                                                                      : M (bool)
                                                                   else
                                                                     (_s3033_ _s2665_) >>= fun w__88 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                     (if match w__88 with
                                                                         | Some (rsc1, rsc2, uimm) =>
                                                                            true
                                                                         | _ => false
                                                                         end then
                                                                        (_s3033_ _s2665_) >>= fun w__89 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                        (match w__89 with
                                                                         | Some (rsc1, rsc2, uimm) =>
                                                                            returnm true
                                                                         | _ => exit tt  : M (bool)
                                                                         end)
                                                                         : M (bool)
                                                                      else
                                                                        (_s3049_ _s2665_) >>= fun w__92 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                        (if match w__92 with
                                                                            | Some
                                                                              (rsc1, rsc2, uimm) =>
                                                                               Z.eqb 32 64
                                                                            | _ => false
                                                                            end then
                                                                           (_s3049_ _s2665_) >>= fun w__93 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                           (match w__93 with
                                                                            | Some
                                                                              (rsc1, rsc2, uimm) =>
                                                                               returnm true
                                                                            | _ =>
                                                                               exit tt  : M (bool)
                                                                            end)
                                                                            : M (bool)
                                                                         else
                                                                           (_s3065_ _s2665_) >>= fun w__96 : option ((mword 5 * mword 6)) =>
                                                                           (if match w__96 with
                                                                               | Some (rsd, nzi) =>
                                                                                  andb
                                                                                    (neq_vec nzi
                                                                                       ('b"000000"
                                                                                        : mword 6))
                                                                                    (neq_vec rsd
                                                                                       zreg)
                                                                               | _ => false
                                                                               end then
                                                                              (_s3065_ _s2665_) >>= fun w__97 : option ((mword 5 * mword 6)) =>
                                                                              (match w__97 with
                                                                               | Some (rsd, nzi) =>
                                                                                  returnm true
                                                                               | _ =>
                                                                                  exit tt
                                                                                   : M (bool)
                                                                               end)
                                                                               : M (bool)
                                                                            else
                                                                              (_s3077_ _s2665_) >>= fun w__100 : option (mword 11) =>
                                                                              (if match w__100 with
                                                                                  | Some imm =>
                                                                                     Z.eqb 32 32
                                                                                  | _ => false
                                                                                  end then
                                                                                 (_s3077_ _s2665_) >>= fun w__101 : option (mword 11) =>
                                                                                 (match w__101 with
                                                                                  | Some imm =>
                                                                                     returnm true
                                                                                  | _ =>
                                                                                     exit tt
                                                                                      : M (bool)
                                                                                  end)
                                                                                  : M (bool)
                                                                               else
                                                                                 (_s3085_ _s2665_) >>= fun w__104 : option ((mword 5 * mword 6)) =>
                                                                                 (if match w__104 with
                                                                                     | Some
                                                                                       (rsd, imm) =>
                                                                                        Z.eqb 32 64
                                                                                     | _ => false
                                                                                     end then
                                                                                    (_s3085_ _s2665_) >>= fun w__105 : option ((mword 5 * mword 6)) =>
                                                                                    (match w__105 with
                                                                                     | Some
                                                                                       (rsd, imm) =>
                                                                                        returnm true
                                                                                     | _ =>
                                                                                        exit tt
                                                                                         : M (bool)
                                                                                     end)
                                                                                     : M (bool)
                                                                                  else
                                                                                    (_s3097_ _s2665_) >>= fun w__108 : option ((mword 5 * mword 6)) =>
                                                                                    (if match w__108 with
                                                                                        | Some
                                                                                          (rd, imm) =>
                                                                                           neq_vec
                                                                                             rd zreg
                                                                                        | _ => false
                                                                                        end then
                                                                                       (_s3097_
                                                                                          _s2665_) >>= fun w__109 : option ((mword 5 * mword 6)) =>
                                                                                       (match w__109 with
                                                                                        | Some
                                                                                          (rd, imm) =>
                                                                                           returnm true
                                                                                        | _ =>
                                                                                           exit tt
                                                                                            : M (bool)
                                                                                        end)
                                                                                        : M (bool)
                                                                                     else
                                                                                       (_s3109_
                                                                                          _s2665_) >>= fun w__112 : option (mword 6) =>
                                                                                       (if match w__112 with
                                                                                           | Some
                                                                                             imm =>
                                                                                              neq_vec
                                                                                                imm
                                                                                                ('b"000000"
                                                                                                 : mword 6)
                                                                                           | _ =>
                                                                                              false
                                                                                           end then
                                                                                          (_s3109_
                                                                                             _s2665_) >>= fun w__113 : option (mword 6) =>
                                                                                          (match w__113 with
                                                                                           | Some
                                                                                             imm =>
                                                                                              returnm true
                                                                                           | _ =>
                                                                                              exit tt
                                                                                               : M (bool)
                                                                                           end)
                                                                                           : M (bool)
                                                                                        else
                                                                                          (_s3117_
                                                                                             _s2665_) >>= fun w__116 : option ((mword 5 * mword 6)) =>
                                                                                          (if match w__116 with
                                                                                              | Some
                                                                                                (rd, imm) =>
                                                                                                 andb
                                                                                                   (neq_vec
                                                                                                      rd
                                                                                                      zreg)
                                                                                                   (andb
                                                                                                      (neq_vec
                                                                                                         rd
                                                                                                         sp)
                                                                                                      (neq_vec
                                                                                                         imm
                                                                                                         ('b"000000"
                                                                                                          : mword 6)))
                                                                                              | _ =>
                                                                                                 false
                                                                                              end
                                                                                           then
                                                                                             (_s3117_
                                                                                                _s2665_) >>= fun w__117 : option ((mword 5 * mword 6)) =>
                                                                                             (match w__117 with
                                                                                              | Some
                                                                                                (rd, imm) =>
                                                                                                 returnm true
                                                                                              | _ =>
                                                                                                 exit tt
                                                                                                  : M (bool)
                                                                                              end)
                                                                                              : M (bool)
                                                                                           else
                                                                                             (_s3129_
                                                                                                _s2665_) >>= fun w__120 : option ((mword 3 * mword 6)) =>
                                                                                             (if match w__120 with
                                                                                                 | Some
                                                                                                   (rsd, shamt) =>
                                                                                                    neq_vec
                                                                                                      shamt
                                                                                                      ('b"000000"
                                                                                                       : mword 6)
                                                                                                 | _ =>
                                                                                                    false
                                                                                                 end
                                                                                              then
                                                                                                (_s3129_
                                                                                                   _s2665_) >>= fun w__121 : option ((mword 3 * mword 6)) =>
                                                                                                (match w__121 with
                                                                                                 | Some
                                                                                                   (rsd, shamt) =>
                                                                                                    returnm true
                                                                                                 | _ =>
                                                                                                    exit tt
                                                                                                     : M (bool)
                                                                                                 end)
                                                                                                 : M (bool)
                                                                                              else
                                                                                                (_s3141_
                                                                                                   _s2665_) >>= fun w__124 : option ((mword 3 * mword 6)) =>
                                                                                                (if match w__124 with
                                                                                                    | Some
                                                                                                      (rsd, shamt) =>
                                                                                                       neq_vec
                                                                                                         shamt
                                                                                                         ('b"000000"
                                                                                                          : mword 6)
                                                                                                    | _ =>
                                                                                                       false
                                                                                                    end
                                                                                                 then
                                                                                                   (_s3141_
                                                                                                      _s2665_) >>= fun w__125 : option ((mword 3 * mword 6)) =>
                                                                                                   (match w__125 with
                                                                                                    | Some
                                                                                                      (rsd, shamt) =>
                                                                                                       returnm true
                                                                                                    | _ =>
                                                                                                       exit tt
                                                                                                        : M (bool)
                                                                                                    end)
                                                                                                    : M (bool)
                                                                                                 else
                                                                                                   (_s3153_
                                                                                                      _s2665_) >>= fun w__128 : option ((mword 3 * mword 6)) =>
                                                                                                   (if
                                                                                                      match w__128 with
                                                                                                      | Some
                                                                                                        (rsd, imm) =>
                                                                                                         true
                                                                                                      | _ =>
                                                                                                         false
                                                                                                      end
                                                                                                    then
                                                                                                      (_s3153_
                                                                                                         _s2665_) >>= fun w__129 : option ((mword 3 * mword 6)) =>
                                                                                                      (match w__129 with
                                                                                                       | Some
                                                                                                         (rsd, imm) =>
                                                                                                          returnm true
                                                                                                       | _ =>
                                                                                                          exit tt
                                                                                                           : M (bool)
                                                                                                       end)
                                                                                                       : M (bool)
                                                                                                    else
                                                                                                      (_s3165_
                                                                                                         _s2665_) >>= fun w__132 : option ((mword 3 * mword 3)) =>
                                                                                                      (if
                                                                                                         match w__132 with
                                                                                                         | Some
                                                                                                           (rsd, rs2) =>
                                                                                                            true
                                                                                                         | _ =>
                                                                                                            false
                                                                                                         end
                                                                                                       then
                                                                                                         (_s3165_
                                                                                                            _s2665_) >>= fun w__133 : option ((mword 3 * mword 3)) =>
                                                                                                         (match w__133 with
                                                                                                          | Some
                                                                                                            (rsd, rs2) =>
                                                                                                             returnm true
                                                                                                          | _ =>
                                                                                                             exit tt
                                                                                                              : M (bool)
                                                                                                          end)
                                                                                                          : M (bool)
                                                                                                       else
                                                                                                         (_s3177_
                                                                                                            _s2665_) >>= fun w__136 : option ((mword 3 * mword 3)) =>
                                                                                                         (if
                                                                                                            match w__136 with
                                                                                                            | Some
                                                                                                              (rsd, rs2) =>
                                                                                                               true
                                                                                                            | _ =>
                                                                                                               false
                                                                                                            end
                                                                                                          then
                                                                                                            (_s3177_
                                                                                                               _s2665_) >>= fun w__137 : option ((mword 3 * mword 3)) =>
                                                                                                            (match w__137 with
                                                                                                             | Some
                                                                                                               (rsd, rs2) =>
                                                                                                                returnm true
                                                                                                             | _ =>
                                                                                                                exit tt
                                                                                                                 : M (bool)
                                                                                                             end)
                                                                                                             : M (bool)
                                                                                                          else
                                                                                                            (_s3189_
                                                                                                               _s2665_) >>= fun w__140 : option ((mword 3 * mword 3)) =>
                                                                                                            (if
                                                                                                               match w__140 with
                                                                                                               | Some
                                                                                                                 (rsd, rs2) =>
                                                                                                                  true
                                                                                                               | _ =>
                                                                                                                  false
                                                                                                               end
                                                                                                             then
                                                                                                               (_s3189_
                                                                                                                  _s2665_) >>= fun w__141 : option ((mword 3 * mword 3)) =>
                                                                                                               (match w__141 with
                                                                                                                | Some
                                                                                                                  (rsd, rs2) =>
                                                                                                                   returnm true
                                                                                                                | _ =>
                                                                                                                   exit tt
                                                                                                                    : M (bool)
                                                                                                                end)
                                                                                                                : M (bool)
                                                                                                             else
                                                                                                               (_s3201_
                                                                                                                  _s2665_) >>= fun w__144 : option ((mword 3 * mword 3)) =>
                                                                                                               (if
                                                                                                                  match w__144 with
                                                                                                                  | Some
                                                                                                                    (rsd, rs2) =>
                                                                                                                     true
                                                                                                                  | _ =>
                                                                                                                     false
                                                                                                                  end
                                                                                                                then
                                                                                                                  (_s3201_
                                                                                                                     _s2665_) >>= fun w__145 : option ((mword 3 * mword 3)) =>
                                                                                                                  (match w__145 with
                                                                                                                   | Some
                                                                                                                     (rsd, rs2) =>
                                                                                                                      returnm true
                                                                                                                   | _ =>
                                                                                                                      exit tt
                                                                                                                       : M (bool)
                                                                                                                   end)
                                                                                                                   : M (bool)
                                                                                                                else
                                                                                                                  (_s3213_
                                                                                                                     _s2665_) >>= fun w__148 : option ((mword 3 * mword 3)) =>
                                                                                                                  (if
                                                                                                                     match w__148 with
                                                                                                                     | Some
                                                                                                                       (rsd, rs2) =>
                                                                                                                        Z.eqb
                                                                                                                          32
                                                                                                                          64
                                                                                                                     | _ =>
                                                                                                                        false
                                                                                                                     end
                                                                                                                   then
                                                                                                                     (_s3213_
                                                                                                                        _s2665_) >>= fun w__149 : option ((mword 3 * mword 3)) =>
                                                                                                                     (match w__149 with
                                                                                                                      | Some
                                                                                                                        (rsd, rs2) =>
                                                                                                                         returnm true
                                                                                                                      | _ =>
                                                                                                                         exit tt
                                                                                                                          : M (bool)
                                                                                                                      end)
                                                                                                                      : M (bool)
                                                                                                                   else
                                                                                                                     (_s3225_
                                                                                                                        _s2665_) >>= fun w__152 : option ((mword 3 * mword 3)) =>
                                                                                                                     (if
                                                                                                                        match w__152 with
                                                                                                                        | Some
                                                                                                                          (rsd, rs2) =>
                                                                                                                           Z.eqb
                                                                                                                             32
                                                                                                                             64
                                                                                                                        | _ =>
                                                                                                                           false
                                                                                                                        end
                                                                                                                      then
                                                                                                                        (_s3225_
                                                                                                                           _s2665_) >>= fun w__153 : option ((mword 3 * mword 3)) =>
                                                                                                                        (match w__153 with
                                                                                                                         | Some
                                                                                                                           (rsd, rs2) =>
                                                                                                                            returnm true
                                                                                                                         | _ =>
                                                                                                                            exit tt
                                                                                                                             : M (bool)
                                                                                                                         end)
                                                                                                                         : M (bool)
                                                                                                                      else
                                                                                                                        (_s3237_
                                                                                                                           _s2665_) >>= fun w__156 : option (mword 11) =>
                                                                                                                        (if
                                                                                                                           match w__156 with
                                                                                                                           | Some
                                                                                                                             imm =>
                                                                                                                              true
                                                                                                                           | _ =>
                                                                                                                              false
                                                                                                                           end
                                                                                                                         then
                                                                                                                           (_s3237_
                                                                                                                              _s2665_) >>= fun w__157 : option (mword 11) =>
                                                                                                                           (match w__157 with
                                                                                                                            | Some
                                                                                                                              imm =>
                                                                                                                               returnm true
                                                                                                                            | _ =>
                                                                                                                               exit tt
                                                                                                                                : M (bool)
                                                                                                                            end)
                                                                                                                            : M (bool)
                                                                                                                         else
                                                                                                                           (_s3245_
                                                                                                                              _s2665_) >>= fun w__160 : option ((mword 3 * mword 8)) =>
                                                                                                                           (if
                                                                                                                              match w__160 with
                                                                                                                              | Some
                                                                                                                                (rs, imm) =>
                                                                                                                                 true
                                                                                                                              | _ =>
                                                                                                                                 false
                                                                                                                              end
                                                                                                                            then
                                                                                                                              (_s3245_
                                                                                                                                 _s2665_) >>= fun w__161 : option ((mword 3 * mword 8)) =>
                                                                                                                              (match w__161 with
                                                                                                                               | Some
                                                                                                                                 (rs, imm) =>
                                                                                                                                  returnm true
                                                                                                                               | _ =>
                                                                                                                                  exit tt
                                                                                                                                   : M (bool)
                                                                                                                               end)
                                                                                                                               : M (bool)
                                                                                                                            else
                                                                                                                              (_s3257_
                                                                                                                                 _s2665_) >>= fun w__164 : option ((mword 3 * mword 8)) =>
                                                                                                                              (if
                                                                                                                                 match w__164 with
                                                                                                                                 | Some
                                                                                                                                   (rs, imm) =>
                                                                                                                                    true
                                                                                                                                 | _ =>
                                                                                                                                    false
                                                                                                                                 end
                                                                                                                               then
                                                                                                                                 (_s3257_
                                                                                                                                    _s2665_) >>= fun w__165 : option ((mword 3 * mword 8)) =>
                                                                                                                                 (match w__165 with
                                                                                                                                  | Some
                                                                                                                                    (rs, imm) =>
                                                                                                                                     returnm true
                                                                                                                                  | _ =>
                                                                                                                                     exit tt
                                                                                                                                      : M (bool)
                                                                                                                                  end)
                                                                                                                                  : M (bool)
                                                                                                                               else
                                                                                                                                 (_s3269_
                                                                                                                                    _s2665_) >>= fun w__168 : option ((mword 5 * mword 6)) =>
                                                                                                                                 (if
                                                                                                                                    match w__168 with
                                                                                                                                    | Some
                                                                                                                                      (rsd, shamt) =>
                                                                                                                                       andb
                                                                                                                                         (neq_vec
                                                                                                                                            shamt
                                                                                                                                            ('b"000000"
                                                                                                                                             : mword 6))
                                                                                                                                         (neq_vec
                                                                                                                                            rsd
                                                                                                                                            zreg)
                                                                                                                                    | _ =>
                                                                                                                                       false
                                                                                                                                    end
                                                                                                                                  then
                                                                                                                                    (_s3269_
                                                                                                                                       _s2665_) >>= fun w__169 : option ((mword 5 * mword 6)) =>
                                                                                                                                    (match w__169 with
                                                                                                                                     | Some
                                                                                                                                       (rsd, shamt) =>
                                                                                                                                        returnm true
                                                                                                                                     | _ =>
                                                                                                                                        exit tt
                                                                                                                                         : M (bool)
                                                                                                                                     end)
                                                                                                                                     : M (bool)
                                                                                                                                  else
                                                                                                                                    (_s3281_
                                                                                                                                       _s2665_) >>= fun w__172 : option ((mword 5 * mword 6)) =>
                                                                                                                                    (if
                                                                                                                                       match w__172 with
                                                                                                                                       | Some
                                                                                                                                         (rd, uimm) =>
                                                                                                                                          neq_vec
                                                                                                                                            rd
                                                                                                                                            zreg
                                                                                                                                       | _ =>
                                                                                                                                          false
                                                                                                                                       end
                                                                                                                                     then
                                                                                                                                       (_s3281_
                                                                                                                                          _s2665_) >>= fun w__173 : option ((mword 5 * mword 6)) =>
                                                                                                                                       (match w__173 with
                                                                                                                                        | Some
                                                                                                                                          (rd, uimm) =>
                                                                                                                                           returnm true
                                                                                                                                        | _ =>
                                                                                                                                           exit tt
                                                                                                                                            : M (bool)
                                                                                                                                        end)
                                                                                                                                        : M (bool)
                                                                                                                                     else
                                                                                                                                       (_s3293_
                                                                                                                                          _s2665_) >>= fun w__176 : option ((mword 5 * mword 6)) =>
                                                                                                                                       (if
                                                                                                                                          match w__176 with
                                                                                                                                          | Some
                                                                                                                                            (rd, uimm) =>
                                                                                                                                             andb
                                                                                                                                               (neq_vec
                                                                                                                                                  rd
                                                                                                                                                  zreg)
                                                                                                                                               (Z.eqb
                                                                                                                                                  32
                                                                                                                                                  64)
                                                                                                                                          | _ =>
                                                                                                                                             false
                                                                                                                                          end
                                                                                                                                        then
                                                                                                                                          (_s3293_
                                                                                                                                             _s2665_) >>= fun w__177 : option ((mword 5 * mword 6)) =>
                                                                                                                                          (match w__177 with
                                                                                                                                           | Some
                                                                                                                                             (rd, uimm) =>
                                                                                                                                              returnm true
                                                                                                                                           | _ =>
                                                                                                                                              exit tt
                                                                                                                                               : M (bool)
                                                                                                                                           end)
                                                                                                                                           : M (bool)
                                                                                                                                        else
                                                                                                                                          (_s3305_
                                                                                                                                             _s2665_) >>= fun w__180 : option ((mword 5 * mword 6)) =>
                                                                                                                                          (if
                                                                                                                                             match w__180 with
                                                                                                                                             | Some
                                                                                                                                               (rd, uimm) =>
                                                                                                                                                true
                                                                                                                                             | _ =>
                                                                                                                                                false
                                                                                                                                             end
                                                                                                                                           then
                                                                                                                                             (_s3305_
                                                                                                                                                _s2665_) >>= fun w__181 : option ((mword 5 * mword 6)) =>
                                                                                                                                             (match w__181 with
                                                                                                                                              | Some
                                                                                                                                                (rd, uimm) =>
                                                                                                                                                 returnm true
                                                                                                                                              | _ =>
                                                                                                                                                 exit tt
                                                                                                                                                  : M (bool)
                                                                                                                                              end)
                                                                                                                                              : M (bool)
                                                                                                                                           else
                                                                                                                                             (_s3317_
                                                                                                                                                _s2665_) >>= fun w__184 : option ((mword 5 * mword 6)) =>
                                                                                                                                             (if
                                                                                                                                                match w__184 with
                                                                                                                                                | Some
                                                                                                                                                  (rs2, uimm) =>
                                                                                                                                                   Z.eqb
                                                                                                                                                     32
                                                                                                                                                     64
                                                                                                                                                | _ =>
                                                                                                                                                   false
                                                                                                                                                end
                                                                                                                                              then
                                                                                                                                                (_s3317_
                                                                                                                                                   _s2665_) >>= fun w__185 : option ((mword 5 * mword 6)) =>
                                                                                                                                                (match w__185 with
                                                                                                                                                 | Some
                                                                                                                                                   (rs2, uimm) =>
                                                                                                                                                    returnm true
                                                                                                                                                 | _ =>
                                                                                                                                                    exit tt
                                                                                                                                                     : M (bool)
                                                                                                                                                 end)
                                                                                                                                                 : M (bool)
                                                                                                                                              else
                                                                                                                                                (_s3329_
                                                                                                                                                   _s2665_) >>= fun w__188 : option (mword 5) =>
                                                                                                                                                (if
                                                                                                                                                   match w__188 with
                                                                                                                                                   | Some
                                                                                                                                                     rs1 =>
                                                                                                                                                      neq_vec
                                                                                                                                                        rs1
                                                                                                                                                        zreg
                                                                                                                                                   | _ =>
                                                                                                                                                      false
                                                                                                                                                   end
                                                                                                                                                 then
                                                                                                                                                   (_s3329_
                                                                                                                                                      _s2665_) >>= fun w__189 : option (mword 5) =>
                                                                                                                                                   (match w__189 with
                                                                                                                                                    | Some
                                                                                                                                                      rs1 =>
                                                                                                                                                       returnm true
                                                                                                                                                    | _ =>
                                                                                                                                                       exit tt
                                                                                                                                                        : M (bool)
                                                                                                                                                    end)
                                                                                                                                                    : M (bool)
                                                                                                                                                 else
                                                                                                                                                   (_s3337_
                                                                                                                                                      _s2665_) >>= fun w__192 : option (mword 5) =>
                                                                                                                                                   (if
                                                                                                                                                      match w__192 with
                                                                                                                                                      | Some
                                                                                                                                                        rs1 =>
                                                                                                                                                         neq_vec
                                                                                                                                                           rs1
                                                                                                                                                           zreg
                                                                                                                                                      | _ =>
                                                                                                                                                         false
                                                                                                                                                      end
                                                                                                                                                    then
                                                                                                                                                      (_s3337_
                                                                                                                                                         _s2665_) >>= fun w__193 : option (mword 5) =>
                                                                                                                                                      (match w__193 with
                                                                                                                                                       | Some
                                                                                                                                                         rs1 =>
                                                                                                                                                          returnm true
                                                                                                                                                       | _ =>
                                                                                                                                                          exit tt
                                                                                                                                                           : M (bool)
                                                                                                                                                       end)
                                                                                                                                                       : M (bool)
                                                                                                                                                    else
                                                                                                                                                      (_s3345_
                                                                                                                                                         _s2665_) >>= fun w__196 : option ((mword 5 * mword 5)) =>
                                                                                                                                                      (if
                                                                                                                                                         match w__196 with
                                                                                                                                                         | Some
                                                                                                                                                           (rd, rs2) =>
                                                                                                                                                            andb
                                                                                                                                                              (neq_vec
                                                                                                                                                                 rd
                                                                                                                                                                 zreg)
                                                                                                                                                              (neq_vec
                                                                                                                                                                 rs2
                                                                                                                                                                 zreg)
                                                                                                                                                         | _ =>
                                                                                                                                                            false
                                                                                                                                                         end
                                                                                                                                                       then
                                                                                                                                                         (_s3345_
                                                                                                                                                            _s2665_) >>= fun w__197 : option ((mword 5 * mword 5)) =>
                                                                                                                                                         (match w__197 with
                                                                                                                                                          | Some
                                                                                                                                                            (rd, rs2) =>
                                                                                                                                                             returnm true
                                                                                                                                                          | _ =>
                                                                                                                                                             exit tt
                                                                                                                                                              : M (bool)
                                                                                                                                                          end)
                                                                                                                                                          : M (bool)
                                                                                                                                                       else if
                                                                                                                                                         generic_eq
                                                                                                                                                           _s2665_
                                                                                                                                                           "c.ebreak"
                                                                                                                                                       then
                                                                                                                                                         returnm true
                                                                                                                                                       else
                                                                                                                                                         (_s3357_
                                                                                                                                                            _s2665_) >>= fun w__200 : option ((mword 5 * mword 5)) =>
                                                                                                                                                         (if
                                                                                                                                                            match w__200 with
                                                                                                                                                            | Some
                                                                                                                                                              (rsd, rs2) =>
                                                                                                                                                               andb
                                                                                                                                                                 (neq_vec
                                                                                                                                                                    rsd
                                                                                                                                                                    zreg)
                                                                                                                                                                 (neq_vec
                                                                                                                                                                    rs2
                                                                                                                                                                    zreg)
                                                                                                                                                            | _ =>
                                                                                                                                                               false
                                                                                                                                                            end
                                                                                                                                                          then
                                                                                                                                                            (_s3357_
                                                                                                                                                               _s2665_) >>= fun w__201 : option ((mword 5 * mword 5)) =>
                                                                                                                                                            (match w__201 with
                                                                                                                                                             | Some
                                                                                                                                                               (rsd, rs2) =>
                                                                                                                                                                returnm true
                                                                                                                                                             | _ =>
                                                                                                                                                                exit tt
                                                                                                                                                                 : M (bool)
                                                                                                                                                             end)
                                                                                                                                                             : M (bool)
                                                                                                                                                          else
                                                                                                                                                            (_s3369_
                                                                                                                                                               _s2665_) >>= fun w__204 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                            (if
                                                                                                                                                               match w__204 with
                                                                                                                                                               | Some
                                                                                                                                                                 (high, signed1, signed2, rd, rs1, rs2) =>
                                                                                                                                                                  true
                                                                                                                                                               | _ =>
                                                                                                                                                                  false
                                                                                                                                                               end
                                                                                                                                                             then
                                                                                                                                                               (_s3369_
                                                                                                                                                                  _s2665_) >>= fun w__205 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                               (match w__205 with
                                                                                                                                                                | Some
                                                                                                                                                                  (high, signed1, signed2, rd, rs1, rs2) =>
                                                                                                                                                                   returnm true
                                                                                                                                                                | _ =>
                                                                                                                                                                   exit tt
                                                                                                                                                                    : M (bool)
                                                                                                                                                                end)
                                                                                                                                                                : M (bool)
                                                                                                                                                             else
                                                                                                                                                               (_s3386_
                                                                                                                                                                  _s2665_) >>= fun w__208 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                               (if
                                                                                                                                                                  match w__208 with
                                                                                                                                                                  | Some
                                                                                                                                                                    (s, rd, rs1, rs2) =>
                                                                                                                                                                     true
                                                                                                                                                                  | _ =>
                                                                                                                                                                     false
                                                                                                                                                                  end
                                                                                                                                                                then
                                                                                                                                                                  (_s3386_
                                                                                                                                                                     _s2665_) >>= fun w__209 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                  (match w__209 with
                                                                                                                                                                   | Some
                                                                                                                                                                     (s, rd, rs1, rs2) =>
                                                                                                                                                                      returnm true
                                                                                                                                                                   | _ =>
                                                                                                                                                                      exit tt
                                                                                                                                                                       : M (bool)
                                                                                                                                                                   end)
                                                                                                                                                                   : M (bool)
                                                                                                                                                                else
                                                                                                                                                                  (_s3404_
                                                                                                                                                                     _s2665_) >>= fun w__212 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                  (if
                                                                                                                                                                     match w__212 with
                                                                                                                                                                     | Some
                                                                                                                                                                       (s, rd, rs1, rs2) =>
                                                                                                                                                                        true
                                                                                                                                                                     | _ =>
                                                                                                                                                                        false
                                                                                                                                                                     end
                                                                                                                                                                   then
                                                                                                                                                                     (_s3404_
                                                                                                                                                                        _s2665_) >>= fun w__213 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                     (match w__213 with
                                                                                                                                                                      | Some
                                                                                                                                                                        (s, rd, rs1, rs2) =>
                                                                                                                                                                         returnm true
                                                                                                                                                                      | _ =>
                                                                                                                                                                         exit tt
                                                                                                                                                                          : M (bool)
                                                                                                                                                                      end)
                                                                                                                                                                      : M (bool)
                                                                                                                                                                   else
                                                                                                                                                                     (_s3422_
                                                                                                                                                                        _s2665_) >>= fun w__216 : option ((mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                     (if
                                                                                                                                                                        match w__216 with
                                                                                                                                                                        | Some
                                                                                                                                                                          (rd, rs1, rs2) =>
                                                                                                                                                                           Z.eqb
                                                                                                                                                                             32
                                                                                                                                                                             64
                                                                                                                                                                        | _ =>
                                                                                                                                                                           false
                                                                                                                                                                        end
                                                                                                                                                                      then
                                                                                                                                                                        (_s3422_
                                                                                                                                                                           _s2665_) >>= fun w__217 : option ((mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                        (match w__217 with
                                                                                                                                                                         | Some
                                                                                                                                                                           (rd, rs1, rs2) =>
                                                                                                                                                                            returnm true
                                                                                                                                                                         | _ =>
                                                                                                                                                                            exit tt
                                                                                                                                                                             : M (bool)
                                                                                                                                                                         end)
                                                                                                                                                                         : M (bool)
                                                                                                                                                                      else
                                                                                                                                                                        (_s3438_
                                                                                                                                                                           _s2665_) >>= fun w__220 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                        (if
                                                                                                                                                                           match w__220 with
                                                                                                                                                                           | Some
                                                                                                                                                                             (s, rd, rs1, rs2) =>
                                                                                                                                                                              Z.eqb
                                                                                                                                                                                32
                                                                                                                                                                                64
                                                                                                                                                                           | _ =>
                                                                                                                                                                              false
                                                                                                                                                                           end
                                                                                                                                                                         then
                                                                                                                                                                           (_s3438_
                                                                                                                                                                              _s2665_) >>= fun w__221 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                           (match w__221 with
                                                                                                                                                                            | Some
                                                                                                                                                                              (s, rd, rs1, rs2) =>
                                                                                                                                                                               returnm true
                                                                                                                                                                            | _ =>
                                                                                                                                                                               exit tt
                                                                                                                                                                                : M (bool)
                                                                                                                                                                            end)
                                                                                                                                                                            : M (bool)
                                                                                                                                                                         else
                                                                                                                                                                           (_s3457_
                                                                                                                                                                              _s2665_) >>= fun w__224 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                           (if
                                                                                                                                                                              match w__224 with
                                                                                                                                                                              | Some
                                                                                                                                                                                (s, rd, rs1, rs2) =>
                                                                                                                                                                                 Z.eqb
                                                                                                                                                                                   32
                                                                                                                                                                                   64
                                                                                                                                                                              | _ =>
                                                                                                                                                                                 false
                                                                                                                                                                              end
                                                                                                                                                                            then
                                                                                                                                                                              (_s3457_
                                                                                                                                                                                 _s2665_) >>= fun w__225 : option ((bool * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                              (match w__225 with
                                                                                                                                                                               | Some
                                                                                                                                                                                 (s, rd, rs1, rs2) =>
                                                                                                                                                                                  returnm true
                                                                                                                                                                               | _ =>
                                                                                                                                                                                  exit tt
                                                                                                                                                                                   : M (bool)
                                                                                                                                                                               end)
                                                                                                                                                                               : M (bool)
                                                                                                                                                                            else
                                                                                                                                                                              (_s3476_
                                                                                                                                                                                 _s2665_) >>= fun w__228 : option ((csrop * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                              (if
                                                                                                                                                                                 match w__228 with
                                                                                                                                                                                 | Some
                                                                                                                                                                                   (op, rd, csr, rs1) =>
                                                                                                                                                                                    true
                                                                                                                                                                                 | _ =>
                                                                                                                                                                                    false
                                                                                                                                                                                 end
                                                                                                                                                                               then
                                                                                                                                                                                 (_s3476_
                                                                                                                                                                                    _s2665_) >>= fun w__229 : option ((csrop * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                 (match w__229 with
                                                                                                                                                                                  | Some
                                                                                                                                                                                    (op, rd, csr, rs1) =>
                                                                                                                                                                                     returnm true
                                                                                                                                                                                  | _ =>
                                                                                                                                                                                     exit tt
                                                                                                                                                                                      : M (bool)
                                                                                                                                                                                  end)
                                                                                                                                                                                  : M (bool)
                                                                                                                                                                               else
                                                                                                                                                                                 (_s3494_
                                                                                                                                                                                    _s2665_) >>= fun w__232 : option ((csrop * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                 (if
                                                                                                                                                                                    match w__232 with
                                                                                                                                                                                    | Some
                                                                                                                                                                                      (op, rd, csr, rs1) =>
                                                                                                                                                                                       true
                                                                                                                                                                                    | _ =>
                                                                                                                                                                                       false
                                                                                                                                                                                    end
                                                                                                                                                                                  then
                                                                                                                                                                                    (_s3494_
                                                                                                                                                                                       _s2665_) >>= fun w__233 : option ((csrop * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                    (match w__233 with
                                                                                                                                                                                     | Some
                                                                                                                                                                                       (op, rd, csr, rs1) =>
                                                                                                                                                                                        returnm true
                                                                                                                                                                                     | _ =>
                                                                                                                                                                                        exit tt
                                                                                                                                                                                         : M (bool)
                                                                                                                                                                                     end)
                                                                                                                                                                                     : M (bool)
                                                                                                                                                                                  else if
                                                                                                                                                                                    generic_eq
                                                                                                                                                                                      _s2665_
                                                                                                                                                                                      "uret"
                                                                                                                                                                                  then
                                                                                                                                                                                    returnm true
                                                                                                                                                                                  else if
                                                                                                                                                                                    match (_s3511_
                                                                                                                                                                                             _s2665_) with
                                                                                                                                                                                    | Some
                                                                                                                                                                                      imm =>
                                                                                                                                                                                       true
                                                                                                                                                                                    | _ =>
                                                                                                                                                                                       false
                                                                                                                                                                                    end
                                                                                                                                                                                  then
                                                                                                                                                                                    (match (_s3511_
                                                                                                                                                                                              _s2665_) with
                                                                                                                                                                                     | Some
                                                                                                                                                                                       imm =>
                                                                                                                                                                                        returnm true
                                                                                                                                                                                     | _ =>
                                                                                                                                                                                        exit tt
                                                                                                                                                                                         : M (bool)
                                                                                                                                                                                     end)
                                                                                                                                                                                     : M (bool)
                                                                                                                                                                                  else
                                                                                                                                                                                    (_s3517_
                                                                                                                                                                                       _s2665_) >>= fun w__238 : option (mword 5) =>
                                                                                                                                                                                    (if
                                                                                                                                                                                       match w__238 with
                                                                                                                                                                                       | Some
                                                                                                                                                                                         rsd =>
                                                                                                                                                                                          neq_vec
                                                                                                                                                                                            rsd
                                                                                                                                                                                            zreg
                                                                                                                                                                                       | _ =>
                                                                                                                                                                                          false
                                                                                                                                                                                       end
                                                                                                                                                                                     then
                                                                                                                                                                                       (_s3517_
                                                                                                                                                                                          _s2665_) >>= fun w__239 : option (mword 5) =>
                                                                                                                                                                                       (match w__239 with
                                                                                                                                                                                        | Some
                                                                                                                                                                                          rsd =>
                                                                                                                                                                                           returnm true
                                                                                                                                                                                        | _ =>
                                                                                                                                                                                           exit tt
                                                                                                                                                                                            : M (bool)
                                                                                                                                                                                        end)
                                                                                                                                                                                        : M (bool)
                                                                                                                                                                                     else if
                                                                                                                                                                                       match (_s3523_
                                                                                                                                                                                                _s2665_) with
                                                                                                                                                                                       | Some
                                                                                                                                                                                         imm =>
                                                                                                                                                                                          true
                                                                                                                                                                                       | _ =>
                                                                                                                                                                                          false
                                                                                                                                                                                       end
                                                                                                                                                                                     then
                                                                                                                                                                                       (match (_s3523_
                                                                                                                                                                                                 _s2665_) with
                                                                                                                                                                                        | Some
                                                                                                                                                                                          imm =>
                                                                                                                                                                                           returnm true
                                                                                                                                                                                        | _ =>
                                                                                                                                                                                           exit tt
                                                                                                                                                                                            : M (bool)
                                                                                                                                                                                        end)
                                                                                                                                                                                        : M (bool)
                                                                                                                                                                                     else if
                                                                                                                                                                                       match (_s3529_
                                                                                                                                                                                                _s2665_) with
                                                                                                                                                                                       | Some
                                                                                                                                                                                         imm =>
                                                                                                                                                                                          neq_vec
                                                                                                                                                                                            imm
                                                                                                                                                                                            ('b"000000"
                                                                                                                                                                                             : mword 6)
                                                                                                                                                                                       | _ =>
                                                                                                                                                                                          false
                                                                                                                                                                                       end
                                                                                                                                                                                     then
                                                                                                                                                                                       (match (_s3529_
                                                                                                                                                                                                 _s2665_) with
                                                                                                                                                                                        | Some
                                                                                                                                                                                          imm =>
                                                                                                                                                                                           returnm true
                                                                                                                                                                                        | _ =>
                                                                                                                                                                                           exit tt
                                                                                                                                                                                            : M (bool)
                                                                                                                                                                                        end)
                                                                                                                                                                                        : M (bool)
                                                                                                                                                                                     else
                                                                                                                                                                                       (_s3535_
                                                                                                                                                                                          _s2665_) >>= fun w__246 : option (mword 5) =>
                                                                                                                                                                                       (if
                                                                                                                                                                                          match w__246 with
                                                                                                                                                                                          | Some
                                                                                                                                                                                            rs2 =>
                                                                                                                                                                                             neq_vec
                                                                                                                                                                                               rs2
                                                                                                                                                                                               zreg
                                                                                                                                                                                          | _ =>
                                                                                                                                                                                             false
                                                                                                                                                                                          end
                                                                                                                                                                                        then
                                                                                                                                                                                          (_s3535_
                                                                                                                                                                                             _s2665_) >>= fun w__247 : option (mword 5) =>
                                                                                                                                                                                          (match w__247 with
                                                                                                                                                                                           | Some
                                                                                                                                                                                             rs2 =>
                                                                                                                                                                                              returnm true
                                                                                                                                                                                           | _ =>
                                                                                                                                                                                              exit tt
                                                                                                                                                                                               : M (bool)
                                                                                                                                                                                           end)
                                                                                                                                                                                           : M (bool)
                                                                                                                                                                                        else
                                                                                                                                                                                          (_s3541_
                                                                                                                                                                                             _s2665_) >>= fun w__250 : option (mword 5) =>
                                                                                                                                                                                          (if
                                                                                                                                                                                             match w__250 with
                                                                                                                                                                                             | Some
                                                                                                                                                                                               rs2 =>
                                                                                                                                                                                                neq_vec
                                                                                                                                                                                                  rs2
                                                                                                                                                                                                  zreg
                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                false
                                                                                                                                                                                             end
                                                                                                                                                                                           then
                                                                                                                                                                                             (_s3541_
                                                                                                                                                                                                _s2665_) >>= fun w__251 : option (mword 5) =>
                                                                                                                                                                                             (match w__251 with
                                                                                                                                                                                              | Some
                                                                                                                                                                                                rs2 =>
                                                                                                                                                                                                 returnm true
                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                 exit tt
                                                                                                                                                                                                  : M (bool)
                                                                                                                                                                                              end)
                                                                                                                                                                                              : M (bool)
                                                                                                                                                                                           else
                                                                                                                                                                                             (_s3547_
                                                                                                                                                                                                _s2665_) >>= fun w__254 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                             (if
                                                                                                                                                                                                match w__254 with
                                                                                                                                                                                                | Some
                                                                                                                                                                                                  (rsd, shamt) =>
                                                                                                                                                                                                   orb
                                                                                                                                                                                                     (eq_vec
                                                                                                                                                                                                        shamt
                                                                                                                                                                                                        ('b"000000"
                                                                                                                                                                                                         : mword 6))
                                                                                                                                                                                                     (eq_vec
                                                                                                                                                                                                        rsd
                                                                                                                                                                                                        zreg)
                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                   false
                                                                                                                                                                                                end
                                                                                                                                                                                              then
                                                                                                                                                                                                (_s3547_
                                                                                                                                                                                                   _s2665_) >>= fun w__255 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                (match w__255 with
                                                                                                                                                                                                 | Some
                                                                                                                                                                                                   (rsd, shamt) =>
                                                                                                                                                                                                    returnm true
                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                    exit tt
                                                                                                                                                                                                     : M (bool)
                                                                                                                                                                                                 end)
                                                                                                                                                                                                 : M (bool)
                                                                                                                                                                                              else
                                                                                                                                                                                                (_s3556_
                                                                                                                                                                                                   _s2665_) >>= fun w__258 : option (mword 3) =>
                                                                                                                                                                                                (if
                                                                                                                                                                                                   match w__258 with
                                                                                                                                                                                                   | Some
                                                                                                                                                                                                     rsd =>
                                                                                                                                                                                                      true
                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                      false
                                                                                                                                                                                                   end
                                                                                                                                                                                                 then
                                                                                                                                                                                                   (_s3556_
                                                                                                                                                                                                      _s2665_) >>= fun w__259 : option (mword 3) =>
                                                                                                                                                                                                   (match w__259 with
                                                                                                                                                                                                    | Some
                                                                                                                                                                                                      rsd =>
                                                                                                                                                                                                       returnm true
                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                       exit tt
                                                                                                                                                                                                        : M (bool)
                                                                                                                                                                                                    end)
                                                                                                                                                                                                    : M (bool)
                                                                                                                                                                                                 else
                                                                                                                                                                                                   (_s3562_
                                                                                                                                                                                                      _s2665_) >>= fun w__262 : option (mword 3) =>
                                                                                                                                                                                                   (if
                                                                                                                                                                                                      match w__262 with
                                                                                                                                                                                                      | Some
                                                                                                                                                                                                        rsd =>
                                                                                                                                                                                                         true
                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                         false
                                                                                                                                                                                                      end
                                                                                                                                                                                                    then
                                                                                                                                                                                                      (_s3562_
                                                                                                                                                                                                         _s2665_) >>= fun w__263 : option (mword 3) =>
                                                                                                                                                                                                      (match w__263 with
                                                                                                                                                                                                       | Some
                                                                                                                                                                                                         rsd =>
                                                                                                                                                                                                          returnm true
                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                          exit tt
                                                                                                                                                                                                           : M (bool)
                                                                                                                                                                                                       end)
                                                                                                                                                                                                       : M (bool)
                                                                                                                                                                                                    else
                                                                                                                                                                                                      (_s3568_
                                                                                                                                                                                                         _s2665_) >>= fun w__266 : option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)) =>
                                                                                                                                                                                                      (if
                                                                                                                                                                                                         match w__266 with
                                                                                                                                                                                                         | Some
                                                                                                                                                                                                           (pred, succ, rs, rd, fm) =>
                                                                                                                                                                                                            orb
                                                                                                                                                                                                              (andb
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    fm
                                                                                                                                                                                                                    (Ox"0"
                                                                                                                                                                                                                     : mword 4))
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    fm
                                                                                                                                                                                                                    (Ox"8"
                                                                                                                                                                                                                     : mword 4)))
                                                                                                                                                                                                              (orb
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    rs
                                                                                                                                                                                                                    ('b"00000"
                                                                                                                                                                                                                     : mword 5))
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    rd
                                                                                                                                                                                                                    ('b"00000"
                                                                                                                                                                                                                     : mword 5)))
                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                            false
                                                                                                                                                                                                         end
                                                                                                                                                                                                       then
                                                                                                                                                                                                         (_s3568_
                                                                                                                                                                                                            _s2665_) >>= fun w__267 : option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4)) =>
                                                                                                                                                                                                         (match w__267 with
                                                                                                                                                                                                          | Some
                                                                                                                                                                                                            (pred, succ, rs, rd, fm) =>
                                                                                                                                                                                                             returnm true
                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                             exit tt
                                                                                                                                                                                                              : M (bool)
                                                                                                                                                                                                          end)
                                                                                                                                                                                                          : M (bool)
                                                                                                                                                                                                       else
                                                                                                                                                                                                         (_s3586_
                                                                                                                                                                                                            _s2665_) >>= fun w__270 : option ((mword 5 * mword 5 * mword 12)) =>
                                                                                                                                                                                                         (if
                                                                                                                                                                                                            match w__270 with
                                                                                                                                                                                                            | Some
                                                                                                                                                                                                              (rd, rs, imm) =>
                                                                                                                                                                                                               orb
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    imm
                                                                                                                                                                                                                    (Ox"000"
                                                                                                                                                                                                                     : mword 12))
                                                                                                                                                                                                                 (orb
                                                                                                                                                                                                                    (neq_vec
                                                                                                                                                                                                                       rs
                                                                                                                                                                                                                       zreg)
                                                                                                                                                                                                                    (neq_vec
                                                                                                                                                                                                                       rd
                                                                                                                                                                                                                       zreg))
                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                               false
                                                                                                                                                                                                            end
                                                                                                                                                                                                          then
                                                                                                                                                                                                            (_s3586_
                                                                                                                                                                                                               _s2665_) >>= fun w__271 : option ((mword 5 * mword 5 * mword 12)) =>
                                                                                                                                                                                                            (match w__271 with
                                                                                                                                                                                                             | Some
                                                                                                                                                                                                               (rd, rs, imm) =>
                                                                                                                                                                                                                returnm true
                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                exit tt
                                                                                                                                                                                                                 : M (bool)
                                                                                                                                                                                                             end)
                                                                                                                                                                                                             : M (bool)
                                                                                                                                                                                                          else
                                                                                                                                                                                                            (_s3598_
                                                                                                                                                                                                               _s2665_) >>= fun w__274 : option ((word_width * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                                            (if
                                                                                                                                                                                                               match w__274 with
                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                 (width, rd, imm, rs1) =>
                                                                                                                                                                                                                  true
                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                  false
                                                                                                                                                                                                               end
                                                                                                                                                                                                             then
                                                                                                                                                                                                               (_s3598_
                                                                                                                                                                                                                  _s2665_) >>= fun w__275 : option ((word_width * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                                               (match w__275 with
                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                  (width, rd, imm, rs1) =>
                                                                                                                                                                                                                   returnm true
                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                   exit tt
                                                                                                                                                                                                                    : M (bool)
                                                                                                                                                                                                                end)
                                                                                                                                                                                                                : M (bool)
                                                                                                                                                                                                             else
                                                                                                                                                                                                               (_s3622_
                                                                                                                                                                                                                  _s2665_) >>= fun w__278 : option ((word_width * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                                               (if
                                                                                                                                                                                                                  match w__278 with
                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                    (width, rs2, imm, rs1) =>
                                                                                                                                                                                                                     true
                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                     false
                                                                                                                                                                                                                  end
                                                                                                                                                                                                                then
                                                                                                                                                                                                                  (_s3622_
                                                                                                                                                                                                                     _s2665_) >>= fun w__279 : option ((word_width * mword 5 * mword 12 * mword 5)) =>
                                                                                                                                                                                                                  (match w__279 with
                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                     (width, rs2, imm, rs1) =>
                                                                                                                                                                                                                      returnm true
                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                      exit tt
                                                                                                                                                                                                                       : M (bool)
                                                                                                                                                                                                                   end)
                                                                                                                                                                                                                   : M (bool)
                                                                                                                                                                                                                else
                                                                                                                                                                                                                  (_s3646_
                                                                                                                                                                                                                     _s2665_) >>= fun w__282 : option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                  (if
                                                                                                                                                                                                                     match w__282 with
                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                       (op, rd, rs1, rs2, rs3, rm) =>
                                                                                                                                                                                                                        true
                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                        false
                                                                                                                                                                                                                     end
                                                                                                                                                                                                                   then
                                                                                                                                                                                                                     (_s3646_
                                                                                                                                                                                                                        _s2665_) >>= fun w__283 : option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                     (match w__283 with
                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                        (op, rd, rs1, rs2, rs3, rm) =>
                                                                                                                                                                                                                         returnm true
                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                         exit tt
                                                                                                                                                                                                                          : M (bool)
                                                                                                                                                                                                                      end)
                                                                                                                                                                                                                      : M (bool)
                                                                                                                                                                                                                   else
                                                                                                                                                                                                                     (_s3671_
                                                                                                                                                                                                                        _s2665_) >>= fun w__286 : option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                     (if
                                                                                                                                                                                                                        match w__286 with
                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                          (op, rd, rs1, rs2, rm) =>
                                                                                                                                                                                                                           true
                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                           false
                                                                                                                                                                                                                        end
                                                                                                                                                                                                                      then
                                                                                                                                                                                                                        (_s3671_
                                                                                                                                                                                                                           _s2665_) >>= fun w__287 : option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                        (match w__287 with
                                                                                                                                                                                                                         | Some
                                                                                                                                                                                                                           (op, rd, rs1, rs2, rm) =>
                                                                                                                                                                                                                            returnm true
                                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                                            exit tt
                                                                                                                                                                                                                             : M (bool)
                                                                                                                                                                                                                         end)
                                                                                                                                                                                                                         : M (bool)
                                                                                                                                                                                                                      else
                                                                                                                                                                                                                        (_s3692_
                                                                                                                                                                                                                           _s2665_) >>= fun w__290 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                        (if
                                                                                                                                                                                                                           match w__290 with
                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                             (FSQRT_S, rd, rs1, rm) =>
                                                                                                                                                                                                                              true
                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                              false
                                                                                                                                                                                                                           end
                                                                                                                                                                                                                         then
                                                                                                                                                                                                                           (_s3692_
                                                                                                                                                                                                                              _s2665_) >>= fun w__291 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                           (match w__291 with
                                                                                                                                                                                                                            | Some
                                                                                                                                                                                                                              (FSQRT_S, rd, rs1, rm) =>
                                                                                                                                                                                                                               returnm true
                                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                                               exit tt
                                                                                                                                                                                                                                : M (bool)
                                                                                                                                                                                                                            end)
                                                                                                                                                                                                                            : M (bool)
                                                                                                                                                                                                                         else
                                                                                                                                                                                                                           (_s3709_
                                                                                                                                                                                                                              _s2665_) >>= fun w__294 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                           (if
                                                                                                                                                                                                                              match w__294 with
                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                (FCVT_W_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                 true
                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                 false
                                                                                                                                                                                                                              end
                                                                                                                                                                                                                            then
                                                                                                                                                                                                                              (_s3709_
                                                                                                                                                                                                                                 _s2665_) >>= fun w__295 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                              (match w__295 with
                                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                                 (FCVT_W_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                  returnm true
                                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                                  exit tt
                                                                                                                                                                                                                                   : M (bool)
                                                                                                                                                                                                                               end)
                                                                                                                                                                                                                               : M (bool)
                                                                                                                                                                                                                            else
                                                                                                                                                                                                                              (_s3726_
                                                                                                                                                                                                                                 _s2665_) >>= fun w__298 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                              (if
                                                                                                                                                                                                                                 match w__298 with
                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                   (FCVT_WU_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                    true
                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                    false
                                                                                                                                                                                                                                 end
                                                                                                                                                                                                                               then
                                                                                                                                                                                                                                 (_s3726_
                                                                                                                                                                                                                                    _s2665_) >>= fun w__299 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                 (match w__299 with
                                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                                    (FCVT_WU_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                     returnm true
                                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                                     exit tt
                                                                                                                                                                                                                                      : M (bool)
                                                                                                                                                                                                                                  end)
                                                                                                                                                                                                                                  : M (bool)
                                                                                                                                                                                                                               else
                                                                                                                                                                                                                                 (_s3743_
                                                                                                                                                                                                                                    _s2665_) >>= fun w__302 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                 (if
                                                                                                                                                                                                                                    match w__302 with
                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                      (FCVT_S_W, rd, rs1, rm) =>
                                                                                                                                                                                                                                       true
                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                       false
                                                                                                                                                                                                                                    end
                                                                                                                                                                                                                                  then
                                                                                                                                                                                                                                    (_s3743_
                                                                                                                                                                                                                                       _s2665_) >>= fun w__303 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                    (match w__303 with
                                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                                       (FCVT_S_W, rd, rs1, rm) =>
                                                                                                                                                                                                                                        returnm true
                                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                                        exit tt
                                                                                                                                                                                                                                         : M (bool)
                                                                                                                                                                                                                                     end)
                                                                                                                                                                                                                                     : M (bool)
                                                                                                                                                                                                                                  else
                                                                                                                                                                                                                                    (_s3760_
                                                                                                                                                                                                                                       _s2665_) >>= fun w__306 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                    (if
                                                                                                                                                                                                                                       match w__306 with
                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                         (FCVT_S_WU, rd, rs1, rm) =>
                                                                                                                                                                                                                                          true
                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                          false
                                                                                                                                                                                                                                       end
                                                                                                                                                                                                                                     then
                                                                                                                                                                                                                                       (_s3760_
                                                                                                                                                                                                                                          _s2665_) >>= fun w__307 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                       (match w__307 with
                                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                                          (FCVT_S_WU, rd, rs1, rm) =>
                                                                                                                                                                                                                                           returnm true
                                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                                           exit tt
                                                                                                                                                                                                                                            : M (bool)
                                                                                                                                                                                                                                        end)
                                                                                                                                                                                                                                        : M (bool)
                                                                                                                                                                                                                                     else
                                                                                                                                                                                                                                       (_s3777_
                                                                                                                                                                                                                                          _s2665_) >>= fun w__310 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                       (if
                                                                                                                                                                                                                                          match w__310 with
                                                                                                                                                                                                                                          | Some
                                                                                                                                                                                                                                            (FCVT_L_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                             true
                                                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                                                             false
                                                                                                                                                                                                                                          end
                                                                                                                                                                                                                                        then
                                                                                                                                                                                                                                          (_s3777_
                                                                                                                                                                                                                                             _s2665_) >>= fun w__311 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                          (match w__311 with
                                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                                             (FCVT_L_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                              returnm true
                                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                                              exit tt
                                                                                                                                                                                                                                               : M (bool)
                                                                                                                                                                                                                                           end)
                                                                                                                                                                                                                                           : M (bool)
                                                                                                                                                                                                                                        else
                                                                                                                                                                                                                                          (_s3794_
                                                                                                                                                                                                                                             _s2665_) >>= fun w__314 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                          (if
                                                                                                                                                                                                                                             match w__314 with
                                                                                                                                                                                                                                             | Some
                                                                                                                                                                                                                                               (FCVT_LU_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                                true
                                                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                                                false
                                                                                                                                                                                                                                             end
                                                                                                                                                                                                                                           then
                                                                                                                                                                                                                                             (_s3794_
                                                                                                                                                                                                                                                _s2665_) >>= fun w__315 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                             (match w__315 with
                                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                                (FCVT_LU_S, rd, rs1, rm) =>
                                                                                                                                                                                                                                                 returnm true
                                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                                 exit tt
                                                                                                                                                                                                                                                  : M (bool)
                                                                                                                                                                                                                                              end)
                                                                                                                                                                                                                                              : M (bool)
                                                                                                                                                                                                                                           else
                                                                                                                                                                                                                                             (_s3811_
                                                                                                                                                                                                                                                _s2665_) >>= fun w__318 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                             (if
                                                                                                                                                                                                                                                match w__318 with
                                                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                                                  (FCVT_S_L, rd, rs1, rm) =>
                                                                                                                                                                                                                                                   true
                                                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                                                   false
                                                                                                                                                                                                                                                end
                                                                                                                                                                                                                                              then
                                                                                                                                                                                                                                                (_s3811_
                                                                                                                                                                                                                                                   _s2665_) >>= fun w__319 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                                (match w__319 with
                                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                                   (FCVT_S_L, rd, rs1, rm) =>
                                                                                                                                                                                                                                                    returnm true
                                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                                    exit tt
                                                                                                                                                                                                                                                     : M (bool)
                                                                                                                                                                                                                                                 end)
                                                                                                                                                                                                                                                 : M (bool)
                                                                                                                                                                                                                                              else
                                                                                                                                                                                                                                                (_s3828_
                                                                                                                                                                                                                                                   _s2665_) >>= fun w__322 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                                (if
                                                                                                                                                                                                                                                   match w__322 with
                                                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                                                     (FCVT_S_LU, rd, rs1, rm) =>
                                                                                                                                                                                                                                                      true
                                                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                                                      false
                                                                                                                                                                                                                                                   end
                                                                                                                                                                                                                                                 then
                                                                                                                                                                                                                                                   (_s3828_
                                                                                                                                                                                                                                                      _s2665_) >>= fun w__323 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode)) =>
                                                                                                                                                                                                                                                   (match w__323 with
                                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                                      (FCVT_S_LU, rd, rs1, rm) =>
                                                                                                                                                                                                                                                       returnm true
                                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                                       exit tt
                                                                                                                                                                                                                                                        : M (bool)
                                                                                                                                                                                                                                                    end)
                                                                                                                                                                                                                                                    : M (bool)
                                                                                                                                                                                                                                                 else
                                                                                                                                                                                                                                                   (_s3845_
                                                                                                                                                                                                                                                      _s2665_) >>= fun w__326 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                   (if
                                                                                                                                                                                                                                                      match w__326 with
                                                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                                                        (FSGNJ_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                         true
                                                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                                                         false
                                                                                                                                                                                                                                                      end
                                                                                                                                                                                                                                                    then
                                                                                                                                                                                                                                                      (_s3845_
                                                                                                                                                                                                                                                         _s2665_) >>= fun w__327 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                      (match w__327 with
                                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                                         (FSGNJ_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                          returnm true
                                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                                          exit tt
                                                                                                                                                                                                                                                           : M (bool)
                                                                                                                                                                                                                                                       end)
                                                                                                                                                                                                                                                       : M (bool)
                                                                                                                                                                                                                                                    else
                                                                                                                                                                                                                                                      (_s3862_
                                                                                                                                                                                                                                                         _s2665_) >>= fun w__330 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                      (if
                                                                                                                                                                                                                                                         match w__330 with
                                                                                                                                                                                                                                                         | Some
                                                                                                                                                                                                                                                           (FSGNJN_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                            true
                                                                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                                                                            false
                                                                                                                                                                                                                                                         end
                                                                                                                                                                                                                                                       then
                                                                                                                                                                                                                                                         (_s3862_
                                                                                                                                                                                                                                                            _s2665_) >>= fun w__331 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                         (match w__331 with
                                                                                                                                                                                                                                                          | Some
                                                                                                                                                                                                                                                            (FSGNJN_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                             returnm true
                                                                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                                                                             exit tt
                                                                                                                                                                                                                                                              : M (bool)
                                                                                                                                                                                                                                                          end)
                                                                                                                                                                                                                                                          : M (bool)
                                                                                                                                                                                                                                                       else
                                                                                                                                                                                                                                                         (_s3879_
                                                                                                                                                                                                                                                            _s2665_) >>= fun w__334 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                         (if
                                                                                                                                                                                                                                                            match w__334 with
                                                                                                                                                                                                                                                            | Some
                                                                                                                                                                                                                                                              (FSGNJX_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                               true
                                                                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                                                                               false
                                                                                                                                                                                                                                                            end
                                                                                                                                                                                                                                                          then
                                                                                                                                                                                                                                                            (_s3879_
                                                                                                                                                                                                                                                               _s2665_) >>= fun w__335 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                            (match w__335 with
                                                                                                                                                                                                                                                             | Some
                                                                                                                                                                                                                                                               (FSGNJX_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                returnm true
                                                                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                                                                exit tt
                                                                                                                                                                                                                                                                 : M (bool)
                                                                                                                                                                                                                                                             end)
                                                                                                                                                                                                                                                             : M (bool)
                                                                                                                                                                                                                                                          else
                                                                                                                                                                                                                                                            (_s3896_
                                                                                                                                                                                                                                                               _s2665_) >>= fun w__338 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                            (if
                                                                                                                                                                                                                                                               match w__338 with
                                                                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                                                                 (FMIN_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                  true
                                                                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                                                                  false
                                                                                                                                                                                                                                                               end
                                                                                                                                                                                                                                                             then
                                                                                                                                                                                                                                                               (_s3896_
                                                                                                                                                                                                                                                                  _s2665_) >>= fun w__339 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                               (match w__339 with
                                                                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                                                                  (FMIN_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                   returnm true
                                                                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                                                                   exit tt
                                                                                                                                                                                                                                                                    : M (bool)
                                                                                                                                                                                                                                                                end)
                                                                                                                                                                                                                                                                : M (bool)
                                                                                                                                                                                                                                                             else
                                                                                                                                                                                                                                                               (_s3913_
                                                                                                                                                                                                                                                                  _s2665_) >>= fun w__342 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                               (if
                                                                                                                                                                                                                                                                  match w__342 with
                                                                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                                                                    (FMAX_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                     true
                                                                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                                                                     false
                                                                                                                                                                                                                                                                  end
                                                                                                                                                                                                                                                                then
                                                                                                                                                                                                                                                                  (_s3913_
                                                                                                                                                                                                                                                                     _s2665_) >>= fun w__343 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                  (match w__343 with
                                                                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                                                                     (FMAX_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                      returnm true
                                                                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                                                                      exit tt
                                                                                                                                                                                                                                                                       : M (bool)
                                                                                                                                                                                                                                                                   end)
                                                                                                                                                                                                                                                                   : M (bool)
                                                                                                                                                                                                                                                                else
                                                                                                                                                                                                                                                                  (_s3930_
                                                                                                                                                                                                                                                                     _s2665_) >>= fun w__346 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                  (if
                                                                                                                                                                                                                                                                     match w__346 with
                                                                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                                                                       (FEQ_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                        true
                                                                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                                                                        false
                                                                                                                                                                                                                                                                     end
                                                                                                                                                                                                                                                                   then
                                                                                                                                                                                                                                                                     (_s3930_
                                                                                                                                                                                                                                                                        _s2665_) >>= fun w__347 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                     (match w__347 with
                                                                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                                                                        (FEQ_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                         returnm true
                                                                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                                                                         exit tt
                                                                                                                                                                                                                                                                          : M (bool)
                                                                                                                                                                                                                                                                      end)
                                                                                                                                                                                                                                                                      : M (bool)
                                                                                                                                                                                                                                                                   else
                                                                                                                                                                                                                                                                     (_s3947_
                                                                                                                                                                                                                                                                        _s2665_) >>= fun w__350 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                     (if
                                                                                                                                                                                                                                                                        match w__350 with
                                                                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                                                                          (FLT_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                           true
                                                                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                                                                           false
                                                                                                                                                                                                                                                                        end
                                                                                                                                                                                                                                                                      then
                                                                                                                                                                                                                                                                        (_s3947_
                                                                                                                                                                                                                                                                           _s2665_) >>= fun w__351 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                        (match w__351 with
                                                                                                                                                                                                                                                                         | Some
                                                                                                                                                                                                                                                                           (FLT_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                            returnm true
                                                                                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                                                                                            exit tt
                                                                                                                                                                                                                                                                             : M (bool)
                                                                                                                                                                                                                                                                         end)
                                                                                                                                                                                                                                                                         : M (bool)
                                                                                                                                                                                                                                                                      else
                                                                                                                                                                                                                                                                        (_s3964_
                                                                                                                                                                                                                                                                           _s2665_) >>= fun w__354 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                        (if
                                                                                                                                                                                                                                                                           match w__354 with
                                                                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                                                                             (FLE_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                              true
                                                                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                                                                              false
                                                                                                                                                                                                                                                                           end
                                                                                                                                                                                                                                                                         then
                                                                                                                                                                                                                                                                           (_s3964_
                                                                                                                                                                                                                                                                              _s2665_) >>= fun w__355 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                           (match w__355 with
                                                                                                                                                                                                                                                                            | Some
                                                                                                                                                                                                                                                                              (FLE_S, rd, rs1, rs2) =>
                                                                                                                                                                                                                                                                               returnm true
                                                                                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                                                                                               exit tt
                                                                                                                                                                                                                                                                                : M (bool)
                                                                                                                                                                                                                                                                            end)
                                                                                                                                                                                                                                                                            : M (bool)
                                                                                                                                                                                                                                                                         else
                                                                                                                                                                                                                                                                           (_s3981_
                                                                                                                                                                                                                                                                              _s2665_) >>= fun w__358 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                           (if
                                                                                                                                                                                                                                                                              match w__358 with
                                                                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                                                                (FMV_X_W, rd, rs1) =>
                                                                                                                                                                                                                                                                                 true
                                                                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                                                                 false
                                                                                                                                                                                                                                                                              end
                                                                                                                                                                                                                                                                            then
                                                                                                                                                                                                                                                                              (_s3981_
                                                                                                                                                                                                                                                                                 _s2665_) >>= fun w__359 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                              (match w__359 with
                                                                                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                                                                                 (FMV_X_W, rd, rs1) =>
                                                                                                                                                                                                                                                                                  returnm true
                                                                                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                                                                                  exit tt
                                                                                                                                                                                                                                                                                   : M (bool)
                                                                                                                                                                                                                                                                               end)
                                                                                                                                                                                                                                                                               : M (bool)
                                                                                                                                                                                                                                                                            else
                                                                                                                                                                                                                                                                              (_s3994_
                                                                                                                                                                                                                                                                                 _s2665_) >>= fun w__362 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                              (if
                                                                                                                                                                                                                                                                                 match w__362 with
                                                                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                                                                   (FMV_W_X, rd, rs1) =>
                                                                                                                                                                                                                                                                                    true
                                                                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                                                                    false
                                                                                                                                                                                                                                                                                 end
                                                                                                                                                                                                                                                                               then
                                                                                                                                                                                                                                                                                 (_s3994_
                                                                                                                                                                                                                                                                                    _s2665_) >>= fun w__363 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                                 (match w__363 with
                                                                                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                                                                                    (FMV_W_X, rd, rs1) =>
                                                                                                                                                                                                                                                                                     returnm true
                                                                                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                                                                                     exit tt
                                                                                                                                                                                                                                                                                      : M (bool)
                                                                                                                                                                                                                                                                                  end)
                                                                                                                                                                                                                                                                                  : M (bool)
                                                                                                                                                                                                                                                                               else
                                                                                                                                                                                                                                                                                 (_s4007_
                                                                                                                                                                                                                                                                                    _s2665_) >>= fun w__366 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                                 (if
                                                                                                                                                                                                                                                                                    match w__366 with
                                                                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                                                                      (FCLASS_S, rd, rs1) =>
                                                                                                                                                                                                                                                                                       true
                                                                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                                                                       false
                                                                                                                                                                                                                                                                                    end
                                                                                                                                                                                                                                                                                  then
                                                                                                                                                                                                                                                                                    (_s4007_
                                                                                                                                                                                                                                                                                       _s2665_) >>= fun w__367 : option ((f_un_op_S * mword 5 * mword 5)) =>
                                                                                                                                                                                                                                                                                    (match w__367 with
                                                                                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                                                                                       (FCLASS_S, rd, rs1) =>
                                                                                                                                                                                                                                                                                        returnm true
                                                                                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                                                                                        exit tt
                                                                                                                                                                                                                                                                                         : M (bool)
                                                                                                                                                                                                                                                                                     end)
                                                                                                                                                                                                                                                                                     : M (bool)
                                                                                                                                                                                                                                                                                  else
                                                                                                                                                                                                                                                                                    (_s4020_
                                                                                                                                                                                                                                                                                       _s2665_) >>= fun w__370 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                                                                                                    (if
                                                                                                                                                                                                                                                                                       match w__370 with
                                                                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                                                                         (rd, imm) =>
                                                                                                                                                                                                                                                                                          Z.eqb
                                                                                                                                                                                                                                                                                            32
                                                                                                                                                                                                                                                                                            32
                                                                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                                                                          false
                                                                                                                                                                                                                                                                                       end
                                                                                                                                                                                                                                                                                     then
                                                                                                                                                                                                                                                                                       (_s4020_
                                                                                                                                                                                                                                                                                          _s2665_) >>= fun w__371 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                                                                                                       (match w__371 with
                                                                                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                                                                                          (rd, imm) =>
                                                                                                                                                                                                                                                                                           returnm true
                                                                                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                                                                                           exit tt
                                                                                                                                                                                                                                                                                            : M (bool)
                                                                                                                                                                                                                                                                                        end)
                                                                                                                                                                                                                                                                                        : M (bool)
                                                                                                                                                                                                                                                                                     else
                                                                                                                                                                                                                                                                                       (_s4032_
                                                                                                                                                                                                                                                                                          _s2665_) >>= fun w__374 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                                                                                                       (if
                                                                                                                                                                                                                                                                                          match w__374 with
                                                                                                                                                                                                                                                                                          | Some
                                                                                                                                                                                                                                                                                            (rd, uimm) =>
                                                                                                                                                                                                                                                                                             Z.eqb
                                                                                                                                                                                                                                                                                               32
                                                                                                                                                                                                                                                                                               32
                                                                                                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                                                                                                             false
                                                                                                                                                                                                                                                                                          end
                                                                                                                                                                                                                                                                                        then
                                                                                                                                                                                                                                                                                          (_s4032_
                                                                                                                                                                                                                                                                                             _s2665_) >>= fun w__375 : option ((mword 5 * mword 6)) =>
                                                                                                                                                                                                                                                                                          (match w__375 with
                                                                                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                                                                                             (rd, uimm) =>
                                                                                                                                                                                                                                                                                              returnm true
                                                                                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                                                                                              exit tt
                                                                                                                                                                                                                                                                                               : M (bool)
                                                                                                                                                                                                                                                                                           end)
                                                                                                                                                                                                                                                                                           : M (bool)
                                                                                                                                                                                                                                                                                        else
                                                                                                                                                                                                                                                                                          (_s4044_
                                                                                                                                                                                                                                                                                             _s2665_) >>= fun w__378 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                                                                                                                                                                                                                                          (if
                                                                                                                                                                                                                                                                                             match w__378 with
                                                                                                                                                                                                                                                                                             | Some
                                                                                                                                                                                                                                                                                               (rdc, rsc, uimm) =>
                                                                                                                                                                                                                                                                                                Z.eqb
                                                                                                                                                                                                                                                                                                  32
                                                                                                                                                                                                                                                                                                  32
                                                                                                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                                                                                                false
                                                                                                                                                                                                                                                                                             end
                                                                                                                                                                                                                                                                                           then
                                                                                                                                                                                                                                                                                             (_s4044_
                                                                                                                                                                                                                                                                                                _s2665_) >>= fun w__379 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                                                                                                                                                                                                                                             (match w__379 with
                                                                                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                                                                                (rdc, rsc, uimm) =>
                                                                                                                                                                                                                                                                                                 returnm true
                                                                                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                                                                                 exit tt
                                                                                                                                                                                                                                                                                                  : M (bool)
                                                                                                                                                                                                                                                                                              end)
                                                                                                                                                                                                                                                                                              : M (bool)
                                                                                                                                                                                                                                                                                           else
                                                                                                                                                                                                                                                                                             (_s4060_
                                                                                                                                                                                                                                                                                                _s2665_) >>= fun w__382 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                                                                                                                                                                                                                                             (if
                                                                                                                                                                                                                                                                                                match w__382 with
                                                                                                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                                                                                                  (rsc1, rsc2, uimm) =>
                                                                                                                                                                                                                                                                                                   Z.eqb
                                                                                                                                                                                                                                                                                                     32
                                                                                                                                                                                                                                                                                                     32
                                                                                                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                                                                                                   false
                                                                                                                                                                                                                                                                                                end
                                                                                                                                                                                                                                                                                              then
                                                                                                                                                                                                                                                                                                (_s4060_
                                                                                                                                                                                                                                                                                                   _s2665_) >>= fun w__383 : option ((mword 3 * mword 3 * mword 5)) =>
                                                                                                                                                                                                                                                                                                (match w__383 with
                                                                                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                                                                                   (rsc1, rsc2, uimm) =>
                                                                                                                                                                                                                                                                                                    returnm true
                                                                                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                                                                                    exit tt
                                                                                                                                                                                                                                                                                                     : M (bool)
                                                                                                                                                                                                                                                                                                 end)
                                                                                                                                                                                                                                                                                                 : M (bool)
                                                                                                                                                                                                                                                                                              else
                                                                                                                                                                                                                                                                                                (_s4076_
                                                                                                                                                                                                                                                                                                   _s2665_) >>= fun w__386 : option (mword 32) =>
                                                                                                                                                                                                                                                                                                (if
                                                                                                                                                                                                                                                                                                   match w__386 with
                                                                                                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                                                                                                     s =>
                                                                                                                                                                                                                                                                                                      true
                                                                                                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                                                                                                      false
                                                                                                                                                                                                                                                                                                   end
                                                                                                                                                                                                                                                                                                 then
                                                                                                                                                                                                                                                                                                   (_s4076_
                                                                                                                                                                                                                                                                                                      _s2665_) >>= fun w__387 : option (mword 32) =>
                                                                                                                                                                                                                                                                                                   (match w__387 with
                                                                                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                                                                                      s =>
                                                                                                                                                                                                                                                                                                       returnm true
                                                                                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                                                                                       exit tt
                                                                                                                                                                                                                                                                                                        : M (bool)
                                                                                                                                                                                                                                                                                                    end)
                                                                                                                                                                                                                                                                                                    : M (bool)
                                                                                                                                                                                                                                                                                                 else
                                                                                                                                                                                                                                                                                                   (_s4084_
                                                                                                                                                                                                                                                                                                      _s2665_) >>= fun w__390 : option (mword 16) =>
                                                                                                                                                                                                                                                                                                   (if
                                                                                                                                                                                                                                                                                                      match w__390 with
                                                                                                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                                                                                                        s =>
                                                                                                                                                                                                                                                                                                         true
                                                                                                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                                                                                                         false
                                                                                                                                                                                                                                                                                                      end
                                                                                                                                                                                                                                                                                                    then
                                                                                                                                                                                                                                                                                                      (_s4084_
                                                                                                                                                                                                                                                                                                         _s2665_) >>= fun w__391 : option (mword 16) =>
                                                                                                                                                                                                                                                                                                      (match w__391 with
                                                                                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                                                                                         s =>
                                                                                                                                                                                                                                                                                                          returnm true
                                                                                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                                                                                          exit tt
                                                                                                                                                                                                                                                                                                           : M (bool)
                                                                                                                                                                                                                                                                                                       end)
                                                                                                                                                                                                                                                                                                       : M (bool)
                                                                                                                                                                                                                                                                                                    else
                                                                                                                                                                                                                                                                                                      returnm false)
                                                                                                                                                                                                                                                                                                    : M (bool))
                                                                                                                                                                                                                                                                                                 : M (bool))
                                                                                                                                                                                                                                                                                              : M (bool))
                                                                                                                                                                                                                                                                                           : M (bool))
                                                                                                                                                                                                                                                                                        : M (bool))
                                                                                                                                                                                                                                                                                     : M (bool))
                                                                                                                                                                                                                                                                                  : M (bool))
                                                                                                                                                                                                                                                                               : M (bool))
                                                                                                                                                                                                                                                                            : M (bool))
                                                                                                                                                                                                                                                                         : M (bool))
                                                                                                                                                                                                                                                                      : M (bool))
                                                                                                                                                                                                                                                                   : M (bool))
                                                                                                                                                                                                                                                                : M (bool))
                                                                                                                                                                                                                                                             : M (bool))
                                                                                                                                                                                                                                                          : M (bool))
                                                                                                                                                                                                                                                       : M (bool))
                                                                                                                                                                                                                                                    : M (bool))
                                                                                                                                                                                                                                                 : M (bool))
                                                                                                                                                                                                                                              : M (bool))
                                                                                                                                                                                                                                           : M (bool))
                                                                                                                                                                                                                                        : M (bool))
                                                                                                                                                                                                                                     : M (bool))
                                                                                                                                                                                                                                  : M (bool))
                                                                                                                                                                                                                               : M (bool))
                                                                                                                                                                                                                            : M (bool))
                                                                                                                                                                                                                         : M (bool))
                                                                                                                                                                                                                      : M (bool))
                                                                                                                                                                                                                   : M (bool))
                                                                                                                                                                                                                : M (bool))
                                                                                                                                                                                                             : M (bool))
                                                                                                                                                                                                          : M (bool))
                                                                                                                                                                                                       : M (bool))
                                                                                                                                                                                                    : M (bool))
                                                                                                                                                                                                 : M (bool))
                                                                                                                                                                                              : M (bool))
                                                                                                                                                                                           : M (bool))
                                                                                                                                                                                        : M (bool))
                                                                                                                                                                                     : M (bool))
                                                                                                                                                                                  : M (bool))
                                                                                                                                                                               : M (bool))
                                                                                                                                                                            : M (bool))
                                                                                                                                                                         : M (bool))
                                                                                                                                                                      : M (bool))
                                                                                                                                                                   : M (bool))
                                                                                                                                                                : M (bool))
                                                                                                                                                             : M (bool))
                                                                                                                                                          : M (bool))
                                                                                                                                                       : M (bool))
                                                                                                                                                    : M (bool))
                                                                                                                                                 : M (bool))
                                                                                                                                              : M (bool))
                                                                                                                                           : M (bool))
                                                                                                                                        : M (bool))
                                                                                                                                     : M (bool))
                                                                                                                                  : M (bool))
                                                                                                                               : M (bool))
                                                                                                                            : M (bool))
                                                                                                                         : M (bool))
                                                                                                                      : M (bool))
                                                                                                                   : M (bool))
                                                                                                                : M (bool))
                                                                                                             : M (bool))
                                                                                                          : M (bool))
                                                                                                       : M (bool))
                                                                                                    : M (bool))
                                                                                                 : M (bool))
                                                                                              : M (bool))
                                                                                           : M (bool))
                                                                                        : M (bool))
                                                                                     : M (bool))
                                                                                  : M (bool))
                                                                               : M (bool))
                                                                            : M (bool))
                                                                         : M (bool))
                                                                      : M (bool))
                                                                   : M (bool))
                                                                : M (bool))
                                                             : M (bool))
                                                          : M (bool))
                                                       : M (bool))
                                                    : M (bool))
                                                 : M (bool))
                                              : M (bool))
                                           : M (bool))
                                        : M (bool))
                                     : M (bool))
                                  : M (bool))
                               : M (bool))
                            : M (bool))
                         : M (bool))
                      : M (bool))
                   : M (bool))
                : M (bool))
             : M (bool))
          : M (bool))
       : M (bool))
    : M (bool).

Definition _s5559_ (_s5560_ : string) : M (option ((mword 16 * string))) :=
   let _s5561_ := _s5560_ in
   (if string_startswith _s5561_ "c.illegal" then
      (match (string_drop _s5561_ (projT1 (string_length "c.illegal"))) with
       | _s5562_ =>
          (spc_matches_prefix _s5562_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s5563_ _) =>
                      match (string_drop _s5562_ _s5563_) with
                      | _s5564_ =>
                         match (hex_bits_16_matches_prefix _s5564_) with
                         | Some (s, existT _ _s5565_ _) =>
                            match (string_drop _s5564_ _s5565_) with | s_ => Some (s, s_) end
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option ((mword 16 * string)))
    else returnm None)
    : M (option ((mword 16 * string))).

Definition _s5551_ (_s5552_ : string) : M (option ((mword 32 * string))) :=
   let _s5553_ := _s5552_ in
   (if string_startswith _s5553_ "illegal" then
      (match (string_drop _s5553_ (projT1 (string_length "illegal"))) with
       | _s5554_ =>
          (spc_matches_prefix _s5554_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s5555_ _) =>
                      match (string_drop _s5554_ _s5555_) with
                      | _s5556_ =>
                         match (hex_bits_32_matches_prefix _s5556_) with
                         | Some (s, existT _ _s5557_ _) =>
                            match (string_drop _s5556_ _s5557_) with | s_ => Some (s, s_) end
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option ((mword 32 * string)))
    else returnm None)
    : M (option ((mword 32 * string))).

Definition _s5535_ (_s5536_ : string) : M (option ((mword 3 * mword 3 * mword 5 * string))) :=
   let _s5537_ := _s5536_ in
   (if string_startswith _s5537_ "c.fsw" then
      (match (string_drop _s5537_ (projT1 (string_length "c.fsw"))) with
       | _s5538_ =>
          (spc_matches_prefix _s5538_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s5539_ _) =>
              (match (string_drop _s5538_ _s5539_) with
               | _s5540_ =>
                  (creg_name_matches_prefix _s5540_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsc1, existT _ _s5541_ _) =>
                      (match (string_drop _s5540_ _s5541_) with
                       | _s5542_ =>
                          (sep_matches_prefix _s5542_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s5543_ _) =>
                              (match (string_drop _s5542_ _s5543_) with
                               | _s5544_ =>
                                  (creg_name_matches_prefix _s5544_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc2, existT _ _s5545_ _) =>
                                      (match (string_drop _s5544_ _s5545_) with
                                       | _s5546_ =>
                                          (sep_matches_prefix _s5546_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s5547_ _) =>
                                                      match (string_drop _s5546_ _s5547_) with
                                                      | _s5548_ =>
                                                         match (hex_bits_7_matches_prefix _s5548_) with
                                                         | Some (v__1212, existT _ _s5549_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1212 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1212 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1212 6 2 in
                                                              match (string_drop _s5548_ _s5549_) with
                                                              | s_ => Some (rsc1, rsc2, uimm, s_)
                                                              end
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5 * string)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5 * string))).

Definition _s5519_ (_s5520_ : string) : M (option ((mword 3 * mword 3 * mword 5 * string))) :=
   let _s5521_ := _s5520_ in
   (if string_startswith _s5521_ "c.flw" then
      (match (string_drop _s5521_ (projT1 (string_length "c.flw"))) with
       | _s5522_ =>
          (spc_matches_prefix _s5522_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s5523_ _) =>
              (match (string_drop _s5522_ _s5523_) with
               | _s5524_ =>
                  (creg_name_matches_prefix _s5524_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s5525_ _) =>
                      (match (string_drop _s5524_ _s5525_) with
                       | _s5526_ =>
                          (sep_matches_prefix _s5526_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s5527_ _) =>
                              (match (string_drop _s5526_ _s5527_) with
                               | _s5528_ =>
                                  (creg_name_matches_prefix _s5528_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc, existT _ _s5529_ _) =>
                                      (match (string_drop _s5528_ _s5529_) with
                                       | _s5530_ =>
                                          (sep_matches_prefix _s5530_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s5531_ _) =>
                                                      match (string_drop _s5530_ _s5531_) with
                                                      | _s5532_ =>
                                                         match (hex_bits_7_matches_prefix _s5532_) with
                                                         | Some (v__1214, existT _ _s5533_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1214 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1214 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1214 6 2 in
                                                              match (string_drop _s5532_ _s5533_) with
                                                              | s_ => Some (rdc, rsc, uimm, s_)
                                                              end
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5 * string)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5 * string))).

Definition _s5507_ (_s5508_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s5509_ := _s5508_ in
   (if string_startswith _s5509_ "c.fswsp" then
      (match (string_drop _s5509_ (projT1 (string_length "c.fswsp"))) with
       | _s5510_ =>
          (spc_matches_prefix _s5510_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s5511_ _) =>
              (match (string_drop _s5510_ _s5511_) with
               | _s5512_ =>
                  (reg_name_matches_prefix _s5512_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s5513_ _) =>
                      (match (string_drop _s5512_ _s5513_) with
                       | _s5514_ =>
                          (sep_matches_prefix _s5514_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s5515_ _) =>
                                      match (string_drop _s5514_ _s5515_) with
                                      | _s5516_ =>
                                         match (hex_bits_6_matches_prefix _s5516_) with
                                         | Some (uimm, existT _ _s5517_ _) =>
                                            match (string_drop _s5516_ _s5517_) with
                                            | s_ => Some (rd, uimm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s5495_ (_s5496_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s5497_ := _s5496_ in
   (if string_startswith _s5497_ "c.flwsp" then
      (match (string_drop _s5497_ (projT1 (string_length "c.flwsp"))) with
       | _s5498_ =>
          (spc_matches_prefix _s5498_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s5499_ _) =>
              (match (string_drop _s5498_ _s5499_) with
               | _s5500_ =>
                  (reg_name_matches_prefix _s5500_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s5501_ _) =>
                      (match (string_drop _s5500_ _s5501_) with
                       | _s5502_ =>
                          (sep_matches_prefix _s5502_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s5503_ _) =>
                                      match (string_drop _s5502_ _s5503_) with
                                      | _s5504_ =>
                                         match (hex_bits_6_matches_prefix _s5504_) with
                                         | Some (imm, existT _ _s5505_ _) =>
                                            match (string_drop _s5504_ _s5505_) with
                                            | s_ => Some (rd, imm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s5482_ (_s5483_ : string) : M (option ((f_un_op_S * mword 5 * mword 5 * string))) :=
   (match _s5483_ with
    | _s5484_ =>
       (f_un_type_mnemonic_S_matches_prefix _s5484_) >>= fun w__0 : option ((f_un_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCLASS_S, existT _ _s5485_ _) =>
           (match (string_drop _s5484_ _s5485_) with
            | _s5486_ =>
               (spc_matches_prefix _s5486_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5487_ _) =>
                   (match (string_drop _s5486_ _s5487_) with
                    | _s5488_ =>
                       (reg_name_matches_prefix _s5488_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5489_ _) =>
                           (match (string_drop _s5488_ _s5489_) with
                            | _s5490_ =>
                               (sep_matches_prefix _s5490_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5491_ _) =>
                                   (match (string_drop _s5490_ _s5491_) with
                                    | _s5492_ =>
                                       (freg_name_matches_prefix _s5492_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       returnm (match w__4 with
                                                | Some (rs1, existT _ _s5493_ _) =>
                                                   match (string_drop _s5492_ _s5493_) with
                                                   | s_ => Some (FCLASS_S, rd, rs1, s_)
                                                   end
                                                | _ => None
                                                end)
                                    end)
                                    : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_un_op_S * mword 5 * mword 5 * string))).

Definition _s5469_ (_s5470_ : string) : M (option ((f_un_op_S * mword 5 * mword 5 * string))) :=
   (match _s5470_ with
    | _s5471_ =>
       (f_un_type_mnemonic_S_matches_prefix _s5471_) >>= fun w__0 : option ((f_un_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMV_W_X, existT _ _s5472_ _) =>
           (match (string_drop _s5471_ _s5472_) with
            | _s5473_ =>
               (spc_matches_prefix _s5473_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5474_ _) =>
                   (match (string_drop _s5473_ _s5474_) with
                    | _s5475_ =>
                       (freg_name_matches_prefix _s5475_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5476_ _) =>
                           (match (string_drop _s5475_ _s5476_) with
                            | _s5477_ =>
                               (sep_matches_prefix _s5477_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5478_ _) =>
                                   (match (string_drop _s5477_ _s5478_) with
                                    | _s5479_ =>
                                       (reg_name_matches_prefix _s5479_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       returnm (match w__4 with
                                                | Some (rs1, existT _ _s5480_ _) =>
                                                   match (string_drop _s5479_ _s5480_) with
                                                   | s_ => Some (FMV_W_X, rd, rs1, s_)
                                                   end
                                                | _ => None
                                                end)
                                    end)
                                    : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_un_op_S * mword 5 * mword 5 * string))).

Definition _s5456_ (_s5457_ : string) : M (option ((f_un_op_S * mword 5 * mword 5 * string))) :=
   (match _s5457_ with
    | _s5458_ =>
       (f_un_type_mnemonic_S_matches_prefix _s5458_) >>= fun w__0 : option ((f_un_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMV_X_W, existT _ _s5459_ _) =>
           (match (string_drop _s5458_ _s5459_) with
            | _s5460_ =>
               (spc_matches_prefix _s5460_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5461_ _) =>
                   (match (string_drop _s5460_ _s5461_) with
                    | _s5462_ =>
                       (reg_name_matches_prefix _s5462_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5463_ _) =>
                           (match (string_drop _s5462_ _s5463_) with
                            | _s5464_ =>
                               (sep_matches_prefix _s5464_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5465_ _) =>
                                   (match (string_drop _s5464_ _s5465_) with
                                    | _s5466_ =>
                                       (freg_name_matches_prefix _s5466_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       returnm (match w__4 with
                                                | Some (rs1, existT _ _s5467_ _) =>
                                                   match (string_drop _s5466_ _s5467_) with
                                                   | s_ => Some (FMV_X_W, rd, rs1, s_)
                                                   end
                                                | _ => None
                                                end)
                                    end)
                                    : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_op_S * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_un_op_S * mword 5 * mword 5 * string))).

Definition _s5439_ (_s5440_ : string)
: M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s5440_ with
    | _s5441_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s5441_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FLE_S, existT _ _s5442_ _) =>
           (match (string_drop _s5441_ _s5442_) with
            | _s5443_ =>
               (spc_matches_prefix _s5443_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5444_ _) =>
                   (match (string_drop _s5443_ _s5444_) with
                    | _s5445_ =>
                       (reg_name_matches_prefix _s5445_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5446_ _) =>
                           (match (string_drop _s5445_ _s5446_) with
                            | _s5447_ =>
                               (sep_matches_prefix _s5447_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5448_ _) =>
                                   (match (string_drop _s5447_ _s5448_) with
                                    | _s5449_ =>
                                       (freg_name_matches_prefix _s5449_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5450_ _) =>
                                           (match (string_drop _s5449_ _s5450_) with
                                            | _s5451_ =>
                                               (sep_matches_prefix _s5451_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5452_ _) =>
                                                   (match (string_drop _s5451_ _s5452_) with
                                                    | _s5453_ =>
                                                       (freg_name_matches_prefix _s5453_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s5454_ _) =>
                                                                   match (string_drop _s5453_
                                                                            _s5454_) with
                                                                   | s_ =>
                                                                      Some (FLE_S, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))).

Definition _s5422_ (_s5423_ : string)
: M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s5423_ with
    | _s5424_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s5424_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FLT_S, existT _ _s5425_ _) =>
           (match (string_drop _s5424_ _s5425_) with
            | _s5426_ =>
               (spc_matches_prefix _s5426_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5427_ _) =>
                   (match (string_drop _s5426_ _s5427_) with
                    | _s5428_ =>
                       (reg_name_matches_prefix _s5428_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5429_ _) =>
                           (match (string_drop _s5428_ _s5429_) with
                            | _s5430_ =>
                               (sep_matches_prefix _s5430_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5431_ _) =>
                                   (match (string_drop _s5430_ _s5431_) with
                                    | _s5432_ =>
                                       (freg_name_matches_prefix _s5432_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5433_ _) =>
                                           (match (string_drop _s5432_ _s5433_) with
                                            | _s5434_ =>
                                               (sep_matches_prefix _s5434_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5435_ _) =>
                                                   (match (string_drop _s5434_ _s5435_) with
                                                    | _s5436_ =>
                                                       (freg_name_matches_prefix _s5436_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s5437_ _) =>
                                                                   match (string_drop _s5436_
                                                                            _s5437_) with
                                                                   | s_ =>
                                                                      Some (FLT_S, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))).

Definition _s5405_ (_s5406_ : string)
: M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s5406_ with
    | _s5407_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s5407_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FEQ_S, existT _ _s5408_ _) =>
           (match (string_drop _s5407_ _s5408_) with
            | _s5409_ =>
               (spc_matches_prefix _s5409_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5410_ _) =>
                   (match (string_drop _s5409_ _s5410_) with
                    | _s5411_ =>
                       (reg_name_matches_prefix _s5411_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5412_ _) =>
                           (match (string_drop _s5411_ _s5412_) with
                            | _s5413_ =>
                               (sep_matches_prefix _s5413_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5414_ _) =>
                                   (match (string_drop _s5413_ _s5414_) with
                                    | _s5415_ =>
                                       (freg_name_matches_prefix _s5415_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5416_ _) =>
                                           (match (string_drop _s5415_ _s5416_) with
                                            | _s5417_ =>
                                               (sep_matches_prefix _s5417_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5418_ _) =>
                                                   (match (string_drop _s5417_ _s5418_) with
                                                    | _s5419_ =>
                                                       (freg_name_matches_prefix _s5419_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s5420_ _) =>
                                                                   match (string_drop _s5419_
                                                                            _s5420_) with
                                                                   | s_ =>
                                                                      Some (FEQ_S, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))).

Definition _s5388_ (_s5389_ : string)
: M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s5389_ with
    | _s5390_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s5390_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMAX_S, existT _ _s5391_ _) =>
           (match (string_drop _s5390_ _s5391_) with
            | _s5392_ =>
               (spc_matches_prefix _s5392_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5393_ _) =>
                   (match (string_drop _s5392_ _s5393_) with
                    | _s5394_ =>
                       (freg_name_matches_prefix _s5394_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5395_ _) =>
                           (match (string_drop _s5394_ _s5395_) with
                            | _s5396_ =>
                               (sep_matches_prefix _s5396_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5397_ _) =>
                                   (match (string_drop _s5396_ _s5397_) with
                                    | _s5398_ =>
                                       (freg_name_matches_prefix _s5398_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5399_ _) =>
                                           (match (string_drop _s5398_ _s5399_) with
                                            | _s5400_ =>
                                               (sep_matches_prefix _s5400_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5401_ _) =>
                                                   (match (string_drop _s5400_ _s5401_) with
                                                    | _s5402_ =>
                                                       (freg_name_matches_prefix _s5402_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s5403_ _) =>
                                                                   match (string_drop _s5402_
                                                                            _s5403_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FMAX_S, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))).

Definition _s5371_ (_s5372_ : string)
: M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s5372_ with
    | _s5373_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s5373_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FMIN_S, existT _ _s5374_ _) =>
           (match (string_drop _s5373_ _s5374_) with
            | _s5375_ =>
               (spc_matches_prefix _s5375_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5376_ _) =>
                   (match (string_drop _s5375_ _s5376_) with
                    | _s5377_ =>
                       (freg_name_matches_prefix _s5377_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5378_ _) =>
                           (match (string_drop _s5377_ _s5378_) with
                            | _s5379_ =>
                               (sep_matches_prefix _s5379_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5380_ _) =>
                                   (match (string_drop _s5379_ _s5380_) with
                                    | _s5381_ =>
                                       (freg_name_matches_prefix _s5381_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5382_ _) =>
                                           (match (string_drop _s5381_ _s5382_) with
                                            | _s5383_ =>
                                               (sep_matches_prefix _s5383_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5384_ _) =>
                                                   (match (string_drop _s5383_ _s5384_) with
                                                    | _s5385_ =>
                                                       (freg_name_matches_prefix _s5385_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s5386_ _) =>
                                                                   match (string_drop _s5385_
                                                                            _s5386_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FMIN_S, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))).

Definition _s5354_ (_s5355_ : string)
: M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s5355_ with
    | _s5356_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s5356_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSGNJX_S, existT _ _s5357_ _) =>
           (match (string_drop _s5356_ _s5357_) with
            | _s5358_ =>
               (spc_matches_prefix _s5358_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5359_ _) =>
                   (match (string_drop _s5358_ _s5359_) with
                    | _s5360_ =>
                       (freg_name_matches_prefix _s5360_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5361_ _) =>
                           (match (string_drop _s5360_ _s5361_) with
                            | _s5362_ =>
                               (sep_matches_prefix _s5362_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5363_ _) =>
                                   (match (string_drop _s5362_ _s5363_) with
                                    | _s5364_ =>
                                       (freg_name_matches_prefix _s5364_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5365_ _) =>
                                           (match (string_drop _s5364_ _s5365_) with
                                            | _s5366_ =>
                                               (sep_matches_prefix _s5366_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5367_ _) =>
                                                   (match (string_drop _s5366_ _s5367_) with
                                                    | _s5368_ =>
                                                       (freg_name_matches_prefix _s5368_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s5369_ _) =>
                                                                   match (string_drop _s5368_
                                                                            _s5369_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FSGNJX_S, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))).

Definition _s5337_ (_s5338_ : string)
: M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s5338_ with
    | _s5339_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s5339_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSGNJN_S, existT _ _s5340_ _) =>
           (match (string_drop _s5339_ _s5340_) with
            | _s5341_ =>
               (spc_matches_prefix _s5341_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5342_ _) =>
                   (match (string_drop _s5341_ _s5342_) with
                    | _s5343_ =>
                       (freg_name_matches_prefix _s5343_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5344_ _) =>
                           (match (string_drop _s5343_ _s5344_) with
                            | _s5345_ =>
                               (sep_matches_prefix _s5345_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5346_ _) =>
                                   (match (string_drop _s5345_ _s5346_) with
                                    | _s5347_ =>
                                       (freg_name_matches_prefix _s5347_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5348_ _) =>
                                           (match (string_drop _s5347_ _s5348_) with
                                            | _s5349_ =>
                                               (sep_matches_prefix _s5349_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5350_ _) =>
                                                   (match (string_drop _s5349_ _s5350_) with
                                                    | _s5351_ =>
                                                       (freg_name_matches_prefix _s5351_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s5352_ _) =>
                                                                   match (string_drop _s5351_
                                                                            _s5352_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FSGNJN_S, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))).

Definition _s5320_ (_s5321_ : string)
: M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s5321_ with
    | _s5322_ =>
       (f_bin_type_mnemonic_S_matches_prefix _s5322_) >>= fun w__0 : option ((f_bin_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSGNJ_S, existT _ _s5323_ _) =>
           (match (string_drop _s5322_ _s5323_) with
            | _s5324_ =>
               (spc_matches_prefix _s5324_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5325_ _) =>
                   (match (string_drop _s5324_ _s5325_) with
                    | _s5326_ =>
                       (freg_name_matches_prefix _s5326_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5327_ _) =>
                           (match (string_drop _s5326_ _s5327_) with
                            | _s5328_ =>
                               (sep_matches_prefix _s5328_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5329_ _) =>
                                   (match (string_drop _s5328_ _s5329_) with
                                    | _s5330_ =>
                                       (freg_name_matches_prefix _s5330_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5331_ _) =>
                                           (match (string_drop _s5330_ _s5331_) with
                                            | _s5332_ =>
                                               (sep_matches_prefix _s5332_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5333_ _) =>
                                                   (match (string_drop _s5332_ _s5333_) with
                                                    | _s5334_ =>
                                                       (freg_name_matches_prefix _s5334_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s5335_ _) =>
                                                                   match (string_drop _s5334_
                                                                            _s5335_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FSGNJ_S, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string))).

Definition _s5303_ (_s5304_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5304_ with
    | _s5305_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s5305_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_LU, existT _ _s5306_ _) =>
           (match (string_drop _s5305_ _s5306_) with
            | _s5307_ =>
               (spc_matches_prefix _s5307_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5308_ _) =>
                   (match (string_drop _s5307_ _s5308_) with
                    | _s5309_ =>
                       (freg_name_matches_prefix _s5309_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5310_ _) =>
                           (match (string_drop _s5309_ _s5310_) with
                            | _s5311_ =>
                               (sep_matches_prefix _s5311_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5312_ _) =>
                                   (match (string_drop _s5311_ _s5312_) with
                                    | _s5313_ =>
                                       (reg_name_matches_prefix _s5313_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5314_ _) =>
                                           (match (string_drop _s5313_ _s5314_) with
                                            | _s5315_ =>
                                               (sep_matches_prefix _s5315_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5316_ _) =>
                                                   (match (string_drop _s5315_ _s5316_) with
                                                    | _s5317_ =>
                                                       (frm_mnemonic_matches_prefix _s5317_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s5318_ _) =>
                                                                   match (string_drop _s5317_
                                                                            _s5318_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FCVT_S_LU, rd, rs1, rm, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5286_ (_s5287_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5287_ with
    | _s5288_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s5288_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_L, existT _ _s5289_ _) =>
           (match (string_drop _s5288_ _s5289_) with
            | _s5290_ =>
               (spc_matches_prefix _s5290_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5291_ _) =>
                   (match (string_drop _s5290_ _s5291_) with
                    | _s5292_ =>
                       (freg_name_matches_prefix _s5292_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5293_ _) =>
                           (match (string_drop _s5292_ _s5293_) with
                            | _s5294_ =>
                               (sep_matches_prefix _s5294_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5295_ _) =>
                                   (match (string_drop _s5294_ _s5295_) with
                                    | _s5296_ =>
                                       (reg_name_matches_prefix _s5296_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5297_ _) =>
                                           (match (string_drop _s5296_ _s5297_) with
                                            | _s5298_ =>
                                               (sep_matches_prefix _s5298_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5299_ _) =>
                                                   (match (string_drop _s5298_ _s5299_) with
                                                    | _s5300_ =>
                                                       (frm_mnemonic_matches_prefix _s5300_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s5301_ _) =>
                                                                   match (string_drop _s5300_
                                                                            _s5301_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FCVT_S_L, rd, rs1, rm, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5269_ (_s5270_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5270_ with
    | _s5271_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s5271_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_LU_S, existT _ _s5272_ _) =>
           (match (string_drop _s5271_ _s5272_) with
            | _s5273_ =>
               (spc_matches_prefix _s5273_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5274_ _) =>
                   (match (string_drop _s5273_ _s5274_) with
                    | _s5275_ =>
                       (reg_name_matches_prefix _s5275_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5276_ _) =>
                           (match (string_drop _s5275_ _s5276_) with
                            | _s5277_ =>
                               (sep_matches_prefix _s5277_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5278_ _) =>
                                   (match (string_drop _s5277_ _s5278_) with
                                    | _s5279_ =>
                                       (freg_name_matches_prefix _s5279_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5280_ _) =>
                                           (match (string_drop _s5279_ _s5280_) with
                                            | _s5281_ =>
                                               (sep_matches_prefix _s5281_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5282_ _) =>
                                                   (match (string_drop _s5281_ _s5282_) with
                                                    | _s5283_ =>
                                                       (frm_mnemonic_matches_prefix _s5283_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s5284_ _) =>
                                                                   match (string_drop _s5283_
                                                                            _s5284_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FCVT_LU_S, rd, rs1, rm, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5252_ (_s5253_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5253_ with
    | _s5254_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s5254_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_L_S, existT _ _s5255_ _) =>
           (match (string_drop _s5254_ _s5255_) with
            | _s5256_ =>
               (spc_matches_prefix _s5256_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5257_ _) =>
                   (match (string_drop _s5256_ _s5257_) with
                    | _s5258_ =>
                       (reg_name_matches_prefix _s5258_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5259_ _) =>
                           (match (string_drop _s5258_ _s5259_) with
                            | _s5260_ =>
                               (sep_matches_prefix _s5260_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5261_ _) =>
                                   (match (string_drop _s5260_ _s5261_) with
                                    | _s5262_ =>
                                       (freg_name_matches_prefix _s5262_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5263_ _) =>
                                           (match (string_drop _s5262_ _s5263_) with
                                            | _s5264_ =>
                                               (sep_matches_prefix _s5264_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5265_ _) =>
                                                   (match (string_drop _s5264_ _s5265_) with
                                                    | _s5266_ =>
                                                       (frm_mnemonic_matches_prefix _s5266_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s5267_ _) =>
                                                                   match (string_drop _s5266_
                                                                            _s5267_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FCVT_L_S, rd, rs1, rm, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5235_ (_s5236_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5236_ with
    | _s5237_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s5237_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_WU, existT _ _s5238_ _) =>
           (match (string_drop _s5237_ _s5238_) with
            | _s5239_ =>
               (spc_matches_prefix _s5239_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5240_ _) =>
                   (match (string_drop _s5239_ _s5240_) with
                    | _s5241_ =>
                       (freg_name_matches_prefix _s5241_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5242_ _) =>
                           (match (string_drop _s5241_ _s5242_) with
                            | _s5243_ =>
                               (sep_matches_prefix _s5243_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5244_ _) =>
                                   (match (string_drop _s5243_ _s5244_) with
                                    | _s5245_ =>
                                       (reg_name_matches_prefix _s5245_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5246_ _) =>
                                           (match (string_drop _s5245_ _s5246_) with
                                            | _s5247_ =>
                                               (sep_matches_prefix _s5247_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5248_ _) =>
                                                   (match (string_drop _s5247_ _s5248_) with
                                                    | _s5249_ =>
                                                       (frm_mnemonic_matches_prefix _s5249_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s5250_ _) =>
                                                                   match (string_drop _s5249_
                                                                            _s5250_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FCVT_S_WU, rd, rs1, rm, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5218_ (_s5219_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5219_ with
    | _s5220_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s5220_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_S_W, existT _ _s5221_ _) =>
           (match (string_drop _s5220_ _s5221_) with
            | _s5222_ =>
               (spc_matches_prefix _s5222_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5223_ _) =>
                   (match (string_drop _s5222_ _s5223_) with
                    | _s5224_ =>
                       (freg_name_matches_prefix _s5224_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5225_ _) =>
                           (match (string_drop _s5224_ _s5225_) with
                            | _s5226_ =>
                               (sep_matches_prefix _s5226_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5227_ _) =>
                                   (match (string_drop _s5226_ _s5227_) with
                                    | _s5228_ =>
                                       (reg_name_matches_prefix _s5228_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5229_ _) =>
                                           (match (string_drop _s5228_ _s5229_) with
                                            | _s5230_ =>
                                               (sep_matches_prefix _s5230_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5231_ _) =>
                                                   (match (string_drop _s5230_ _s5231_) with
                                                    | _s5232_ =>
                                                       (frm_mnemonic_matches_prefix _s5232_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s5233_ _) =>
                                                                   match (string_drop _s5232_
                                                                            _s5233_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FCVT_S_W, rd, rs1, rm, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5201_ (_s5202_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5202_ with
    | _s5203_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s5203_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_WU_S, existT _ _s5204_ _) =>
           (match (string_drop _s5203_ _s5204_) with
            | _s5205_ =>
               (spc_matches_prefix _s5205_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5206_ _) =>
                   (match (string_drop _s5205_ _s5206_) with
                    | _s5207_ =>
                       (reg_name_matches_prefix _s5207_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5208_ _) =>
                           (match (string_drop _s5207_ _s5208_) with
                            | _s5209_ =>
                               (sep_matches_prefix _s5209_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5210_ _) =>
                                   (match (string_drop _s5209_ _s5210_) with
                                    | _s5211_ =>
                                       (freg_name_matches_prefix _s5211_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5212_ _) =>
                                           (match (string_drop _s5211_ _s5212_) with
                                            | _s5213_ =>
                                               (sep_matches_prefix _s5213_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5214_ _) =>
                                                   (match (string_drop _s5213_ _s5214_) with
                                                    | _s5215_ =>
                                                       (frm_mnemonic_matches_prefix _s5215_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s5216_ _) =>
                                                                   match (string_drop _s5215_
                                                                            _s5216_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FCVT_WU_S, rd, rs1, rm, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5184_ (_s5185_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5185_ with
    | _s5186_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s5186_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FCVT_W_S, existT _ _s5187_ _) =>
           (match (string_drop _s5186_ _s5187_) with
            | _s5188_ =>
               (spc_matches_prefix _s5188_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5189_ _) =>
                   (match (string_drop _s5188_ _s5189_) with
                    | _s5190_ =>
                       (reg_name_matches_prefix _s5190_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5191_ _) =>
                           (match (string_drop _s5190_ _s5191_) with
                            | _s5192_ =>
                               (sep_matches_prefix _s5192_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5193_ _) =>
                                   (match (string_drop _s5192_ _s5193_) with
                                    | _s5194_ =>
                                       (freg_name_matches_prefix _s5194_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5195_ _) =>
                                           (match (string_drop _s5194_ _s5195_) with
                                            | _s5196_ =>
                                               (sep_matches_prefix _s5196_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5197_ _) =>
                                                   (match (string_drop _s5196_ _s5197_) with
                                                    | _s5198_ =>
                                                       (frm_mnemonic_matches_prefix _s5198_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s5199_ _) =>
                                                                   match (string_drop _s5198_
                                                                            _s5199_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FCVT_W_S, rd, rs1, rm, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5167_ (_s5168_ : string)
: M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5168_ with
    | _s5169_ =>
       (f_un_rm_type_mnemonic_S_matches_prefix _s5169_) >>= fun w__0 : option ((f_un_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (FSQRT_S, existT _ _s5170_ _) =>
           (match (string_drop _s5169_ _s5170_) with
            | _s5171_ =>
               (spc_matches_prefix _s5171_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5172_ _) =>
                   (match (string_drop _s5171_ _s5172_) with
                    | _s5173_ =>
                       (freg_name_matches_prefix _s5173_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5174_ _) =>
                           (match (string_drop _s5173_ _s5174_) with
                            | _s5175_ =>
                               (sep_matches_prefix _s5175_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5176_ _) =>
                                   (match (string_drop _s5175_ _s5176_) with
                                    | _s5177_ =>
                                       (freg_name_matches_prefix _s5177_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5178_ _) =>
                                           (match (string_drop _s5177_ _s5178_) with
                                            | _s5179_ =>
                                               (sep_matches_prefix _s5179_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5180_ _) =>
                                                   (match (string_drop _s5179_ _s5180_) with
                                                    | _s5181_ =>
                                                       (frm_mnemonic_matches_prefix _s5181_) >>= fun w__6 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rm, existT _ _s5182_ _) =>
                                                                   match (string_drop _s5181_
                                                                            _s5182_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (FSQRT_S, rd, rs1, rm, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5146_ (_s5147_ : string)
: M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5147_ with
    | _s5148_ =>
       (f_bin_rm_type_mnemonic_S_matches_prefix _s5148_) >>= fun w__0 : option ((f_bin_rm_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s5149_ _) =>
           (match (string_drop _s5148_ _s5149_) with
            | _s5150_ =>
               (spc_matches_prefix _s5150_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5151_ _) =>
                   (match (string_drop _s5150_ _s5151_) with
                    | _s5152_ =>
                       (freg_name_matches_prefix _s5152_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5153_ _) =>
                           (match (string_drop _s5152_ _s5153_) with
                            | _s5154_ =>
                               (sep_matches_prefix _s5154_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5155_ _) =>
                                   (match (string_drop _s5154_ _s5155_) with
                                    | _s5156_ =>
                                       (freg_name_matches_prefix _s5156_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5157_ _) =>
                                           (match (string_drop _s5156_ _s5157_) with
                                            | _s5158_ =>
                                               (sep_matches_prefix _s5158_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5159_ _) =>
                                                   (match (string_drop _s5158_ _s5159_) with
                                                    | _s5160_ =>
                                                       (freg_name_matches_prefix _s5160_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       (match w__6 with
                                                        | Some (rs2, existT _ _s5161_ _) =>
                                                           (match (string_drop _s5160_ _s5161_) with
                                                            | _s5162_ =>
                                                               (sep_matches_prefix _s5162_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                 0)})) =>
                                                               (match w__7 with
                                                                | Some (tt, existT _ _s5163_ _) =>
                                                                   (match (string_drop _s5162_
                                                                             _s5163_) with
                                                                    | _s5164_ =>
                                                                       (frm_mnemonic_matches_prefix
                                                                          _s5164_) >>= fun w__8 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                                         0)})) =>
                                                                       returnm (match w__8 with
                                                                                | Some
                                                                                  (rm, existT _ _s5165_ _) =>
                                                                                   match (string_drop
                                                                                            _s5164_
                                                                                            _s5165_) with
                                                                                   | s_ =>
                                                                                      Some
                                                                                        (op, rd, rs1, rs2, rm, s_)
                                                                                   end
                                                                                | _ => None
                                                                                end)
                                                                    end)
                                                                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                                | _ => returnm None
                                                                end)
                                                                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                            end)
                                                            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                        | _ => returnm None
                                                        end)
                                                        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                    end)
                                                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5121_ (_s5122_ : string)
: M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string))) :=
   (match _s5122_ with
    | _s5123_ =>
       (f_madd_type_mnemonic_S_matches_prefix _s5123_) >>= fun w__0 : option ((f_madd_op_S * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s5124_ _) =>
           (match (string_drop _s5123_ _s5124_) with
            | _s5125_ =>
               (spc_matches_prefix _s5125_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s5126_ _) =>
                   (match (string_drop _s5125_ _s5126_) with
                    | _s5127_ =>
                       (freg_name_matches_prefix _s5127_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s5128_ _) =>
                           (match (string_drop _s5127_ _s5128_) with
                            | _s5129_ =>
                               (sep_matches_prefix _s5129_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s5130_ _) =>
                                   (match (string_drop _s5129_ _s5130_) with
                                    | _s5131_ =>
                                       (freg_name_matches_prefix _s5131_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s5132_ _) =>
                                           (match (string_drop _s5131_ _s5132_) with
                                            | _s5133_ =>
                                               (sep_matches_prefix _s5133_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s5134_ _) =>
                                                   (match (string_drop _s5133_ _s5134_) with
                                                    | _s5135_ =>
                                                       (freg_name_matches_prefix _s5135_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       (match w__6 with
                                                        | Some (rs2, existT _ _s5136_ _) =>
                                                           (match (string_drop _s5135_ _s5136_) with
                                                            | _s5137_ =>
                                                               (sep_matches_prefix _s5137_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                 0)})) =>
                                                               (match w__7 with
                                                                | Some (tt, existT _ _s5138_ _) =>
                                                                   (match (string_drop _s5137_
                                                                             _s5138_) with
                                                                    | _s5139_ =>
                                                                       (freg_name_matches_prefix
                                                                          _s5139_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                         0)})) =>
                                                                       (match w__8 with
                                                                        | Some
                                                                          (rs3, existT _ _s5140_ _) =>
                                                                           (match (string_drop
                                                                                     _s5139_ _s5140_) with
                                                                            | _s5141_ =>
                                                                               (sep_matches_prefix
                                                                                  _s5141_) >>= fun w__9 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                 0)})) =>
                                                                               (match w__9 with
                                                                                | Some
                                                                                  (tt, existT _ _s5142_ _) =>
                                                                                   (match (string_drop
                                                                                             _s5141_
                                                                                             _s5142_) with
                                                                                    | _s5143_ =>
                                                                                       (frm_mnemonic_matches_prefix
                                                                                          _s5143_) >>= fun w__10 : option ((rounding_mode * {n : Z & ArithFact (n >=?
                                                                                         0)})) =>
                                                                                       returnm (match w__10 with
                                                                                                | Some
                                                                                                  (rm, existT _ _s5144_ _) =>
                                                                                                   match (string_drop
                                                                                                            _s5143_
                                                                                                            _s5144_) with
                                                                                                   | s_ =>
                                                                                                      Some
                                                                                                        (op, rd, rs1, rs2, rs3, rm, s_)
                                                                                                   end
                                                                                                | _ =>
                                                                                                   None
                                                                                                end)
                                                                                    end)
                                                                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                                                | _ => returnm None
                                                                                end)
                                                                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                                            end)
                                                                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                                        | _ => returnm None
                                                                        end)
                                                                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                                    end)
                                                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                                | _ => returnm None
                                                                end)
                                                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                            end)
                                                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                        | _ => returnm None
                                                        end)
                                                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                    end)
                                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                            end)
                                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                    end)
                                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                                | _ => returnm None
                                end)
                                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                            end)
                            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                        | _ => returnm None
                        end)
                        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                    end)
                    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
                | _ => returnm None
                end)
                : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
            end)
            : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
        | _ => returnm None
        end)
        : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)))
    end)
    : M (option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string))).

Definition _s5097_ (_s5098_ : string)
: M (option ((word_width * mword 5 * mword 12 * mword 5 * string))) :=
   let _s5099_ := _s5098_ in
   (if string_startswith _s5099_ "fs" then
      (match (string_drop _s5099_ (projT1 (string_length "fs"))) with
       | _s5100_ =>
          (size_mnemonic_matches_prefix _s5100_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (width, existT _ _s5101_ _) =>
              (match (string_drop _s5100_ _s5101_) with
               | _s5102_ =>
                  (spc_matches_prefix _s5102_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s5103_ _) =>
                      (match (string_drop _s5102_ _s5103_) with
                       | _s5104_ =>
                          (freg_name_matches_prefix _s5104_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rs2, existT _ _s5105_ _) =>
                              (match (string_drop _s5104_ _s5105_) with
                               | _s5106_ =>
                                  (sep_matches_prefix _s5106_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s5107_ _) =>
                                      (match (string_drop _s5106_ _s5107_) with
                                       | _s5108_ =>
                                          (match (hex_bits_12_matches_prefix _s5108_) with
                                           | Some (imm, existT _ _s5109_ _) =>
                                              (match (string_drop _s5108_ _s5109_) with
                                               | _s5110_ =>
                                                  (opt_spc_matches_prefix _s5110_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__4 with
                                                   | Some (tt, existT _ _s5111_ _) =>
                                                      let _s5112_ := string_drop _s5110_ _s5111_ in
                                                      (if string_startswith _s5112_ "(" then
                                                         (match (string_drop _s5112_
                                                                   (projT1
                                                                    (string_length "("))) with
                                                          | _s5113_ =>
                                                             (opt_spc_matches_prefix _s5113_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             (match w__5 with
                                                              | Some (tt, existT _ _s5114_ _) =>
                                                                 (match (string_drop _s5113_ _s5114_) with
                                                                  | _s5115_ =>
                                                                     (reg_name_matches_prefix
                                                                        _s5115_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                       0)})) =>
                                                                     (match w__6 with
                                                                      | Some
                                                                        (rs1, existT _ _s5116_ _) =>
                                                                         (match (string_drop _s5115_
                                                                                   _s5116_) with
                                                                          | _s5117_ =>
                                                                             (opt_spc_matches_prefix
                                                                                _s5117_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                               0)})) =>
                                                                             returnm (match w__7 with
                                                                                      | Some
                                                                                        (tt, existT _ _s5118_ _) =>
                                                                                         let _s5119_ :=
                                                                                           string_drop
                                                                                             _s5117_
                                                                                             _s5118_ in
                                                                                         if string_startswith
                                                                                              _s5119_
                                                                                              ")"
                                                                                         then
                                                                                           match (string_drop
                                                                                                    _s5119_
                                                                                                    (projT1
                                                                                                     (string_length
                                                                                                        ")"))) with
                                                                                           | s_ =>
                                                                                              Some
                                                                                                (width, rs2, imm, rs1, s_)
                                                                                           end
                                                                                         else None
                                                                                      | _ => None
                                                                                      end)
                                                                          end)
                                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                                      | _ => returnm None
                                                                      end)
                                                                      : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                                  end)
                                                                  : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                              | _ => returnm None
                                                              end)
                                                              : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                          end)
                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                       else returnm None)
                                                       : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                               end)
                                               : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                       end)
                                       : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                               end)
                               : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                       end)
                       : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
               end)
               : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
       end)
       : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
    else returnm None)
    : M (option ((word_width * mword 5 * mword 12 * mword 5 * string))).

Definition _s5073_ (_s5074_ : string)
: M (option ((word_width * mword 5 * mword 12 * mword 5 * string))) :=
   let _s5075_ := _s5074_ in
   (if string_startswith _s5075_ "fl" then
      (match (string_drop _s5075_ (projT1 (string_length "fl"))) with
       | _s5076_ =>
          (size_mnemonic_matches_prefix _s5076_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (width, existT _ _s5077_ _) =>
              (match (string_drop _s5076_ _s5077_) with
               | _s5078_ =>
                  (spc_matches_prefix _s5078_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s5079_ _) =>
                      (match (string_drop _s5078_ _s5079_) with
                       | _s5080_ =>
                          (freg_name_matches_prefix _s5080_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s5081_ _) =>
                              (match (string_drop _s5080_ _s5081_) with
                               | _s5082_ =>
                                  (sep_matches_prefix _s5082_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s5083_ _) =>
                                      (match (string_drop _s5082_ _s5083_) with
                                       | _s5084_ =>
                                          (match (hex_bits_12_matches_prefix _s5084_) with
                                           | Some (imm, existT _ _s5085_ _) =>
                                              (match (string_drop _s5084_ _s5085_) with
                                               | _s5086_ =>
                                                  (opt_spc_matches_prefix _s5086_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__4 with
                                                   | Some (tt, existT _ _s5087_ _) =>
                                                      let _s5088_ := string_drop _s5086_ _s5087_ in
                                                      (if string_startswith _s5088_ "(" then
                                                         (match (string_drop _s5088_
                                                                   (projT1
                                                                    (string_length "("))) with
                                                          | _s5089_ =>
                                                             (opt_spc_matches_prefix _s5089_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             (match w__5 with
                                                              | Some (tt, existT _ _s5090_ _) =>
                                                                 (match (string_drop _s5089_ _s5090_) with
                                                                  | _s5091_ =>
                                                                     (reg_name_matches_prefix
                                                                        _s5091_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                       0)})) =>
                                                                     (match w__6 with
                                                                      | Some
                                                                        (rs1, existT _ _s5092_ _) =>
                                                                         (match (string_drop _s5091_
                                                                                   _s5092_) with
                                                                          | _s5093_ =>
                                                                             (opt_spc_matches_prefix
                                                                                _s5093_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                               0)})) =>
                                                                             returnm (match w__7 with
                                                                                      | Some
                                                                                        (tt, existT _ _s5094_ _) =>
                                                                                         let _s5095_ :=
                                                                                           string_drop
                                                                                             _s5093_
                                                                                             _s5094_ in
                                                                                         if string_startswith
                                                                                              _s5095_
                                                                                              ")"
                                                                                         then
                                                                                           match (string_drop
                                                                                                    _s5095_
                                                                                                    (projT1
                                                                                                     (string_length
                                                                                                        ")"))) with
                                                                                           | s_ =>
                                                                                              Some
                                                                                                (width, rd, imm, rs1, s_)
                                                                                           end
                                                                                         else None
                                                                                      | _ => None
                                                                                      end)
                                                                          end)
                                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                                      | _ => returnm None
                                                                      end)
                                                                      : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                                  end)
                                                                  : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                              | _ => returnm None
                                                              end)
                                                              : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                          end)
                                                          : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                       else returnm None)
                                                       : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                               end)
                                               : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                       end)
                                       : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                               end)
                               : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                       end)
                       : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
               end)
               : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
       end)
       : M (option ((word_width * mword 5 * mword 12 * mword 5 * string)))
    else returnm None)
    : M (option ((word_width * mword 5 * mword 12 * mword 5 * string))).

Definition _s5061_ (_s5062_ : string) : M (option ((mword 5 * mword 5 * mword 12 * string))) :=
   let _s5063_ := _s5062_ in
   (if string_startswith _s5063_ "fence.i.reserved." then
      (match (string_drop _s5063_ (projT1 (string_length "fence.i.reserved."))) with
       | _s5064_ =>
          (reg_name_matches_prefix _s5064_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (rd, existT _ _s5065_ _) =>
              let _s5066_ := string_drop _s5064_ _s5065_ in
              (if string_startswith _s5066_ "." then
                 (match (string_drop _s5066_ (projT1 (string_length "."))) with
                  | _s5067_ =>
                     (reg_name_matches_prefix _s5067_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                       0)})) =>
                     returnm (match w__1 with
                              | Some (rs, existT _ _s5068_ _) =>
                                 let _s5069_ := string_drop _s5067_ _s5068_ in
                                 if string_startswith _s5069_ "." then
                                   match (string_drop _s5069_ (projT1 (string_length "."))) with
                                   | _s5070_ =>
                                      match (hex_bits_12_matches_prefix _s5070_) with
                                      | Some (imm, existT _ _s5071_ _) =>
                                         match (string_drop _s5070_ _s5071_) with
                                         | s_ => Some (rd, rs, imm, s_)
                                         end
                                      | _ => None
                                      end
                                   end
                                 else None
                              | _ => None
                              end)
                  end)
                  : M (option ((mword 5 * mword 5 * mword 12 * string)))
               else returnm None)
               : M (option ((mword 5 * mword 5 * mword 12 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 12 * string)))
       end)
       : M (option ((mword 5 * mword 5 * mword 12 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 12 * string))).

Definition _s5043_ (_s5044_ : string)
: M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string))) :=
   let _s5045_ := _s5044_ in
   (if string_startswith _s5045_ "fence.reserved." then
      (match (string_drop _s5045_ (projT1 (string_length "fence.reserved."))) with
       | _s5046_ =>
          (fence_bits_matches_prefix _s5046_) >>= fun w__0 : option ((mword 4 * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (pred, existT _ _s5047_ _) =>
              let _s5048_ := string_drop _s5046_ _s5047_ in
              (if string_startswith _s5048_ "." then
                 (match (string_drop _s5048_ (projT1 (string_length "."))) with
                  | _s5049_ =>
                     (fence_bits_matches_prefix _s5049_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >=?
                       0)})) =>
                     (match w__1 with
                      | Some (succ, existT _ _s5050_ _) =>
                         let _s5051_ := string_drop _s5049_ _s5050_ in
                         (if string_startswith _s5051_ "." then
                            (match (string_drop _s5051_ (projT1 (string_length "."))) with
                             | _s5052_ =>
                                (reg_name_matches_prefix _s5052_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                  0)})) =>
                                (match w__2 with
                                 | Some (rs, existT _ _s5053_ _) =>
                                    let _s5054_ := string_drop _s5052_ _s5053_ in
                                    (if string_startswith _s5054_ "." then
                                       (match (string_drop _s5054_ (projT1 (string_length "."))) with
                                        | _s5055_ =>
                                           (reg_name_matches_prefix _s5055_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                             0)})) =>
                                           returnm (match w__3 with
                                                    | Some (rd, existT _ _s5056_ _) =>
                                                       let _s5057_ := string_drop _s5055_ _s5056_ in
                                                       if string_startswith _s5057_ "." then
                                                         match (string_drop _s5057_
                                                                  (projT1
                                                                   (string_length "."))) with
                                                         | _s5058_ =>
                                                            match (hex_bits_4_matches_prefix _s5058_) with
                                                            | Some (fm, existT _ _s5059_ _) =>
                                                               match (string_drop _s5058_ _s5059_) with
                                                               | s_ =>
                                                                  Some (pred, succ, rs, rd, fm, s_)
                                                               end
                                                            | _ => None
                                                            end
                                                         end
                                                       else None
                                                    | _ => None
                                                    end)
                                        end)
                                        : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
                                     else returnm None)
                                     : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
                                 | _ => returnm None
                                 end)
                                 : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
                             end)
                             : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
                          else returnm None)
                          : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
                      | _ => returnm None
                      end)
                      : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
                  end)
                  : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
               else returnm None)
               : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
       end)
       : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)))
    else returnm None)
    : M (option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string))).

Definition _s5037_ (_s5038_ : string) : M (option ((mword 3 * string))) :=
   let _s5039_ := _s5038_ in
   (if string_startswith _s5039_ "c.srai.hint." then
      (match (string_drop _s5039_ (projT1 (string_length "c.srai.hint."))) with
       | _s5040_ =>
          (creg_name_matches_prefix _s5040_) >>= fun w__0 : option ((mword 3 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s5041_ _) =>
                      match (string_drop _s5040_ _s5041_) with | s_ => Some (rsd, s_) end
                   | _ => None
                   end)
       end)
       : M (option ((mword 3 * string)))
    else returnm None)
    : M (option ((mword 3 * string))).

Definition _s5031_ (_s5032_ : string) : M (option ((mword 3 * string))) :=
   let _s5033_ := _s5032_ in
   (if string_startswith _s5033_ "c.srli.hint." then
      (match (string_drop _s5033_ (projT1 (string_length "c.srli.hint."))) with
       | _s5034_ =>
          (creg_name_matches_prefix _s5034_) >>= fun w__0 : option ((mword 3 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s5035_ _) =>
                      match (string_drop _s5034_ _s5035_) with | s_ => Some (rsd, s_) end
                   | _ => None
                   end)
       end)
       : M (option ((mword 3 * string)))
    else returnm None)
    : M (option ((mword 3 * string))).

Definition _s5022_ (_s5023_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s5024_ := _s5023_ in
   (if string_startswith _s5024_ "c.slli.hint." then
      (match (string_drop _s5024_ (projT1 (string_length "c.slli.hint."))) with
       | _s5025_ =>
          (reg_name_matches_prefix _s5025_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s5026_ _) =>
                      let _s5027_ := string_drop _s5025_ _s5026_ in
                      if string_startswith _s5027_ "." then
                        match (string_drop _s5027_ (projT1 (string_length "."))) with
                        | _s5028_ =>
                           match (hex_bits_6_matches_prefix _s5028_) with
                           | Some (shamt, existT _ _s5029_ _) =>
                              match (string_drop _s5028_ _s5029_) with
                              | s_ => Some (rsd, shamt, s_)
                              end
                           | _ => None
                           end
                        end
                      else None
                   | _ => None
                   end)
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s5016_ (_s5017_ : string) : M (option ((mword 5 * string))) :=
   let _s5018_ := _s5017_ in
   (if string_startswith _s5018_ "c.add.hint." then
      (match (string_drop _s5018_ (projT1 (string_length "c.add.hint."))) with
       | _s5019_ =>
          (reg_name_matches_prefix _s5019_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rs2, existT _ _s5020_ _) =>
                      match (string_drop _s5019_ _s5020_) with | s_ => Some (rs2, s_) end
                   | _ => None
                   end)
       end)
       : M (option ((mword 5 * string)))
    else returnm None)
    : M (option ((mword 5 * string))).

Definition _s5010_ (_s5011_ : string) : M (option ((mword 5 * string))) :=
   let _s5012_ := _s5011_ in
   (if string_startswith _s5012_ "c.mv.hint." then
      (match (string_drop _s5012_ (projT1 (string_length "c.mv.hint."))) with
       | _s5013_ =>
          (reg_name_matches_prefix _s5013_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rs2, existT _ _s5014_ _) =>
                      match (string_drop _s5013_ _s5014_) with | s_ => Some (rs2, s_) end
                   | _ => None
                   end)
       end)
       : M (option ((mword 5 * string)))
    else returnm None)
    : M (option ((mword 5 * string))).

Definition _s5004_ (_s5005_ : string) : option ((mword 6 * string)) :=
   let _s5006_ := _s5005_ in
   if string_startswith _s5006_ "c.lui.hint." then
     match (string_drop _s5006_ (projT1 (string_length "c.lui.hint."))) with
     | _s5007_ =>
        match (hex_bits_6_matches_prefix _s5007_) with
        | Some (imm, existT _ _s5008_ _) =>
           match (string_drop _s5007_ _s5008_) with | s_ => Some (imm, s_) end
        | _ => None
        end
     end
   else None.

Definition _s4998_ (_s4999_ : string) : option ((mword 6 * string)) :=
   let _s5000_ := _s4999_ in
   if string_startswith _s5000_ "c.li.hint." then
     match (string_drop _s5000_ (projT1 (string_length "c.li.hint."))) with
     | _s5001_ =>
        match (hex_bits_6_matches_prefix _s5001_) with
        | Some (imm, existT _ _s5002_ _) =>
           match (string_drop _s5001_ _s5002_) with | s_ => Some (imm, s_) end
        | _ => None
        end
     end
   else None.

Definition _s4992_ (_s4993_ : string) : M (option ((mword 5 * string))) :=
   let _s4994_ := _s4993_ in
   (if string_startswith _s4994_ "c.addi.hint." then
      (match (string_drop _s4994_ (projT1 (string_length "c.addi.hint."))) with
       | _s4995_ =>
          (reg_name_matches_prefix _s4995_) >>= fun w__0 : option ((mword 5 * {n : Z & ArithFact (n >=?
            0)})) =>
          returnm (match w__0 with
                   | Some (rsd, existT _ _s4996_ _) =>
                      match (string_drop _s4995_ _s4996_) with | s_ => Some (rsd, s_) end
                   | _ => None
                   end)
       end)
       : M (option ((mword 5 * string)))
    else returnm None)
    : M (option ((mword 5 * string))).

Definition _s4986_ (_s4987_ : string) : option ((mword 6 * string)) :=
   let _s4988_ := _s4987_ in
   if string_startswith _s4988_ "c.nop.hint." then
     match (string_drop _s4988_ (projT1 (string_length "c.nop.hint."))) with
     | _s4989_ =>
        match (hex_bits_6_matches_prefix _s4989_) with
        | Some (imm, existT _ _s4990_ _) =>
           match (string_drop _s4989_ _s4990_) with | s_ => Some (imm, s_) end
        | _ => None
        end
     end
   else None.

Definition _s4982_ (_s4983_ : string) : option string :=
   let _s4984_ := _s4983_ in
   if string_startswith _s4984_ "uret" then
     match (string_drop _s4984_ (projT1 (string_length "uret"))) with | s_ => Some s_ end
   else None.

Definition _s4965_ (_s4966_ : string) : M (option ((csrop * mword 5 * mword 12 * mword 5 * string))) :=
   (match _s4966_ with
    | _s4967_ =>
       (csr_mnemonic_matches_prefix _s4967_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4968_ _) =>
           (match (string_drop _s4967_ _s4968_) with
            | _s4969_ =>
               (spc_matches_prefix _s4969_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4970_ _) =>
                   (match (string_drop _s4969_ _s4970_) with
                    | _s4971_ =>
                       (reg_name_matches_prefix _s4971_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4972_ _) =>
                           (match (string_drop _s4971_ _s4972_) with
                            | _s4973_ =>
                               (sep_matches_prefix _s4973_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4974_ _) =>
                                   (match (string_drop _s4973_ _s4974_) with
                                    | _s4975_ =>
                                       (csr_name_map_matches_prefix _s4975_) >>= fun w__4 : option ((mword 12 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (csr, existT _ _s4976_ _) =>
                                           (match (string_drop _s4975_ _s4976_) with
                                            | _s4977_ =>
                                               (sep_matches_prefix _s4977_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s4978_ _) =>
                                                   (match (string_drop _s4977_ _s4978_) with
                                                    | _s4979_ =>
                                                       (reg_name_matches_prefix _s4979_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs1, existT _ _s4980_ _) =>
                                                                   match (string_drop _s4979_
                                                                            _s4980_) with
                                                                   | s_ =>
                                                                      Some (op, rd, csr, rs1, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                                            end)
                                            : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                                    end)
                                    : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                            end)
                            : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                    end)
                    : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
            end)
            : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
    end)
    : M (option ((csrop * mword 5 * mword 12 * mword 5 * string))).

Definition _s4947_ (_s4948_ : string) : M (option ((csrop * mword 5 * mword 12 * mword 5 * string))) :=
   (match _s4948_ with
    | _s4949_ =>
       (csr_mnemonic_matches_prefix _s4949_) >>= fun w__0 : option ((csrop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4950_ _) =>
           let _s4951_ := string_drop _s4949_ _s4950_ in
           (if string_startswith _s4951_ "i" then
              (match (string_drop _s4951_ (projT1 (string_length "i"))) with
               | _s4952_ =>
                  (spc_matches_prefix _s4952_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s4953_ _) =>
                      (match (string_drop _s4952_ _s4953_) with
                       | _s4954_ =>
                          (reg_name_matches_prefix _s4954_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s4955_ _) =>
                              (match (string_drop _s4954_ _s4955_) with
                               | _s4956_ =>
                                  (sep_matches_prefix _s4956_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s4957_ _) =>
                                      (match (string_drop _s4956_ _s4957_) with
                                       | _s4958_ =>
                                          (csr_name_map_matches_prefix _s4958_) >>= fun w__4 : option ((mword 12 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (csr, existT _ _s4959_ _) =>
                                              (match (string_drop _s4958_ _s4959_) with
                                               | _s4960_ =>
                                                  (sep_matches_prefix _s4960_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  returnm (match w__5 with
                                                           | Some (tt, existT _ _s4961_ _) =>
                                                              match (string_drop _s4960_ _s4961_) with
                                                              | _s4962_ =>
                                                                 match (hex_bits_5_matches_prefix
                                                                          _s4962_) with
                                                                 | Some (rs1, existT _ _s4963_ _) =>
                                                                    match (string_drop _s4962_
                                                                             _s4963_) with
                                                                    | s_ =>
                                                                       Some (op, rd, csr, rs1, s_)
                                                                    end
                                                                 | _ => None
                                                                 end
                                                              end
                                                           | _ => None
                                                           end)
                                               end)
                                               : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                                       end)
                                       : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                               end)
                               : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                       end)
                       : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
               end)
               : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
            else returnm None)
            : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((csrop * mword 5 * mword 12 * mword 5 * string)))
    end)
    : M (option ((csrop * mword 5 * mword 12 * mword 5 * string))).

Definition _s4928_ (_s4929_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) :=
   let _s4930_ := _s4929_ in
   (if string_startswith _s4930_ "rem" then
      (match (string_drop _s4930_ (projT1 (string_length "rem"))) with
       | _s4931_ =>
          (maybe_not_u_matches_prefix _s4931_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s4932_ _) =>
              let _s4933_ := string_drop _s4931_ _s4932_ in
              (if string_startswith _s4933_ "w" then
                 (match (string_drop _s4933_ (projT1 (string_length "w"))) with
                  | _s4934_ =>
                     (spc_matches_prefix _s4934_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                       0)})) =>
                     (match w__1 with
                      | Some (tt, existT _ _s4935_ _) =>
                         (match (string_drop _s4934_ _s4935_) with
                          | _s4936_ =>
                             (reg_name_matches_prefix _s4936_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                               0)})) =>
                             (match w__2 with
                              | Some (rd, existT _ _s4937_ _) =>
                                 (match (string_drop _s4936_ _s4937_) with
                                  | _s4938_ =>
                                     (sep_matches_prefix _s4938_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                       0)})) =>
                                     (match w__3 with
                                      | Some (tt, existT _ _s4939_ _) =>
                                         (match (string_drop _s4938_ _s4939_) with
                                          | _s4940_ =>
                                             (reg_name_matches_prefix _s4940_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                               0)})) =>
                                             (match w__4 with
                                              | Some (rs1, existT _ _s4941_ _) =>
                                                 (match (string_drop _s4940_ _s4941_) with
                                                  | _s4942_ =>
                                                     (sep_matches_prefix _s4942_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                       0)})) =>
                                                     (match w__5 with
                                                      | Some (tt, existT _ _s4943_ _) =>
                                                         (match (string_drop _s4942_ _s4943_) with
                                                          | _s4944_ =>
                                                             (reg_name_matches_prefix _s4944_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             returnm (match w__6 with
                                                                      | Some
                                                                        (rs2, existT _ _s4945_ _) =>
                                                                         match (string_drop _s4944_
                                                                                  _s4945_) with
                                                                         | s_ =>
                                                                            Some
                                                                              (s, rd, rs1, rs2, s_)
                                                                         end
                                                                      | _ => None
                                                                      end)
                                                          end)
                                                          : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                                      | _ => returnm None
                                                      end)
                                                      : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                                  end)
                                                  : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                              | _ => returnm None
                                              end)
                                              : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                          end)
                                          : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                      | _ => returnm None
                                      end)
                                      : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                  end)
                                  : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                              | _ => returnm None
                              end)
                              : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                          end)
                          : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                      | _ => returnm None
                      end)
                      : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                  end)
                  : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
               else returnm None)
               : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5 * string))).

Definition _s4909_ (_s4910_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) :=
   let _s4911_ := _s4910_ in
   (if string_startswith _s4911_ "div" then
      (match (string_drop _s4911_ (projT1 (string_length "div"))) with
       | _s4912_ =>
          (maybe_not_u_matches_prefix _s4912_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s4913_ _) =>
              let _s4914_ := string_drop _s4912_ _s4913_ in
              (if string_startswith _s4914_ "w" then
                 (match (string_drop _s4914_ (projT1 (string_length "w"))) with
                  | _s4915_ =>
                     (spc_matches_prefix _s4915_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                       0)})) =>
                     (match w__1 with
                      | Some (tt, existT _ _s4916_ _) =>
                         (match (string_drop _s4915_ _s4916_) with
                          | _s4917_ =>
                             (reg_name_matches_prefix _s4917_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                               0)})) =>
                             (match w__2 with
                              | Some (rd, existT _ _s4918_ _) =>
                                 (match (string_drop _s4917_ _s4918_) with
                                  | _s4919_ =>
                                     (sep_matches_prefix _s4919_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                       0)})) =>
                                     (match w__3 with
                                      | Some (tt, existT _ _s4920_ _) =>
                                         (match (string_drop _s4919_ _s4920_) with
                                          | _s4921_ =>
                                             (reg_name_matches_prefix _s4921_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                               0)})) =>
                                             (match w__4 with
                                              | Some (rs1, existT _ _s4922_ _) =>
                                                 (match (string_drop _s4921_ _s4922_) with
                                                  | _s4923_ =>
                                                     (sep_matches_prefix _s4923_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                       0)})) =>
                                                     (match w__5 with
                                                      | Some (tt, existT _ _s4924_ _) =>
                                                         (match (string_drop _s4923_ _s4924_) with
                                                          | _s4925_ =>
                                                             (reg_name_matches_prefix _s4925_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                               0)})) =>
                                                             returnm (match w__6 with
                                                                      | Some
                                                                        (rs2, existT _ _s4926_ _) =>
                                                                         match (string_drop _s4925_
                                                                                  _s4926_) with
                                                                         | s_ =>
                                                                            Some
                                                                              (s, rd, rs1, rs2, s_)
                                                                         end
                                                                      | _ => None
                                                                      end)
                                                          end)
                                                          : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                                      | _ => returnm None
                                                      end)
                                                      : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                                  end)
                                                  : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                              | _ => returnm None
                                              end)
                                              : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                          end)
                                          : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                      | _ => returnm None
                                      end)
                                      : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                  end)
                                  : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                              | _ => returnm None
                              end)
                              : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                          end)
                          : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                      | _ => returnm None
                      end)
                      : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                  end)
                  : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
               else returnm None)
               : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5 * string))).

Definition _s4893_ (_s4894_ : string) : M (option ((mword 5 * mword 5 * mword 5 * string))) :=
   let _s4895_ := _s4894_ in
   (if string_startswith _s4895_ "mulw" then
      (match (string_drop _s4895_ (projT1 (string_length "mulw"))) with
       | _s4896_ =>
          (spc_matches_prefix _s4896_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4897_ _) =>
              (match (string_drop _s4896_ _s4897_) with
               | _s4898_ =>
                  (reg_name_matches_prefix _s4898_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4899_ _) =>
                      (match (string_drop _s4898_ _s4899_) with
                       | _s4900_ =>
                          (sep_matches_prefix _s4900_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4901_ _) =>
                              (match (string_drop _s4900_ _s4901_) with
                               | _s4902_ =>
                                  (reg_name_matches_prefix _s4902_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rs1, existT _ _s4903_ _) =>
                                      (match (string_drop _s4902_ _s4903_) with
                                       | _s4904_ =>
                                          (sep_matches_prefix _s4904_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (tt, existT _ _s4905_ _) =>
                                              (match (string_drop _s4904_ _s4905_) with
                                               | _s4906_ =>
                                                  (reg_name_matches_prefix _s4906_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  returnm (match w__5 with
                                                           | Some (rs2, existT _ _s4907_ _) =>
                                                              match (string_drop _s4906_ _s4907_) with
                                                              | s_ => Some (rd, rs1, rs2, s_)
                                                              end
                                                           | _ => None
                                                           end)
                                               end)
                                               : M (option ((mword 5 * mword 5 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((mword 5 * mword 5 * mword 5 * string)))
                                       end)
                                       : M (option ((mword 5 * mword 5 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 5 * mword 5 * mword 5 * string)))
                               end)
                               : M (option ((mword 5 * mword 5 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * mword 5 * string)))
                       end)
                       : M (option ((mword 5 * mword 5 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * mword 5 * string)))
               end)
               : M (option ((mword 5 * mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 5 * string)))
       end)
       : M (option ((mword 5 * mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 5 * string))).

Definition _s4875_ (_s4876_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) :=
   let _s4877_ := _s4876_ in
   (if string_startswith _s4877_ "rem" then
      (match (string_drop _s4877_ (projT1 (string_length "rem"))) with
       | _s4878_ =>
          (maybe_not_u_matches_prefix _s4878_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s4879_ _) =>
              (match (string_drop _s4878_ _s4879_) with
               | _s4880_ =>
                  (spc_matches_prefix _s4880_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s4881_ _) =>
                      (match (string_drop _s4880_ _s4881_) with
                       | _s4882_ =>
                          (reg_name_matches_prefix _s4882_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s4883_ _) =>
                              (match (string_drop _s4882_ _s4883_) with
                               | _s4884_ =>
                                  (sep_matches_prefix _s4884_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s4885_ _) =>
                                      (match (string_drop _s4884_ _s4885_) with
                                       | _s4886_ =>
                                          (reg_name_matches_prefix _s4886_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rs1, existT _ _s4887_ _) =>
                                              (match (string_drop _s4886_ _s4887_) with
                                               | _s4888_ =>
                                                  (sep_matches_prefix _s4888_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s4889_ _) =>
                                                      (match (string_drop _s4888_ _s4889_) with
                                                       | _s4890_ =>
                                                          (reg_name_matches_prefix _s4890_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          returnm (match w__6 with
                                                                   | Some (rs2, existT _ _s4891_ _) =>
                                                                      match (string_drop _s4890_
                                                                               _s4891_) with
                                                                      | s_ =>
                                                                         Some (s, rd, rs1, rs2, s_)
                                                                      end
                                                                   | _ => None
                                                                   end)
                                                       end)
                                                       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                               end)
                                               : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                       end)
                                       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                               end)
                               : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                       end)
                       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
               end)
               : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5 * string))).

Definition _s4857_ (_s4858_ : string) : M (option ((bool * mword 5 * mword 5 * mword 5 * string))) :=
   let _s4859_ := _s4858_ in
   (if string_startswith _s4859_ "div" then
      (match (string_drop _s4859_ (projT1 (string_length "div"))) with
       | _s4860_ =>
          (maybe_not_u_matches_prefix _s4860_) >>= fun w__0 : option ((bool * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (s, existT _ _s4861_ _) =>
              (match (string_drop _s4860_ _s4861_) with
               | _s4862_ =>
                  (spc_matches_prefix _s4862_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (tt, existT _ _s4863_ _) =>
                      (match (string_drop _s4862_ _s4863_) with
                       | _s4864_ =>
                          (reg_name_matches_prefix _s4864_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rd, existT _ _s4865_ _) =>
                              (match (string_drop _s4864_ _s4865_) with
                               | _s4866_ =>
                                  (sep_matches_prefix _s4866_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s4867_ _) =>
                                      (match (string_drop _s4866_ _s4867_) with
                                       | _s4868_ =>
                                          (reg_name_matches_prefix _s4868_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rs1, existT _ _s4869_ _) =>
                                              (match (string_drop _s4868_ _s4869_) with
                                               | _s4870_ =>
                                                  (sep_matches_prefix _s4870_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s4871_ _) =>
                                                      (match (string_drop _s4870_ _s4871_) with
                                                       | _s4872_ =>
                                                          (reg_name_matches_prefix _s4872_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          returnm (match w__6 with
                                                                   | Some (rs2, existT _ _s4873_ _) =>
                                                                      match (string_drop _s4872_
                                                                               _s4873_) with
                                                                      | s_ =>
                                                                         Some (s, rd, rs1, rs2, s_)
                                                                      end
                                                                   | _ => None
                                                                   end)
                                                       end)
                                                       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                               end)
                                               : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                       end)
                                       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                               end)
                               : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                       end)
                       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
               end)
               : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
       end)
       : M (option ((bool * mword 5 * mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((bool * mword 5 * mword 5 * mword 5 * string))).

Definition _s4840_ (_s4841_ : string)
: M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s4841_ with
    | _s4842_ =>
       (mul_mnemonic_matches_prefix _s4842_) >>= fun w__0 : option (((bool * bool * bool) * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some ((high, signed1, signed2), existT _ _s4843_ _) =>
           (match (string_drop _s4842_ _s4843_) with
            | _s4844_ =>
               (spc_matches_prefix _s4844_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4845_ _) =>
                   (match (string_drop _s4844_ _s4845_) with
                    | _s4846_ =>
                       (reg_name_matches_prefix _s4846_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4847_ _) =>
                           (match (string_drop _s4846_ _s4847_) with
                            | _s4848_ =>
                               (sep_matches_prefix _s4848_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4849_ _) =>
                                   (match (string_drop _s4848_ _s4849_) with
                                    | _s4850_ =>
                                       (reg_name_matches_prefix _s4850_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s4851_ _) =>
                                           (match (string_drop _s4850_ _s4851_) with
                                            | _s4852_ =>
                                               (sep_matches_prefix _s4852_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s4853_ _) =>
                                                   (match (string_drop _s4852_ _s4853_) with
                                                    | _s4854_ =>
                                                       (reg_name_matches_prefix _s4854_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s4855_ _) =>
                                                                   match (string_drop _s4854_
                                                                            _s4855_) with
                                                                   | s_ =>
                                                                      Some
                                                                        (high, signed1, signed2, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string))).

Definition _s4828_ (_s4829_ : string) : M (option ((mword 5 * mword 5 * string))) :=
   let _s4830_ := _s4829_ in
   (if string_startswith _s4830_ "c.add" then
      (match (string_drop _s4830_ (projT1 (string_length "c.add"))) with
       | _s4831_ =>
          (spc_matches_prefix _s4831_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4832_ _) =>
              (match (string_drop _s4831_ _s4832_) with
               | _s4833_ =>
                  (reg_name_matches_prefix _s4833_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4834_ _) =>
                      (match (string_drop _s4833_ _s4834_) with
                       | _s4835_ =>
                          (sep_matches_prefix _s4835_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4836_ _) =>
                              (match (string_drop _s4835_ _s4836_) with
                               | _s4837_ =>
                                  (reg_name_matches_prefix _s4837_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s4838_ _) =>
                                              match (string_drop _s4837_ _s4838_) with
                                              | s_ => Some (rsd, rs2, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 5 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * string)))
                       end)
                       : M (option ((mword 5 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * string)))
               end)
               : M (option ((mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * string)))
       end)
       : M (option ((mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * string))).

Definition _s4824_ (_s4825_ : string) : option string :=
   let _s4826_ := _s4825_ in
   if string_startswith _s4826_ "c.ebreak" then
     match (string_drop _s4826_ (projT1 (string_length "c.ebreak"))) with | s_ => Some s_ end
   else None.

Definition _s4812_ (_s4813_ : string) : M (option ((mword 5 * mword 5 * string))) :=
   let _s4814_ := _s4813_ in
   (if string_startswith _s4814_ "c.mv" then
      (match (string_drop _s4814_ (projT1 (string_length "c.mv"))) with
       | _s4815_ =>
          (spc_matches_prefix _s4815_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4816_ _) =>
              (match (string_drop _s4815_ _s4816_) with
               | _s4817_ =>
                  (reg_name_matches_prefix _s4817_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4818_ _) =>
                      (match (string_drop _s4817_ _s4818_) with
                       | _s4819_ =>
                          (sep_matches_prefix _s4819_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4820_ _) =>
                              (match (string_drop _s4819_ _s4820_) with
                               | _s4821_ =>
                                  (reg_name_matches_prefix _s4821_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s4822_ _) =>
                                              match (string_drop _s4821_ _s4822_) with
                                              | s_ => Some (rd, rs2, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 5 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * string)))
                       end)
                       : M (option ((mword 5 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * string)))
               end)
               : M (option ((mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * string)))
       end)
       : M (option ((mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * string))).

Definition _s4804_ (_s4805_ : string) : M (option ((mword 5 * string))) :=
   let _s4806_ := _s4805_ in
   (if string_startswith _s4806_ "c.jalr" then
      (match (string_drop _s4806_ (projT1 (string_length "c.jalr"))) with
       | _s4807_ =>
          (spc_matches_prefix _s4807_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4808_ _) =>
              (match (string_drop _s4807_ _s4808_) with
               | _s4809_ =>
                  (reg_name_matches_prefix _s4809_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  returnm (match w__1 with
                           | Some (rs1, existT _ _s4810_ _) =>
                              match (string_drop _s4809_ _s4810_) with | s_ => Some (rs1, s_) end
                           | _ => None
                           end)
               end)
               : M (option ((mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * string)))
       end)
       : M (option ((mword 5 * string)))
    else returnm None)
    : M (option ((mword 5 * string))).

Definition _s4796_ (_s4797_ : string) : M (option ((mword 5 * string))) :=
   let _s4798_ := _s4797_ in
   (if string_startswith _s4798_ "c.jr" then
      (match (string_drop _s4798_ (projT1 (string_length "c.jr"))) with
       | _s4799_ =>
          (spc_matches_prefix _s4799_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4800_ _) =>
              (match (string_drop _s4799_ _s4800_) with
               | _s4801_ =>
                  (reg_name_matches_prefix _s4801_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  returnm (match w__1 with
                           | Some (rs1, existT _ _s4802_ _) =>
                              match (string_drop _s4801_ _s4802_) with | s_ => Some (rs1, s_) end
                           | _ => None
                           end)
               end)
               : M (option ((mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * string)))
       end)
       : M (option ((mword 5 * string)))
    else returnm None)
    : M (option ((mword 5 * string))).

Definition _s4784_ (_s4785_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s4786_ := _s4785_ in
   (if string_startswith _s4786_ "c.sdsp" then
      (match (string_drop _s4786_ (projT1 (string_length "c.sdsp"))) with
       | _s4787_ =>
          (spc_matches_prefix _s4787_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4788_ _) =>
              (match (string_drop _s4787_ _s4788_) with
               | _s4789_ =>
                  (reg_name_matches_prefix _s4789_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs2, existT _ _s4790_ _) =>
                      (match (string_drop _s4789_ _s4790_) with
                       | _s4791_ =>
                          (sep_matches_prefix _s4791_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4792_ _) =>
                                      match (string_drop _s4791_ _s4792_) with
                                      | _s4793_ =>
                                         match (hex_bits_6_matches_prefix _s4793_) with
                                         | Some (uimm, existT _ _s4794_ _) =>
                                            match (string_drop _s4793_ _s4794_) with
                                            | s_ => Some (rs2, uimm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s4772_ (_s4773_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s4774_ := _s4773_ in
   (if string_startswith _s4774_ "c.swsp" then
      (match (string_drop _s4774_ (projT1 (string_length "c.swsp"))) with
       | _s4775_ =>
          (spc_matches_prefix _s4775_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4776_ _) =>
              (match (string_drop _s4775_ _s4776_) with
               | _s4777_ =>
                  (reg_name_matches_prefix _s4777_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4778_ _) =>
                      (match (string_drop _s4777_ _s4778_) with
                       | _s4779_ =>
                          (sep_matches_prefix _s4779_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4780_ _) =>
                                      match (string_drop _s4779_ _s4780_) with
                                      | _s4781_ =>
                                         match (hex_bits_6_matches_prefix _s4781_) with
                                         | Some (uimm, existT _ _s4782_ _) =>
                                            match (string_drop _s4781_ _s4782_) with
                                            | s_ => Some (rd, uimm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s4760_ (_s4761_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s4762_ := _s4761_ in
   (if string_startswith _s4762_ "c.ldsp" then
      (match (string_drop _s4762_ (projT1 (string_length "c.ldsp"))) with
       | _s4763_ =>
          (spc_matches_prefix _s4763_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4764_ _) =>
              (match (string_drop _s4763_ _s4764_) with
               | _s4765_ =>
                  (reg_name_matches_prefix _s4765_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4766_ _) =>
                      (match (string_drop _s4765_ _s4766_) with
                       | _s4767_ =>
                          (sep_matches_prefix _s4767_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4768_ _) =>
                                      match (string_drop _s4767_ _s4768_) with
                                      | _s4769_ =>
                                         match (hex_bits_6_matches_prefix _s4769_) with
                                         | Some (uimm, existT _ _s4770_ _) =>
                                            match (string_drop _s4769_ _s4770_) with
                                            | s_ => Some (rd, uimm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s4748_ (_s4749_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s4750_ := _s4749_ in
   (if string_startswith _s4750_ "c.lwsp" then
      (match (string_drop _s4750_ (projT1 (string_length "c.lwsp"))) with
       | _s4751_ =>
          (spc_matches_prefix _s4751_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4752_ _) =>
              (match (string_drop _s4751_ _s4752_) with
               | _s4753_ =>
                  (reg_name_matches_prefix _s4753_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4754_ _) =>
                      (match (string_drop _s4753_ _s4754_) with
                       | _s4755_ =>
                          (sep_matches_prefix _s4755_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4756_ _) =>
                                      match (string_drop _s4755_ _s4756_) with
                                      | _s4757_ =>
                                         match (hex_bits_6_matches_prefix _s4757_) with
                                         | Some (uimm, existT _ _s4758_ _) =>
                                            match (string_drop _s4757_ _s4758_) with
                                            | s_ => Some (rd, uimm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s4736_ (_s4737_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s4738_ := _s4737_ in
   (if string_startswith _s4738_ "c.slli" then
      (match (string_drop _s4738_ (projT1 (string_length "c.slli"))) with
       | _s4739_ =>
          (spc_matches_prefix _s4739_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4740_ _) =>
              (match (string_drop _s4739_ _s4740_) with
               | _s4741_ =>
                  (reg_name_matches_prefix _s4741_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4742_ _) =>
                      (match (string_drop _s4741_ _s4742_) with
                       | _s4743_ =>
                          (sep_matches_prefix _s4743_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4744_ _) =>
                                      match (string_drop _s4743_ _s4744_) with
                                      | _s4745_ =>
                                         match (hex_bits_6_matches_prefix _s4745_) with
                                         | Some (shamt, existT _ _s4746_ _) =>
                                            match (string_drop _s4745_ _s4746_) with
                                            | s_ => Some (rsd, shamt, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s4724_ (_s4725_ : string) : M (option ((mword 3 * mword 8 * string))) :=
   let _s4726_ := _s4725_ in
   (if string_startswith _s4726_ "c.bnez" then
      (match (string_drop _s4726_ (projT1 (string_length "c.bnez"))) with
       | _s4727_ =>
          (spc_matches_prefix _s4727_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4728_ _) =>
              (match (string_drop _s4727_ _s4728_) with
               | _s4729_ =>
                  (creg_name_matches_prefix _s4729_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs, existT _ _s4730_ _) =>
                      (match (string_drop _s4729_ _s4730_) with
                       | _s4731_ =>
                          (sep_matches_prefix _s4731_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4732_ _) =>
                                      match (string_drop _s4731_ _s4732_) with
                                      | _s4733_ =>
                                         match (hex_bits_8_matches_prefix _s4733_) with
                                         | Some (imm, existT _ _s4734_ _) =>
                                            match (string_drop _s4733_ _s4734_) with
                                            | s_ => Some (rs, imm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 8 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 8 * string)))
               end)
               : M (option ((mword 3 * mword 8 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 8 * string)))
       end)
       : M (option ((mword 3 * mword 8 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 8 * string))).

Definition _s4712_ (_s4713_ : string) : M (option ((mword 3 * mword 8 * string))) :=
   let _s4714_ := _s4713_ in
   (if string_startswith _s4714_ "c.beqz" then
      (match (string_drop _s4714_ (projT1 (string_length "c.beqz"))) with
       | _s4715_ =>
          (spc_matches_prefix _s4715_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4716_ _) =>
              (match (string_drop _s4715_ _s4716_) with
               | _s4717_ =>
                  (creg_name_matches_prefix _s4717_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs, existT _ _s4718_ _) =>
                      (match (string_drop _s4717_ _s4718_) with
                       | _s4719_ =>
                          (sep_matches_prefix _s4719_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4720_ _) =>
                                      match (string_drop _s4719_ _s4720_) with
                                      | _s4721_ =>
                                         match (hex_bits_8_matches_prefix _s4721_) with
                                         | Some (imm, existT _ _s4722_ _) =>
                                            match (string_drop _s4721_ _s4722_) with
                                            | s_ => Some (rs, imm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 8 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 8 * string)))
               end)
               : M (option ((mword 3 * mword 8 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 8 * string)))
       end)
       : M (option ((mword 3 * mword 8 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 8 * string))).

Definition _s4704_ (_s4705_ : string) : M (option ((mword 11 * string))) :=
   let _s4706_ := _s4705_ in
   (if string_startswith _s4706_ "c.j" then
      (match (string_drop _s4706_ (projT1 (string_length "c.j"))) with
       | _s4707_ =>
          (spc_matches_prefix _s4707_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s4708_ _) =>
                      match (string_drop _s4707_ _s4708_) with
                      | _s4709_ =>
                         match (hex_bits_11_matches_prefix _s4709_) with
                         | Some (imm, existT _ _s4710_ _) =>
                            match (string_drop _s4709_ _s4710_) with | s_ => Some (imm, s_) end
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option ((mword 11 * string)))
    else returnm None)
    : M (option ((mword 11 * string))).

Definition _s4692_ (_s4693_ : string) : M (option ((mword 3 * mword 3 * string))) :=
   let _s4694_ := _s4693_ in
   (if string_startswith _s4694_ "c.addw" then
      (match (string_drop _s4694_ (projT1 (string_length "c.addw"))) with
       | _s4695_ =>
          (spc_matches_prefix _s4695_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4696_ _) =>
              (match (string_drop _s4695_ _s4696_) with
               | _s4697_ =>
                  (creg_name_matches_prefix _s4697_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4698_ _) =>
                      (match (string_drop _s4697_ _s4698_) with
                       | _s4699_ =>
                          (sep_matches_prefix _s4699_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4700_ _) =>
                              (match (string_drop _s4699_ _s4700_) with
                               | _s4701_ =>
                                  (creg_name_matches_prefix _s4701_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s4702_ _) =>
                                              match (string_drop _s4701_ _s4702_) with
                                              | s_ => Some (rsd, rs2, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * string)))
               end)
               : M (option ((mword 3 * mword 3 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * string)))
       end)
       : M (option ((mword 3 * mword 3 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * string))).

Definition _s4680_ (_s4681_ : string) : M (option ((mword 3 * mword 3 * string))) :=
   let _s4682_ := _s4681_ in
   (if string_startswith _s4682_ "c.subw" then
      (match (string_drop _s4682_ (projT1 (string_length "c.subw"))) with
       | _s4683_ =>
          (spc_matches_prefix _s4683_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4684_ _) =>
              (match (string_drop _s4683_ _s4684_) with
               | _s4685_ =>
                  (creg_name_matches_prefix _s4685_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4686_ _) =>
                      (match (string_drop _s4685_ _s4686_) with
                       | _s4687_ =>
                          (sep_matches_prefix _s4687_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4688_ _) =>
                              (match (string_drop _s4687_ _s4688_) with
                               | _s4689_ =>
                                  (creg_name_matches_prefix _s4689_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s4690_ _) =>
                                              match (string_drop _s4689_ _s4690_) with
                                              | s_ => Some (rsd, rs2, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * string)))
               end)
               : M (option ((mword 3 * mword 3 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * string)))
       end)
       : M (option ((mword 3 * mword 3 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * string))).

Definition _s4668_ (_s4669_ : string) : M (option ((mword 3 * mword 3 * string))) :=
   let _s4670_ := _s4669_ in
   (if string_startswith _s4670_ "c.and" then
      (match (string_drop _s4670_ (projT1 (string_length "c.and"))) with
       | _s4671_ =>
          (spc_matches_prefix _s4671_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4672_ _) =>
              (match (string_drop _s4671_ _s4672_) with
               | _s4673_ =>
                  (creg_name_matches_prefix _s4673_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4674_ _) =>
                      (match (string_drop _s4673_ _s4674_) with
                       | _s4675_ =>
                          (sep_matches_prefix _s4675_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4676_ _) =>
                              (match (string_drop _s4675_ _s4676_) with
                               | _s4677_ =>
                                  (creg_name_matches_prefix _s4677_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s4678_ _) =>
                                              match (string_drop _s4677_ _s4678_) with
                                              | s_ => Some (rsd, rs2, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * string)))
               end)
               : M (option ((mword 3 * mword 3 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * string)))
       end)
       : M (option ((mword 3 * mword 3 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * string))).

Definition _s4656_ (_s4657_ : string) : M (option ((mword 3 * mword 3 * string))) :=
   let _s4658_ := _s4657_ in
   (if string_startswith _s4658_ "c.or" then
      (match (string_drop _s4658_ (projT1 (string_length "c.or"))) with
       | _s4659_ =>
          (spc_matches_prefix _s4659_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4660_ _) =>
              (match (string_drop _s4659_ _s4660_) with
               | _s4661_ =>
                  (creg_name_matches_prefix _s4661_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4662_ _) =>
                      (match (string_drop _s4661_ _s4662_) with
                       | _s4663_ =>
                          (sep_matches_prefix _s4663_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4664_ _) =>
                              (match (string_drop _s4663_ _s4664_) with
                               | _s4665_ =>
                                  (creg_name_matches_prefix _s4665_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s4666_ _) =>
                                              match (string_drop _s4665_ _s4666_) with
                                              | s_ => Some (rsd, rs2, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * string)))
               end)
               : M (option ((mword 3 * mword 3 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * string)))
       end)
       : M (option ((mword 3 * mword 3 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * string))).

Definition _s4644_ (_s4645_ : string) : M (option ((mword 3 * mword 3 * string))) :=
   let _s4646_ := _s4645_ in
   (if string_startswith _s4646_ "c.xor" then
      (match (string_drop _s4646_ (projT1 (string_length "c.xor"))) with
       | _s4647_ =>
          (spc_matches_prefix _s4647_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4648_ _) =>
              (match (string_drop _s4647_ _s4648_) with
               | _s4649_ =>
                  (creg_name_matches_prefix _s4649_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4650_ _) =>
                      (match (string_drop _s4649_ _s4650_) with
                       | _s4651_ =>
                          (sep_matches_prefix _s4651_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4652_ _) =>
                              (match (string_drop _s4651_ _s4652_) with
                               | _s4653_ =>
                                  (creg_name_matches_prefix _s4653_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s4654_ _) =>
                                              match (string_drop _s4653_ _s4654_) with
                                              | s_ => Some (rsd, rs2, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * string)))
               end)
               : M (option ((mword 3 * mword 3 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * string)))
       end)
       : M (option ((mword 3 * mword 3 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * string))).

Definition _s4632_ (_s4633_ : string) : M (option ((mword 3 * mword 3 * string))) :=
   let _s4634_ := _s4633_ in
   (if string_startswith _s4634_ "c.sub" then
      (match (string_drop _s4634_ (projT1 (string_length "c.sub"))) with
       | _s4635_ =>
          (spc_matches_prefix _s4635_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4636_ _) =>
              (match (string_drop _s4635_ _s4636_) with
               | _s4637_ =>
                  (creg_name_matches_prefix _s4637_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4638_ _) =>
                      (match (string_drop _s4637_ _s4638_) with
                       | _s4639_ =>
                          (sep_matches_prefix _s4639_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4640_ _) =>
                              (match (string_drop _s4639_ _s4640_) with
                               | _s4641_ =>
                                  (creg_name_matches_prefix _s4641_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s4642_ _) =>
                                              match (string_drop _s4641_ _s4642_) with
                                              | s_ => Some (rsd, rs2, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 3 * mword 3 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * string)))
               end)
               : M (option ((mword 3 * mword 3 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * string)))
       end)
       : M (option ((mword 3 * mword 3 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * string))).

Definition _s4620_ (_s4621_ : string) : M (option ((mword 3 * mword 6 * string))) :=
   let _s4622_ := _s4621_ in
   (if string_startswith _s4622_ "c.andi" then
      (match (string_drop _s4622_ (projT1 (string_length "c.andi"))) with
       | _s4623_ =>
          (spc_matches_prefix _s4623_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4624_ _) =>
              (match (string_drop _s4623_ _s4624_) with
               | _s4625_ =>
                  (creg_name_matches_prefix _s4625_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4626_ _) =>
                      (match (string_drop _s4625_ _s4626_) with
                       | _s4627_ =>
                          (sep_matches_prefix _s4627_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4628_ _) =>
                                      match (string_drop _s4627_ _s4628_) with
                                      | _s4629_ =>
                                         match (hex_bits_6_matches_prefix _s4629_) with
                                         | Some (imm, existT _ _s4630_ _) =>
                                            match (string_drop _s4629_ _s4630_) with
                                            | s_ => Some (rsd, imm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 6 * string)))
               end)
               : M (option ((mword 3 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 6 * string)))
       end)
       : M (option ((mword 3 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 6 * string))).

Definition _s4608_ (_s4609_ : string) : M (option ((mword 3 * mword 6 * string))) :=
   let _s4610_ := _s4609_ in
   (if string_startswith _s4610_ "c.srai" then
      (match (string_drop _s4610_ (projT1 (string_length "c.srai"))) with
       | _s4611_ =>
          (spc_matches_prefix _s4611_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4612_ _) =>
              (match (string_drop _s4611_ _s4612_) with
               | _s4613_ =>
                  (creg_name_matches_prefix _s4613_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4614_ _) =>
                      (match (string_drop _s4613_ _s4614_) with
                       | _s4615_ =>
                          (sep_matches_prefix _s4615_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4616_ _) =>
                                      match (string_drop _s4615_ _s4616_) with
                                      | _s4617_ =>
                                         match (hex_bits_6_matches_prefix _s4617_) with
                                         | Some (shamt, existT _ _s4618_ _) =>
                                            match (string_drop _s4617_ _s4618_) with
                                            | s_ => Some (rsd, shamt, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 6 * string)))
               end)
               : M (option ((mword 3 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 6 * string)))
       end)
       : M (option ((mword 3 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 6 * string))).

Definition _s4596_ (_s4597_ : string) : M (option ((mword 3 * mword 6 * string))) :=
   let _s4598_ := _s4597_ in
   (if string_startswith _s4598_ "c.srli" then
      (match (string_drop _s4598_ (projT1 (string_length "c.srli"))) with
       | _s4599_ =>
          (spc_matches_prefix _s4599_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4600_ _) =>
              (match (string_drop _s4599_ _s4600_) with
               | _s4601_ =>
                  (creg_name_matches_prefix _s4601_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4602_ _) =>
                      (match (string_drop _s4601_ _s4602_) with
                       | _s4603_ =>
                          (sep_matches_prefix _s4603_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4604_ _) =>
                                      match (string_drop _s4603_ _s4604_) with
                                      | _s4605_ =>
                                         match (hex_bits_6_matches_prefix _s4605_) with
                                         | Some (shamt, existT _ _s4606_ _) =>
                                            match (string_drop _s4605_ _s4606_) with
                                            | s_ => Some (rsd, shamt, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 6 * string)))
               end)
               : M (option ((mword 3 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 6 * string)))
       end)
       : M (option ((mword 3 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 6 * string))).

Definition _s4584_ (_s4585_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s4586_ := _s4585_ in
   (if string_startswith _s4586_ "c.lui" then
      (match (string_drop _s4586_ (projT1 (string_length "c.lui"))) with
       | _s4587_ =>
          (spc_matches_prefix _s4587_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4588_ _) =>
              (match (string_drop _s4587_ _s4588_) with
               | _s4589_ =>
                  (reg_name_matches_prefix _s4589_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4590_ _) =>
                      (match (string_drop _s4589_ _s4590_) with
                       | _s4591_ =>
                          (sep_matches_prefix _s4591_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4592_ _) =>
                                      match (string_drop _s4591_ _s4592_) with
                                      | _s4593_ =>
                                         match (hex_bits_6_matches_prefix _s4593_) with
                                         | Some (imm, existT _ _s4594_ _) =>
                                            match (string_drop _s4593_ _s4594_) with
                                            | s_ => Some (rd, imm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s4576_ (_s4577_ : string) : M (option ((mword 6 * string))) :=
   let _s4578_ := _s4577_ in
   (if string_startswith _s4578_ "c.addi16sp" then
      (match (string_drop _s4578_ (projT1 (string_length "c.addi16sp"))) with
       | _s4579_ =>
          (spc_matches_prefix _s4579_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s4580_ _) =>
                      match (string_drop _s4579_ _s4580_) with
                      | _s4581_ =>
                         match (hex_bits_6_matches_prefix _s4581_) with
                         | Some (imm, existT _ _s4582_ _) =>
                            match (string_drop _s4581_ _s4582_) with | s_ => Some (imm, s_) end
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option ((mword 6 * string)))
    else returnm None)
    : M (option ((mword 6 * string))).

Definition _s4564_ (_s4565_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s4566_ := _s4565_ in
   (if string_startswith _s4566_ "c.li" then
      (match (string_drop _s4566_ (projT1 (string_length "c.li"))) with
       | _s4567_ =>
          (spc_matches_prefix _s4567_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4568_ _) =>
              (match (string_drop _s4567_ _s4568_) with
               | _s4569_ =>
                  (reg_name_matches_prefix _s4569_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4570_ _) =>
                      (match (string_drop _s4569_ _s4570_) with
                       | _s4571_ =>
                          (sep_matches_prefix _s4571_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4572_ _) =>
                                      match (string_drop _s4571_ _s4572_) with
                                      | _s4573_ =>
                                         match (hex_bits_6_matches_prefix _s4573_) with
                                         | Some (imm, existT _ _s4574_ _) =>
                                            match (string_drop _s4573_ _s4574_) with
                                            | s_ => Some (rd, imm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s4552_ (_s4553_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s4554_ := _s4553_ in
   (if string_startswith _s4554_ "c.addiw" then
      (match (string_drop _s4554_ (projT1 (string_length "c.addiw"))) with
       | _s4555_ =>
          (spc_matches_prefix _s4555_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4556_ _) =>
              (match (string_drop _s4555_ _s4556_) with
               | _s4557_ =>
                  (reg_name_matches_prefix _s4557_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4558_ _) =>
                      (match (string_drop _s4557_ _s4558_) with
                       | _s4559_ =>
                          (sep_matches_prefix _s4559_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4560_ _) =>
                                      match (string_drop _s4559_ _s4560_) with
                                      | _s4561_ =>
                                         match (hex_bits_6_matches_prefix _s4561_) with
                                         | Some (imm, existT _ _s4562_ _) =>
                                            match (string_drop _s4561_ _s4562_) with
                                            | s_ => Some (rsd, imm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s4544_ (_s4545_ : string) : M (option ((mword 11 * string))) :=
   let _s4546_ := _s4545_ in
   (if string_startswith _s4546_ "c.jal" then
      (match (string_drop _s4546_ (projT1 (string_length "c.jal"))) with
       | _s4547_ =>
          (spc_matches_prefix _s4547_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          returnm (match w__0 with
                   | Some (tt, existT _ _s4548_ _) =>
                      match (string_drop _s4547_ _s4548_) with
                      | _s4549_ =>
                         match (hex_bits_12_matches_prefix _s4549_) with
                         | Some (v__1216, existT _ _s4550_ _) =>
                            if eq_vec (subrange_vec_dec v__1216 0 0) ('b"0"  : mword (0 - 0 + 1))
                            then
                              let imm : mword 11 := subrange_vec_dec v__1216 11 1 in
                              let imm : mword 11 := subrange_vec_dec v__1216 11 1 in
                              match (string_drop _s4549_ _s4550_) with | s_ => Some (imm, s_) end
                            else None
                         | _ => None
                         end
                      end
                   | _ => None
                   end)
       end)
       : M (option ((mword 11 * string)))
    else returnm None)
    : M (option ((mword 11 * string))).

Definition _s4532_ (_s4533_ : string) : M (option ((mword 5 * mword 6 * string))) :=
   let _s4534_ := _s4533_ in
   (if string_startswith _s4534_ "c.addi" then
      (match (string_drop _s4534_ (projT1 (string_length "c.addi"))) with
       | _s4535_ =>
          (spc_matches_prefix _s4535_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4536_ _) =>
              (match (string_drop _s4535_ _s4536_) with
               | _s4537_ =>
                  (reg_name_matches_prefix _s4537_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsd, existT _ _s4538_ _) =>
                      (match (string_drop _s4537_ _s4538_) with
                       | _s4539_ =>
                          (sep_matches_prefix _s4539_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4540_ _) =>
                                      match (string_drop _s4539_ _s4540_) with
                                      | _s4541_ =>
                                         match (hex_bits_6_matches_prefix _s4541_) with
                                         | Some (nzi, existT _ _s4542_ _) =>
                                            match (string_drop _s4541_ _s4542_) with
                                            | s_ => Some (rsd, nzi, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 6 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 6 * string)))
               end)
               : M (option ((mword 5 * mword 6 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 6 * string)))
       end)
       : M (option ((mword 5 * mword 6 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 6 * string))).

Definition _s4516_ (_s4517_ : string) : M (option ((mword 3 * mword 3 * mword 5 * string))) :=
   let _s4518_ := _s4517_ in
   (if string_startswith _s4518_ "c.sd" then
      (match (string_drop _s4518_ (projT1 (string_length "c.sd"))) with
       | _s4519_ =>
          (spc_matches_prefix _s4519_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4520_ _) =>
              (match (string_drop _s4519_ _s4520_) with
               | _s4521_ =>
                  (creg_name_matches_prefix _s4521_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsc1, existT _ _s4522_ _) =>
                      (match (string_drop _s4521_ _s4522_) with
                       | _s4523_ =>
                          (sep_matches_prefix _s4523_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4524_ _) =>
                              (match (string_drop _s4523_ _s4524_) with
                               | _s4525_ =>
                                  (creg_name_matches_prefix _s4525_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc2, existT _ _s4526_ _) =>
                                      (match (string_drop _s4525_ _s4526_) with
                                       | _s4527_ =>
                                          (sep_matches_prefix _s4527_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s4528_ _) =>
                                                      match (string_drop _s4527_ _s4528_) with
                                                      | _s4529_ =>
                                                         match (hex_bits_8_matches_prefix _s4529_) with
                                                         | Some (v__1218, existT _ _s4530_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1218 2 0)
                                                                 ('b"000"
                                                                  : mword (2 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1218 7 3 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1218 7 3 in
                                                              match (string_drop _s4529_ _s4530_) with
                                                              | s_ => Some (rsc1, rsc2, uimm, s_)
                                                              end
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5 * string)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5 * string))).

Definition _s4500_ (_s4501_ : string) : M (option ((mword 3 * mword 3 * mword 5 * string))) :=
   let _s4502_ := _s4501_ in
   (if string_startswith _s4502_ "c.sw" then
      (match (string_drop _s4502_ (projT1 (string_length "c.sw"))) with
       | _s4503_ =>
          (spc_matches_prefix _s4503_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4504_ _) =>
              (match (string_drop _s4503_ _s4504_) with
               | _s4505_ =>
                  (creg_name_matches_prefix _s4505_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rsc1, existT _ _s4506_ _) =>
                      (match (string_drop _s4505_ _s4506_) with
                       | _s4507_ =>
                          (sep_matches_prefix _s4507_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4508_ _) =>
                              (match (string_drop _s4507_ _s4508_) with
                               | _s4509_ =>
                                  (creg_name_matches_prefix _s4509_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc2, existT _ _s4510_ _) =>
                                      (match (string_drop _s4509_ _s4510_) with
                                       | _s4511_ =>
                                          (sep_matches_prefix _s4511_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s4512_ _) =>
                                                      match (string_drop _s4511_ _s4512_) with
                                                      | _s4513_ =>
                                                         match (hex_bits_7_matches_prefix _s4513_) with
                                                         | Some (v__1220, existT _ _s4514_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1220 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1220 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1220 6 2 in
                                                              match (string_drop _s4513_ _s4514_) with
                                                              | s_ => Some (rsc1, rsc2, uimm, s_)
                                                              end
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5 * string)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5 * string))).

Definition _s4484_ (_s4485_ : string) : M (option ((mword 3 * mword 3 * mword 5 * string))) :=
   let _s4486_ := _s4485_ in
   (if string_startswith _s4486_ "c.ld" then
      (match (string_drop _s4486_ (projT1 (string_length "c.ld"))) with
       | _s4487_ =>
          (spc_matches_prefix _s4487_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4488_ _) =>
              (match (string_drop _s4487_ _s4488_) with
               | _s4489_ =>
                  (creg_name_matches_prefix _s4489_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s4490_ _) =>
                      (match (string_drop _s4489_ _s4490_) with
                       | _s4491_ =>
                          (sep_matches_prefix _s4491_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4492_ _) =>
                              (match (string_drop _s4491_ _s4492_) with
                               | _s4493_ =>
                                  (creg_name_matches_prefix _s4493_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc, existT _ _s4494_ _) =>
                                      (match (string_drop _s4493_ _s4494_) with
                                       | _s4495_ =>
                                          (sep_matches_prefix _s4495_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s4496_ _) =>
                                                      match (string_drop _s4495_ _s4496_) with
                                                      | _s4497_ =>
                                                         match (hex_bits_8_matches_prefix _s4497_) with
                                                         | Some (v__1222, existT _ _s4498_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1222 2 0)
                                                                 ('b"000"
                                                                  : mword (2 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1222 7 3 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1222 7 3 in
                                                              match (string_drop _s4497_ _s4498_) with
                                                              | s_ => Some (rdc, rsc, uimm, s_)
                                                              end
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5 * string)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5 * string))).

Definition _s4468_ (_s4469_ : string) : M (option ((mword 3 * mword 3 * mword 5 * string))) :=
   let _s4470_ := _s4469_ in
   (if string_startswith _s4470_ "c.lw" then
      (match (string_drop _s4470_ (projT1 (string_length "c.lw"))) with
       | _s4471_ =>
          (spc_matches_prefix _s4471_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4472_ _) =>
              (match (string_drop _s4471_ _s4472_) with
               | _s4473_ =>
                  (creg_name_matches_prefix _s4473_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s4474_ _) =>
                      (match (string_drop _s4473_ _s4474_) with
                       | _s4475_ =>
                          (sep_matches_prefix _s4475_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4476_ _) =>
                              (match (string_drop _s4475_ _s4476_) with
                               | _s4477_ =>
                                  (creg_name_matches_prefix _s4477_) >>= fun w__3 : option ((mword 3 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rsc, existT _ _s4478_ _) =>
                                      (match (string_drop _s4477_ _s4478_) with
                                       | _s4479_ =>
                                          (sep_matches_prefix _s4479_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s4480_ _) =>
                                                      match (string_drop _s4479_ _s4480_) with
                                                      | _s4481_ =>
                                                         match (hex_bits_7_matches_prefix _s4481_) with
                                                         | Some (v__1224, existT _ _s4482_ _) =>
                                                            if eq_vec (subrange_vec_dec v__1224 1 0)
                                                                 ('b"00"
                                                                  : mword (1 - 0 + 1)) then
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1224 6 2 in
                                                              let uimm : mword 5 :=
                                                                subrange_vec_dec v__1224 6 2 in
                                                              match (string_drop _s4481_ _s4482_) with
                                                              | s_ => Some (rdc, rsc, uimm, s_)
                                                              end
                                                            else None
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
                               end)
                               : M (option ((mword 3 * mword 3 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 3 * mword 3 * mword 5 * string)))
                       end)
                       : M (option ((mword 3 * mword 3 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 3 * mword 5 * string)))
               end)
               : M (option ((mword 3 * mword 3 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 3 * mword 5 * string)))
       end)
       : M (option ((mword 3 * mword 3 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 3 * mword 5 * string))).

Definition _s4456_ (_s4457_ : string) : M (option ((mword 3 * mword 8 * string))) :=
   let _s4458_ := _s4457_ in
   (if string_startswith _s4458_ "c.addi4spn" then
      (match (string_drop _s4458_ (projT1 (string_length "c.addi4spn"))) with
       | _s4459_ =>
          (spc_matches_prefix _s4459_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4460_ _) =>
              (match (string_drop _s4459_ _s4460_) with
               | _s4461_ =>
                  (creg_name_matches_prefix _s4461_) >>= fun w__1 : option ((mword 3 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rdc, existT _ _s4462_ _) =>
                      (match (string_drop _s4461_ _s4462_) with
                       | _s4463_ =>
                          (sep_matches_prefix _s4463_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4464_ _) =>
                                      match (string_drop _s4463_ _s4464_) with
                                      | _s4465_ =>
                                         match (hex_bits_10_matches_prefix _s4465_) with
                                         | Some (v__1226, existT _ _s4466_ _) =>
                                            if eq_vec (subrange_vec_dec v__1226 1 0)
                                                 ('b"00"
                                                  : mword (1 - 0 + 1)) then
                                              let nzimm : mword 8 := subrange_vec_dec v__1226 9 2 in
                                              let nzimm : mword 8 := subrange_vec_dec v__1226 9 2 in
                                              match (string_drop _s4465_ _s4466_) with
                                              | s_ => Some (rdc, nzimm, s_)
                                              end
                                            else None
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 3 * mword 8 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 3 * mword 8 * string)))
               end)
               : M (option ((mword 3 * mword 8 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 3 * mword 8 * string)))
       end)
       : M (option ((mword 3 * mword 8 * string)))
    else returnm None)
    : M (option ((mword 3 * mword 8 * string))).

Definition _s4452_ (_s4453_ : string) : option string :=
   let _s4454_ := _s4453_ in
   if string_startswith _s4454_ "c.nop" then
     match (string_drop _s4454_ (projT1 (string_length "c.nop"))) with | s_ => Some s_ end
   else None.

Definition _s4426_ (_s4427_ : string)
: M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s4427_ with
    | _s4428_ =>
       (amo_mnemonic_matches_prefix _s4428_) >>= fun w__0 : option ((amoop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4429_ _) =>
           let _s4430_ := string_drop _s4428_ _s4429_ in
           (if string_startswith _s4430_ "." then
              (match (string_drop _s4430_ (projT1 (string_length "."))) with
               | _s4431_ =>
                  (size_mnemonic_matches_prefix _s4431_) >>= fun w__1 : option ((word_width * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (width, existT _ _s4432_ _) =>
                      (match (string_drop _s4431_ _s4432_) with
                       | _s4433_ =>
                          (maybe_aq_matches_prefix _s4433_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (aq, existT _ _s4434_ _) =>
                              (match (string_drop _s4433_ _s4434_) with
                               | _s4435_ =>
                                  (maybe_rl_matches_prefix _s4435_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rl, existT _ _s4436_ _) =>
                                      (match (string_drop _s4435_ _s4436_) with
                                       | _s4437_ =>
                                          (spc_matches_prefix _s4437_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (tt, existT _ _s4438_ _) =>
                                              (match (string_drop _s4437_ _s4438_) with
                                               | _s4439_ =>
                                                  (reg_name_matches_prefix _s4439_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (rd, existT _ _s4440_ _) =>
                                                      (match (string_drop _s4439_ _s4440_) with
                                                       | _s4441_ =>
                                                          (sep_matches_prefix _s4441_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          (match w__6 with
                                                           | Some (tt, existT _ _s4442_ _) =>
                                                              (match (string_drop _s4441_ _s4442_) with
                                                               | _s4443_ =>
                                                                  (reg_name_matches_prefix _s4443_) >>= fun w__7 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                    0)})) =>
                                                                  (match w__7 with
                                                                   | Some (rs2, existT _ _s4444_ _) =>
                                                                      (match (string_drop _s4443_
                                                                                _s4444_) with
                                                                       | _s4445_ =>
                                                                          (sep_matches_prefix
                                                                             _s4445_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >=?
                                                                            0)})) =>
                                                                          (match w__8 with
                                                                           | Some
                                                                             (tt, existT _ _s4446_ _) =>
                                                                              let _s4447_ :=
                                                                                string_drop _s4445_
                                                                                  _s4446_ in
                                                                              (if string_startswith
                                                                                    _s4447_ "(" then
                                                                                 (match (string_drop
                                                                                           _s4447_
                                                                                           (projT1
                                                                                            (string_length
                                                                                               "("))) with
                                                                                  | _s4448_ =>
                                                                                     (reg_name_matches_prefix
                                                                                        _s4448_) >>= fun w__9 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                                       0)})) =>
                                                                                     returnm (match w__9 with
                                                                                              | Some
                                                                                                (rs1, existT _ _s4449_ _) =>
                                                                                                 let _s4450_ :=
                                                                                                   string_drop
                                                                                                     _s4448_
                                                                                                     _s4449_ in
                                                                                                 if string_startswith
                                                                                                      _s4450_
                                                                                                      ")"
                                                                                                 then
                                                                                                   match (string_drop
                                                                                                            _s4450_
                                                                                                            (projT1
                                                                                                             (string_length
                                                                                                                ")"))) with
                                                                                                   | s_ =>
                                                                                                      Some
                                                                                                        (op, width, aq, rl, rd, rs2, rs1, s_)
                                                                                                   end
                                                                                                 else
                                                                                                   None
                                                                                              | _ =>
                                                                                                 None
                                                                                              end)
                                                                                  end)
                                                                                  : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                                               else returnm None)
                                                                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                                           | _ => returnm None
                                                                           end)
                                                                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                                       end)
                                                                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                               end)
                                                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                       end)
                                                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                               end)
                                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                       end)
                                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                               end)
                               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                       end)
                       : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
               end)
               : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
            else returnm None)
            : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))).

Definition _s4404_ (_s4405_ : string)
: M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))) :=
   let _s4406_ := _s4405_ in
   (if string_startswith _s4406_ "sc." then
      (match (string_drop _s4406_ (projT1 (string_length "sc."))) with
       | _s4407_ =>
          (size_mnemonic_matches_prefix _s4407_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s4408_ _) =>
              (match (string_drop _s4407_ _s4408_) with
               | _s4409_ =>
                  (maybe_aq_matches_prefix _s4409_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (aq, existT _ _s4410_ _) =>
                      (match (string_drop _s4409_ _s4410_) with
                       | _s4411_ =>
                          (maybe_rl_matches_prefix _s4411_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rl, existT _ _s4412_ _) =>
                              (match (string_drop _s4411_ _s4412_) with
                               | _s4413_ =>
                                  (spc_matches_prefix _s4413_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s4414_ _) =>
                                      (match (string_drop _s4413_ _s4414_) with
                                       | _s4415_ =>
                                          (reg_name_matches_prefix _s4415_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rd, existT _ _s4416_ _) =>
                                              (match (string_drop _s4415_ _s4416_) with
                                               | _s4417_ =>
                                                  (sep_matches_prefix _s4417_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s4418_ _) =>
                                                      (match (string_drop _s4417_ _s4418_) with
                                                       | _s4419_ =>
                                                          (reg_name_matches_prefix _s4419_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          (match w__6 with
                                                           | Some (rs1, existT _ _s4420_ _) =>
                                                              (match (string_drop _s4419_ _s4420_) with
                                                               | _s4421_ =>
                                                                  (sep_matches_prefix _s4421_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                    0)})) =>
                                                                  (match w__7 with
                                                                   | Some (tt, existT _ _s4422_ _) =>
                                                                      (match (string_drop _s4421_
                                                                                _s4422_) with
                                                                       | _s4423_ =>
                                                                          (reg_name_matches_prefix
                                                                             _s4423_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                            0)})) =>
                                                                          returnm (match w__8 with
                                                                                   | Some
                                                                                     (rs2, existT _ _s4424_ _) =>
                                                                                      match (string_drop
                                                                                               _s4423_
                                                                                               _s4424_) with
                                                                                      | s_ =>
                                                                                         Some
                                                                                           (size, aq, rl, rd, rs1, rs2, s_)
                                                                                      end
                                                                                   | _ => None
                                                                                   end)
                                                                       end)
                                                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                               end)
                                                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                       end)
                                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                               end)
                                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                       end)
                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                               end)
                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                       end)
                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
               end)
               : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
       end)
       : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string))).

Definition _s4386_ (_s4387_ : string)
: M (option ((word_width * bool * bool * mword 5 * mword 5 * string))) :=
   let _s4388_ := _s4387_ in
   (if string_startswith _s4388_ "lr." then
      (match (string_drop _s4388_ (projT1 (string_length "lr."))) with
       | _s4389_ =>
          (size_mnemonic_matches_prefix _s4389_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s4390_ _) =>
              (match (string_drop _s4389_ _s4390_) with
               | _s4391_ =>
                  (maybe_aq_matches_prefix _s4391_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (aq, existT _ _s4392_ _) =>
                      (match (string_drop _s4391_ _s4392_) with
                       | _s4393_ =>
                          (maybe_rl_matches_prefix _s4393_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rl, existT _ _s4394_ _) =>
                              (match (string_drop _s4393_ _s4394_) with
                               | _s4395_ =>
                                  (spc_matches_prefix _s4395_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s4396_ _) =>
                                      (match (string_drop _s4395_ _s4396_) with
                                       | _s4397_ =>
                                          (reg_name_matches_prefix _s4397_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rd, existT _ _s4398_ _) =>
                                              (match (string_drop _s4397_ _s4398_) with
                                               | _s4399_ =>
                                                  (sep_matches_prefix _s4399_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s4400_ _) =>
                                                      (match (string_drop _s4399_ _s4400_) with
                                                       | _s4401_ =>
                                                          (reg_name_matches_prefix _s4401_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          returnm (match w__6 with
                                                                   | Some (rs1, existT _ _s4402_ _) =>
                                                                      match (string_drop _s4401_
                                                                               _s4402_) with
                                                                      | s_ =>
                                                                         Some
                                                                           (size, aq, rl, rd, rs1, s_)
                                                                      end
                                                                   | _ => None
                                                                   end)
                                                       end)
                                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
                                               end)
                                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
                                       end)
                                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
                               end)
                               : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
                       end)
                       : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
               end)
               : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
       end)
       : M (option ((word_width * bool * bool * mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((word_width * bool * bool * mword 5 * mword 5 * string))).

Definition _s4374_ (_s4375_ : string) : M (option ((mword 5 * mword 5 * string))) :=
   let _s4376_ := _s4375_ in
   (if string_startswith _s4376_ "sfence.vma" then
      (match (string_drop _s4376_ (projT1 (string_length "sfence.vma"))) with
       | _s4377_ =>
          (spc_matches_prefix _s4377_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4378_ _) =>
              (match (string_drop _s4377_ _s4378_) with
               | _s4379_ =>
                  (reg_name_matches_prefix _s4379_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rs1, existT _ _s4380_ _) =>
                      (match (string_drop _s4379_ _s4380_) with
                       | _s4381_ =>
                          (sep_matches_prefix _s4381_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4382_ _) =>
                              (match (string_drop _s4381_ _s4382_) with
                               | _s4383_ =>
                                  (reg_name_matches_prefix _s4383_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (rs2, existT _ _s4384_ _) =>
                                              match (string_drop _s4383_ _s4384_) with
                                              | s_ => Some (rs1, rs2, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 5 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * string)))
                       end)
                       : M (option ((mword 5 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * string)))
               end)
               : M (option ((mword 5 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * string)))
       end)
       : M (option ((mword 5 * mword 5 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * string))).

Definition _s4370_ (_s4371_ : string) : option string :=
   let _s4372_ := _s4371_ in
   if string_startswith _s4372_ "wfi" then
     match (string_drop _s4372_ (projT1 (string_length "wfi"))) with | s_ => Some s_ end
   else None.

Definition _s4366_ (_s4367_ : string) : option string :=
   let _s4368_ := _s4367_ in
   if string_startswith _s4368_ "ebreak" then
     match (string_drop _s4368_ (projT1 (string_length "ebreak"))) with | s_ => Some s_ end
   else None.

Definition _s4362_ (_s4363_ : string) : option string :=
   let _s4364_ := _s4363_ in
   if string_startswith _s4364_ "sret" then
     match (string_drop _s4364_ (projT1 (string_length "sret"))) with | s_ => Some s_ end
   else None.

Definition _s4358_ (_s4359_ : string) : option string :=
   let _s4360_ := _s4359_ in
   if string_startswith _s4360_ "mret" then
     match (string_drop _s4360_ (projT1 (string_length "mret"))) with | s_ => Some s_ end
   else None.

Definition _s4354_ (_s4355_ : string) : option string :=
   let _s4356_ := _s4355_ in
   if string_startswith _s4356_ "ecall" then
     match (string_drop _s4356_ (projT1 (string_length "ecall"))) with | s_ => Some s_ end
   else None.

Definition _s4350_ (_s4351_ : string) : option string :=
   let _s4352_ := _s4351_ in
   if string_startswith _s4352_ "fence.i" then
     match (string_drop _s4352_ (projT1 (string_length "fence.i"))) with | s_ => Some s_ end
   else None.

Definition _s4338_ (_s4339_ : string) : M (option ((mword 4 * mword 4 * string))) :=
   let _s4340_ := _s4339_ in
   (if string_startswith _s4340_ "fence.tso" then
      (match (string_drop _s4340_ (projT1 (string_length "fence.tso"))) with
       | _s4341_ =>
          (spc_matches_prefix _s4341_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4342_ _) =>
              (match (string_drop _s4341_ _s4342_) with
               | _s4343_ =>
                  (fence_bits_matches_prefix _s4343_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (pred, existT _ _s4344_ _) =>
                      (match (string_drop _s4343_ _s4344_) with
                       | _s4345_ =>
                          (sep_matches_prefix _s4345_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4346_ _) =>
                              (match (string_drop _s4345_ _s4346_) with
                               | _s4347_ =>
                                  (fence_bits_matches_prefix _s4347_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (succ, existT _ _s4348_ _) =>
                                              match (string_drop _s4347_ _s4348_) with
                                              | s_ => Some (pred, succ, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 4 * mword 4 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 4 * mword 4 * string)))
                       end)
                       : M (option ((mword 4 * mword 4 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 4 * mword 4 * string)))
               end)
               : M (option ((mword 4 * mword 4 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 4 * mword 4 * string)))
       end)
       : M (option ((mword 4 * mword 4 * string)))
    else returnm None)
    : M (option ((mword 4 * mword 4 * string))).

Definition _s4326_ (_s4327_ : string) : M (option ((mword 4 * mword 4 * string))) :=
   let _s4328_ := _s4327_ in
   (if string_startswith _s4328_ "fence" then
      (match (string_drop _s4328_ (projT1 (string_length "fence"))) with
       | _s4329_ =>
          (spc_matches_prefix _s4329_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4330_ _) =>
              (match (string_drop _s4329_ _s4330_) with
               | _s4331_ =>
                  (fence_bits_matches_prefix _s4331_) >>= fun w__1 : option ((mword 4 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (pred, existT _ _s4332_ _) =>
                      (match (string_drop _s4331_ _s4332_) with
                       | _s4333_ =>
                          (sep_matches_prefix _s4333_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4334_ _) =>
                              (match (string_drop _s4333_ _s4334_) with
                               | _s4335_ =>
                                  (fence_bits_matches_prefix _s4335_) >>= fun w__3 : option ((mword 4 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  returnm (match w__3 with
                                           | Some (succ, existT _ _s4336_ _) =>
                                              match (string_drop _s4335_ _s4336_) with
                                              | s_ => Some (pred, succ, s_)
                                              end
                                           | _ => None
                                           end)
                               end)
                               : M (option ((mword 4 * mword 4 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 4 * mword 4 * string)))
                       end)
                       : M (option ((mword 4 * mword 4 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 4 * mword 4 * string)))
               end)
               : M (option ((mword 4 * mword 4 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 4 * mword 4 * string)))
       end)
       : M (option ((mword 4 * mword 4 * string)))
    else returnm None)
    : M (option ((mword 4 * mword 4 * string))).

Definition _s4309_ (_s4310_ : string) : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s4310_ with
    | _s4311_ =>
       (shiftiwop_mnemonic_matches_prefix _s4311_) >>= fun w__0 : option ((sopw * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4312_ _) =>
           (match (string_drop _s4311_ _s4312_) with
            | _s4313_ =>
               (spc_matches_prefix _s4313_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4314_ _) =>
                   (match (string_drop _s4313_ _s4314_) with
                    | _s4315_ =>
                       (reg_name_matches_prefix _s4315_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4316_ _) =>
                           (match (string_drop _s4315_ _s4316_) with
                            | _s4317_ =>
                               (sep_matches_prefix _s4317_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4318_ _) =>
                                   (match (string_drop _s4317_ _s4318_) with
                                    | _s4319_ =>
                                       (reg_name_matches_prefix _s4319_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s4320_ _) =>
                                           (match (string_drop _s4319_ _s4320_) with
                                            | _s4321_ =>
                                               (sep_matches_prefix _s4321_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s4322_ _) =>
                                                           match (string_drop _s4321_ _s4322_) with
                                                           | _s4323_ =>
                                                              match (hex_bits_5_matches_prefix
                                                                       _s4323_) with
                                                              | Some (shamt, existT _ _s4324_ _) =>
                                                                 match (string_drop _s4323_ _s4324_) with
                                                                 | s_ =>
                                                                    Some (op, rd, rs1, shamt, s_)
                                                                 end
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((sopw * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((sopw * mword 5 * mword 5 * mword 5 * string))).

Definition _s4292_ (_s4293_ : string) : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s4293_ with
    | _s4294_ =>
       (rtypew_mnemonic_matches_prefix _s4294_) >>= fun w__0 : option ((ropw * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4295_ _) =>
           (match (string_drop _s4294_ _s4295_) with
            | _s4296_ =>
               (spc_matches_prefix _s4296_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4297_ _) =>
                   (match (string_drop _s4296_ _s4297_) with
                    | _s4298_ =>
                       (reg_name_matches_prefix _s4298_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4299_ _) =>
                           (match (string_drop _s4298_ _s4299_) with
                            | _s4300_ =>
                               (sep_matches_prefix _s4300_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4301_ _) =>
                                   (match (string_drop _s4300_ _s4301_) with
                                    | _s4302_ =>
                                       (reg_name_matches_prefix _s4302_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s4303_ _) =>
                                           (match (string_drop _s4302_ _s4303_) with
                                            | _s4304_ =>
                                               (sep_matches_prefix _s4304_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s4305_ _) =>
                                                   (match (string_drop _s4304_ _s4305_) with
                                                    | _s4306_ =>
                                                       (reg_name_matches_prefix _s4306_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s4307_ _) =>
                                                                   match (string_drop _s4306_
                                                                            _s4307_) with
                                                                   | s_ =>
                                                                      Some (op, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((ropw * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((ropw * mword 5 * mword 5 * mword 5 * string))).

Definition _s4275_ (_s4276_ : string) : M (option ((sop * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s4276_ with
    | _s4277_ =>
       (shiftw_mnemonic_matches_prefix _s4277_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4278_ _) =>
           (match (string_drop _s4277_ _s4278_) with
            | _s4279_ =>
               (spc_matches_prefix _s4279_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4280_ _) =>
                   (match (string_drop _s4279_ _s4280_) with
                    | _s4281_ =>
                       (reg_name_matches_prefix _s4281_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4282_ _) =>
                           (match (string_drop _s4281_ _s4282_) with
                            | _s4283_ =>
                               (sep_matches_prefix _s4283_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4284_ _) =>
                                   (match (string_drop _s4283_ _s4284_) with
                                    | _s4285_ =>
                                       (reg_name_matches_prefix _s4285_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s4286_ _) =>
                                           (match (string_drop _s4285_ _s4286_) with
                                            | _s4287_ =>
                                               (sep_matches_prefix _s4287_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s4288_ _) =>
                                                           match (string_drop _s4287_ _s4288_) with
                                                           | _s4289_ =>
                                                              match (hex_bits_5_matches_prefix
                                                                       _s4289_) with
                                                              | Some (shamt, existT _ _s4290_ _) =>
                                                                 match (string_drop _s4289_ _s4290_) with
                                                                 | s_ =>
                                                                    Some (op, rd, rs1, shamt, s_)
                                                                 end
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((sop * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((sop * mword 5 * mword 5 * mword 5 * string))).

Definition _s4259_ (_s4260_ : string) : M (option ((mword 5 * mword 5 * mword 12 * string))) :=
   let _s4261_ := _s4260_ in
   (if string_startswith _s4261_ "addiw" then
      (match (string_drop _s4261_ (projT1 (string_length "addiw"))) with
       | _s4262_ =>
          (spc_matches_prefix _s4262_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4263_ _) =>
              (match (string_drop _s4262_ _s4263_) with
               | _s4264_ =>
                  (reg_name_matches_prefix _s4264_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4265_ _) =>
                      (match (string_drop _s4264_ _s4265_) with
                       | _s4266_ =>
                          (sep_matches_prefix _s4266_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4267_ _) =>
                              (match (string_drop _s4266_ _s4267_) with
                               | _s4268_ =>
                                  (reg_name_matches_prefix _s4268_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rs1, existT _ _s4269_ _) =>
                                      (match (string_drop _s4268_ _s4269_) with
                                       | _s4270_ =>
                                          (sep_matches_prefix _s4270_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s4271_ _) =>
                                                      match (string_drop _s4270_ _s4271_) with
                                                      | _s4272_ =>
                                                         match (hex_bits_12_matches_prefix _s4272_) with
                                                         | Some (imm, existT _ _s4273_ _) =>
                                                            match (string_drop _s4272_ _s4273_) with
                                                            | s_ => Some (rd, rs1, imm, s_)
                                                            end
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 5 * mword 5 * mword 12 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 5 * mword 5 * mword 12 * string)))
                               end)
                               : M (option ((mword 5 * mword 5 * mword 12 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * mword 12 * string)))
                       end)
                       : M (option ((mword 5 * mword 5 * mword 12 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * mword 12 * string)))
               end)
               : M (option ((mword 5 * mword 5 * mword 12 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 12 * string)))
       end)
       : M (option ((mword 5 * mword 5 * mword 12 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 12 * string))).

Definition _s4231_ (_s4232_ : string)
: M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string))) :=
   let _s4233_ := _s4232_ in
   (if string_startswith _s4233_ "s" then
      (match (string_drop _s4233_ (projT1 (string_length "s"))) with
       | _s4234_ =>
          (size_mnemonic_matches_prefix _s4234_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s4235_ _) =>
              (match (string_drop _s4234_ _s4235_) with
               | _s4236_ =>
                  (maybe_aq_matches_prefix _s4236_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (aq, existT _ _s4237_ _) =>
                      (match (string_drop _s4236_ _s4237_) with
                       | _s4238_ =>
                          (maybe_rl_matches_prefix _s4238_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (rl, existT _ _s4239_ _) =>
                              (match (string_drop _s4238_ _s4239_) with
                               | _s4240_ =>
                                  (spc_matches_prefix _s4240_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (tt, existT _ _s4241_ _) =>
                                      (match (string_drop _s4240_ _s4241_) with
                                       | _s4242_ =>
                                          (reg_name_matches_prefix _s4242_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (rs2, existT _ _s4243_ _) =>
                                              (match (string_drop _s4242_ _s4243_) with
                                               | _s4244_ =>
                                                  (sep_matches_prefix _s4244_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (tt, existT _ _s4245_ _) =>
                                                      (match (string_drop _s4244_ _s4245_) with
                                                       | _s4246_ =>
                                                          (match (hex_bits_12_matches_prefix _s4246_) with
                                                           | Some (imm, existT _ _s4247_ _) =>
                                                              (match (string_drop _s4246_ _s4247_) with
                                                               | _s4248_ =>
                                                                  (opt_spc_matches_prefix _s4248_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >=?
                                                                    0)})) =>
                                                                  (match w__6 with
                                                                   | Some (tt, existT _ _s4249_ _) =>
                                                                      let _s4250_ :=
                                                                        string_drop _s4248_ _s4249_ in
                                                                      (if string_startswith _s4250_
                                                                            "(" then
                                                                         (match (string_drop _s4250_
                                                                                   (projT1
                                                                                    (string_length
                                                                                       "("))) with
                                                                          | _s4251_ =>
                                                                             (opt_spc_matches_prefix
                                                                                _s4251_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                               0)})) =>
                                                                             (match w__7 with
                                                                              | Some
                                                                                (tt, existT _ _s4252_ _) =>
                                                                                 (match (string_drop
                                                                                           _s4251_
                                                                                           _s4252_) with
                                                                                  | _s4253_ =>
                                                                                     (reg_name_matches_prefix
                                                                                        _s4253_) >>= fun w__8 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                                       0)})) =>
                                                                                     (match w__8 with
                                                                                      | Some
                                                                                        (rs1, existT _ _s4254_ _) =>
                                                                                         (match (string_drop
                                                                                                   _s4253_
                                                                                                   _s4254_) with
                                                                                          | _s4255_ =>
                                                                                             (opt_spc_matches_prefix
                                                                                                _s4255_) >>= fun w__9 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                               0)})) =>
                                                                                             returnm (match w__9 with
                                                                                                      | Some
                                                                                                        (tt, existT _ _s4256_ _) =>
                                                                                                         let _s4257_ :=
                                                                                                           string_drop
                                                                                                             _s4255_
                                                                                                             _s4256_ in
                                                                                                         if
                                                                                                           string_startswith
                                                                                                             _s4257_
                                                                                                             ")"
                                                                                                         then
                                                                                                           match (string_drop
                                                                                                                    _s4257_
                                                                                                                    (projT1
                                                                                                                     (string_length
                                                                                                                        ")"))) with
                                                                                                           | s_ =>
                                                                                                              Some
                                                                                                                (size, aq, rl, rs2, imm, rs1, s_)
                                                                                                           end
                                                                                                         else
                                                                                                           None
                                                                                                      | _ =>
                                                                                                         None
                                                                                                      end)
                                                                                          end)
                                                                                          : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                                      | _ =>
                                                                                         returnm None
                                                                                      end)
                                                                                      : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                                  end)
                                                                                  : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                              | _ => returnm None
                                                                              end)
                                                                              : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                          end)
                                                                          : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                       else returnm None)
                                                                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                               end)
                                                               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                       end)
                                                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                               end)
                                               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                       end)
                                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                               end)
                               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                       end)
                       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
               end)
               : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
       end)
       : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)))
    else returnm None)
    : M (option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string))).

Definition _s4201_ (_s4202_ : string)
: M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string))) :=
   let _s4203_ := _s4202_ in
   (if string_startswith _s4203_ "l" then
      (match (string_drop _s4203_ (projT1 (string_length "l"))) with
       | _s4204_ =>
          (size_mnemonic_matches_prefix _s4204_) >>= fun w__0 : option ((word_width * {n : Z & ArithFact (n >=?
            0)})) =>
          (match w__0 with
           | Some (size, existT _ _s4205_ _) =>
              (match (string_drop _s4204_ _s4205_) with
               | _s4206_ =>
                  (maybe_u_matches_prefix _s4206_) >>= fun w__1 : option ((bool * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (is_unsigned, existT _ _s4207_ _) =>
                      (match (string_drop _s4206_ _s4207_) with
                       | _s4208_ =>
                          (maybe_aq_matches_prefix _s4208_) >>= fun w__2 : option ((bool * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (aq, existT _ _s4209_ _) =>
                              (match (string_drop _s4208_ _s4209_) with
                               | _s4210_ =>
                                  (maybe_rl_matches_prefix _s4210_) >>= fun w__3 : option ((bool * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rl, existT _ _s4211_ _) =>
                                      (match (string_drop _s4210_ _s4211_) with
                                       | _s4212_ =>
                                          (spc_matches_prefix _s4212_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          (match w__4 with
                                           | Some (tt, existT _ _s4213_ _) =>
                                              (match (string_drop _s4212_ _s4213_) with
                                               | _s4214_ =>
                                                  (reg_name_matches_prefix _s4214_) >>= fun w__5 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                    0)})) =>
                                                  (match w__5 with
                                                   | Some (rd, existT _ _s4215_ _) =>
                                                      (match (string_drop _s4214_ _s4215_) with
                                                       | _s4216_ =>
                                                          (sep_matches_prefix _s4216_) >>= fun w__6 : option ((unit * {n : Z & ArithFact (n >=?
                                                            0)})) =>
                                                          (match w__6 with
                                                           | Some (tt, existT _ _s4217_ _) =>
                                                              (match (string_drop _s4216_ _s4217_) with
                                                               | _s4218_ =>
                                                                  (match (hex_bits_12_matches_prefix
                                                                            _s4218_) with
                                                                   | Some (imm, existT _ _s4219_ _) =>
                                                                      (match (string_drop _s4218_
                                                                                _s4219_) with
                                                                       | _s4220_ =>
                                                                          (opt_spc_matches_prefix
                                                                             _s4220_) >>= fun w__7 : option ((unit * {n : Z & ArithFact (n >=?
                                                                            0)})) =>
                                                                          (match w__7 with
                                                                           | Some
                                                                             (tt, existT _ _s4221_ _) =>
                                                                              let _s4222_ :=
                                                                                string_drop _s4220_
                                                                                  _s4221_ in
                                                                              (if string_startswith
                                                                                    _s4222_ "(" then
                                                                                 (match (string_drop
                                                                                           _s4222_
                                                                                           (projT1
                                                                                            (string_length
                                                                                               "("))) with
                                                                                  | _s4223_ =>
                                                                                     (opt_spc_matches_prefix
                                                                                        _s4223_) >>= fun w__8 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                       0)})) =>
                                                                                     (match w__8 with
                                                                                      | Some
                                                                                        (tt, existT _ _s4224_ _) =>
                                                                                         (match (string_drop
                                                                                                   _s4223_
                                                                                                   _s4224_) with
                                                                                          | _s4225_ =>
                                                                                             (reg_name_matches_prefix
                                                                                                _s4225_) >>= fun w__9 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                                                               0)})) =>
                                                                                             (match w__9 with
                                                                                              | Some
                                                                                                (rs1, existT _ _s4226_ _) =>
                                                                                                 (match (string_drop
                                                                                                           _s4225_
                                                                                                           _s4226_) with
                                                                                                  | _s4227_ =>
                                                                                                     (opt_spc_matches_prefix
                                                                                                        _s4227_) >>= fun w__10 : option ((unit * {n : Z & ArithFact (n >=?
                                                                                                       0)})) =>
                                                                                                     returnm (match w__10 with
                                                                                                              | Some
                                                                                                                (tt, existT _ _s4228_ _) =>
                                                                                                                 let _s4229_ :=
                                                                                                                   string_drop
                                                                                                                     _s4227_
                                                                                                                     _s4228_ in
                                                                                                                 if
                                                                                                                   string_startswith
                                                                                                                     _s4229_
                                                                                                                     ")"
                                                                                                                 then
                                                                                                                   match (string_drop
                                                                                                                            _s4229_
                                                                                                                            (projT1
                                                                                                                             (string_length
                                                                                                                                ")"))) with
                                                                                                                   | s_ =>
                                                                                                                      Some
                                                                                                                        (size, is_unsigned, aq, rl, rd, imm, rs1, s_)
                                                                                                                   end
                                                                                                                 else
                                                                                                                   None
                                                                                                              | _ =>
                                                                                                                 None
                                                                                                              end)
                                                                                                  end)
                                                                                                  : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                                              | _ =>
                                                                                                 returnm None
                                                                                              end)
                                                                                              : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                                          end)
                                                                                          : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                                      | _ =>
                                                                                         returnm None
                                                                                      end)
                                                                                      : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                                  end)
                                                                                  : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                               else returnm None)
                                                                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                           | _ => returnm None
                                                                           end)
                                                                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                       end)
                                                                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                                   | _ => returnm None
                                                                   end)
                                                                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                               end)
                                                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                           | _ => returnm None
                                                           end)
                                                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                       end)
                                                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                                   | _ => returnm None
                                                   end)
                                                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                               end)
                                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                           | _ => returnm None
                                           end)
                                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                       end)
                                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                               end)
                               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                       end)
                       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
               end)
               : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
           | _ => returnm None
           end)
           : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
       end)
       : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)))
    else returnm None)
    : M (option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string))).

Definition _s4184_ (_s4185_ : string) : M (option ((rop * mword 5 * mword 5 * mword 5 * string))) :=
   (match _s4185_ with
    | _s4186_ =>
       (rtype_mnemonic_matches_prefix _s4186_) >>= fun w__0 : option ((rop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4187_ _) =>
           (match (string_drop _s4186_ _s4187_) with
            | _s4188_ =>
               (spc_matches_prefix _s4188_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4189_ _) =>
                   (match (string_drop _s4188_ _s4189_) with
                    | _s4190_ =>
                       (reg_name_matches_prefix _s4190_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4191_ _) =>
                           (match (string_drop _s4190_ _s4191_) with
                            | _s4192_ =>
                               (sep_matches_prefix _s4192_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4193_ _) =>
                                   (match (string_drop _s4192_ _s4193_) with
                                    | _s4194_ =>
                                       (reg_name_matches_prefix _s4194_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s4195_ _) =>
                                           (match (string_drop _s4194_ _s4195_) with
                                            | _s4196_ =>
                                               (sep_matches_prefix _s4196_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               (match w__5 with
                                                | Some (tt, existT _ _s4197_ _) =>
                                                   (match (string_drop _s4196_ _s4197_) with
                                                    | _s4198_ =>
                                                       (reg_name_matches_prefix _s4198_) >>= fun w__6 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                                         0)})) =>
                                                       returnm (match w__6 with
                                                                | Some (rs2, existT _ _s4199_ _) =>
                                                                   match (string_drop _s4198_
                                                                            _s4199_) with
                                                                   | s_ =>
                                                                      Some (op, rd, rs1, rs2, s_)
                                                                   end
                                                                | _ => None
                                                                end)
                                                    end)
                                                    : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
                                                | _ => returnm None
                                                end)
                                                : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
                                            end)
                                            : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
                                    end)
                                    : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
                            end)
                            : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
                    end)
                    : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
                | _ => returnm None
                end)
                : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
            end)
            : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
        | _ => returnm None
        end)
        : M (option ((rop * mword 5 * mword 5 * mword 5 * string)))
    end)
    : M (option ((rop * mword 5 * mword 5 * mword 5 * string))).

Definition _s4167_ (_s4168_ : string) : M (option ((sop * mword 5 * mword 5 * mword 6 * string))) :=
   (match _s4168_ with
    | _s4169_ =>
       (shiftiop_mnemonic_matches_prefix _s4169_) >>= fun w__0 : option ((sop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4170_ _) =>
           (match (string_drop _s4169_ _s4170_) with
            | _s4171_ =>
               (spc_matches_prefix _s4171_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4172_ _) =>
                   (match (string_drop _s4171_ _s4172_) with
                    | _s4173_ =>
                       (reg_name_matches_prefix _s4173_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4174_ _) =>
                           (match (string_drop _s4173_ _s4174_) with
                            | _s4175_ =>
                               (sep_matches_prefix _s4175_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4176_ _) =>
                                   (match (string_drop _s4175_ _s4176_) with
                                    | _s4177_ =>
                                       (reg_name_matches_prefix _s4177_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s4178_ _) =>
                                           (match (string_drop _s4177_ _s4178_) with
                                            | _s4179_ =>
                                               (sep_matches_prefix _s4179_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s4180_ _) =>
                                                           match (string_drop _s4179_ _s4180_) with
                                                           | _s4181_ =>
                                                              match (hex_bits_6_matches_prefix
                                                                       _s4181_) with
                                                              | Some (shamt, existT _ _s4182_ _) =>
                                                                 match (string_drop _s4181_ _s4182_) with
                                                                 | s_ =>
                                                                    Some (op, rd, rs1, shamt, s_)
                                                                 end
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
                                    end)
                                    : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
                            end)
                            : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
                    end)
                    : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
                | _ => returnm None
                end)
                : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
            end)
            : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
        | _ => returnm None
        end)
        : M (option ((sop * mword 5 * mword 5 * mword 6 * string)))
    end)
    : M (option ((sop * mword 5 * mword 5 * mword 6 * string))).

Definition _s4150_ (_s4151_ : string) : M (option ((iop * mword 5 * mword 5 * mword 12 * string))) :=
   (match _s4151_ with
    | _s4152_ =>
       (itype_mnemonic_matches_prefix _s4152_) >>= fun w__0 : option ((iop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4153_ _) =>
           (match (string_drop _s4152_ _s4153_) with
            | _s4154_ =>
               (spc_matches_prefix _s4154_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4155_ _) =>
                   (match (string_drop _s4154_ _s4155_) with
                    | _s4156_ =>
                       (reg_name_matches_prefix _s4156_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4157_ _) =>
                           (match (string_drop _s4156_ _s4157_) with
                            | _s4158_ =>
                               (sep_matches_prefix _s4158_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4159_ _) =>
                                   (match (string_drop _s4158_ _s4159_) with
                                    | _s4160_ =>
                                       (reg_name_matches_prefix _s4160_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs1, existT _ _s4161_ _) =>
                                           (match (string_drop _s4160_ _s4161_) with
                                            | _s4162_ =>
                                               (sep_matches_prefix _s4162_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s4163_ _) =>
                                                           match (string_drop _s4162_ _s4163_) with
                                                           | _s4164_ =>
                                                              match (hex_bits_12_matches_prefix
                                                                       _s4164_) with
                                                              | Some (imm, existT _ _s4165_ _) =>
                                                                 match (string_drop _s4164_ _s4165_) with
                                                                 | s_ => Some (op, rd, rs1, imm, s_)
                                                                 end
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
                                    end)
                                    : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
                            end)
                            : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
                    end)
                    : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
                | _ => returnm None
                end)
                : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
            end)
            : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
        | _ => returnm None
        end)
        : M (option ((iop * mword 5 * mword 5 * mword 12 * string)))
    end)
    : M (option ((iop * mword 5 * mword 5 * mword 12 * string))).

Definition _s4133_ (_s4134_ : string) : M (option ((bop * mword 5 * mword 5 * mword 13 * string))) :=
   (match _s4134_ with
    | _s4135_ =>
       (btype_mnemonic_matches_prefix _s4135_) >>= fun w__0 : option ((bop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4136_ _) =>
           (match (string_drop _s4135_ _s4136_) with
            | _s4137_ =>
               (spc_matches_prefix _s4137_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4138_ _) =>
                   (match (string_drop _s4137_ _s4138_) with
                    | _s4139_ =>
                       (reg_name_matches_prefix _s4139_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rs1, existT _ _s4140_ _) =>
                           (match (string_drop _s4139_ _s4140_) with
                            | _s4141_ =>
                               (sep_matches_prefix _s4141_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               (match w__3 with
                                | Some (tt, existT _ _s4142_ _) =>
                                   (match (string_drop _s4141_ _s4142_) with
                                    | _s4143_ =>
                                       (reg_name_matches_prefix _s4143_) >>= fun w__4 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                         0)})) =>
                                       (match w__4 with
                                        | Some (rs2, existT _ _s4144_ _) =>
                                           (match (string_drop _s4143_ _s4144_) with
                                            | _s4145_ =>
                                               (sep_matches_prefix _s4145_) >>= fun w__5 : option ((unit * {n : Z & ArithFact (n >=?
                                                 0)})) =>
                                               returnm (match w__5 with
                                                        | Some (tt, existT _ _s4146_ _) =>
                                                           match (string_drop _s4145_ _s4146_) with
                                                           | _s4147_ =>
                                                              match (hex_bits_13_matches_prefix
                                                                       _s4147_) with
                                                              | Some (imm, existT _ _s4148_ _) =>
                                                                 match (string_drop _s4147_ _s4148_) with
                                                                 | s_ =>
                                                                    Some (op, rs1, rs2, imm, s_)
                                                                 end
                                                              | _ => None
                                                              end
                                                           end
                                                        | _ => None
                                                        end)
                                            end)
                                            : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
                                        | _ => returnm None
                                        end)
                                        : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
                                    end)
                                    : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
                                | _ => returnm None
                                end)
                                : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
                            end)
                            : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
                    end)
                    : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
                | _ => returnm None
                end)
                : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
            end)
            : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
        | _ => returnm None
        end)
        : M (option ((bop * mword 5 * mword 5 * mword 13 * string)))
    end)
    : M (option ((bop * mword 5 * mword 5 * mword 13 * string))).

Definition _s4117_ (_s4118_ : string) : M (option ((mword 5 * mword 5 * mword 12 * string))) :=
   let _s4119_ := _s4118_ in
   (if string_startswith _s4119_ "jalr" then
      (match (string_drop _s4119_ (projT1 (string_length "jalr"))) with
       | _s4120_ =>
          (spc_matches_prefix _s4120_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4121_ _) =>
              (match (string_drop _s4120_ _s4121_) with
               | _s4122_ =>
                  (reg_name_matches_prefix _s4122_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4123_ _) =>
                      (match (string_drop _s4122_ _s4123_) with
                       | _s4124_ =>
                          (sep_matches_prefix _s4124_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          (match w__2 with
                           | Some (tt, existT _ _s4125_ _) =>
                              (match (string_drop _s4124_ _s4125_) with
                               | _s4126_ =>
                                  (reg_name_matches_prefix _s4126_) >>= fun w__3 : option ((mword 5 * {n : Z & ArithFact (n >=?
                                    0)})) =>
                                  (match w__3 with
                                   | Some (rs1, existT _ _s4127_ _) =>
                                      (match (string_drop _s4126_ _s4127_) with
                                       | _s4128_ =>
                                          (sep_matches_prefix _s4128_) >>= fun w__4 : option ((unit * {n : Z & ArithFact (n >=?
                                            0)})) =>
                                          returnm (match w__4 with
                                                   | Some (tt, existT _ _s4129_ _) =>
                                                      match (string_drop _s4128_ _s4129_) with
                                                      | _s4130_ =>
                                                         match (hex_bits_12_matches_prefix _s4130_) with
                                                         | Some (imm, existT _ _s4131_ _) =>
                                                            match (string_drop _s4130_ _s4131_) with
                                                            | s_ => Some (rd, rs1, imm, s_)
                                                            end
                                                         | _ => None
                                                         end
                                                      end
                                                   | _ => None
                                                   end)
                                       end)
                                       : M (option ((mword 5 * mword 5 * mword 12 * string)))
                                   | _ => returnm None
                                   end)
                                   : M (option ((mword 5 * mword 5 * mword 12 * string)))
                               end)
                               : M (option ((mword 5 * mword 5 * mword 12 * string)))
                           | _ => returnm None
                           end)
                           : M (option ((mword 5 * mword 5 * mword 12 * string)))
                       end)
                       : M (option ((mword 5 * mword 5 * mword 12 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 5 * mword 12 * string)))
               end)
               : M (option ((mword 5 * mword 5 * mword 12 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 5 * mword 12 * string)))
       end)
       : M (option ((mword 5 * mword 5 * mword 12 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 5 * mword 12 * string))).

Definition _s4105_ (_s4106_ : string) : M (option ((mword 5 * mword 21 * string))) :=
   let _s4107_ := _s4106_ in
   (if string_startswith _s4107_ "jal" then
      (match (string_drop _s4107_ (projT1 (string_length "jal"))) with
       | _s4108_ =>
          (spc_matches_prefix _s4108_) >>= fun w__0 : option ((unit * {n : Z & ArithFact (n >=? 0)})) =>
          (match w__0 with
           | Some (tt, existT _ _s4109_ _) =>
              (match (string_drop _s4108_ _s4109_) with
               | _s4110_ =>
                  (reg_name_matches_prefix _s4110_) >>= fun w__1 : option ((mword 5 * {n : Z & ArithFact (n >=?
                    0)})) =>
                  (match w__1 with
                   | Some (rd, existT _ _s4111_ _) =>
                      (match (string_drop _s4110_ _s4111_) with
                       | _s4112_ =>
                          (sep_matches_prefix _s4112_) >>= fun w__2 : option ((unit * {n : Z & ArithFact (n >=?
                            0)})) =>
                          returnm (match w__2 with
                                   | Some (tt, existT _ _s4113_ _) =>
                                      match (string_drop _s4112_ _s4113_) with
                                      | _s4114_ =>
                                         match (hex_bits_21_matches_prefix _s4114_) with
                                         | Some (imm, existT _ _s4115_ _) =>
                                            match (string_drop _s4114_ _s4115_) with
                                            | s_ => Some (rd, imm, s_)
                                            end
                                         | _ => None
                                         end
                                      end
                                   | _ => None
                                   end)
                       end)
                       : M (option ((mword 5 * mword 21 * string)))
                   | _ => returnm None
                   end)
                   : M (option ((mword 5 * mword 21 * string)))
               end)
               : M (option ((mword 5 * mword 21 * string)))
           | _ => returnm None
           end)
           : M (option ((mword 5 * mword 21 * string)))
       end)
       : M (option ((mword 5 * mword 21 * string)))
    else returnm None)
    : M (option ((mword 5 * mword 21 * string))).

Definition _s4092_ (_s4093_ : string) : M (option ((uop * mword 5 * mword 20 * string))) :=
   (match _s4093_ with
    | _s4094_ =>
       (utype_mnemonic_matches_prefix _s4094_) >>= fun w__0 : option ((uop * {n : Z & ArithFact (n >=?
         0)})) =>
       (match w__0 with
        | Some (op, existT _ _s4095_ _) =>
           (match (string_drop _s4094_ _s4095_) with
            | _s4096_ =>
               (spc_matches_prefix _s4096_) >>= fun w__1 : option ((unit * {n : Z & ArithFact (n >=?
                 0)})) =>
               (match w__1 with
                | Some (tt, existT _ _s4097_ _) =>
                   (match (string_drop _s4096_ _s4097_) with
                    | _s4098_ =>
                       (reg_name_matches_prefix _s4098_) >>= fun w__2 : option ((mword 5 * {n : Z & ArithFact (n >=?
                         0)})) =>
                       (match w__2 with
                        | Some (rd, existT _ _s4099_ _) =>
                           (match (string_drop _s4098_ _s4099_) with
                            | _s4100_ =>
                               (sep_matches_prefix _s4100_) >>= fun w__3 : option ((unit * {n : Z & ArithFact (n >=?
                                 0)})) =>
                               returnm (match w__3 with
                                        | Some (tt, existT _ _s4101_ _) =>
                                           match (string_drop _s4100_ _s4101_) with
                                           | _s4102_ =>
                                              match (hex_bits_20_matches_prefix _s4102_) with
                                              | Some (imm, existT _ _s4103_ _) =>
                                                 match (string_drop _s4102_ _s4103_) with
                                                 | s_ => Some (op, rd, imm, s_)
                                                 end
                                              | _ => None
                                              end
                                           end
                                        | _ => None
                                        end)
                            end)
                            : M (option ((uop * mword 5 * mword 20 * string)))
                        | _ => returnm None
                        end)
                        : M (option ((uop * mword 5 * mword 20 * string)))
                    end)
                    : M (option ((uop * mword 5 * mword 20 * string)))
                | _ => returnm None
                end)
                : M (option ((uop * mword 5 * mword 20 * string)))
            end)
            : M (option ((uop * mword 5 * mword 20 * string)))
        | _ => returnm None
        end)
        : M (option ((uop * mword 5 * mword 20 * string)))
    end)
    : M (option ((uop * mword 5 * mword 20 * string))).

Definition assembly_matches_prefix (arg_ : string)
: M (option ((ast * {n : Z & ArithFact (n >=? 0)}))) :=
   let _s4104_ := arg_ in
   (_s4092_ _s4104_) >>= fun w__0 : option ((uop * mword 5 * mword 20 * string)) =>
   (if match w__0 with | Some (op, rd, imm, s_) => true | _ => false end then
      (_s4092_ _s4104_) >>= fun w__1 : option ((uop * mword 5 * mword 20 * string)) =>
      (match w__1 with
       | Some (op, rd, imm, s_) =>
          returnm (Some
                     (UTYPE (imm, rd, op), build_ex
                     (projT1
                      (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
       | _ => exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
       end)
       : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
    else
      (_s4105_ _s4104_) >>= fun w__4 : option ((mword 5 * mword 21 * string)) =>
      (if match w__4 with | Some (rd, imm, s_) => true | _ => false end then
         (_s4105_ _s4104_) >>= fun w__5 : option ((mword 5 * mword 21 * string)) =>
         (match w__5 with
          | Some (rd, imm, s_) =>
             returnm (Some
                        (RISCV_JAL (imm, rd), build_ex
                        (projT1
                         (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
          | _ => exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
          end)
          : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
       else
         (_s4117_ _s4104_) >>= fun w__8 : option ((mword 5 * mword 5 * mword 12 * string)) =>
         (if match w__8 with | Some (rd, rs1, imm, s_) => true | _ => false end then
            (_s4117_ _s4104_) >>= fun w__9 : option ((mword 5 * mword 5 * mword 12 * string)) =>
            (match w__9 with
             | Some (rd, rs1, imm, s_) =>
                returnm (Some
                           (RISCV_JALR (imm, rs1, rd), build_ex
                           (projT1
                            (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
             | _ => exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
             end)
             : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
          else
            (_s4133_ _s4104_) >>= fun w__12 : option ((bop * mword 5 * mword 5 * mword 13 * string)) =>
            (if match w__12 with | Some (op, rs1, rs2, imm, s_) => true | _ => false end then
               (_s4133_ _s4104_) >>= fun w__13 : option ((bop * mword 5 * mword 5 * mword 13 * string)) =>
               (match w__13 with
                | Some (op, rs1, rs2, imm, s_) =>
                   returnm (Some
                              (BTYPE (imm, rs2, rs1, op), build_ex
                              (projT1
                               (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
                | _ => exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                end)
                : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
             else
               (_s4150_ _s4104_) >>= fun w__16 : option ((iop * mword 5 * mword 5 * mword 12 * string)) =>
               (if match w__16 with | Some (op, rd, rs1, imm, s_) => true | _ => false end then
                  (_s4150_ _s4104_) >>= fun w__17 : option ((iop * mword 5 * mword 5 * mword 12 * string)) =>
                  (match w__17 with
                   | Some (op, rd, rs1, imm, s_) =>
                      returnm (Some
                                 (ITYPE (imm, rs1, rd, op), build_ex
                                 (projT1
                                  (sub_nat (projT1 (string_length arg_)) (projT1 (string_length s_))))))
                   | _ => exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                   end)
                   : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                else
                  (_s4167_ _s4104_) >>= fun w__20 : option ((sop * mword 5 * mword 5 * mword 6 * string)) =>
                  (if match w__20 with | Some (op, rd, rs1, shamt, s_) => true | _ => false end then
                     (_s4167_ _s4104_) >>= fun w__21 : option ((sop * mword 5 * mword 5 * mword 6 * string)) =>
                     (match w__21 with
                      | Some (op, rd, rs1, shamt, s_) =>
                         returnm (Some
                                    (SHIFTIOP (shamt, rs1, rd, op), build_ex
                                    (projT1
                                     (sub_nat (projT1 (string_length arg_))
                                        (projT1
                                         (string_length s_))))))
                      | _ => exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                      end)
                      : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                   else
                     (_s4184_ _s4104_) >>= fun w__24 : option ((rop * mword 5 * mword 5 * mword 5 * string)) =>
                     (if match w__24 with | Some (op, rd, rs1, rs2, s_) => true | _ => false end
                      then
                        (_s4184_ _s4104_) >>= fun w__25 : option ((rop * mword 5 * mword 5 * mword 5 * string)) =>
                        (match w__25 with
                         | Some (op, rd, rs1, rs2, s_) =>
                            returnm (Some
                                       (RTYPE (rs2, rs1, rd, op), build_ex
                                       (projT1
                                        (sub_nat (projT1 (string_length arg_))
                                           (projT1
                                            (string_length s_))))))
                         | _ => exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                         end)
                         : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                      else
                        (_s4201_ _s4104_) >>= fun w__28 : option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)) =>
                        (if match w__28 with
                            | Some (size, is_unsigned, aq, rl, rd, imm, rs1, s_) => true
                            | _ => false
                            end then
                           (_s4201_ _s4104_) >>= fun w__29 : option ((word_width * bool * bool * bool * mword 5 * mword 12 * mword 5 * string)) =>
                           (match w__29 with
                            | Some (size, is_unsigned, aq, rl, rd, imm, rs1, s_) =>
                               returnm (Some
                                          (LOAD (imm, rs1, rd, is_unsigned, size, aq, rl), build_ex
                                          (projT1
                                           (sub_nat (projT1 (string_length arg_))
                                              (projT1
                                               (string_length s_))))))
                            | _ => exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                            end)
                            : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                         else
                           (_s4231_ _s4104_) >>= fun w__32 : option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)) =>
                           (if match w__32 with
                               | Some (size, aq, rl, rs2, imm, rs1, s_) => true
                               | _ => false
                               end then
                              (_s4231_ _s4104_) >>= fun w__33 : option ((word_width * bool * bool * mword 5 * mword 12 * mword 5 * string)) =>
                              (match w__33 with
                               | Some (size, aq, rl, rs2, imm, rs1, s_) =>
                                  returnm (Some
                                             (STORE (imm, rs2, rs1, size, aq, rl), build_ex
                                             (projT1
                                              (sub_nat (projT1 (string_length arg_))
                                                 (projT1
                                                  (string_length s_))))))
                               | _ => exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                               end)
                               : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                            else
                              (_s4259_ _s4104_) >>= fun w__36 : option ((mword 5 * mword 5 * mword 12 * string)) =>
                              (if match w__36 with
                                  | Some (rd, rs1, imm, s_) => Z.eqb 32 64
                                  | _ => false
                                  end then
                                 (_s4259_ _s4104_) >>= fun w__37 : option ((mword 5 * mword 5 * mword 12 * string)) =>
                                 (match w__37 with
                                  | Some (rd, rs1, imm, s_) =>
                                     returnm (Some
                                                (ADDIW (imm, rs1, rd), build_ex
                                                (projT1
                                                 (sub_nat (projT1 (string_length arg_))
                                                    (projT1
                                                     (string_length s_))))))
                                  | _ =>
                                     exit tt  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                  end)
                                  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                               else
                                 (_s4275_ _s4104_) >>= fun w__40 : option ((sop * mword 5 * mword 5 * mword 5 * string)) =>
                                 (if match w__40 with
                                     | Some (op, rd, rs1, shamt, s_) => Z.eqb 32 64
                                     | _ => false
                                     end then
                                    (_s4275_ _s4104_) >>= fun w__41 : option ((sop * mword 5 * mword 5 * mword 5 * string)) =>
                                    (match w__41 with
                                     | Some (op, rd, rs1, shamt, s_) =>
                                        returnm (Some
                                                   (SHIFTW (shamt, rs1, rd, op), build_ex
                                                   (projT1
                                                    (sub_nat (projT1 (string_length arg_))
                                                       (projT1
                                                        (string_length s_))))))
                                     | _ =>
                                        exit tt
                                         : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                     end)
                                     : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                  else
                                    (_s4292_ _s4104_) >>= fun w__44 : option ((ropw * mword 5 * mword 5 * mword 5 * string)) =>
                                    (if match w__44 with
                                        | Some (op, rd, rs1, rs2, s_) => Z.eqb 32 64
                                        | _ => false
                                        end then
                                       (_s4292_ _s4104_) >>= fun w__45 : option ((ropw * mword 5 * mword 5 * mword 5 * string)) =>
                                       (match w__45 with
                                        | Some (op, rd, rs1, rs2, s_) =>
                                           returnm (Some
                                                      (RTYPEW (rs2, rs1, rd, op), build_ex
                                                      (projT1
                                                       (sub_nat (projT1 (string_length arg_))
                                                          (projT1
                                                           (string_length s_))))))
                                        | _ =>
                                           exit tt
                                            : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                        end)
                                        : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                     else
                                       (_s4309_ _s4104_) >>= fun w__48 : option ((sopw * mword 5 * mword 5 * mword 5 * string)) =>
                                       (if match w__48 with
                                           | Some (op, rd, rs1, shamt, s_) => Z.eqb 32 64
                                           | _ => false
                                           end then
                                          (_s4309_ _s4104_) >>= fun w__49 : option ((sopw * mword 5 * mword 5 * mword 5 * string)) =>
                                          (match w__49 with
                                           | Some (op, rd, rs1, shamt, s_) =>
                                              returnm (Some
                                                         (SHIFTIWOP (shamt, rs1, rd, op), build_ex
                                                         (projT1
                                                          (sub_nat (projT1 (string_length arg_))
                                                             (projT1
                                                              (string_length s_))))))
                                           | _ =>
                                              exit tt
                                               : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                           end)
                                           : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                        else
                                          (_s4326_ _s4104_) >>= fun w__52 : option ((mword 4 * mword 4 * string)) =>
                                          (if match w__52 with
                                              | Some (pred, succ, s_) => true
                                              | _ => false
                                              end then
                                             (_s4326_ _s4104_) >>= fun w__53 : option ((mword 4 * mword 4 * string)) =>
                                             (match w__53 with
                                              | Some (pred, succ, s_) =>
                                                 returnm (Some
                                                            (FENCE (pred, succ), build_ex
                                                            (projT1
                                                             (sub_nat (projT1 (string_length arg_))
                                                                (projT1
                                                                 (string_length s_))))))
                                              | _ =>
                                                 exit tt
                                                  : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                              end)
                                              : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                           else
                                             (_s4338_ _s4104_) >>= fun w__56 : option ((mword 4 * mword 4 * string)) =>
                                             (if match w__56 with
                                                 | Some (pred, succ, s_) => true
                                                 | _ => false
                                                 end then
                                                (_s4338_ _s4104_) >>= fun w__57 : option ((mword 4 * mword 4 * string)) =>
                                                (match w__57 with
                                                 | Some (pred, succ, s_) =>
                                                    returnm (Some
                                                               (FENCE_TSO (pred, succ), build_ex
                                                               (projT1
                                                                (sub_nat
                                                                   (projT1
                                                                    (string_length arg_))
                                                                   (projT1
                                                                    (string_length s_))))))
                                                 | _ =>
                                                    exit tt
                                                     : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                                 end)
                                                 : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                              else if match (_s4350_ _s4104_) with
                                                      | Some s_ => true
                                                      | _ => false
                                                      end then
                                                (match (_s4350_ _s4104_) with
                                                 | Some s_ =>
                                                    returnm (Some
                                                               (FENCEI tt, build_ex
                                                               (projT1
                                                                (sub_nat
                                                                   (projT1
                                                                    (string_length arg_))
                                                                   (projT1
                                                                    (string_length s_))))))
                                                 | _ =>
                                                    exit tt
                                                     : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                                 end)
                                                 : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                              else if match (_s4354_ _s4104_) with
                                                      | Some s_ => true
                                                      | _ => false
                                                      end then
                                                (match (_s4354_ _s4104_) with
                                                 | Some s_ =>
                                                    returnm (Some
                                                               (ECALL tt, build_ex
                                                               (projT1
                                                                (sub_nat
                                                                   (projT1
                                                                    (string_length arg_))
                                                                   (projT1
                                                                    (string_length s_))))))
                                                 | _ =>
                                                    exit tt
                                                     : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                                 end)
                                                 : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                              else if match (_s4358_ _s4104_) with
                                                      | Some s_ => true
                                                      | _ => false
                                                      end then
                                                (match (_s4358_ _s4104_) with
                                                 | Some s_ =>
                                                    returnm (Some
                                                               (MRET tt, build_ex
                                                               (projT1
                                                                (sub_nat
                                                                   (projT1
                                                                    (string_length arg_))
                                                                   (projT1
                                                                    (string_length s_))))))
                                                 | _ =>
                                                    exit tt
                                                     : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                                 end)
                                                 : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                              else if match (_s4362_ _s4104_) with
                                                      | Some s_ => true
                                                      | _ => false
                                                      end then
                                                (match (_s4362_ _s4104_) with
                                                 | Some s_ =>
                                                    returnm (Some
                                                               (SRET tt, build_ex
                                                               (projT1
                                                                (sub_nat
                                                                   (projT1
                                                                    (string_length arg_))
                                                                   (projT1
                                                                    (string_length s_))))))
                                                 | _ =>
                                                    exit tt
                                                     : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                                 end)
                                                 : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                              else if match (_s4366_ _s4104_) with
                                                      | Some s_ => true
                                                      | _ => false
                                                      end then
                                                (match (_s4366_ _s4104_) with
                                                 | Some s_ =>
                                                    returnm (Some
                                                               (EBREAK tt, build_ex
                                                               (projT1
                                                                (sub_nat
                                                                   (projT1
                                                                    (string_length arg_))
                                                                   (projT1
                                                                    (string_length s_))))))
                                                 | _ =>
                                                    exit tt
                                                     : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                                 end)
                                                 : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                              else if match (_s4370_ _s4104_) with
                                                      | Some s_ => true
                                                      | _ => false
                                                      end then
                                                (match (_s4370_ _s4104_) with
                                                 | Some s_ =>
                                                    returnm (Some
                                                               (WFI tt, build_ex
                                                               (projT1
                                                                (sub_nat
                                                                   (projT1
                                                                    (string_length arg_))
                                                                   (projT1
                                                                    (string_length s_))))))
                                                 | _ =>
                                                    exit tt
                                                     : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                                 end)
                                                 : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                              else
                                                (_s4374_ _s4104_) >>= fun w__72 : option ((mword 5 * mword 5 * string)) =>
                                                (if match w__72 with
                                                    | Some (rs1, rs2, s_) => true
                                                    | _ => false
                                                    end then
                                                   (_s4374_ _s4104_) >>= fun w__73 : option ((mword 5 * mword 5 * string)) =>
                                                   (match w__73 with
                                                    | Some (rs1, rs2, s_) =>
                                                       returnm (Some
                                                                  (SFENCE_VMA (rs1, rs2), build_ex
                                                                  (projT1
                                                                   (sub_nat
                                                                      (projT1
                                                                       (string_length arg_))
                                                                      (projT1
                                                                       (string_length s_))))))
                                                    | _ =>
                                                       exit tt
                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                         0)})))
                                                    end)
                                                    : M (option ((ast * {n : Z & ArithFact (n >=? 0)})))
                                                 else
                                                   (_s4386_ _s4104_) >>= fun w__76 : option ((word_width * bool * bool * mword 5 * mword 5 * string)) =>
                                                   (if match w__76 with
                                                       | Some (size, aq, rl, rd, rs1, s_) => true
                                                       | _ => false
                                                       end then
                                                      (_s4386_ _s4104_) >>= fun w__77 : option ((word_width * bool * bool * mword 5 * mword 5 * string)) =>
                                                      (match w__77 with
                                                       | Some (size, aq, rl, rd, rs1, s_) =>
                                                          returnm (Some
                                                                     (LOADRES
                                                                        (aq, rl, rs1, size, rd), build_ex
                                                                     (projT1
                                                                      (sub_nat
                                                                         (projT1
                                                                          (string_length arg_))
                                                                         (projT1
                                                                          (string_length s_))))))
                                                       | _ =>
                                                          exit tt
                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                            0)})))
                                                       end)
                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                        0)})))
                                                    else
                                                      (_s4404_ _s4104_) >>= fun w__80 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                      (if match w__80 with
                                                          | Some (size, aq, rl, rd, rs1, rs2, s_) =>
                                                             true
                                                          | _ => false
                                                          end then
                                                         (_s4404_ _s4104_) >>= fun w__81 : option ((word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                         (match w__81 with
                                                          | Some (size, aq, rl, rd, rs1, rs2, s_) =>
                                                             returnm (Some
                                                                        (STORECON
                                                                           (aq, rl, rs2, rs1, size, rd), build_ex
                                                                        (projT1
                                                                         (sub_nat
                                                                            (projT1
                                                                             (string_length arg_))
                                                                            (projT1
                                                                             (string_length s_))))))
                                                          | _ =>
                                                             exit tt
                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                               0)})))
                                                          end)
                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                           0)})))
                                                       else
                                                         (_s4426_ _s4104_) >>= fun w__84 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                         (if match w__84 with
                                                             | Some
                                                               (op, width, aq, rl, rd, rs2, rs1, s_) =>
                                                                true
                                                             | _ => false
                                                             end then
                                                            (_s4426_ _s4104_) >>= fun w__85 : option ((amoop * word_width * bool * bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                            (match w__85 with
                                                             | Some
                                                               (op, width, aq, rl, rd, rs2, rs1, s_) =>
                                                                returnm (Some
                                                                           (AMO
                                                                              (op, aq, rl, rs2, rs1, width, rd), build_ex
                                                                           (projT1
                                                                            (sub_nat
                                                                               (projT1
                                                                                (string_length arg_))
                                                                               (projT1
                                                                                (string_length s_))))))
                                                             | _ =>
                                                                exit tt
                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                  0)})))
                                                             end)
                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                              0)})))
                                                          else if match (_s4452_ _s4104_) with
                                                                  | Some s_ => true
                                                                  | _ => false
                                                                  end then
                                                            (match (_s4452_ _s4104_) with
                                                             | Some s_ =>
                                                                returnm (Some
                                                                           (C_NOP tt, build_ex
                                                                           (projT1
                                                                            (sub_nat
                                                                               (projT1
                                                                                (string_length arg_))
                                                                               (projT1
                                                                                (string_length s_))))))
                                                             | _ =>
                                                                exit tt
                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                  0)})))
                                                             end)
                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                              0)})))
                                                          else
                                                            (_s4456_ _s4104_) >>= fun w__90 : option ((mword 3 * mword 8 * string)) =>
                                                            (if match w__90 with
                                                                | Some (rdc, nzimm, s_) =>
                                                                   neq_vec nzimm (Ox"00"  : mword 8)
                                                                | _ => false
                                                                end then
                                                               (_s4456_ _s4104_) >>= fun w__91 : option ((mword 3 * mword 8 * string)) =>
                                                               (match w__91 with
                                                                | Some (rdc, nzimm, s_) =>
                                                                   returnm (Some
                                                                              (C_ADDI4SPN
                                                                                 (rdc, nzimm), build_ex
                                                                              (projT1
                                                                               (sub_nat
                                                                                  (projT1
                                                                                   (string_length
                                                                                      arg_))
                                                                                  (projT1
                                                                                   (string_length s_))))))
                                                                | _ =>
                                                                   exit tt
                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                     0)})))
                                                                end)
                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                 0)})))
                                                             else
                                                               (_s4468_ _s4104_) >>= fun w__94 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                               (if match w__94 with
                                                                   | Some (rdc, rsc, uimm, s_) =>
                                                                      true
                                                                   | _ => false
                                                                   end then
                                                                  (_s4468_ _s4104_) >>= fun w__95 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                  (match w__95 with
                                                                   | Some (rdc, rsc, uimm, s_) =>
                                                                      returnm (Some
                                                                                 (C_LW
                                                                                    (uimm, rsc, rdc), build_ex
                                                                                 (projT1
                                                                                  (sub_nat
                                                                                     (projT1
                                                                                      (string_length
                                                                                         arg_))
                                                                                     (projT1
                                                                                      (string_length
                                                                                         s_))))))
                                                                   | _ =>
                                                                      exit tt
                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                        0)})))
                                                                   end)
                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                    0)})))
                                                                else
                                                                  (_s4484_ _s4104_) >>= fun w__98 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                  (if match w__98 with
                                                                      | Some (rdc, rsc, uimm, s_) =>
                                                                         Z.eqb 32 64
                                                                      | _ => false
                                                                      end then
                                                                     (_s4484_ _s4104_) >>= fun w__99 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                     (match w__99 with
                                                                      | Some (rdc, rsc, uimm, s_) =>
                                                                         returnm (Some
                                                                                    (C_LD
                                                                                       (uimm, rsc, rdc), build_ex
                                                                                    (projT1
                                                                                     (sub_nat
                                                                                        (projT1
                                                                                         (string_length
                                                                                            arg_))
                                                                                        (projT1
                                                                                         (string_length
                                                                                            s_))))))
                                                                      | _ =>
                                                                         exit tt
                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                           0)})))
                                                                      end)
                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                       0)})))
                                                                   else
                                                                     (_s4500_ _s4104_) >>= fun w__102 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                     (if match w__102 with
                                                                         | Some
                                                                           (rsc1, rsc2, uimm, s_) =>
                                                                            true
                                                                         | _ => false
                                                                         end then
                                                                        (_s4500_ _s4104_) >>= fun w__103 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                        (match w__103 with
                                                                         | Some
                                                                           (rsc1, rsc2, uimm, s_) =>
                                                                            returnm (Some
                                                                                       (C_SW
                                                                                          (uimm, rsc1, rsc2), build_ex
                                                                                       (projT1
                                                                                        (sub_nat
                                                                                           (projT1
                                                                                            (string_length
                                                                                               arg_))
                                                                                           (projT1
                                                                                            (string_length
                                                                                               s_))))))
                                                                         | _ =>
                                                                            exit tt
                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                              0)})))
                                                                         end)
                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                          0)})))
                                                                      else
                                                                        (_s4516_ _s4104_) >>= fun w__106 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                        (if match w__106 with
                                                                            | Some
                                                                              (rsc1, rsc2, uimm, s_) =>
                                                                               Z.eqb 32 64
                                                                            | _ => false
                                                                            end then
                                                                           (_s4516_ _s4104_) >>= fun w__107 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                           (match w__107 with
                                                                            | Some
                                                                              (rsc1, rsc2, uimm, s_) =>
                                                                               returnm (Some
                                                                                          (C_SD
                                                                                             (uimm, rsc1, rsc2), build_ex
                                                                                          (projT1
                                                                                           (sub_nat
                                                                                              (projT1
                                                                                               (string_length
                                                                                                  arg_))
                                                                                              (projT1
                                                                                               (string_length
                                                                                                  s_))))))
                                                                            | _ =>
                                                                               exit tt
                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                 0)})))
                                                                            end)
                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                             0)})))
                                                                         else
                                                                           (_s4532_ _s4104_) >>= fun w__110 : option ((mword 5 * mword 6 * string)) =>
                                                                           (if match w__110 with
                                                                               | Some (rsd, nzi, s_) =>
                                                                                  andb
                                                                                    (neq_vec nzi
                                                                                       ('b"000000"
                                                                                        : mword 6))
                                                                                    (neq_vec rsd
                                                                                       zreg)
                                                                               | _ => false
                                                                               end then
                                                                              (_s4532_ _s4104_) >>= fun w__111 : option ((mword 5 * mword 6 * string)) =>
                                                                              (match w__111 with
                                                                               | Some (rsd, nzi, s_) =>
                                                                                  returnm (Some
                                                                                             (C_ADDI
                                                                                                (nzi, rsd), build_ex
                                                                                             (projT1
                                                                                              (sub_nat
                                                                                                 (projT1
                                                                                                  (string_length
                                                                                                     arg_))
                                                                                                 (projT1
                                                                                                  (string_length
                                                                                                     s_))))))
                                                                               | _ =>
                                                                                  exit tt
                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                    0)})))
                                                                               end)
                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                0)})))
                                                                            else
                                                                              (_s4544_ _s4104_) >>= fun w__114 : option ((mword 11 * string)) =>
                                                                              (if match w__114 with
                                                                                  | Some (imm, s_) =>
                                                                                     Z.eqb 32 32
                                                                                  | _ => false
                                                                                  end then
                                                                                 (_s4544_ _s4104_) >>= fun w__115 : option ((mword 11 * string)) =>
                                                                                 (match w__115 with
                                                                                  | Some (imm, s_) =>
                                                                                     returnm (Some
                                                                                                (C_JAL
                                                                                                   imm, build_ex
                                                                                                (projT1
                                                                                                 (sub_nat
                                                                                                    (projT1
                                                                                                     (string_length
                                                                                                        arg_))
                                                                                                    (projT1
                                                                                                     (string_length
                                                                                                        s_))))))
                                                                                  | _ =>
                                                                                     exit tt
                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                       0)})))
                                                                                  end)
                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                   0)})))
                                                                               else
                                                                                 (_s4552_ _s4104_) >>= fun w__118 : option ((mword 5 * mword 6 * string)) =>
                                                                                 (if match w__118 with
                                                                                     | Some
                                                                                       (rsd, imm, s_) =>
                                                                                        Z.eqb 32 64
                                                                                     | _ => false
                                                                                     end then
                                                                                    (_s4552_ _s4104_) >>= fun w__119 : option ((mword 5 * mword 6 * string)) =>
                                                                                    (match w__119 with
                                                                                     | Some
                                                                                       (rsd, imm, s_) =>
                                                                                        returnm (Some
                                                                                                   (C_ADDIW
                                                                                                      (imm, rsd), build_ex
                                                                                                   (projT1
                                                                                                    (sub_nat
                                                                                                       (projT1
                                                                                                        (string_length
                                                                                                           arg_))
                                                                                                       (projT1
                                                                                                        (string_length
                                                                                                           s_))))))
                                                                                     | _ =>
                                                                                        exit tt
                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                          0)})))
                                                                                     end)
                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                      0)})))
                                                                                  else
                                                                                    (_s4564_ _s4104_) >>= fun w__122 : option ((mword 5 * mword 6 * string)) =>
                                                                                    (if match w__122 with
                                                                                        | Some
                                                                                          (rd, imm, s_) =>
                                                                                           neq_vec
                                                                                             rd zreg
                                                                                        | _ => false
                                                                                        end then
                                                                                       (_s4564_
                                                                                          _s4104_) >>= fun w__123 : option ((mword 5 * mword 6 * string)) =>
                                                                                       (match w__123 with
                                                                                        | Some
                                                                                          (rd, imm, s_) =>
                                                                                           returnm (Some
                                                                                                      (C_LI
                                                                                                         (imm, rd), build_ex
                                                                                                      (projT1
                                                                                                       (sub_nat
                                                                                                          (projT1
                                                                                                           (string_length
                                                                                                              arg_))
                                                                                                          (projT1
                                                                                                           (string_length
                                                                                                              s_))))))
                                                                                        | _ =>
                                                                                           exit tt
                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                             0)})))
                                                                                        end)
                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                         0)})))
                                                                                     else
                                                                                       (_s4576_
                                                                                          _s4104_) >>= fun w__126 : option ((mword 6 * string)) =>
                                                                                       (if match w__126 with
                                                                                           | Some
                                                                                             (imm, s_) =>
                                                                                              neq_vec
                                                                                                imm
                                                                                                ('b"000000"
                                                                                                 : mword 6)
                                                                                           | _ =>
                                                                                              false
                                                                                           end then
                                                                                          (_s4576_
                                                                                             _s4104_) >>= fun w__127 : option ((mword 6 * string)) =>
                                                                                          (match w__127 with
                                                                                           | Some
                                                                                             (imm, s_) =>
                                                                                              returnm (Some
                                                                                                         (C_ADDI16SP
                                                                                                            imm, build_ex
                                                                                                         (projT1
                                                                                                          (sub_nat
                                                                                                             (projT1
                                                                                                              (string_length
                                                                                                                 arg_))
                                                                                                             (projT1
                                                                                                              (string_length
                                                                                                                 s_))))))
                                                                                           | _ =>
                                                                                              exit tt
                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                0)})))
                                                                                           end)
                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                            0)})))
                                                                                        else
                                                                                          (_s4584_
                                                                                             _s4104_) >>= fun w__130 : option ((mword 5 * mword 6 * string)) =>
                                                                                          (if match w__130 with
                                                                                              | Some
                                                                                                (rd, imm, s_) =>
                                                                                                 andb
                                                                                                   (neq_vec
                                                                                                      rd
                                                                                                      zreg)
                                                                                                   (andb
                                                                                                      (neq_vec
                                                                                                         rd
                                                                                                         sp)
                                                                                                      (neq_vec
                                                                                                         imm
                                                                                                         ('b"000000"
                                                                                                          : mword 6)))
                                                                                              | _ =>
                                                                                                 false
                                                                                              end
                                                                                           then
                                                                                             (_s4584_
                                                                                                _s4104_) >>= fun w__131 : option ((mword 5 * mword 6 * string)) =>
                                                                                             (match w__131 with
                                                                                              | Some
                                                                                                (rd, imm, s_) =>
                                                                                                 returnm (Some
                                                                                                            (C_LUI
                                                                                                               (imm, rd), build_ex
                                                                                                            (projT1
                                                                                                             (sub_nat
                                                                                                                (projT1
                                                                                                                 (string_length
                                                                                                                    arg_))
                                                                                                                (projT1
                                                                                                                 (string_length
                                                                                                                    s_))))))
                                                                                              | _ =>
                                                                                                 exit tt
                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                   0)})))
                                                                                              end)
                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                               0)})))
                                                                                           else
                                                                                             (_s4596_
                                                                                                _s4104_) >>= fun w__134 : option ((mword 3 * mword 6 * string)) =>
                                                                                             (if match w__134 with
                                                                                                 | Some
                                                                                                   (rsd, shamt, s_) =>
                                                                                                    neq_vec
                                                                                                      shamt
                                                                                                      ('b"000000"
                                                                                                       : mword 6)
                                                                                                 | _ =>
                                                                                                    false
                                                                                                 end
                                                                                              then
                                                                                                (_s4596_
                                                                                                   _s4104_) >>= fun w__135 : option ((mword 3 * mword 6 * string)) =>
                                                                                                (match w__135 with
                                                                                                 | Some
                                                                                                   (rsd, shamt, s_) =>
                                                                                                    returnm (Some
                                                                                                               (C_SRLI
                                                                                                                  (shamt, rsd), build_ex
                                                                                                               (projT1
                                                                                                                (sub_nat
                                                                                                                   (projT1
                                                                                                                    (string_length
                                                                                                                       arg_))
                                                                                                                   (projT1
                                                                                                                    (string_length
                                                                                                                       s_))))))
                                                                                                 | _ =>
                                                                                                    exit tt
                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                      0)})))
                                                                                                 end)
                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                  0)})))
                                                                                              else
                                                                                                (_s4608_
                                                                                                   _s4104_) >>= fun w__138 : option ((mword 3 * mword 6 * string)) =>
                                                                                                (if match w__138 with
                                                                                                    | Some
                                                                                                      (rsd, shamt, s_) =>
                                                                                                       neq_vec
                                                                                                         shamt
                                                                                                         ('b"000000"
                                                                                                          : mword 6)
                                                                                                    | _ =>
                                                                                                       false
                                                                                                    end
                                                                                                 then
                                                                                                   (_s4608_
                                                                                                      _s4104_) >>= fun w__139 : option ((mword 3 * mword 6 * string)) =>
                                                                                                   (match w__139 with
                                                                                                    | Some
                                                                                                      (rsd, shamt, s_) =>
                                                                                                       returnm (Some
                                                                                                                  (C_SRAI
                                                                                                                     (shamt, rsd), build_ex
                                                                                                                  (projT1
                                                                                                                   (sub_nat
                                                                                                                      (projT1
                                                                                                                       (string_length
                                                                                                                          arg_))
                                                                                                                      (projT1
                                                                                                                       (string_length
                                                                                                                          s_))))))
                                                                                                    | _ =>
                                                                                                       exit tt
                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                         0)})))
                                                                                                    end)
                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                     0)})))
                                                                                                 else
                                                                                                   (_s4620_
                                                                                                      _s4104_) >>= fun w__142 : option ((mword 3 * mword 6 * string)) =>
                                                                                                   (if
                                                                                                      match w__142 with
                                                                                                      | Some
                                                                                                        (rsd, imm, s_) =>
                                                                                                         true
                                                                                                      | _ =>
                                                                                                         false
                                                                                                      end
                                                                                                    then
                                                                                                      (_s4620_
                                                                                                         _s4104_) >>= fun w__143 : option ((mword 3 * mword 6 * string)) =>
                                                                                                      (match w__143 with
                                                                                                       | Some
                                                                                                         (rsd, imm, s_) =>
                                                                                                          returnm (Some
                                                                                                                     (C_ANDI
                                                                                                                        (imm, rsd), build_ex
                                                                                                                     (projT1
                                                                                                                      (sub_nat
                                                                                                                         (projT1
                                                                                                                          (string_length
                                                                                                                             arg_))
                                                                                                                         (projT1
                                                                                                                          (string_length
                                                                                                                             s_))))))
                                                                                                       | _ =>
                                                                                                          exit tt
                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                            0)})))
                                                                                                       end)
                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                        0)})))
                                                                                                    else
                                                                                                      (_s4632_
                                                                                                         _s4104_) >>= fun w__146 : option ((mword 3 * mword 3 * string)) =>
                                                                                                      (if
                                                                                                         match w__146 with
                                                                                                         | Some
                                                                                                           (rsd, rs2, s_) =>
                                                                                                            true
                                                                                                         | _ =>
                                                                                                            false
                                                                                                         end
                                                                                                       then
                                                                                                         (_s4632_
                                                                                                            _s4104_) >>= fun w__147 : option ((mword 3 * mword 3 * string)) =>
                                                                                                         (match w__147 with
                                                                                                          | Some
                                                                                                            (rsd, rs2, s_) =>
                                                                                                             returnm (Some
                                                                                                                        (C_SUB
                                                                                                                           (rsd, rs2), build_ex
                                                                                                                        (projT1
                                                                                                                         (sub_nat
                                                                                                                            (projT1
                                                                                                                             (string_length
                                                                                                                                arg_))
                                                                                                                            (projT1
                                                                                                                             (string_length
                                                                                                                                s_))))))
                                                                                                          | _ =>
                                                                                                             exit tt
                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                               0)})))
                                                                                                          end)
                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                           0)})))
                                                                                                       else
                                                                                                         (_s4644_
                                                                                                            _s4104_) >>= fun w__150 : option ((mword 3 * mword 3 * string)) =>
                                                                                                         (if
                                                                                                            match w__150 with
                                                                                                            | Some
                                                                                                              (rsd, rs2, s_) =>
                                                                                                               true
                                                                                                            | _ =>
                                                                                                               false
                                                                                                            end
                                                                                                          then
                                                                                                            (_s4644_
                                                                                                               _s4104_) >>= fun w__151 : option ((mword 3 * mword 3 * string)) =>
                                                                                                            (match w__151 with
                                                                                                             | Some
                                                                                                               (rsd, rs2, s_) =>
                                                                                                                returnm (Some
                                                                                                                           (C_XOR
                                                                                                                              (rsd, rs2), build_ex
                                                                                                                           (projT1
                                                                                                                            (sub_nat
                                                                                                                               (projT1
                                                                                                                                (string_length
                                                                                                                                   arg_))
                                                                                                                               (projT1
                                                                                                                                (string_length
                                                                                                                                   s_))))))
                                                                                                             | _ =>
                                                                                                                exit tt
                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                  0)})))
                                                                                                             end)
                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                              0)})))
                                                                                                          else
                                                                                                            (_s4656_
                                                                                                               _s4104_) >>= fun w__154 : option ((mword 3 * mword 3 * string)) =>
                                                                                                            (if
                                                                                                               match w__154 with
                                                                                                               | Some
                                                                                                                 (rsd, rs2, s_) =>
                                                                                                                  true
                                                                                                               | _ =>
                                                                                                                  false
                                                                                                               end
                                                                                                             then
                                                                                                               (_s4656_
                                                                                                                  _s4104_) >>= fun w__155 : option ((mword 3 * mword 3 * string)) =>
                                                                                                               (match w__155 with
                                                                                                                | Some
                                                                                                                  (rsd, rs2, s_) =>
                                                                                                                   returnm (Some
                                                                                                                              (C_OR
                                                                                                                                 (rsd, rs2), build_ex
                                                                                                                              (projT1
                                                                                                                               (sub_nat
                                                                                                                                  (projT1
                                                                                                                                   (string_length
                                                                                                                                      arg_))
                                                                                                                                  (projT1
                                                                                                                                   (string_length
                                                                                                                                      s_))))))
                                                                                                                | _ =>
                                                                                                                   exit tt
                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                     0)})))
                                                                                                                end)
                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                 0)})))
                                                                                                             else
                                                                                                               (_s4668_
                                                                                                                  _s4104_) >>= fun w__158 : option ((mword 3 * mword 3 * string)) =>
                                                                                                               (if
                                                                                                                  match w__158 with
                                                                                                                  | Some
                                                                                                                    (rsd, rs2, s_) =>
                                                                                                                     true
                                                                                                                  | _ =>
                                                                                                                     false
                                                                                                                  end
                                                                                                                then
                                                                                                                  (_s4668_
                                                                                                                     _s4104_) >>= fun w__159 : option ((mword 3 * mword 3 * string)) =>
                                                                                                                  (match w__159 with
                                                                                                                   | Some
                                                                                                                     (rsd, rs2, s_) =>
                                                                                                                      returnm (Some
                                                                                                                                 (C_AND
                                                                                                                                    (rsd, rs2), build_ex
                                                                                                                                 (projT1
                                                                                                                                  (sub_nat
                                                                                                                                     (projT1
                                                                                                                                      (string_length
                                                                                                                                         arg_))
                                                                                                                                     (projT1
                                                                                                                                      (string_length
                                                                                                                                         s_))))))
                                                                                                                   | _ =>
                                                                                                                      exit tt
                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                        0)})))
                                                                                                                   end)
                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                    0)})))
                                                                                                                else
                                                                                                                  (_s4680_
                                                                                                                     _s4104_) >>= fun w__162 : option ((mword 3 * mword 3 * string)) =>
                                                                                                                  (if
                                                                                                                     match w__162 with
                                                                                                                     | Some
                                                                                                                       (rsd, rs2, s_) =>
                                                                                                                        Z.eqb
                                                                                                                          32
                                                                                                                          64
                                                                                                                     | _ =>
                                                                                                                        false
                                                                                                                     end
                                                                                                                   then
                                                                                                                     (_s4680_
                                                                                                                        _s4104_) >>= fun w__163 : option ((mword 3 * mword 3 * string)) =>
                                                                                                                     (match w__163 with
                                                                                                                      | Some
                                                                                                                        (rsd, rs2, s_) =>
                                                                                                                         returnm (Some
                                                                                                                                    (C_SUBW
                                                                                                                                       (rsd, rs2), build_ex
                                                                                                                                    (projT1
                                                                                                                                     (sub_nat
                                                                                                                                        (projT1
                                                                                                                                         (string_length
                                                                                                                                            arg_))
                                                                                                                                        (projT1
                                                                                                                                         (string_length
                                                                                                                                            s_))))))
                                                                                                                      | _ =>
                                                                                                                         exit tt
                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                           0)})))
                                                                                                                      end)
                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                       0)})))
                                                                                                                   else
                                                                                                                     (_s4692_
                                                                                                                        _s4104_) >>= fun w__166 : option ((mword 3 * mword 3 * string)) =>
                                                                                                                     (if
                                                                                                                        match w__166 with
                                                                                                                        | Some
                                                                                                                          (rsd, rs2, s_) =>
                                                                                                                           Z.eqb
                                                                                                                             32
                                                                                                                             64
                                                                                                                        | _ =>
                                                                                                                           false
                                                                                                                        end
                                                                                                                      then
                                                                                                                        (_s4692_
                                                                                                                           _s4104_) >>= fun w__167 : option ((mword 3 * mword 3 * string)) =>
                                                                                                                        (match w__167 with
                                                                                                                         | Some
                                                                                                                           (rsd, rs2, s_) =>
                                                                                                                            returnm (Some
                                                                                                                                       (C_ADDW
                                                                                                                                          (rsd, rs2), build_ex
                                                                                                                                       (projT1
                                                                                                                                        (sub_nat
                                                                                                                                           (projT1
                                                                                                                                            (string_length
                                                                                                                                               arg_))
                                                                                                                                           (projT1
                                                                                                                                            (string_length
                                                                                                                                               s_))))))
                                                                                                                         | _ =>
                                                                                                                            exit tt
                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                              0)})))
                                                                                                                         end)
                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                          0)})))
                                                                                                                      else
                                                                                                                        (_s4704_
                                                                                                                           _s4104_) >>= fun w__170 : option ((mword 11 * string)) =>
                                                                                                                        (if
                                                                                                                           match w__170 with
                                                                                                                           | Some
                                                                                                                             (imm, s_) =>
                                                                                                                              true
                                                                                                                           | _ =>
                                                                                                                              false
                                                                                                                           end
                                                                                                                         then
                                                                                                                           (_s4704_
                                                                                                                              _s4104_) >>= fun w__171 : option ((mword 11 * string)) =>
                                                                                                                           (match w__171 with
                                                                                                                            | Some
                                                                                                                              (imm, s_) =>
                                                                                                                               returnm (Some
                                                                                                                                          (C_J
                                                                                                                                             imm, build_ex
                                                                                                                                          (projT1
                                                                                                                                           (sub_nat
                                                                                                                                              (projT1
                                                                                                                                               (string_length
                                                                                                                                                  arg_))
                                                                                                                                              (projT1
                                                                                                                                               (string_length
                                                                                                                                                  s_))))))
                                                                                                                            | _ =>
                                                                                                                               exit tt
                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                 0)})))
                                                                                                                            end)
                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                             0)})))
                                                                                                                         else
                                                                                                                           (_s4712_
                                                                                                                              _s4104_) >>= fun w__174 : option ((mword 3 * mword 8 * string)) =>
                                                                                                                           (if
                                                                                                                              match w__174 with
                                                                                                                              | Some
                                                                                                                                (rs, imm, s_) =>
                                                                                                                                 true
                                                                                                                              | _ =>
                                                                                                                                 false
                                                                                                                              end
                                                                                                                            then
                                                                                                                              (_s4712_
                                                                                                                                 _s4104_) >>= fun w__175 : option ((mword 3 * mword 8 * string)) =>
                                                                                                                              (match w__175 with
                                                                                                                               | Some
                                                                                                                                 (rs, imm, s_) =>
                                                                                                                                  returnm (Some
                                                                                                                                             (C_BEQZ
                                                                                                                                                (imm, rs), build_ex
                                                                                                                                             (projT1
                                                                                                                                              (sub_nat
                                                                                                                                                 (projT1
                                                                                                                                                  (string_length
                                                                                                                                                     arg_))
                                                                                                                                                 (projT1
                                                                                                                                                  (string_length
                                                                                                                                                     s_))))))
                                                                                                                               | _ =>
                                                                                                                                  exit tt
                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                    0)})))
                                                                                                                               end)
                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                0)})))
                                                                                                                            else
                                                                                                                              (_s4724_
                                                                                                                                 _s4104_) >>= fun w__178 : option ((mword 3 * mword 8 * string)) =>
                                                                                                                              (if
                                                                                                                                 match w__178 with
                                                                                                                                 | Some
                                                                                                                                   (rs, imm, s_) =>
                                                                                                                                    true
                                                                                                                                 | _ =>
                                                                                                                                    false
                                                                                                                                 end
                                                                                                                               then
                                                                                                                                 (_s4724_
                                                                                                                                    _s4104_) >>= fun w__179 : option ((mword 3 * mword 8 * string)) =>
                                                                                                                                 (match w__179 with
                                                                                                                                  | Some
                                                                                                                                    (rs, imm, s_) =>
                                                                                                                                     returnm (Some
                                                                                                                                                (C_BNEZ
                                                                                                                                                   (imm, rs), build_ex
                                                                                                                                                (projT1
                                                                                                                                                 (sub_nat
                                                                                                                                                    (projT1
                                                                                                                                                     (string_length
                                                                                                                                                        arg_))
                                                                                                                                                    (projT1
                                                                                                                                                     (string_length
                                                                                                                                                        s_))))))
                                                                                                                                  | _ =>
                                                                                                                                     exit tt
                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                       0)})))
                                                                                                                                  end)
                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                   0)})))
                                                                                                                               else
                                                                                                                                 (_s4736_
                                                                                                                                    _s4104_) >>= fun w__182 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                 (if
                                                                                                                                    match w__182 with
                                                                                                                                    | Some
                                                                                                                                      (rsd, shamt, s_) =>
                                                                                                                                       andb
                                                                                                                                         (neq_vec
                                                                                                                                            shamt
                                                                                                                                            ('b"000000"
                                                                                                                                             : mword 6))
                                                                                                                                         (neq_vec
                                                                                                                                            rsd
                                                                                                                                            zreg)
                                                                                                                                    | _ =>
                                                                                                                                       false
                                                                                                                                    end
                                                                                                                                  then
                                                                                                                                    (_s4736_
                                                                                                                                       _s4104_) >>= fun w__183 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                    (match w__183 with
                                                                                                                                     | Some
                                                                                                                                       (rsd, shamt, s_) =>
                                                                                                                                        returnm (Some
                                                                                                                                                   (C_SLLI
                                                                                                                                                      (shamt, rsd), build_ex
                                                                                                                                                   (projT1
                                                                                                                                                    (sub_nat
                                                                                                                                                       (projT1
                                                                                                                                                        (string_length
                                                                                                                                                           arg_))
                                                                                                                                                       (projT1
                                                                                                                                                        (string_length
                                                                                                                                                           s_))))))
                                                                                                                                     | _ =>
                                                                                                                                        exit tt
                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                          0)})))
                                                                                                                                     end)
                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                      0)})))
                                                                                                                                  else
                                                                                                                                    (_s4748_
                                                                                                                                       _s4104_) >>= fun w__186 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                    (if
                                                                                                                                       match w__186 with
                                                                                                                                       | Some
                                                                                                                                         (rd, uimm, s_) =>
                                                                                                                                          neq_vec
                                                                                                                                            rd
                                                                                                                                            zreg
                                                                                                                                       | _ =>
                                                                                                                                          false
                                                                                                                                       end
                                                                                                                                     then
                                                                                                                                       (_s4748_
                                                                                                                                          _s4104_) >>= fun w__187 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                       (match w__187 with
                                                                                                                                        | Some
                                                                                                                                          (rd, uimm, s_) =>
                                                                                                                                           returnm (Some
                                                                                                                                                      (C_LWSP
                                                                                                                                                         (uimm, rd), build_ex
                                                                                                                                                      (projT1
                                                                                                                                                       (sub_nat
                                                                                                                                                          (projT1
                                                                                                                                                           (string_length
                                                                                                                                                              arg_))
                                                                                                                                                          (projT1
                                                                                                                                                           (string_length
                                                                                                                                                              s_))))))
                                                                                                                                        | _ =>
                                                                                                                                           exit tt
                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                             0)})))
                                                                                                                                        end)
                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                         0)})))
                                                                                                                                     else
                                                                                                                                       (_s4760_
                                                                                                                                          _s4104_) >>= fun w__190 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                       (if
                                                                                                                                          match w__190 with
                                                                                                                                          | Some
                                                                                                                                            (rd, uimm, s_) =>
                                                                                                                                             andb
                                                                                                                                               (neq_vec
                                                                                                                                                  rd
                                                                                                                                                  zreg)
                                                                                                                                               (Z.eqb
                                                                                                                                                  32
                                                                                                                                                  64)
                                                                                                                                          | _ =>
                                                                                                                                             false
                                                                                                                                          end
                                                                                                                                        then
                                                                                                                                          (_s4760_
                                                                                                                                             _s4104_) >>= fun w__191 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                          (match w__191 with
                                                                                                                                           | Some
                                                                                                                                             (rd, uimm, s_) =>
                                                                                                                                              returnm (Some
                                                                                                                                                         (C_LDSP
                                                                                                                                                            (uimm, rd), build_ex
                                                                                                                                                         (projT1
                                                                                                                                                          (sub_nat
                                                                                                                                                             (projT1
                                                                                                                                                              (string_length
                                                                                                                                                                 arg_))
                                                                                                                                                             (projT1
                                                                                                                                                              (string_length
                                                                                                                                                                 s_))))))
                                                                                                                                           | _ =>
                                                                                                                                              exit tt
                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                0)})))
                                                                                                                                           end)
                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                            0)})))
                                                                                                                                        else
                                                                                                                                          (_s4772_
                                                                                                                                             _s4104_) >>= fun w__194 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                          (if
                                                                                                                                             match w__194 with
                                                                                                                                             | Some
                                                                                                                                               (rd, uimm, s_) =>
                                                                                                                                                true
                                                                                                                                             | _ =>
                                                                                                                                                false
                                                                                                                                             end
                                                                                                                                           then
                                                                                                                                             (_s4772_
                                                                                                                                                _s4104_) >>= fun w__195 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                             (match w__195 with
                                                                                                                                              | Some
                                                                                                                                                (rd, uimm, s_) =>
                                                                                                                                                 returnm (Some
                                                                                                                                                            (C_SWSP
                                                                                                                                                               (uimm, rd), build_ex
                                                                                                                                                            (projT1
                                                                                                                                                             (sub_nat
                                                                                                                                                                (projT1
                                                                                                                                                                 (string_length
                                                                                                                                                                    arg_))
                                                                                                                                                                (projT1
                                                                                                                                                                 (string_length
                                                                                                                                                                    s_))))))
                                                                                                                                              | _ =>
                                                                                                                                                 exit tt
                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                   0)})))
                                                                                                                                              end)
                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                               0)})))
                                                                                                                                           else
                                                                                                                                             (_s4784_
                                                                                                                                                _s4104_) >>= fun w__198 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                             (if
                                                                                                                                                match w__198 with
                                                                                                                                                | Some
                                                                                                                                                  (rs2, uimm, s_) =>
                                                                                                                                                   Z.eqb
                                                                                                                                                     32
                                                                                                                                                     64
                                                                                                                                                | _ =>
                                                                                                                                                   false
                                                                                                                                                end
                                                                                                                                              then
                                                                                                                                                (_s4784_
                                                                                                                                                   _s4104_) >>= fun w__199 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                                (match w__199 with
                                                                                                                                                 | Some
                                                                                                                                                   (rs2, uimm, s_) =>
                                                                                                                                                    returnm (Some
                                                                                                                                                               (C_SDSP
                                                                                                                                                                  (uimm, rs2), build_ex
                                                                                                                                                               (projT1
                                                                                                                                                                (sub_nat
                                                                                                                                                                   (projT1
                                                                                                                                                                    (string_length
                                                                                                                                                                       arg_))
                                                                                                                                                                   (projT1
                                                                                                                                                                    (string_length
                                                                                                                                                                       s_))))))
                                                                                                                                                 | _ =>
                                                                                                                                                    exit tt
                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                      0)})))
                                                                                                                                                 end)
                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                  0)})))
                                                                                                                                              else
                                                                                                                                                (_s4796_
                                                                                                                                                   _s4104_) >>= fun w__202 : option ((mword 5 * string)) =>
                                                                                                                                                (if
                                                                                                                                                   match w__202 with
                                                                                                                                                   | Some
                                                                                                                                                     (rs1, s_) =>
                                                                                                                                                      neq_vec
                                                                                                                                                        rs1
                                                                                                                                                        zreg
                                                                                                                                                   | _ =>
                                                                                                                                                      false
                                                                                                                                                   end
                                                                                                                                                 then
                                                                                                                                                   (_s4796_
                                                                                                                                                      _s4104_) >>= fun w__203 : option ((mword 5 * string)) =>
                                                                                                                                                   (match w__203 with
                                                                                                                                                    | Some
                                                                                                                                                      (rs1, s_) =>
                                                                                                                                                       returnm (Some
                                                                                                                                                                  (C_JR
                                                                                                                                                                     rs1, build_ex
                                                                                                                                                                  (projT1
                                                                                                                                                                   (sub_nat
                                                                                                                                                                      (projT1
                                                                                                                                                                       (string_length
                                                                                                                                                                          arg_))
                                                                                                                                                                      (projT1
                                                                                                                                                                       (string_length
                                                                                                                                                                          s_))))))
                                                                                                                                                    | _ =>
                                                                                                                                                       exit tt
                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                         0)})))
                                                                                                                                                    end)
                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                     0)})))
                                                                                                                                                 else
                                                                                                                                                   (_s4804_
                                                                                                                                                      _s4104_) >>= fun w__206 : option ((mword 5 * string)) =>
                                                                                                                                                   (if
                                                                                                                                                      match w__206 with
                                                                                                                                                      | Some
                                                                                                                                                        (rs1, s_) =>
                                                                                                                                                         neq_vec
                                                                                                                                                           rs1
                                                                                                                                                           zreg
                                                                                                                                                      | _ =>
                                                                                                                                                         false
                                                                                                                                                      end
                                                                                                                                                    then
                                                                                                                                                      (_s4804_
                                                                                                                                                         _s4104_) >>= fun w__207 : option ((mword 5 * string)) =>
                                                                                                                                                      (match w__207 with
                                                                                                                                                       | Some
                                                                                                                                                         (rs1, s_) =>
                                                                                                                                                          returnm (Some
                                                                                                                                                                     (C_JALR
                                                                                                                                                                        rs1, build_ex
                                                                                                                                                                     (projT1
                                                                                                                                                                      (sub_nat
                                                                                                                                                                         (projT1
                                                                                                                                                                          (string_length
                                                                                                                                                                             arg_))
                                                                                                                                                                         (projT1
                                                                                                                                                                          (string_length
                                                                                                                                                                             s_))))))
                                                                                                                                                       | _ =>
                                                                                                                                                          exit tt
                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                            0)})))
                                                                                                                                                       end)
                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                        0)})))
                                                                                                                                                    else
                                                                                                                                                      (_s4812_
                                                                                                                                                         _s4104_) >>= fun w__210 : option ((mword 5 * mword 5 * string)) =>
                                                                                                                                                      (if
                                                                                                                                                         match w__210 with
                                                                                                                                                         | Some
                                                                                                                                                           (rd, rs2, s_) =>
                                                                                                                                                            andb
                                                                                                                                                              (neq_vec
                                                                                                                                                                 rd
                                                                                                                                                                 zreg)
                                                                                                                                                              (neq_vec
                                                                                                                                                                 rs2
                                                                                                                                                                 zreg)
                                                                                                                                                         | _ =>
                                                                                                                                                            false
                                                                                                                                                         end
                                                                                                                                                       then
                                                                                                                                                         (_s4812_
                                                                                                                                                            _s4104_) >>= fun w__211 : option ((mword 5 * mword 5 * string)) =>
                                                                                                                                                         (match w__211 with
                                                                                                                                                          | Some
                                                                                                                                                            (rd, rs2, s_) =>
                                                                                                                                                             returnm (Some
                                                                                                                                                                        (C_MV
                                                                                                                                                                           (rd, rs2), build_ex
                                                                                                                                                                        (projT1
                                                                                                                                                                         (sub_nat
                                                                                                                                                                            (projT1
                                                                                                                                                                             (string_length
                                                                                                                                                                                arg_))
                                                                                                                                                                            (projT1
                                                                                                                                                                             (string_length
                                                                                                                                                                                s_))))))
                                                                                                                                                          | _ =>
                                                                                                                                                             exit tt
                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                               0)})))
                                                                                                                                                          end)
                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                           0)})))
                                                                                                                                                       else if
                                                                                                                                                         match (_s4824_
                                                                                                                                                                  _s4104_) with
                                                                                                                                                         | Some
                                                                                                                                                           s_ =>
                                                                                                                                                            true
                                                                                                                                                         | _ =>
                                                                                                                                                            false
                                                                                                                                                         end
                                                                                                                                                       then
                                                                                                                                                         (match (_s4824_
                                                                                                                                                                   _s4104_) with
                                                                                                                                                          | Some
                                                                                                                                                            s_ =>
                                                                                                                                                             returnm (Some
                                                                                                                                                                        (C_EBREAK
                                                                                                                                                                           tt, build_ex
                                                                                                                                                                        (projT1
                                                                                                                                                                         (sub_nat
                                                                                                                                                                            (projT1
                                                                                                                                                                             (string_length
                                                                                                                                                                                arg_))
                                                                                                                                                                            (projT1
                                                                                                                                                                             (string_length
                                                                                                                                                                                s_))))))
                                                                                                                                                          | _ =>
                                                                                                                                                             exit tt
                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                               0)})))
                                                                                                                                                          end)
                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                           0)})))
                                                                                                                                                       else
                                                                                                                                                         (_s4828_
                                                                                                                                                            _s4104_) >>= fun w__216 : option ((mword 5 * mword 5 * string)) =>
                                                                                                                                                         (if
                                                                                                                                                            match w__216 with
                                                                                                                                                            | Some
                                                                                                                                                              (rsd, rs2, s_) =>
                                                                                                                                                               andb
                                                                                                                                                                 (neq_vec
                                                                                                                                                                    rsd
                                                                                                                                                                    zreg)
                                                                                                                                                                 (neq_vec
                                                                                                                                                                    rs2
                                                                                                                                                                    zreg)
                                                                                                                                                            | _ =>
                                                                                                                                                               false
                                                                                                                                                            end
                                                                                                                                                          then
                                                                                                                                                            (_s4828_
                                                                                                                                                               _s4104_) >>= fun w__217 : option ((mword 5 * mword 5 * string)) =>
                                                                                                                                                            (match w__217 with
                                                                                                                                                             | Some
                                                                                                                                                               (rsd, rs2, s_) =>
                                                                                                                                                                returnm (Some
                                                                                                                                                                           (C_ADD
                                                                                                                                                                              (rsd, rs2), build_ex
                                                                                                                                                                           (projT1
                                                                                                                                                                            (sub_nat
                                                                                                                                                                               (projT1
                                                                                                                                                                                (string_length
                                                                                                                                                                                   arg_))
                                                                                                                                                                               (projT1
                                                                                                                                                                                (string_length
                                                                                                                                                                                   s_))))))
                                                                                                                                                             | _ =>
                                                                                                                                                                exit tt
                                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                  0)})))
                                                                                                                                                             end)
                                                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                              0)})))
                                                                                                                                                          else
                                                                                                                                                            (_s4840_
                                                                                                                                                               _s4104_) >>= fun w__220 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                            (if
                                                                                                                                                               match w__220 with
                                                                                                                                                               | Some
                                                                                                                                                                 (high, signed1, signed2, rd, rs1, rs2, s_) =>
                                                                                                                                                                  true
                                                                                                                                                               | _ =>
                                                                                                                                                                  false
                                                                                                                                                               end
                                                                                                                                                             then
                                                                                                                                                               (_s4840_
                                                                                                                                                                  _s4104_) >>= fun w__221 : option ((bool * bool * bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                               (match w__221 with
                                                                                                                                                                | Some
                                                                                                                                                                  (high, signed1, signed2, rd, rs1, rs2, s_) =>
                                                                                                                                                                   returnm (Some
                                                                                                                                                                              (MUL
                                                                                                                                                                                 (rs2, rs1, rd, high, signed1, signed2), build_ex
                                                                                                                                                                              (projT1
                                                                                                                                                                               (sub_nat
                                                                                                                                                                                  (projT1
                                                                                                                                                                                   (string_length
                                                                                                                                                                                      arg_))
                                                                                                                                                                                  (projT1
                                                                                                                                                                                   (string_length
                                                                                                                                                                                      s_))))))
                                                                                                                                                                | _ =>
                                                                                                                                                                   exit tt
                                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                     0)})))
                                                                                                                                                                end)
                                                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                 0)})))
                                                                                                                                                             else
                                                                                                                                                               (_s4857_
                                                                                                                                                                  _s4104_) >>= fun w__224 : option ((bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                               (if
                                                                                                                                                                  match w__224 with
                                                                                                                                                                  | Some
                                                                                                                                                                    (s, rd, rs1, rs2, s_) =>
                                                                                                                                                                     true
                                                                                                                                                                  | _ =>
                                                                                                                                                                     false
                                                                                                                                                                  end
                                                                                                                                                                then
                                                                                                                                                                  (_s4857_
                                                                                                                                                                     _s4104_) >>= fun w__225 : option ((bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                  (match w__225 with
                                                                                                                                                                   | Some
                                                                                                                                                                     (s, rd, rs1, rs2, s_) =>
                                                                                                                                                                      returnm (Some
                                                                                                                                                                                 (DIV
                                                                                                                                                                                    (rs2, rs1, rd, s), build_ex
                                                                                                                                                                                 (projT1
                                                                                                                                                                                  (sub_nat
                                                                                                                                                                                     (projT1
                                                                                                                                                                                      (string_length
                                                                                                                                                                                         arg_))
                                                                                                                                                                                     (projT1
                                                                                                                                                                                      (string_length
                                                                                                                                                                                         s_))))))
                                                                                                                                                                   | _ =>
                                                                                                                                                                      exit tt
                                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                        0)})))
                                                                                                                                                                   end)
                                                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                    0)})))
                                                                                                                                                                else
                                                                                                                                                                  (_s4875_
                                                                                                                                                                     _s4104_) >>= fun w__228 : option ((bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                  (if
                                                                                                                                                                     match w__228 with
                                                                                                                                                                     | Some
                                                                                                                                                                       (s, rd, rs1, rs2, s_) =>
                                                                                                                                                                        true
                                                                                                                                                                     | _ =>
                                                                                                                                                                        false
                                                                                                                                                                     end
                                                                                                                                                                   then
                                                                                                                                                                     (_s4875_
                                                                                                                                                                        _s4104_) >>= fun w__229 : option ((bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                     (match w__229 with
                                                                                                                                                                      | Some
                                                                                                                                                                        (s, rd, rs1, rs2, s_) =>
                                                                                                                                                                         returnm (Some
                                                                                                                                                                                    (REM
                                                                                                                                                                                       (rs2, rs1, rd, s), build_ex
                                                                                                                                                                                    (projT1
                                                                                                                                                                                     (sub_nat
                                                                                                                                                                                        (projT1
                                                                                                                                                                                         (string_length
                                                                                                                                                                                            arg_))
                                                                                                                                                                                        (projT1
                                                                                                                                                                                         (string_length
                                                                                                                                                                                            s_))))))
                                                                                                                                                                      | _ =>
                                                                                                                                                                         exit tt
                                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                           0)})))
                                                                                                                                                                      end)
                                                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                       0)})))
                                                                                                                                                                   else
                                                                                                                                                                     (_s4893_
                                                                                                                                                                        _s4104_) >>= fun w__232 : option ((mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                     (if
                                                                                                                                                                        match w__232 with
                                                                                                                                                                        | Some
                                                                                                                                                                          (rd, rs1, rs2, s_) =>
                                                                                                                                                                           Z.eqb
                                                                                                                                                                             32
                                                                                                                                                                             64
                                                                                                                                                                        | _ =>
                                                                                                                                                                           false
                                                                                                                                                                        end
                                                                                                                                                                      then
                                                                                                                                                                        (_s4893_
                                                                                                                                                                           _s4104_) >>= fun w__233 : option ((mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                        (match w__233 with
                                                                                                                                                                         | Some
                                                                                                                                                                           (rd, rs1, rs2, s_) =>
                                                                                                                                                                            returnm (Some
                                                                                                                                                                                       (MULW
                                                                                                                                                                                          (rs2, rs1, rd), build_ex
                                                                                                                                                                                       (projT1
                                                                                                                                                                                        (sub_nat
                                                                                                                                                                                           (projT1
                                                                                                                                                                                            (string_length
                                                                                                                                                                                               arg_))
                                                                                                                                                                                           (projT1
                                                                                                                                                                                            (string_length
                                                                                                                                                                                               s_))))))
                                                                                                                                                                         | _ =>
                                                                                                                                                                            exit tt
                                                                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                              0)})))
                                                                                                                                                                         end)
                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                          0)})))
                                                                                                                                                                      else
                                                                                                                                                                        (_s4909_
                                                                                                                                                                           _s4104_) >>= fun w__236 : option ((bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                        (if
                                                                                                                                                                           match w__236 with
                                                                                                                                                                           | Some
                                                                                                                                                                             (s, rd, rs1, rs2, s_) =>
                                                                                                                                                                              Z.eqb
                                                                                                                                                                                32
                                                                                                                                                                                64
                                                                                                                                                                           | _ =>
                                                                                                                                                                              false
                                                                                                                                                                           end
                                                                                                                                                                         then
                                                                                                                                                                           (_s4909_
                                                                                                                                                                              _s4104_) >>= fun w__237 : option ((bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                           (match w__237 with
                                                                                                                                                                            | Some
                                                                                                                                                                              (s, rd, rs1, rs2, s_) =>
                                                                                                                                                                               returnm (Some
                                                                                                                                                                                          (DIVW
                                                                                                                                                                                             (rs2, rs1, rd, s), build_ex
                                                                                                                                                                                          (projT1
                                                                                                                                                                                           (sub_nat
                                                                                                                                                                                              (projT1
                                                                                                                                                                                               (string_length
                                                                                                                                                                                                  arg_))
                                                                                                                                                                                              (projT1
                                                                                                                                                                                               (string_length
                                                                                                                                                                                                  s_))))))
                                                                                                                                                                            | _ =>
                                                                                                                                                                               exit tt
                                                                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                 0)})))
                                                                                                                                                                            end)
                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                             0)})))
                                                                                                                                                                         else
                                                                                                                                                                           (_s4928_
                                                                                                                                                                              _s4104_) >>= fun w__240 : option ((bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                           (if
                                                                                                                                                                              match w__240 with
                                                                                                                                                                              | Some
                                                                                                                                                                                (s, rd, rs1, rs2, s_) =>
                                                                                                                                                                                 Z.eqb
                                                                                                                                                                                   32
                                                                                                                                                                                   64
                                                                                                                                                                              | _ =>
                                                                                                                                                                                 false
                                                                                                                                                                              end
                                                                                                                                                                            then
                                                                                                                                                                              (_s4928_
                                                                                                                                                                                 _s4104_) >>= fun w__241 : option ((bool * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                              (match w__241 with
                                                                                                                                                                               | Some
                                                                                                                                                                                 (s, rd, rs1, rs2, s_) =>
                                                                                                                                                                                  returnm (Some
                                                                                                                                                                                             (REMW
                                                                                                                                                                                                (rs2, rs1, rd, s), build_ex
                                                                                                                                                                                             (projT1
                                                                                                                                                                                              (sub_nat
                                                                                                                                                                                                 (projT1
                                                                                                                                                                                                  (string_length
                                                                                                                                                                                                     arg_))
                                                                                                                                                                                                 (projT1
                                                                                                                                                                                                  (string_length
                                                                                                                                                                                                     s_))))))
                                                                                                                                                                               | _ =>
                                                                                                                                                                                  exit tt
                                                                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                    0)})))
                                                                                                                                                                               end)
                                                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                0)})))
                                                                                                                                                                            else
                                                                                                                                                                              (_s4947_
                                                                                                                                                                                 _s4104_) >>= fun w__244 : option ((csrop * mword 5 * mword 12 * mword 5 * string)) =>
                                                                                                                                                                              (if
                                                                                                                                                                                 match w__244 with
                                                                                                                                                                                 | Some
                                                                                                                                                                                   (op, rd, csr, rs1, s_) =>
                                                                                                                                                                                    true
                                                                                                                                                                                 | _ =>
                                                                                                                                                                                    false
                                                                                                                                                                                 end
                                                                                                                                                                               then
                                                                                                                                                                                 (_s4947_
                                                                                                                                                                                    _s4104_) >>= fun w__245 : option ((csrop * mword 5 * mword 12 * mword 5 * string)) =>
                                                                                                                                                                                 (match w__245 with
                                                                                                                                                                                  | Some
                                                                                                                                                                                    (op, rd, csr, rs1, s_) =>
                                                                                                                                                                                     returnm (Some
                                                                                                                                                                                                (CSR
                                                                                                                                                                                                   (csr, rs1, rd, true, op), build_ex
                                                                                                                                                                                                (projT1
                                                                                                                                                                                                 (sub_nat
                                                                                                                                                                                                    (projT1
                                                                                                                                                                                                     (string_length
                                                                                                                                                                                                        arg_))
                                                                                                                                                                                                    (projT1
                                                                                                                                                                                                     (string_length
                                                                                                                                                                                                        s_))))))
                                                                                                                                                                                  | _ =>
                                                                                                                                                                                     exit tt
                                                                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                       0)})))
                                                                                                                                                                                  end)
                                                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                   0)})))
                                                                                                                                                                               else
                                                                                                                                                                                 (_s4965_
                                                                                                                                                                                    _s4104_) >>= fun w__248 : option ((csrop * mword 5 * mword 12 * mword 5 * string)) =>
                                                                                                                                                                                 (if
                                                                                                                                                                                    match w__248 with
                                                                                                                                                                                    | Some
                                                                                                                                                                                      (op, rd, csr, rs1, s_) =>
                                                                                                                                                                                       true
                                                                                                                                                                                    | _ =>
                                                                                                                                                                                       false
                                                                                                                                                                                    end
                                                                                                                                                                                  then
                                                                                                                                                                                    (_s4965_
                                                                                                                                                                                       _s4104_) >>= fun w__249 : option ((csrop * mword 5 * mword 12 * mword 5 * string)) =>
                                                                                                                                                                                    (match w__249 with
                                                                                                                                                                                     | Some
                                                                                                                                                                                       (op, rd, csr, rs1, s_) =>
                                                                                                                                                                                        returnm (Some
                                                                                                                                                                                                   (CSR
                                                                                                                                                                                                      (csr, rs1, rd, false, op), build_ex
                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                    (sub_nat
                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                           arg_))
                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                           s_))))))
                                                                                                                                                                                     | _ =>
                                                                                                                                                                                        exit tt
                                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                          0)})))
                                                                                                                                                                                     end)
                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                      0)})))
                                                                                                                                                                                  else if
                                                                                                                                                                                    match (_s4982_
                                                                                                                                                                                             _s4104_) with
                                                                                                                                                                                    | Some
                                                                                                                                                                                      s_ =>
                                                                                                                                                                                       true
                                                                                                                                                                                    | _ =>
                                                                                                                                                                                       false
                                                                                                                                                                                    end
                                                                                                                                                                                  then
                                                                                                                                                                                    (match (_s4982_
                                                                                                                                                                                              _s4104_) with
                                                                                                                                                                                     | Some
                                                                                                                                                                                       s_ =>
                                                                                                                                                                                        returnm (Some
                                                                                                                                                                                                   (URET
                                                                                                                                                                                                      tt, build_ex
                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                    (sub_nat
                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                           arg_))
                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                           s_))))))
                                                                                                                                                                                     | _ =>
                                                                                                                                                                                        exit tt
                                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                          0)})))
                                                                                                                                                                                     end)
                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                      0)})))
                                                                                                                                                                                  else if
                                                                                                                                                                                    match (_s4986_
                                                                                                                                                                                             _s4104_) with
                                                                                                                                                                                    | Some
                                                                                                                                                                                      (imm, s_) =>
                                                                                                                                                                                       true
                                                                                                                                                                                    | _ =>
                                                                                                                                                                                       false
                                                                                                                                                                                    end
                                                                                                                                                                                  then
                                                                                                                                                                                    (match (_s4986_
                                                                                                                                                                                              _s4104_) with
                                                                                                                                                                                     | Some
                                                                                                                                                                                       (imm, s_) =>
                                                                                                                                                                                        returnm (Some
                                                                                                                                                                                                   (C_NOP_HINT
                                                                                                                                                                                                      imm, build_ex
                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                    (sub_nat
                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                           arg_))
                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                           s_))))))
                                                                                                                                                                                     | _ =>
                                                                                                                                                                                        exit tt
                                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                          0)})))
                                                                                                                                                                                     end)
                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                      0)})))
                                                                                                                                                                                  else
                                                                                                                                                                                    (_s4992_
                                                                                                                                                                                       _s4104_) >>= fun w__256 : option ((mword 5 * string)) =>
                                                                                                                                                                                    (if
                                                                                                                                                                                       match w__256 with
                                                                                                                                                                                       | Some
                                                                                                                                                                                         (rsd, s_) =>
                                                                                                                                                                                          neq_vec
                                                                                                                                                                                            rsd
                                                                                                                                                                                            zreg
                                                                                                                                                                                       | _ =>
                                                                                                                                                                                          false
                                                                                                                                                                                       end
                                                                                                                                                                                     then
                                                                                                                                                                                       (_s4992_
                                                                                                                                                                                          _s4104_) >>= fun w__257 : option ((mword 5 * string)) =>
                                                                                                                                                                                       (match w__257 with
                                                                                                                                                                                        | Some
                                                                                                                                                                                          (rsd, s_) =>
                                                                                                                                                                                           returnm (Some
                                                                                                                                                                                                      (C_ADDI_HINT
                                                                                                                                                                                                         rsd, build_ex
                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                       (sub_nat
                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                              arg_))
                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                              s_))))))
                                                                                                                                                                                        | _ =>
                                                                                                                                                                                           exit tt
                                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                             0)})))
                                                                                                                                                                                        end)
                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                         0)})))
                                                                                                                                                                                     else if
                                                                                                                                                                                       match (_s4998_
                                                                                                                                                                                                _s4104_) with
                                                                                                                                                                                       | Some
                                                                                                                                                                                         (imm, s_) =>
                                                                                                                                                                                          true
                                                                                                                                                                                       | _ =>
                                                                                                                                                                                          false
                                                                                                                                                                                       end
                                                                                                                                                                                     then
                                                                                                                                                                                       (match (_s4998_
                                                                                                                                                                                                 _s4104_) with
                                                                                                                                                                                        | Some
                                                                                                                                                                                          (imm, s_) =>
                                                                                                                                                                                           returnm (Some
                                                                                                                                                                                                      (C_LI_HINT
                                                                                                                                                                                                         imm, build_ex
                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                       (sub_nat
                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                              arg_))
                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                              s_))))))
                                                                                                                                                                                        | _ =>
                                                                                                                                                                                           exit tt
                                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                             0)})))
                                                                                                                                                                                        end)
                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                         0)})))
                                                                                                                                                                                     else if
                                                                                                                                                                                       match (_s5004_
                                                                                                                                                                                                _s4104_) with
                                                                                                                                                                                       | Some
                                                                                                                                                                                         (imm, s_) =>
                                                                                                                                                                                          neq_vec
                                                                                                                                                                                            imm
                                                                                                                                                                                            ('b"000000"
                                                                                                                                                                                             : mword 6)
                                                                                                                                                                                       | _ =>
                                                                                                                                                                                          false
                                                                                                                                                                                       end
                                                                                                                                                                                     then
                                                                                                                                                                                       (match (_s5004_
                                                                                                                                                                                                 _s4104_) with
                                                                                                                                                                                        | Some
                                                                                                                                                                                          (imm, s_) =>
                                                                                                                                                                                           returnm (Some
                                                                                                                                                                                                      (C_LUI_HINT
                                                                                                                                                                                                         imm, build_ex
                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                       (sub_nat
                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                              arg_))
                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                              s_))))))
                                                                                                                                                                                        | _ =>
                                                                                                                                                                                           exit tt
                                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                             0)})))
                                                                                                                                                                                        end)
                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                         0)})))
                                                                                                                                                                                     else
                                                                                                                                                                                       (_s5010_
                                                                                                                                                                                          _s4104_) >>= fun w__264 : option ((mword 5 * string)) =>
                                                                                                                                                                                       (if
                                                                                                                                                                                          match w__264 with
                                                                                                                                                                                          | Some
                                                                                                                                                                                            (rs2, s_) =>
                                                                                                                                                                                             neq_vec
                                                                                                                                                                                               rs2
                                                                                                                                                                                               zreg
                                                                                                                                                                                          | _ =>
                                                                                                                                                                                             false
                                                                                                                                                                                          end
                                                                                                                                                                                        then
                                                                                                                                                                                          (_s5010_
                                                                                                                                                                                             _s4104_) >>= fun w__265 : option ((mword 5 * string)) =>
                                                                                                                                                                                          (match w__265 with
                                                                                                                                                                                           | Some
                                                                                                                                                                                             (rs2, s_) =>
                                                                                                                                                                                              returnm (Some
                                                                                                                                                                                                         (C_MV_HINT
                                                                                                                                                                                                            rs2, build_ex
                                                                                                                                                                                                         (projT1
                                                                                                                                                                                                          (sub_nat
                                                                                                                                                                                                             (projT1
                                                                                                                                                                                                              (string_length
                                                                                                                                                                                                                 arg_))
                                                                                                                                                                                                             (projT1
                                                                                                                                                                                                              (string_length
                                                                                                                                                                                                                 s_))))))
                                                                                                                                                                                           | _ =>
                                                                                                                                                                                              exit tt
                                                                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                0)})))
                                                                                                                                                                                           end)
                                                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                            0)})))
                                                                                                                                                                                        else
                                                                                                                                                                                          (_s5016_
                                                                                                                                                                                             _s4104_) >>= fun w__268 : option ((mword 5 * string)) =>
                                                                                                                                                                                          (if
                                                                                                                                                                                             match w__268 with
                                                                                                                                                                                             | Some
                                                                                                                                                                                               (rs2, s_) =>
                                                                                                                                                                                                neq_vec
                                                                                                                                                                                                  rs2
                                                                                                                                                                                                  zreg
                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                false
                                                                                                                                                                                             end
                                                                                                                                                                                           then
                                                                                                                                                                                             (_s5016_
                                                                                                                                                                                                _s4104_) >>= fun w__269 : option ((mword 5 * string)) =>
                                                                                                                                                                                             (match w__269 with
                                                                                                                                                                                              | Some
                                                                                                                                                                                                (rs2, s_) =>
                                                                                                                                                                                                 returnm (Some
                                                                                                                                                                                                            (C_ADD_HINT
                                                                                                                                                                                                               rs2, build_ex
                                                                                                                                                                                                            (projT1
                                                                                                                                                                                                             (sub_nat
                                                                                                                                                                                                                (projT1
                                                                                                                                                                                                                 (string_length
                                                                                                                                                                                                                    arg_))
                                                                                                                                                                                                                (projT1
                                                                                                                                                                                                                 (string_length
                                                                                                                                                                                                                    s_))))))
                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                 exit tt
                                                                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                   0)})))
                                                                                                                                                                                              end)
                                                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                               0)})))
                                                                                                                                                                                           else
                                                                                                                                                                                             (_s5022_
                                                                                                                                                                                                _s4104_) >>= fun w__272 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                                                                             (if
                                                                                                                                                                                                match w__272 with
                                                                                                                                                                                                | Some
                                                                                                                                                                                                  (rsd, shamt, s_) =>
                                                                                                                                                                                                   orb
                                                                                                                                                                                                     (eq_vec
                                                                                                                                                                                                        shamt
                                                                                                                                                                                                        ('b"000000"
                                                                                                                                                                                                         : mword 6))
                                                                                                                                                                                                     (eq_vec
                                                                                                                                                                                                        rsd
                                                                                                                                                                                                        zreg)
                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                   false
                                                                                                                                                                                                end
                                                                                                                                                                                              then
                                                                                                                                                                                                (_s5022_
                                                                                                                                                                                                   _s4104_) >>= fun w__273 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                                                                                (match w__273 with
                                                                                                                                                                                                 | Some
                                                                                                                                                                                                   (rsd, shamt, s_) =>
                                                                                                                                                                                                    returnm (Some
                                                                                                                                                                                                               (C_SLLI_HINT
                                                                                                                                                                                                                  (shamt, rsd), build_ex
                                                                                                                                                                                                               (projT1
                                                                                                                                                                                                                (sub_nat
                                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                                    (string_length
                                                                                                                                                                                                                       arg_))
                                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                                    (string_length
                                                                                                                                                                                                                       s_))))))
                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                    exit tt
                                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                      0)})))
                                                                                                                                                                                                 end)
                                                                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                  0)})))
                                                                                                                                                                                              else
                                                                                                                                                                                                (_s5031_
                                                                                                                                                                                                   _s4104_) >>= fun w__276 : option ((mword 3 * string)) =>
                                                                                                                                                                                                (if
                                                                                                                                                                                                   match w__276 with
                                                                                                                                                                                                   | Some
                                                                                                                                                                                                     (rsd, s_) =>
                                                                                                                                                                                                      true
                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                      false
                                                                                                                                                                                                   end
                                                                                                                                                                                                 then
                                                                                                                                                                                                   (_s5031_
                                                                                                                                                                                                      _s4104_) >>= fun w__277 : option ((mword 3 * string)) =>
                                                                                                                                                                                                   (match w__277 with
                                                                                                                                                                                                    | Some
                                                                                                                                                                                                      (rsd, s_) =>
                                                                                                                                                                                                       returnm (Some
                                                                                                                                                                                                                  (C_SRLI_HINT
                                                                                                                                                                                                                     rsd, build_ex
                                                                                                                                                                                                                  (projT1
                                                                                                                                                                                                                   (sub_nat
                                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                                       (string_length
                                                                                                                                                                                                                          arg_))
                                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                                       (string_length
                                                                                                                                                                                                                          s_))))))
                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                       exit tt
                                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                         0)})))
                                                                                                                                                                                                    end)
                                                                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                     0)})))
                                                                                                                                                                                                 else
                                                                                                                                                                                                   (_s5037_
                                                                                                                                                                                                      _s4104_) >>= fun w__280 : option ((mword 3 * string)) =>
                                                                                                                                                                                                   (if
                                                                                                                                                                                                      match w__280 with
                                                                                                                                                                                                      | Some
                                                                                                                                                                                                        (rsd, s_) =>
                                                                                                                                                                                                         true
                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                         false
                                                                                                                                                                                                      end
                                                                                                                                                                                                    then
                                                                                                                                                                                                      (_s5037_
                                                                                                                                                                                                         _s4104_) >>= fun w__281 : option ((mword 3 * string)) =>
                                                                                                                                                                                                      (match w__281 with
                                                                                                                                                                                                       | Some
                                                                                                                                                                                                         (rsd, s_) =>
                                                                                                                                                                                                          returnm (Some
                                                                                                                                                                                                                     (C_SRAI_HINT
                                                                                                                                                                                                                        rsd, build_ex
                                                                                                                                                                                                                     (projT1
                                                                                                                                                                                                                      (sub_nat
                                                                                                                                                                                                                         (projT1
                                                                                                                                                                                                                          (string_length
                                                                                                                                                                                                                             arg_))
                                                                                                                                                                                                                         (projT1
                                                                                                                                                                                                                          (string_length
                                                                                                                                                                                                                             s_))))))
                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                          exit tt
                                                                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                            0)})))
                                                                                                                                                                                                       end)
                                                                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                        0)})))
                                                                                                                                                                                                    else
                                                                                                                                                                                                      (_s5043_
                                                                                                                                                                                                         _s4104_) >>= fun w__284 : option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)) =>
                                                                                                                                                                                                      (if
                                                                                                                                                                                                         match w__284 with
                                                                                                                                                                                                         | Some
                                                                                                                                                                                                           (pred, succ, rs, rd, fm, s_) =>
                                                                                                                                                                                                            orb
                                                                                                                                                                                                              (andb
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    fm
                                                                                                                                                                                                                    (Ox"0"
                                                                                                                                                                                                                     : mword 4))
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    fm
                                                                                                                                                                                                                    (Ox"8"
                                                                                                                                                                                                                     : mword 4)))
                                                                                                                                                                                                              (orb
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    rs
                                                                                                                                                                                                                    ('b"00000"
                                                                                                                                                                                                                     : mword 5))
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    rd
                                                                                                                                                                                                                    ('b"00000"
                                                                                                                                                                                                                     : mword 5)))
                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                            false
                                                                                                                                                                                                         end
                                                                                                                                                                                                       then
                                                                                                                                                                                                         (_s5043_
                                                                                                                                                                                                            _s4104_) >>= fun w__285 : option ((mword 4 * mword 4 * mword 5 * mword 5 * mword 4 * string)) =>
                                                                                                                                                                                                         (match w__285 with
                                                                                                                                                                                                          | Some
                                                                                                                                                                                                            (pred, succ, rs, rd, fm, s_) =>
                                                                                                                                                                                                             returnm (Some
                                                                                                                                                                                                                        (FENCE_RESERVED
                                                                                                                                                                                                                           (fm, pred, succ, rs, rd), build_ex
                                                                                                                                                                                                                        (projT1
                                                                                                                                                                                                                         (sub_nat
                                                                                                                                                                                                                            (projT1
                                                                                                                                                                                                                             (string_length
                                                                                                                                                                                                                                arg_))
                                                                                                                                                                                                                            (projT1
                                                                                                                                                                                                                             (string_length
                                                                                                                                                                                                                                s_))))))
                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                             exit tt
                                                                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                               0)})))
                                                                                                                                                                                                          end)
                                                                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                           0)})))
                                                                                                                                                                                                       else
                                                                                                                                                                                                         (_s5061_
                                                                                                                                                                                                            _s4104_) >>= fun w__288 : option ((mword 5 * mword 5 * mword 12 * string)) =>
                                                                                                                                                                                                         (if
                                                                                                                                                                                                            match w__288 with
                                                                                                                                                                                                            | Some
                                                                                                                                                                                                              (rd, rs, imm, s_) =>
                                                                                                                                                                                                               orb
                                                                                                                                                                                                                 (neq_vec
                                                                                                                                                                                                                    imm
                                                                                                                                                                                                                    (Ox"000"
                                                                                                                                                                                                                     : mword 12))
                                                                                                                                                                                                                 (orb
                                                                                                                                                                                                                    (neq_vec
                                                                                                                                                                                                                       rs
                                                                                                                                                                                                                       zreg)
                                                                                                                                                                                                                    (neq_vec
                                                                                                                                                                                                                       rd
                                                                                                                                                                                                                       zreg))
                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                               false
                                                                                                                                                                                                            end
                                                                                                                                                                                                          then
                                                                                                                                                                                                            (_s5061_
                                                                                                                                                                                                               _s4104_) >>= fun w__289 : option ((mword 5 * mword 5 * mword 12 * string)) =>
                                                                                                                                                                                                            (match w__289 with
                                                                                                                                                                                                             | Some
                                                                                                                                                                                                               (rd, rs, imm, s_) =>
                                                                                                                                                                                                                returnm (Some
                                                                                                                                                                                                                           (FENCEI_RESERVED
                                                                                                                                                                                                                              (imm, rs, rd), build_ex
                                                                                                                                                                                                                           (projT1
                                                                                                                                                                                                                            (sub_nat
                                                                                                                                                                                                                               (projT1
                                                                                                                                                                                                                                (string_length
                                                                                                                                                                                                                                   arg_))
                                                                                                                                                                                                                               (projT1
                                                                                                                                                                                                                                (string_length
                                                                                                                                                                                                                                   s_))))))
                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                exit tt
                                                                                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                  0)})))
                                                                                                                                                                                                             end)
                                                                                                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                              0)})))
                                                                                                                                                                                                          else
                                                                                                                                                                                                            (_s5073_
                                                                                                                                                                                                               _s4104_) >>= fun w__292 : option ((word_width * mword 5 * mword 12 * mword 5 * string)) =>
                                                                                                                                                                                                            (if
                                                                                                                                                                                                               match w__292 with
                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                 (width, rd, imm, rs1, s_) =>
                                                                                                                                                                                                                  true
                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                  false
                                                                                                                                                                                                               end
                                                                                                                                                                                                             then
                                                                                                                                                                                                               (_s5073_
                                                                                                                                                                                                                  _s4104_) >>= fun w__293 : option ((word_width * mword 5 * mword 12 * mword 5 * string)) =>
                                                                                                                                                                                                               (match w__293 with
                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                  (width, rd, imm, rs1, s_) =>
                                                                                                                                                                                                                   returnm (Some
                                                                                                                                                                                                                              (LOAD_FP
                                                                                                                                                                                                                                 (imm, rs1, rd, width), build_ex
                                                                                                                                                                                                                              (projT1
                                                                                                                                                                                                                               (sub_nat
                                                                                                                                                                                                                                  (projT1
                                                                                                                                                                                                                                   (string_length
                                                                                                                                                                                                                                      arg_))
                                                                                                                                                                                                                                  (projT1
                                                                                                                                                                                                                                   (string_length
                                                                                                                                                                                                                                      s_))))))
                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                   exit tt
                                                                                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                     0)})))
                                                                                                                                                                                                                end)
                                                                                                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                 0)})))
                                                                                                                                                                                                             else
                                                                                                                                                                                                               (_s5097_
                                                                                                                                                                                                                  _s4104_) >>= fun w__296 : option ((word_width * mword 5 * mword 12 * mword 5 * string)) =>
                                                                                                                                                                                                               (if
                                                                                                                                                                                                                  match w__296 with
                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                    (width, rs2, imm, rs1, s_) =>
                                                                                                                                                                                                                     true
                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                     false
                                                                                                                                                                                                                  end
                                                                                                                                                                                                                then
                                                                                                                                                                                                                  (_s5097_
                                                                                                                                                                                                                     _s4104_) >>= fun w__297 : option ((word_width * mword 5 * mword 12 * mword 5 * string)) =>
                                                                                                                                                                                                                  (match w__297 with
                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                     (width, rs2, imm, rs1, s_) =>
                                                                                                                                                                                                                      returnm (Some
                                                                                                                                                                                                                                 (STORE_FP
                                                                                                                                                                                                                                    (imm, rs2, rs1, width), build_ex
                                                                                                                                                                                                                                 (projT1
                                                                                                                                                                                                                                  (sub_nat
                                                                                                                                                                                                                                     (projT1
                                                                                                                                                                                                                                      (string_length
                                                                                                                                                                                                                                         arg_))
                                                                                                                                                                                                                                     (projT1
                                                                                                                                                                                                                                      (string_length
                                                                                                                                                                                                                                         s_))))))
                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                      exit tt
                                                                                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                        0)})))
                                                                                                                                                                                                                   end)
                                                                                                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                    0)})))
                                                                                                                                                                                                                else
                                                                                                                                                                                                                  (_s5121_
                                                                                                                                                                                                                     _s4104_) >>= fun w__300 : option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                  (if
                                                                                                                                                                                                                     match w__300 with
                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                       (op, rd, rs1, rs2, rs3, rm, s_) =>
                                                                                                                                                                                                                        true
                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                        false
                                                                                                                                                                                                                     end
                                                                                                                                                                                                                   then
                                                                                                                                                                                                                     (_s5121_
                                                                                                                                                                                                                        _s4104_) >>= fun w__301 : option ((f_madd_op_S * mword 5 * mword 5 * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                     (match w__301 with
                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                        (op, rd, rs1, rs2, rs3, rm, s_) =>
                                                                                                                                                                                                                         returnm (Some
                                                                                                                                                                                                                                    (F_MADD_TYPE_S
                                                                                                                                                                                                                                       (rs3, rs2, rs1, rm, rd, op), build_ex
                                                                                                                                                                                                                                    (projT1
                                                                                                                                                                                                                                     (sub_nat
                                                                                                                                                                                                                                        (projT1
                                                                                                                                                                                                                                         (string_length
                                                                                                                                                                                                                                            arg_))
                                                                                                                                                                                                                                        (projT1
                                                                                                                                                                                                                                         (string_length
                                                                                                                                                                                                                                            s_))))))
                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                         exit tt
                                                                                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                           0)})))
                                                                                                                                                                                                                      end)
                                                                                                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                       0)})))
                                                                                                                                                                                                                   else
                                                                                                                                                                                                                     (_s5146_
                                                                                                                                                                                                                        _s4104_) >>= fun w__304 : option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                     (if
                                                                                                                                                                                                                        match w__304 with
                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                          (op, rd, rs1, rs2, rm, s_) =>
                                                                                                                                                                                                                           true
                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                           false
                                                                                                                                                                                                                        end
                                                                                                                                                                                                                      then
                                                                                                                                                                                                                        (_s5146_
                                                                                                                                                                                                                           _s4104_) >>= fun w__305 : option ((f_bin_rm_op_S * mword 5 * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                        (match w__305 with
                                                                                                                                                                                                                         | Some
                                                                                                                                                                                                                           (op, rd, rs1, rs2, rm, s_) =>
                                                                                                                                                                                                                            returnm (Some
                                                                                                                                                                                                                                       (F_BIN_RM_TYPE_S
                                                                                                                                                                                                                                          (rs2, rs1, rm, rd, op), build_ex
                                                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                                                        (sub_nat
                                                                                                                                                                                                                                           (projT1
                                                                                                                                                                                                                                            (string_length
                                                                                                                                                                                                                                               arg_))
                                                                                                                                                                                                                                           (projT1
                                                                                                                                                                                                                                            (string_length
                                                                                                                                                                                                                                               s_))))))
                                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                                            exit tt
                                                                                                                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                              0)})))
                                                                                                                                                                                                                         end)
                                                                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                          0)})))
                                                                                                                                                                                                                      else
                                                                                                                                                                                                                        (_s5167_
                                                                                                                                                                                                                           _s4104_) >>= fun w__308 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                        (if
                                                                                                                                                                                                                           match w__308 with
                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                             (FSQRT_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                              true
                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                              false
                                                                                                                                                                                                                           end
                                                                                                                                                                                                                         then
                                                                                                                                                                                                                           (_s5167_
                                                                                                                                                                                                                              _s4104_) >>= fun w__309 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                           (match w__309 with
                                                                                                                                                                                                                            | Some
                                                                                                                                                                                                                              (FSQRT_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                               returnm (Some
                                                                                                                                                                                                                                          (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                             (rs1, rm, rd, FSQRT_S), build_ex
                                                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                                                           (sub_nat
                                                                                                                                                                                                                                              (projT1
                                                                                                                                                                                                                                               (string_length
                                                                                                                                                                                                                                                  arg_))
                                                                                                                                                                                                                                              (projT1
                                                                                                                                                                                                                                               (string_length
                                                                                                                                                                                                                                                  s_))))))
                                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                                               exit tt
                                                                                                                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                 0)})))
                                                                                                                                                                                                                            end)
                                                                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                             0)})))
                                                                                                                                                                                                                         else
                                                                                                                                                                                                                           (_s5184_
                                                                                                                                                                                                                              _s4104_) >>= fun w__312 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                           (if
                                                                                                                                                                                                                              match w__312 with
                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                (FCVT_W_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                 true
                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                 false
                                                                                                                                                                                                                              end
                                                                                                                                                                                                                            then
                                                                                                                                                                                                                              (_s5184_
                                                                                                                                                                                                                                 _s4104_) >>= fun w__313 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                              (match w__313 with
                                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                                 (FCVT_W_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                  returnm (Some
                                                                                                                                                                                                                                             (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                (rs1, rm, rd, FCVT_W_S), build_ex
                                                                                                                                                                                                                                             (projT1
                                                                                                                                                                                                                                              (sub_nat
                                                                                                                                                                                                                                                 (projT1
                                                                                                                                                                                                                                                  (string_length
                                                                                                                                                                                                                                                     arg_))
                                                                                                                                                                                                                                                 (projT1
                                                                                                                                                                                                                                                  (string_length
                                                                                                                                                                                                                                                     s_))))))
                                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                                  exit tt
                                                                                                                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                    0)})))
                                                                                                                                                                                                                               end)
                                                                                                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                0)})))
                                                                                                                                                                                                                            else
                                                                                                                                                                                                                              (_s5201_
                                                                                                                                                                                                                                 _s4104_) >>= fun w__316 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                              (if
                                                                                                                                                                                                                                 match w__316 with
                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                   (FCVT_WU_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                    true
                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                    false
                                                                                                                                                                                                                                 end
                                                                                                                                                                                                                               then
                                                                                                                                                                                                                                 (_s5201_
                                                                                                                                                                                                                                    _s4104_) >>= fun w__317 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                 (match w__317 with
                                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                                    (FCVT_WU_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                     returnm (Some
                                                                                                                                                                                                                                                (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                   (rs1, rm, rd, FCVT_WU_S), build_ex
                                                                                                                                                                                                                                                (projT1
                                                                                                                                                                                                                                                 (sub_nat
                                                                                                                                                                                                                                                    (projT1
                                                                                                                                                                                                                                                     (string_length
                                                                                                                                                                                                                                                        arg_))
                                                                                                                                                                                                                                                    (projT1
                                                                                                                                                                                                                                                     (string_length
                                                                                                                                                                                                                                                        s_))))))
                                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                                     exit tt
                                                                                                                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                       0)})))
                                                                                                                                                                                                                                  end)
                                                                                                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                   0)})))
                                                                                                                                                                                                                               else
                                                                                                                                                                                                                                 (_s5218_
                                                                                                                                                                                                                                    _s4104_) >>= fun w__320 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                 (if
                                                                                                                                                                                                                                    match w__320 with
                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                      (FCVT_S_W, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                       true
                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                       false
                                                                                                                                                                                                                                    end
                                                                                                                                                                                                                                  then
                                                                                                                                                                                                                                    (_s5218_
                                                                                                                                                                                                                                       _s4104_) >>= fun w__321 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                    (match w__321 with
                                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                                       (FCVT_S_W, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                        returnm (Some
                                                                                                                                                                                                                                                   (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                      (rs1, rm, rd, FCVT_S_W), build_ex
                                                                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                                                                    (sub_nat
                                                                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                                                                           arg_))
                                                                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                                                                           s_))))))
                                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                                        exit tt
                                                                                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                          0)})))
                                                                                                                                                                                                                                     end)
                                                                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                      0)})))
                                                                                                                                                                                                                                  else
                                                                                                                                                                                                                                    (_s5235_
                                                                                                                                                                                                                                       _s4104_) >>= fun w__324 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                    (if
                                                                                                                                                                                                                                       match w__324 with
                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                         (FCVT_S_WU, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                          true
                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                          false
                                                                                                                                                                                                                                       end
                                                                                                                                                                                                                                     then
                                                                                                                                                                                                                                       (_s5235_
                                                                                                                                                                                                                                          _s4104_) >>= fun w__325 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                       (match w__325 with
                                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                                          (FCVT_S_WU, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                           returnm (Some
                                                                                                                                                                                                                                                      (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                         (rs1, rm, rd, FCVT_S_WU), build_ex
                                                                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                                                                       (sub_nat
                                                                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                                                                              arg_))
                                                                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                                                                              s_))))))
                                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                                           exit tt
                                                                                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                             0)})))
                                                                                                                                                                                                                                        end)
                                                                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                         0)})))
                                                                                                                                                                                                                                     else
                                                                                                                                                                                                                                       (_s5252_
                                                                                                                                                                                                                                          _s4104_) >>= fun w__328 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                       (if
                                                                                                                                                                                                                                          match w__328 with
                                                                                                                                                                                                                                          | Some
                                                                                                                                                                                                                                            (FCVT_L_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                             true
                                                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                                                             false
                                                                                                                                                                                                                                          end
                                                                                                                                                                                                                                        then
                                                                                                                                                                                                                                          (_s5252_
                                                                                                                                                                                                                                             _s4104_) >>= fun w__329 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                          (match w__329 with
                                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                                             (FCVT_L_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                              returnm (Some
                                                                                                                                                                                                                                                         (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                            (rs1, rm, rd, FCVT_L_S), build_ex
                                                                                                                                                                                                                                                         (projT1
                                                                                                                                                                                                                                                          (sub_nat
                                                                                                                                                                                                                                                             (projT1
                                                                                                                                                                                                                                                              (string_length
                                                                                                                                                                                                                                                                 arg_))
                                                                                                                                                                                                                                                             (projT1
                                                                                                                                                                                                                                                              (string_length
                                                                                                                                                                                                                                                                 s_))))))
                                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                                              exit tt
                                                                                                                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                0)})))
                                                                                                                                                                                                                                           end)
                                                                                                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                            0)})))
                                                                                                                                                                                                                                        else
                                                                                                                                                                                                                                          (_s5269_
                                                                                                                                                                                                                                             _s4104_) >>= fun w__332 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                          (if
                                                                                                                                                                                                                                             match w__332 with
                                                                                                                                                                                                                                             | Some
                                                                                                                                                                                                                                               (FCVT_LU_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                                true
                                                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                                                false
                                                                                                                                                                                                                                             end
                                                                                                                                                                                                                                           then
                                                                                                                                                                                                                                             (_s5269_
                                                                                                                                                                                                                                                _s4104_) >>= fun w__333 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                             (match w__333 with
                                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                                (FCVT_LU_S, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                                 returnm (Some
                                                                                                                                                                                                                                                            (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                               (rs1, rm, rd, FCVT_LU_S), build_ex
                                                                                                                                                                                                                                                            (projT1
                                                                                                                                                                                                                                                             (sub_nat
                                                                                                                                                                                                                                                                (projT1
                                                                                                                                                                                                                                                                 (string_length
                                                                                                                                                                                                                                                                    arg_))
                                                                                                                                                                                                                                                                (projT1
                                                                                                                                                                                                                                                                 (string_length
                                                                                                                                                                                                                                                                    s_))))))
                                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                                 exit tt
                                                                                                                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                   0)})))
                                                                                                                                                                                                                                              end)
                                                                                                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                               0)})))
                                                                                                                                                                                                                                           else
                                                                                                                                                                                                                                             (_s5286_
                                                                                                                                                                                                                                                _s4104_) >>= fun w__336 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                             (if
                                                                                                                                                                                                                                                match w__336 with
                                                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                                                  (FCVT_S_L, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                                   true
                                                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                                                   false
                                                                                                                                                                                                                                                end
                                                                                                                                                                                                                                              then
                                                                                                                                                                                                                                                (_s5286_
                                                                                                                                                                                                                                                   _s4104_) >>= fun w__337 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                                (match w__337 with
                                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                                   (FCVT_S_L, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                                    returnm (Some
                                                                                                                                                                                                                                                               (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                                  (rs1, rm, rd, FCVT_S_L), build_ex
                                                                                                                                                                                                                                                               (projT1
                                                                                                                                                                                                                                                                (sub_nat
                                                                                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                                                                                    (string_length
                                                                                                                                                                                                                                                                       arg_))
                                                                                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                                                                                    (string_length
                                                                                                                                                                                                                                                                       s_))))))
                                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                                    exit tt
                                                                                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                      0)})))
                                                                                                                                                                                                                                                 end)
                                                                                                                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                  0)})))
                                                                                                                                                                                                                                              else
                                                                                                                                                                                                                                                (_s5303_
                                                                                                                                                                                                                                                   _s4104_) >>= fun w__340 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                                (if
                                                                                                                                                                                                                                                   match w__340 with
                                                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                                                     (FCVT_S_LU, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                                      true
                                                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                                                      false
                                                                                                                                                                                                                                                   end
                                                                                                                                                                                                                                                 then
                                                                                                                                                                                                                                                   (_s5303_
                                                                                                                                                                                                                                                      _s4104_) >>= fun w__341 : option ((f_un_rm_op_S * mword 5 * mword 5 * rounding_mode * string)) =>
                                                                                                                                                                                                                                                   (match w__341 with
                                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                                      (FCVT_S_LU, rd, rs1, rm, s_) =>
                                                                                                                                                                                                                                                       returnm (Some
                                                                                                                                                                                                                                                                  (F_UN_RM_TYPE_S
                                                                                                                                                                                                                                                                     (rs1, rm, rd, FCVT_S_LU), build_ex
                                                                                                                                                                                                                                                                  (projT1
                                                                                                                                                                                                                                                                   (sub_nat
                                                                                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                                                                                       (string_length
                                                                                                                                                                                                                                                                          arg_))
                                                                                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                                                                                       (string_length
                                                                                                                                                                                                                                                                          s_))))))
                                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                                       exit tt
                                                                                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                         0)})))
                                                                                                                                                                                                                                                    end)
                                                                                                                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                     0)})))
                                                                                                                                                                                                                                                 else
                                                                                                                                                                                                                                                   (_s5320_
                                                                                                                                                                                                                                                      _s4104_) >>= fun w__344 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                   (if
                                                                                                                                                                                                                                                      match w__344 with
                                                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                                                        (FSGNJ_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                         true
                                                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                                                         false
                                                                                                                                                                                                                                                      end
                                                                                                                                                                                                                                                    then
                                                                                                                                                                                                                                                      (_s5320_
                                                                                                                                                                                                                                                         _s4104_) >>= fun w__345 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                      (match w__345 with
                                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                                         (FSGNJ_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                          returnm (Some
                                                                                                                                                                                                                                                                     (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                        (rs2, rs1, rd, FSGNJ_S), build_ex
                                                                                                                                                                                                                                                                     (projT1
                                                                                                                                                                                                                                                                      (sub_nat
                                                                                                                                                                                                                                                                         (projT1
                                                                                                                                                                                                                                                                          (string_length
                                                                                                                                                                                                                                                                             arg_))
                                                                                                                                                                                                                                                                         (projT1
                                                                                                                                                                                                                                                                          (string_length
                                                                                                                                                                                                                                                                             s_))))))
                                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                                          exit tt
                                                                                                                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                            0)})))
                                                                                                                                                                                                                                                       end)
                                                                                                                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                        0)})))
                                                                                                                                                                                                                                                    else
                                                                                                                                                                                                                                                      (_s5337_
                                                                                                                                                                                                                                                         _s4104_) >>= fun w__348 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                      (if
                                                                                                                                                                                                                                                         match w__348 with
                                                                                                                                                                                                                                                         | Some
                                                                                                                                                                                                                                                           (FSGNJN_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                            true
                                                                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                                                                            false
                                                                                                                                                                                                                                                         end
                                                                                                                                                                                                                                                       then
                                                                                                                                                                                                                                                         (_s5337_
                                                                                                                                                                                                                                                            _s4104_) >>= fun w__349 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                         (match w__349 with
                                                                                                                                                                                                                                                          | Some
                                                                                                                                                                                                                                                            (FSGNJN_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                             returnm (Some
                                                                                                                                                                                                                                                                        (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                           (rs2, rs1, rd, FSGNJN_S), build_ex
                                                                                                                                                                                                                                                                        (projT1
                                                                                                                                                                                                                                                                         (sub_nat
                                                                                                                                                                                                                                                                            (projT1
                                                                                                                                                                                                                                                                             (string_length
                                                                                                                                                                                                                                                                                arg_))
                                                                                                                                                                                                                                                                            (projT1
                                                                                                                                                                                                                                                                             (string_length
                                                                                                                                                                                                                                                                                s_))))))
                                                                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                                                                             exit tt
                                                                                                                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                               0)})))
                                                                                                                                                                                                                                                          end)
                                                                                                                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                           0)})))
                                                                                                                                                                                                                                                       else
                                                                                                                                                                                                                                                         (_s5354_
                                                                                                                                                                                                                                                            _s4104_) >>= fun w__352 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                         (if
                                                                                                                                                                                                                                                            match w__352 with
                                                                                                                                                                                                                                                            | Some
                                                                                                                                                                                                                                                              (FSGNJX_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                               true
                                                                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                                                                               false
                                                                                                                                                                                                                                                            end
                                                                                                                                                                                                                                                          then
                                                                                                                                                                                                                                                            (_s5354_
                                                                                                                                                                                                                                                               _s4104_) >>= fun w__353 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                            (match w__353 with
                                                                                                                                                                                                                                                             | Some
                                                                                                                                                                                                                                                               (FSGNJX_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                returnm (Some
                                                                                                                                                                                                                                                                           (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                              (rs2, rs1, rd, FSGNJX_S), build_ex
                                                                                                                                                                                                                                                                           (projT1
                                                                                                                                                                                                                                                                            (sub_nat
                                                                                                                                                                                                                                                                               (projT1
                                                                                                                                                                                                                                                                                (string_length
                                                                                                                                                                                                                                                                                   arg_))
                                                                                                                                                                                                                                                                               (projT1
                                                                                                                                                                                                                                                                                (string_length
                                                                                                                                                                                                                                                                                   s_))))))
                                                                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                                                                exit tt
                                                                                                                                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                  0)})))
                                                                                                                                                                                                                                                             end)
                                                                                                                                                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                              0)})))
                                                                                                                                                                                                                                                          else
                                                                                                                                                                                                                                                            (_s5371_
                                                                                                                                                                                                                                                               _s4104_) >>= fun w__356 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                            (if
                                                                                                                                                                                                                                                               match w__356 with
                                                                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                                                                 (FMIN_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                  true
                                                                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                                                                  false
                                                                                                                                                                                                                                                               end
                                                                                                                                                                                                                                                             then
                                                                                                                                                                                                                                                               (_s5371_
                                                                                                                                                                                                                                                                  _s4104_) >>= fun w__357 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                               (match w__357 with
                                                                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                                                                  (FMIN_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                   returnm (Some
                                                                                                                                                                                                                                                                              (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                                 (rs2, rs1, rd, FMIN_S), build_ex
                                                                                                                                                                                                                                                                              (projT1
                                                                                                                                                                                                                                                                               (sub_nat
                                                                                                                                                                                                                                                                                  (projT1
                                                                                                                                                                                                                                                                                   (string_length
                                                                                                                                                                                                                                                                                      arg_))
                                                                                                                                                                                                                                                                                  (projT1
                                                                                                                                                                                                                                                                                   (string_length
                                                                                                                                                                                                                                                                                      s_))))))
                                                                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                                                                   exit tt
                                                                                                                                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                     0)})))
                                                                                                                                                                                                                                                                end)
                                                                                                                                                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                 0)})))
                                                                                                                                                                                                                                                             else
                                                                                                                                                                                                                                                               (_s5388_
                                                                                                                                                                                                                                                                  _s4104_) >>= fun w__360 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                               (if
                                                                                                                                                                                                                                                                  match w__360 with
                                                                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                                                                    (FMAX_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                     true
                                                                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                                                                     false
                                                                                                                                                                                                                                                                  end
                                                                                                                                                                                                                                                                then
                                                                                                                                                                                                                                                                  (_s5388_
                                                                                                                                                                                                                                                                     _s4104_) >>= fun w__361 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                  (match w__361 with
                                                                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                                                                     (FMAX_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                      returnm (Some
                                                                                                                                                                                                                                                                                 (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                                    (rs2, rs1, rd, FMAX_S), build_ex
                                                                                                                                                                                                                                                                                 (projT1
                                                                                                                                                                                                                                                                                  (sub_nat
                                                                                                                                                                                                                                                                                     (projT1
                                                                                                                                                                                                                                                                                      (string_length
                                                                                                                                                                                                                                                                                         arg_))
                                                                                                                                                                                                                                                                                     (projT1
                                                                                                                                                                                                                                                                                      (string_length
                                                                                                                                                                                                                                                                                         s_))))))
                                                                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                                                                      exit tt
                                                                                                                                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                        0)})))
                                                                                                                                                                                                                                                                   end)
                                                                                                                                                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                    0)})))
                                                                                                                                                                                                                                                                else
                                                                                                                                                                                                                                                                  (_s5405_
                                                                                                                                                                                                                                                                     _s4104_) >>= fun w__364 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                  (if
                                                                                                                                                                                                                                                                     match w__364 with
                                                                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                                                                       (FEQ_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                        true
                                                                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                                                                        false
                                                                                                                                                                                                                                                                     end
                                                                                                                                                                                                                                                                   then
                                                                                                                                                                                                                                                                     (_s5405_
                                                                                                                                                                                                                                                                        _s4104_) >>= fun w__365 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                     (match w__365 with
                                                                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                                                                        (FEQ_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                         returnm (Some
                                                                                                                                                                                                                                                                                    (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                                       (rs2, rs1, rd, FEQ_S), build_ex
                                                                                                                                                                                                                                                                                    (projT1
                                                                                                                                                                                                                                                                                     (sub_nat
                                                                                                                                                                                                                                                                                        (projT1
                                                                                                                                                                                                                                                                                         (string_length
                                                                                                                                                                                                                                                                                            arg_))
                                                                                                                                                                                                                                                                                        (projT1
                                                                                                                                                                                                                                                                                         (string_length
                                                                                                                                                                                                                                                                                            s_))))))
                                                                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                                                                         exit tt
                                                                                                                                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                           0)})))
                                                                                                                                                                                                                                                                      end)
                                                                                                                                                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                       0)})))
                                                                                                                                                                                                                                                                   else
                                                                                                                                                                                                                                                                     (_s5422_
                                                                                                                                                                                                                                                                        _s4104_) >>= fun w__368 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                     (if
                                                                                                                                                                                                                                                                        match w__368 with
                                                                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                                                                          (FLT_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                           true
                                                                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                                                                           false
                                                                                                                                                                                                                                                                        end
                                                                                                                                                                                                                                                                      then
                                                                                                                                                                                                                                                                        (_s5422_
                                                                                                                                                                                                                                                                           _s4104_) >>= fun w__369 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                        (match w__369 with
                                                                                                                                                                                                                                                                         | Some
                                                                                                                                                                                                                                                                           (FLT_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                            returnm (Some
                                                                                                                                                                                                                                                                                       (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                                          (rs2, rs1, rd, FLT_S), build_ex
                                                                                                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                                                                                                        (sub_nat
                                                                                                                                                                                                                                                                                           (projT1
                                                                                                                                                                                                                                                                                            (string_length
                                                                                                                                                                                                                                                                                               arg_))
                                                                                                                                                                                                                                                                                           (projT1
                                                                                                                                                                                                                                                                                            (string_length
                                                                                                                                                                                                                                                                                               s_))))))
                                                                                                                                                                                                                                                                         | _ =>
                                                                                                                                                                                                                                                                            exit tt
                                                                                                                                                                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                              0)})))
                                                                                                                                                                                                                                                                         end)
                                                                                                                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                          0)})))
                                                                                                                                                                                                                                                                      else
                                                                                                                                                                                                                                                                        (_s5439_
                                                                                                                                                                                                                                                                           _s4104_) >>= fun w__372 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                        (if
                                                                                                                                                                                                                                                                           match w__372 with
                                                                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                                                                             (FLE_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                              true
                                                                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                                                                              false
                                                                                                                                                                                                                                                                           end
                                                                                                                                                                                                                                                                         then
                                                                                                                                                                                                                                                                           (_s5439_
                                                                                                                                                                                                                                                                              _s4104_) >>= fun w__373 : option ((f_bin_op_S * mword 5 * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                           (match w__373 with
                                                                                                                                                                                                                                                                            | Some
                                                                                                                                                                                                                                                                              (FLE_S, rd, rs1, rs2, s_) =>
                                                                                                                                                                                                                                                                               returnm (Some
                                                                                                                                                                                                                                                                                          (F_BIN_TYPE_S
                                                                                                                                                                                                                                                                                             (rs2, rs1, rd, FLE_S), build_ex
                                                                                                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                                                                                                           (sub_nat
                                                                                                                                                                                                                                                                                              (projT1
                                                                                                                                                                                                                                                                                               (string_length
                                                                                                                                                                                                                                                                                                  arg_))
                                                                                                                                                                                                                                                                                              (projT1
                                                                                                                                                                                                                                                                                               (string_length
                                                                                                                                                                                                                                                                                                  s_))))))
                                                                                                                                                                                                                                                                            | _ =>
                                                                                                                                                                                                                                                                               exit tt
                                                                                                                                                                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                 0)})))
                                                                                                                                                                                                                                                                            end)
                                                                                                                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                             0)})))
                                                                                                                                                                                                                                                                         else
                                                                                                                                                                                                                                                                           (_s5456_
                                                                                                                                                                                                                                                                              _s4104_) >>= fun w__376 : option ((f_un_op_S * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                           (if
                                                                                                                                                                                                                                                                              match w__376 with
                                                                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                                                                (FMV_X_W, rd, rs1, s_) =>
                                                                                                                                                                                                                                                                                 true
                                                                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                                                                 false
                                                                                                                                                                                                                                                                              end
                                                                                                                                                                                                                                                                            then
                                                                                                                                                                                                                                                                              (_s5456_
                                                                                                                                                                                                                                                                                 _s4104_) >>= fun w__377 : option ((f_un_op_S * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                              (match w__377 with
                                                                                                                                                                                                                                                                               | Some
                                                                                                                                                                                                                                                                                 (FMV_X_W, rd, rs1, s_) =>
                                                                                                                                                                                                                                                                                  returnm (Some
                                                                                                                                                                                                                                                                                             (F_UN_TYPE_S
                                                                                                                                                                                                                                                                                                (rs1, rd, FMV_X_W), build_ex
                                                                                                                                                                                                                                                                                             (projT1
                                                                                                                                                                                                                                                                                              (sub_nat
                                                                                                                                                                                                                                                                                                 (projT1
                                                                                                                                                                                                                                                                                                  (string_length
                                                                                                                                                                                                                                                                                                     arg_))
                                                                                                                                                                                                                                                                                                 (projT1
                                                                                                                                                                                                                                                                                                  (string_length
                                                                                                                                                                                                                                                                                                     s_))))))
                                                                                                                                                                                                                                                                               | _ =>
                                                                                                                                                                                                                                                                                  exit tt
                                                                                                                                                                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                    0)})))
                                                                                                                                                                                                                                                                               end)
                                                                                                                                                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                0)})))
                                                                                                                                                                                                                                                                            else
                                                                                                                                                                                                                                                                              (_s5469_
                                                                                                                                                                                                                                                                                 _s4104_) >>= fun w__380 : option ((f_un_op_S * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                              (if
                                                                                                                                                                                                                                                                                 match w__380 with
                                                                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                                                                   (FMV_W_X, rd, rs1, s_) =>
                                                                                                                                                                                                                                                                                    true
                                                                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                                                                    false
                                                                                                                                                                                                                                                                                 end
                                                                                                                                                                                                                                                                               then
                                                                                                                                                                                                                                                                                 (_s5469_
                                                                                                                                                                                                                                                                                    _s4104_) >>= fun w__381 : option ((f_un_op_S * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                                 (match w__381 with
                                                                                                                                                                                                                                                                                  | Some
                                                                                                                                                                                                                                                                                    (FMV_W_X, rd, rs1, s_) =>
                                                                                                                                                                                                                                                                                     returnm (Some
                                                                                                                                                                                                                                                                                                (F_UN_TYPE_S
                                                                                                                                                                                                                                                                                                   (rs1, rd, FMV_W_X), build_ex
                                                                                                                                                                                                                                                                                                (projT1
                                                                                                                                                                                                                                                                                                 (sub_nat
                                                                                                                                                                                                                                                                                                    (projT1
                                                                                                                                                                                                                                                                                                     (string_length
                                                                                                                                                                                                                                                                                                        arg_))
                                                                                                                                                                                                                                                                                                    (projT1
                                                                                                                                                                                                                                                                                                     (string_length
                                                                                                                                                                                                                                                                                                        s_))))))
                                                                                                                                                                                                                                                                                  | _ =>
                                                                                                                                                                                                                                                                                     exit tt
                                                                                                                                                                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                       0)})))
                                                                                                                                                                                                                                                                                  end)
                                                                                                                                                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                   0)})))
                                                                                                                                                                                                                                                                               else
                                                                                                                                                                                                                                                                                 (_s5482_
                                                                                                                                                                                                                                                                                    _s4104_) >>= fun w__384 : option ((f_un_op_S * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                                 (if
                                                                                                                                                                                                                                                                                    match w__384 with
                                                                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                                                                      (FCLASS_S, rd, rs1, s_) =>
                                                                                                                                                                                                                                                                                       true
                                                                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                                                                       false
                                                                                                                                                                                                                                                                                    end
                                                                                                                                                                                                                                                                                  then
                                                                                                                                                                                                                                                                                    (_s5482_
                                                                                                                                                                                                                                                                                       _s4104_) >>= fun w__385 : option ((f_un_op_S * mword 5 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                                    (match w__385 with
                                                                                                                                                                                                                                                                                     | Some
                                                                                                                                                                                                                                                                                       (FCLASS_S, rd, rs1, s_) =>
                                                                                                                                                                                                                                                                                        returnm (Some
                                                                                                                                                                                                                                                                                                   (F_UN_TYPE_S
                                                                                                                                                                                                                                                                                                      (rs1, rd, FCLASS_S), build_ex
                                                                                                                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                                                                                                                    (sub_nat
                                                                                                                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                                                                                                                           arg_))
                                                                                                                                                                                                                                                                                                       (projT1
                                                                                                                                                                                                                                                                                                        (string_length
                                                                                                                                                                                                                                                                                                           s_))))))
                                                                                                                                                                                                                                                                                     | _ =>
                                                                                                                                                                                                                                                                                        exit tt
                                                                                                                                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                          0)})))
                                                                                                                                                                                                                                                                                     end)
                                                                                                                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                      0)})))
                                                                                                                                                                                                                                                                                  else
                                                                                                                                                                                                                                                                                    (_s5495_
                                                                                                                                                                                                                                                                                       _s4104_) >>= fun w__388 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                                                                                                                                                                    (if
                                                                                                                                                                                                                                                                                       match w__388 with
                                                                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                                                                         (rd, imm, s_) =>
                                                                                                                                                                                                                                                                                          Z.eqb
                                                                                                                                                                                                                                                                                            32
                                                                                                                                                                                                                                                                                            32
                                                                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                                                                          false
                                                                                                                                                                                                                                                                                       end
                                                                                                                                                                                                                                                                                     then
                                                                                                                                                                                                                                                                                       (_s5495_
                                                                                                                                                                                                                                                                                          _s4104_) >>= fun w__389 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                                                                                                                                                                       (match w__389 with
                                                                                                                                                                                                                                                                                        | Some
                                                                                                                                                                                                                                                                                          (rd, imm, s_) =>
                                                                                                                                                                                                                                                                                           returnm (Some
                                                                                                                                                                                                                                                                                                      (C_FLWSP
                                                                                                                                                                                                                                                                                                         (imm, rd), build_ex
                                                                                                                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                                                                                                                       (sub_nat
                                                                                                                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                                                                                                                              arg_))
                                                                                                                                                                                                                                                                                                          (projT1
                                                                                                                                                                                                                                                                                                           (string_length
                                                                                                                                                                                                                                                                                                              s_))))))
                                                                                                                                                                                                                                                                                        | _ =>
                                                                                                                                                                                                                                                                                           exit tt
                                                                                                                                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                             0)})))
                                                                                                                                                                                                                                                                                        end)
                                                                                                                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                         0)})))
                                                                                                                                                                                                                                                                                     else
                                                                                                                                                                                                                                                                                       (_s5507_
                                                                                                                                                                                                                                                                                          _s4104_) >>= fun w__392 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                                                                                                                                                                       (if
                                                                                                                                                                                                                                                                                          match w__392 with
                                                                                                                                                                                                                                                                                          | Some
                                                                                                                                                                                                                                                                                            (rd, uimm, s_) =>
                                                                                                                                                                                                                                                                                             Z.eqb
                                                                                                                                                                                                                                                                                               32
                                                                                                                                                                                                                                                                                               32
                                                                                                                                                                                                                                                                                          | _ =>
                                                                                                                                                                                                                                                                                             false
                                                                                                                                                                                                                                                                                          end
                                                                                                                                                                                                                                                                                        then
                                                                                                                                                                                                                                                                                          (_s5507_
                                                                                                                                                                                                                                                                                             _s4104_) >>= fun w__393 : option ((mword 5 * mword 6 * string)) =>
                                                                                                                                                                                                                                                                                          (match w__393 with
                                                                                                                                                                                                                                                                                           | Some
                                                                                                                                                                                                                                                                                             (rd, uimm, s_) =>
                                                                                                                                                                                                                                                                                              returnm (Some
                                                                                                                                                                                                                                                                                                         (C_FSWSP
                                                                                                                                                                                                                                                                                                            (uimm, rd), build_ex
                                                                                                                                                                                                                                                                                                         (projT1
                                                                                                                                                                                                                                                                                                          (sub_nat
                                                                                                                                                                                                                                                                                                             (projT1
                                                                                                                                                                                                                                                                                                              (string_length
                                                                                                                                                                                                                                                                                                                 arg_))
                                                                                                                                                                                                                                                                                                             (projT1
                                                                                                                                                                                                                                                                                                              (string_length
                                                                                                                                                                                                                                                                                                                 s_))))))
                                                                                                                                                                                                                                                                                           | _ =>
                                                                                                                                                                                                                                                                                              exit tt
                                                                                                                                                                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                0)})))
                                                                                                                                                                                                                                                                                           end)
                                                                                                                                                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                            0)})))
                                                                                                                                                                                                                                                                                        else
                                                                                                                                                                                                                                                                                          (_s5519_
                                                                                                                                                                                                                                                                                             _s4104_) >>= fun w__396 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                                          (if
                                                                                                                                                                                                                                                                                             match w__396 with
                                                                                                                                                                                                                                                                                             | Some
                                                                                                                                                                                                                                                                                               (rdc, rsc, uimm, s_) =>
                                                                                                                                                                                                                                                                                                Z.eqb
                                                                                                                                                                                                                                                                                                  32
                                                                                                                                                                                                                                                                                                  32
                                                                                                                                                                                                                                                                                             | _ =>
                                                                                                                                                                                                                                                                                                false
                                                                                                                                                                                                                                                                                             end
                                                                                                                                                                                                                                                                                           then
                                                                                                                                                                                                                                                                                             (_s5519_
                                                                                                                                                                                                                                                                                                _s4104_) >>= fun w__397 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                                             (match w__397 with
                                                                                                                                                                                                                                                                                              | Some
                                                                                                                                                                                                                                                                                                (rdc, rsc, uimm, s_) =>
                                                                                                                                                                                                                                                                                                 returnm (Some
                                                                                                                                                                                                                                                                                                            (C_FLW
                                                                                                                                                                                                                                                                                                               (uimm, rsc, rdc), build_ex
                                                                                                                                                                                                                                                                                                            (projT1
                                                                                                                                                                                                                                                                                                             (sub_nat
                                                                                                                                                                                                                                                                                                                (projT1
                                                                                                                                                                                                                                                                                                                 (string_length
                                                                                                                                                                                                                                                                                                                    arg_))
                                                                                                                                                                                                                                                                                                                (projT1
                                                                                                                                                                                                                                                                                                                 (string_length
                                                                                                                                                                                                                                                                                                                    s_))))))
                                                                                                                                                                                                                                                                                              | _ =>
                                                                                                                                                                                                                                                                                                 exit tt
                                                                                                                                                                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                   0)})))
                                                                                                                                                                                                                                                                                              end)
                                                                                                                                                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                               0)})))
                                                                                                                                                                                                                                                                                           else
                                                                                                                                                                                                                                                                                             (_s5535_
                                                                                                                                                                                                                                                                                                _s4104_) >>= fun w__400 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                                             (if
                                                                                                                                                                                                                                                                                                match w__400 with
                                                                                                                                                                                                                                                                                                | Some
                                                                                                                                                                                                                                                                                                  (rsc1, rsc2, uimm, s_) =>
                                                                                                                                                                                                                                                                                                   Z.eqb
                                                                                                                                                                                                                                                                                                     32
                                                                                                                                                                                                                                                                                                     32
                                                                                                                                                                                                                                                                                                | _ =>
                                                                                                                                                                                                                                                                                                   false
                                                                                                                                                                                                                                                                                                end
                                                                                                                                                                                                                                                                                              then
                                                                                                                                                                                                                                                                                                (_s5535_
                                                                                                                                                                                                                                                                                                   _s4104_) >>= fun w__401 : option ((mword 3 * mword 3 * mword 5 * string)) =>
                                                                                                                                                                                                                                                                                                (match w__401 with
                                                                                                                                                                                                                                                                                                 | Some
                                                                                                                                                                                                                                                                                                   (rsc1, rsc2, uimm, s_) =>
                                                                                                                                                                                                                                                                                                    returnm (Some
                                                                                                                                                                                                                                                                                                               (C_FSW
                                                                                                                                                                                                                                                                                                                  (uimm, rsc1, rsc2), build_ex
                                                                                                                                                                                                                                                                                                               (projT1
                                                                                                                                                                                                                                                                                                                (sub_nat
                                                                                                                                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                                                                                                                                    (string_length
                                                                                                                                                                                                                                                                                                                       arg_))
                                                                                                                                                                                                                                                                                                                   (projT1
                                                                                                                                                                                                                                                                                                                    (string_length
                                                                                                                                                                                                                                                                                                                       s_))))))
                                                                                                                                                                                                                                                                                                 | _ =>
                                                                                                                                                                                                                                                                                                    exit tt
                                                                                                                                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                      0)})))
                                                                                                                                                                                                                                                                                                 end)
                                                                                                                                                                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                  0)})))
                                                                                                                                                                                                                                                                                              else
                                                                                                                                                                                                                                                                                                (_s5551_
                                                                                                                                                                                                                                                                                                   _s4104_) >>= fun w__404 : option ((mword 32 * string)) =>
                                                                                                                                                                                                                                                                                                (if
                                                                                                                                                                                                                                                                                                   match w__404 with
                                                                                                                                                                                                                                                                                                   | Some
                                                                                                                                                                                                                                                                                                     (s, s_) =>
                                                                                                                                                                                                                                                                                                      true
                                                                                                                                                                                                                                                                                                   | _ =>
                                                                                                                                                                                                                                                                                                      false
                                                                                                                                                                                                                                                                                                   end
                                                                                                                                                                                                                                                                                                 then
                                                                                                                                                                                                                                                                                                   (_s5551_
                                                                                                                                                                                                                                                                                                      _s4104_) >>= fun w__405 : option ((mword 32 * string)) =>
                                                                                                                                                                                                                                                                                                   (match w__405 with
                                                                                                                                                                                                                                                                                                    | Some
                                                                                                                                                                                                                                                                                                      (s, s_) =>
                                                                                                                                                                                                                                                                                                       returnm (Some
                                                                                                                                                                                                                                                                                                                  (ILLEGAL
                                                                                                                                                                                                                                                                                                                     s, build_ex
                                                                                                                                                                                                                                                                                                                  (projT1
                                                                                                                                                                                                                                                                                                                   (sub_nat
                                                                                                                                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                                                                                                                                       (string_length
                                                                                                                                                                                                                                                                                                                          arg_))
                                                                                                                                                                                                                                                                                                                      (projT1
                                                                                                                                                                                                                                                                                                                       (string_length
                                                                                                                                                                                                                                                                                                                          s_))))))
                                                                                                                                                                                                                                                                                                    | _ =>
                                                                                                                                                                                                                                                                                                       exit tt
                                                                                                                                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                         0)})))
                                                                                                                                                                                                                                                                                                    end)
                                                                                                                                                                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                     0)})))
                                                                                                                                                                                                                                                                                                 else
                                                                                                                                                                                                                                                                                                   (_s5559_
                                                                                                                                                                                                                                                                                                      _s4104_) >>= fun w__408 : option ((mword 16 * string)) =>
                                                                                                                                                                                                                                                                                                   (if
                                                                                                                                                                                                                                                                                                      match w__408 with
                                                                                                                                                                                                                                                                                                      | Some
                                                                                                                                                                                                                                                                                                        (s, s_) =>
                                                                                                                                                                                                                                                                                                         true
                                                                                                                                                                                                                                                                                                      | _ =>
                                                                                                                                                                                                                                                                                                         false
                                                                                                                                                                                                                                                                                                      end
                                                                                                                                                                                                                                                                                                    then
                                                                                                                                                                                                                                                                                                      (_s5559_
                                                                                                                                                                                                                                                                                                         _s4104_) >>= fun w__409 : option ((mword 16 * string)) =>
                                                                                                                                                                                                                                                                                                      (match w__409 with
                                                                                                                                                                                                                                                                                                       | Some
                                                                                                                                                                                                                                                                                                         (s, s_) =>
                                                                                                                                                                                                                                                                                                          returnm (Some
                                                                                                                                                                                                                                                                                                                     (C_ILLEGAL
                                                                                                                                                                                                                                                                                                                        s, build_ex
                                                                                                                                                                                                                                                                                                                     (projT1
                                                                                                                                                                                                                                                                                                                      (sub_nat
                                                                                                                                                                                                                                                                                                                         (projT1
                                                                                                                                                                                                                                                                                                                          (string_length
                                                                                                                                                                                                                                                                                                                             arg_))
                                                                                                                                                                                                                                                                                                                         (projT1
                                                                                                                                                                                                                                                                                                                          (string_length
                                                                                                                                                                                                                                                                                                                             s_))))))
                                                                                                                                                                                                                                                                                                       | _ =>
                                                                                                                                                                                                                                                                                                          exit tt
                                                                                                                                                                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                            0)})))
                                                                                                                                                                                                                                                                                                       end)
                                                                                                                                                                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                        0)})))
                                                                                                                                                                                                                                                                                                    else
                                                                                                                                                                                                                                                                                                      returnm None)
                                                                                                                                                                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                     0)}))))
                                                                                                                                                                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                                  0)}))))
                                                                                                                                                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                               0)}))))
                                                                                                                                                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                            0)}))))
                                                                                                                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                         0)}))))
                                                                                                                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                      0)}))))
                                                                                                                                                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                   0)}))))
                                                                                                                                                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                                0)}))))
                                                                                                                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                             0)}))))
                                                                                                                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                          0)}))))
                                                                                                                                                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                       0)}))))
                                                                                                                                                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                    0)}))))
                                                                                                                                                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                                 0)}))))
                                                                                                                                                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                              0)}))))
                                                                                                                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                           0)}))))
                                                                                                                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                        0)}))))
                                                                                                                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                     0)}))))
                                                                                                                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                                  0)}))))
                                                                                                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                               0)}))))
                                                                                                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                            0)}))))
                                                                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                         0)}))))
                                                                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                      0)}))))
                                                                                                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                   0)}))))
                                                                                                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                                0)}))))
                                                                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                             0)}))))
                                                                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                          0)}))))
                                                                                                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                       0)}))))
                                                                                                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                    0)}))))
                                                                                                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                                 0)}))))
                                                                                                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                              0)}))))
                                                                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                           0)}))))
                                                                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                        0)}))))
                                                                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                     0)}))))
                                                                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                                  0)}))))
                                                                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                               0)}))))
                                                                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                            0)}))))
                                                                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                         0)}))))
                                                                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                      0)}))))
                                                                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                   0)}))))
                                                                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                                0)}))))
                                                                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                             0)}))))
                                                                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                          0)}))))
                                                                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                       0)}))))
                                                                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                    0)}))))
                                                                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                                 0)}))))
                                                                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                              0)}))))
                                                                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                           0)}))))
                                                                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                        0)}))))
                                                                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                     0)}))))
                                                                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                                  0)}))))
                                                                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                               0)}))))
                                                                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                            0)}))))
                                                                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                         0)}))))
                                                                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                      0)}))))
                                                                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                   0)}))))
                                                                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                                0)}))))
                                                                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                             0)}))))
                                                                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                          0)}))))
                                                                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                       0)}))))
                                                                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                    0)}))))
                                                                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                                 0)}))))
                                                                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                              0)}))))
                                                                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                           0)}))))
                                                                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                        0)}))))
                                                                                                    : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                     0)}))))
                                                                                                 : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                                  0)}))))
                                                                                              : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                               0)}))))
                                                                                           : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                            0)}))))
                                                                                        : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                         0)}))))
                                                                                     : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                      0)}))))
                                                                                  : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                   0)}))))
                                                                               : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                                0)}))))
                                                                            : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                             0)}))))
                                                                         : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                          0)}))))
                                                                      : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                       0)}))))
                                                                   : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                    0)}))))
                                                                : M (option ((ast * {n : Z & ArithFact (n >=?
                                                                 0)}))))
                                                             : M (option ((ast * {n : Z & ArithFact (n >=?
                                                              0)}))))
                                                          : M (option ((ast * {n : Z & ArithFact (n >=?
                                                           0)}))))
                                                       : M (option ((ast * {n : Z & ArithFact (n >=?
                                                        0)}))))
                                                    : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                                                 : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                                              : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                                           : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                                        : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                                     : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                                  : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                               : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                            : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                         : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                      : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                   : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
                : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
             : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
          : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
       : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))))
    : M (option ((ast * {n : Z & ArithFact (n >=? 0)}))).

Definition print_insn (insn : ast) : M (string) := (assembly_forwards insn)  : M (string).

Definition decode (bv : mword 32) : M (ast) := (encdec_backwards bv)  : M (ast).

Definition decodeCompressed (bv : mword 16) : M (ast) :=
   (encdec_compressed_backwards bv)  : M (ast).



