(* Generated by coq-of-rust *)
Require Import CoqOfRust.CoqOfRust.

Module annotated_visitor.
  (* Trait *)
  (* Empty module 'Visitor' *)
  
  (* Trait *)
  Module Traversal.
    Definition traverse_u8
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; _value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let _value := M.alloc (| _value |) in
          Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_u8 :
      M.IsProvidedMethod "move_core_types::annotated_visitor::Traversal" "traverse_u8" traverse_u8.
    Definition traverse_u16
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; _value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let _value := M.alloc (| _value |) in
          Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_u16 :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_u16"
        traverse_u16.
    Definition traverse_u32
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; _value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let _value := M.alloc (| _value |) in
          Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_u32 :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_u32"
        traverse_u32.
    Definition traverse_u64
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; _value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let _value := M.alloc (| _value |) in
          Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_u64 :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_u64"
        traverse_u64.
    Definition traverse_u128
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; _value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let _value := M.alloc (| _value |) in
          Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_u128 :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_u128"
        traverse_u128.
    Definition traverse_u256
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; _value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let _value := M.alloc (| _value |) in
          Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_u256 :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_u256"
        traverse_u256.
    Definition traverse_bool
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; _value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let _value := M.alloc (| _value |) in
          Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_bool :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_bool"
        traverse_bool.
    Definition traverse_address
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; _value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let _value := M.alloc (| _value |) in
          Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_address :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_address"
        traverse_address.
    Definition traverse_signer
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; _value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let _value := M.alloc (| _value |) in
          Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_signer :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_signer"
        traverse_signer.
    Definition traverse_vector
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; driver ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let driver := M.alloc (| driver |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let~ _ :=
                  M.loop (|
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::option::Option")
                                          []
                                          [ Ty.tuple [] ],
                                        "is_some",
                                        []
                                      |),
                                      [
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.apply
                                                      (Ty.path "core::option::Option")
                                                      []
                                                      [ Ty.tuple [] ];
                                                    Ty.associated
                                                  ],
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.path
                                                      "move_core_types::annotated_visitor::VecDriver",
                                                    "next_element",
                                                    [ Self ]
                                                  |),
                                                  [ M.read (| driver |); M.read (| self |) ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::ops::control_flow::ControlFlow::Break",
                                                    0
                                                  |) in
                                                let residual := M.copy (| γ0_0 |) in
                                                M.alloc (|
                                                  M.never_to_any (|
                                                    M.read (|
                                                      M.return_ (|
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::ops::try_trait::FromResidual",
                                                            Ty.apply
                                                              (Ty.path "core::result::Result")
                                                              []
                                                              [ Ty.tuple []; Ty.associated ],
                                                            [
                                                              Ty.apply
                                                                (Ty.path "core::result::Result")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "core::convert::Infallible";
                                                                  Ty.associated
                                                                ]
                                                            ],
                                                            "from_residual",
                                                            []
                                                          |),
                                                          [ M.read (| residual |) ]
                                                        |)
                                                      |)
                                                    |)
                                                  |)
                                                |)));
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::ops::control_flow::ControlFlow::Continue",
                                                    0
                                                  |) in
                                                let val := M.copy (| γ0_0 |) in
                                                val))
                                          ]
                                        |)
                                      ]
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (| Value.Tuple [] |)));
                          fun γ =>
                            ltac:(M.monadic
                              (M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    let~ _ :=
                                      M.alloc (|
                                        M.never_to_any (| M.read (| M.break (||) |) |)
                                      |) in
                                    M.alloc (| Value.Tuple [] |)
                                  |)
                                |)
                              |)))
                        ]
                      |)))
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_vector :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_vector"
        traverse_vector.
    Definition traverse_struct
        (Self : Ty.t)
        (ε : list Value.t)
        (τ : list Ty.t)
        (α : list Value.t)
        : M :=
      match ε, τ, α with
      | [], [], [ self; driver ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let driver := M.alloc (| driver |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                let~ _ :=
                  M.loop (|
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.apply
                                          (Ty.path "core::option::Option")
                                          []
                                          [
                                            Ty.tuple
                                              [
                                                Ty.apply
                                                  (Ty.path "&")
                                                  []
                                                  [
                                                    Ty.path
                                                      "move_core_types::annotated_value::MoveFieldLayout"
                                                  ];
                                                Ty.tuple []
                                              ]
                                          ],
                                        "is_some",
                                        []
                                      |),
                                      [
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.apply
                                                      (Ty.path "core::option::Option")
                                                      []
                                                      [
                                                        Ty.tuple
                                                          [
                                                            Ty.apply
                                                              (Ty.path "&")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "move_core_types::annotated_value::MoveFieldLayout"
                                                              ];
                                                            Ty.tuple []
                                                          ]
                                                      ];
                                                    Ty.associated
                                                  ],
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.path
                                                      "move_core_types::annotated_visitor::StructDriver",
                                                    "next_field",
                                                    [ Self ]
                                                  |),
                                                  [ M.read (| driver |); M.read (| self |) ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::ops::control_flow::ControlFlow::Break",
                                                    0
                                                  |) in
                                                let residual := M.copy (| γ0_0 |) in
                                                M.alloc (|
                                                  M.never_to_any (|
                                                    M.read (|
                                                      M.return_ (|
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::ops::try_trait::FromResidual",
                                                            Ty.apply
                                                              (Ty.path "core::result::Result")
                                                              []
                                                              [ Ty.tuple []; Ty.associated ],
                                                            [
                                                              Ty.apply
                                                                (Ty.path "core::result::Result")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "core::convert::Infallible";
                                                                  Ty.associated
                                                                ]
                                                            ],
                                                            "from_residual",
                                                            []
                                                          |),
                                                          [ M.read (| residual |) ]
                                                        |)
                                                      |)
                                                    |)
                                                  |)
                                                |)));
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::ops::control_flow::ControlFlow::Continue",
                                                    0
                                                  |) in
                                                let val := M.copy (| γ0_0 |) in
                                                val))
                                          ]
                                        |)
                                      ]
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (| Value.Tuple [] |)));
                          fun γ =>
                            ltac:(M.monadic
                              (M.alloc (|
                                M.never_to_any (|
                                  M.read (|
                                    let~ _ :=
                                      M.alloc (|
                                        M.never_to_any (| M.read (| M.break (||) |) |)
                                      |) in
                                    M.alloc (| Value.Tuple [] |)
                                  |)
                                |)
                              |)))
                        ]
                      |)))
                  |) in
                M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom ProvidedMethod_traverse_struct :
      M.IsProvidedMethod
        "move_core_types::annotated_visitor::Traversal"
        "traverse_struct"
        traverse_struct.
  End Traversal.
  
  Module Impl_move_core_types_annotated_visitor_Visitor_where_move_core_types_annotated_visitor_Traversal_T_where_core_marker_Sized_T_for_T.
    Definition Self (T : Ty.t) : Ty.t := T.
    
    (*     type Value = (); *)
    Definition _Value (T : Ty.t) : Ty.t := Ty.tuple [].
    
    (*     type Error = T::Error; *)
    Definition _Error (T : Ty.t) : Ty.t := Ty.associated.
    
    (*
        fn visit_u8(&mut self, value: u8) -> Result<Self::Value, Self::Error> {
            self.traverse_u8(value)
        }
    *)
    Definition visit_u8 (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let value := M.alloc (| value |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_u8",
              []
            |),
            [ M.read (| self |); M.read (| value |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_u16(&mut self, value: u16) -> Result<Self::Value, Self::Error> {
            self.traverse_u16(value)
        }
    *)
    Definition visit_u16 (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let value := M.alloc (| value |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_u16",
              []
            |),
            [ M.read (| self |); M.read (| value |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_u32(&mut self, value: u32) -> Result<Self::Value, Self::Error> {
            self.traverse_u32(value)
        }
    *)
    Definition visit_u32 (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let value := M.alloc (| value |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_u32",
              []
            |),
            [ M.read (| self |); M.read (| value |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_u64(&mut self, value: u64) -> Result<Self::Value, Self::Error> {
            self.traverse_u64(value)
        }
    *)
    Definition visit_u64 (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let value := M.alloc (| value |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_u64",
              []
            |),
            [ M.read (| self |); M.read (| value |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_u128(&mut self, value: u128) -> Result<Self::Value, Self::Error> {
            self.traverse_u128(value)
        }
    *)
    Definition visit_u128 (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let value := M.alloc (| value |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_u128",
              []
            |),
            [ M.read (| self |); M.read (| value |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_u256(&mut self, value: U256) -> Result<Self::Value, Self::Error> {
            self.traverse_u256(value)
        }
    *)
    Definition visit_u256 (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let value := M.alloc (| value |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_u256",
              []
            |),
            [ M.read (| self |); M.read (| value |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_bool(&mut self, value: bool) -> Result<Self::Value, Self::Error> {
            self.traverse_bool(value)
        }
    *)
    Definition visit_bool (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let value := M.alloc (| value |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_bool",
              []
            |),
            [ M.read (| self |); M.read (| value |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_address(&mut self, value: AccountAddress) -> Result<Self::Value, Self::Error> {
            self.traverse_address(value)
        }
    *)
    Definition visit_address (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let value := M.alloc (| value |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_address",
              []
            |),
            [ M.read (| self |); M.read (| value |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_signer(&mut self, value: AccountAddress) -> Result<Self::Value, Self::Error> {
            self.traverse_signer(value)
        }
    *)
    Definition visit_signer (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; value ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let value := M.alloc (| value |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_signer",
              []
            |),
            [ M.read (| self |); M.read (| value |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_vector(
            &mut self,
            driver: &mut VecDriver<'_, '_, '_>,
        ) -> Result<Self::Value, Self::Error> {
            self.traverse_vector(driver)
        }
    *)
    Definition visit_vector (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; driver ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let driver := M.alloc (| driver |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_vector",
              []
            |),
            [ M.read (| self |); M.read (| driver |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    (*
        fn visit_struct(
            &mut self,
            driver: &mut StructDriver<'_, '_, '_>,
        ) -> Result<Self::Value, Self::Error> {
            self.traverse_struct(driver)
        }
    *)
    Definition visit_struct (T : Ty.t) (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      let Self : Ty.t := Self T in
      match ε, τ, α with
      | [], [], [ self; driver ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let driver := M.alloc (| driver |) in
          M.call_closure (|
            M.get_trait_method (|
              "move_core_types::annotated_visitor::Traversal",
              T,
              [],
              "traverse_struct",
              []
            |),
            [ M.read (| self |); M.read (| driver |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      forall (T : Ty.t),
      M.IsTraitInstance
        "move_core_types::annotated_visitor::Visitor"
        (Self T)
        (* Trait polymorphic types *) []
        (* Instance *)
        [
          ("Value", InstanceField.Ty (_Value T));
          ("Error", InstanceField.Ty (_Error T));
          ("visit_u8", InstanceField.Method (visit_u8 T));
          ("visit_u16", InstanceField.Method (visit_u16 T));
          ("visit_u32", InstanceField.Method (visit_u32 T));
          ("visit_u64", InstanceField.Method (visit_u64 T));
          ("visit_u128", InstanceField.Method (visit_u128 T));
          ("visit_u256", InstanceField.Method (visit_u256 T));
          ("visit_bool", InstanceField.Method (visit_bool T));
          ("visit_address", InstanceField.Method (visit_address T));
          ("visit_signer", InstanceField.Method (visit_signer T));
          ("visit_vector", InstanceField.Method (visit_vector T));
          ("visit_struct", InstanceField.Method (visit_struct T))
        ].
  End Impl_move_core_types_annotated_visitor_Visitor_where_move_core_types_annotated_visitor_Traversal_T_where_core_marker_Sized_T_for_T.
  
  (* StructRecord
    {
      name := "VecDriver";
      const_params := [];
      ty_params := [];
      fields :=
        [
          ("bytes",
            Ty.apply
              (Ty.path "&mut")
              []
              [ Ty.apply (Ty.path "&") [] [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ] ]);
          ("layout",
            Ty.apply
              (Ty.path "&")
              []
              [ Ty.path "move_core_types::annotated_value::MoveTypeLayout" ]);
          ("len", Ty.path "u64");
          ("off", Ty.path "u64")
        ];
    } *)
  
  (* StructRecord
    {
      name := "StructDriver";
      const_params := [];
      ty_params := [];
      fields :=
        [
          ("bytes",
            Ty.apply
              (Ty.path "&mut")
              []
              [ Ty.apply (Ty.path "&") [] [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ] ]);
          ("layout",
            Ty.apply
              (Ty.path "&")
              []
              [ Ty.path "move_core_types::annotated_value::MoveStructLayout" ]);
          ("off", Ty.path "usize")
        ];
    } *)
  
  (*
  Enum Error
  {
    const_params := [];
    ty_params := [];
    variants :=
      [
        {
          name := "UnexpectedEof";
          item := StructTuple [];
          discriminant := None;
        };
        {
          name := "UnexpectedByte";
          item := StructTuple [ Ty.path "u8" ];
          discriminant := None;
        };
        {
          name := "TrailingBytes";
          item := StructTuple [ Ty.path "usize" ];
          discriminant := None;
        }
      ];
  }
  *)
  
  Module Impl_core_error_Error_for_move_core_types_annotated_visitor_Error.
    Definition Self : Ty.t := Ty.path "move_core_types::annotated_visitor::Error".
    
    Axiom Implements :
      M.IsTraitInstance
        "core::error::Error"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [].
  End Impl_core_error_Error_for_move_core_types_annotated_visitor_Error.
  
  Module Impl_core_fmt_Display_for_move_core_types_annotated_visitor_Error.
    Definition Self : Ty.t := Ty.path "move_core_types::annotated_visitor::Error".
    
    (* thiserror::Error *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; __formatter ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let __formatter := M.alloc (| __formatter |) in
          M.read (|
            M.match_operator (|
              self,
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ := M.read (| γ |) in
                    let _ :=
                      M.is_struct_tuple (|
                        γ,
                        "move_core_types::annotated_visitor::Error::UnexpectedEof"
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "core::fmt::Formatter",
                          "write_fmt",
                          []
                        |),
                        [
                          M.read (| __formatter |);
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "core::fmt::Arguments",
                              "new_const",
                              []
                            |),
                            [
                              M.alloc (|
                                Value.Array [ M.read (| Value.String "unexpected end of input" |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let γ := M.read (| γ |) in
                    let γ1_0 :=
                      M.SubPointer.get_struct_tuple_field (|
                        γ,
                        "move_core_types::annotated_visitor::Error::UnexpectedByte",
                        0
                      |) in
                    let _0 := M.alloc (| γ1_0 |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "core::fmt::Formatter",
                          "write_fmt",
                          []
                        |),
                        [
                          M.read (| __formatter |);
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "core::fmt::Arguments",
                              "new_v1",
                              []
                            |),
                            [
                              M.alloc (|
                                Value.Array [ M.read (| Value.String "unexpected byte: " |) ]
                              |);
                              M.alloc (|
                                Value.Array
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "core::fmt::rt::Argument",
                                        "new_display",
                                        [ Ty.apply (Ty.path "&") [] [ Ty.path "u8" ] ]
                                      |),
                                      [
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "thiserror::display::DisplayAsDisplay",
                                              Ty.apply (Ty.path "&") [] [ Ty.path "u8" ],
                                              [],
                                              "as_display",
                                              []
                                            |),
                                            [ _0 ]
                                          |)
                                        |)
                                      ]
                                    |)
                                  ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let γ := M.read (| γ |) in
                    let γ1_0 :=
                      M.SubPointer.get_struct_tuple_field (|
                        γ,
                        "move_core_types::annotated_visitor::Error::TrailingBytes",
                        0
                      |) in
                    let _0 := M.alloc (| γ1_0 |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "core::fmt::Formatter",
                          "write_fmt",
                          []
                        |),
                        [
                          M.read (| __formatter |);
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "core::fmt::Arguments",
                              "new_v1",
                              []
                            |),
                            [
                              M.alloc (|
                                Value.Array
                                  [
                                    M.read (| Value.String "trailing " |);
                                    M.read (| Value.String " byte(s) at the end of input" |)
                                  ]
                              |);
                              M.alloc (|
                                Value.Array
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "core::fmt::rt::Argument",
                                        "new_display",
                                        [ Ty.apply (Ty.path "&") [] [ Ty.path "usize" ] ]
                                      |),
                                      [
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "thiserror::display::DisplayAsDisplay",
                                              Ty.apply (Ty.path "&") [] [ Ty.path "usize" ],
                                              [],
                                              "as_display",
                                              []
                                            |),
                                            [ _0 ]
                                          |)
                                        |)
                                      ]
                                    |)
                                  ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Display"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Display_for_move_core_types_annotated_visitor_Error.
  
  Module Impl_core_fmt_Debug_for_move_core_types_annotated_visitor_Error.
    Definition Self : Ty.t := Ty.path "move_core_types::annotated_visitor::Error".
    
    (* Debug *)
    Definition fmt (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self; f ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let f := M.alloc (| f |) in
          M.read (|
            M.match_operator (|
              self,
              [
                fun γ =>
                  ltac:(M.monadic
                    (let γ := M.read (| γ |) in
                    let _ :=
                      M.is_struct_tuple (|
                        γ,
                        "move_core_types::annotated_visitor::Error::UnexpectedEof"
                      |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "core::fmt::Formatter",
                          "write_str",
                          []
                        |),
                        [ M.read (| f |); M.read (| Value.String "UnexpectedEof" |) ]
                      |)
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let γ := M.read (| γ |) in
                    let γ1_0 :=
                      M.SubPointer.get_struct_tuple_field (|
                        γ,
                        "move_core_types::annotated_visitor::Error::UnexpectedByte",
                        0
                      |) in
                    let __self_0 := M.alloc (| γ1_0 |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "core::fmt::Formatter",
                          "debug_tuple_field1_finish",
                          []
                        |),
                        [ M.read (| f |); M.read (| Value.String "UnexpectedByte" |); __self_0 ]
                      |)
                    |)));
                fun γ =>
                  ltac:(M.monadic
                    (let γ := M.read (| γ |) in
                    let γ1_0 :=
                      M.SubPointer.get_struct_tuple_field (|
                        γ,
                        "move_core_types::annotated_visitor::Error::TrailingBytes",
                        0
                      |) in
                    let __self_0 := M.alloc (| γ1_0 |) in
                    M.alloc (|
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.path "core::fmt::Formatter",
                          "debug_tuple_field1_finish",
                          []
                        |),
                        [ M.read (| f |); M.read (| Value.String "TrailingBytes" |); __self_0 ]
                      |)
                    |)))
              ]
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom Implements :
      M.IsTraitInstance
        "core::fmt::Debug"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("fmt", InstanceField.Method fmt) ].
  End Impl_core_fmt_Debug_for_move_core_types_annotated_visitor_Error.
  
  (* StructTuple
    {
      name := "NullTraversal";
      const_params := [];
      ty_params := [];
      fields := [];
    } *)
  
  Module Impl_move_core_types_annotated_visitor_Traversal_for_move_core_types_annotated_visitor_NullTraversal.
    Definition Self : Ty.t := Ty.path "move_core_types::annotated_visitor::NullTraversal".
    
    (*     type Error = Error; *)
    Definition _Error : Ty.t := Ty.path "move_core_types::annotated_visitor::Error".
    
    Axiom Implements :
      M.IsTraitInstance
        "move_core_types::annotated_visitor::Traversal"
        Self
        (* Trait polymorphic types *) []
        (* Instance *) [ ("Error", InstanceField.Ty _Error) ].
  End Impl_move_core_types_annotated_visitor_Traversal_for_move_core_types_annotated_visitor_NullTraversal.
  
  Module Impl_move_core_types_annotated_visitor_VecDriver.
    Definition Self : Ty.t := Ty.path "move_core_types::annotated_visitor::VecDriver".
    
    (*
        fn new(bytes: &'r mut &'b [u8], layout: &'l MoveTypeLayout, len: u64) -> Self {
            Self {
                bytes,
                layout,
                len,
                off: 0,
            }
        }
    *)
    Definition new (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ bytes; layout; len ] =>
        ltac:(M.monadic
          (let bytes := M.alloc (| bytes |) in
          let layout := M.alloc (| layout |) in
          let len := M.alloc (| len |) in
          Value.StructRecord
            "move_core_types::annotated_visitor::VecDriver"
            [
              ("bytes", M.read (| bytes |));
              ("layout", M.read (| layout |));
              ("len", M.read (| len |));
              ("off", Value.Integer IntegerKind.U64 0)
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_new : M.IsAssociatedFunction Self "new" new.
    
    (*
        pub fn element_layout(&self) -> &'l MoveTypeLayout {
            self.layout
        }
    *)
    Definition element_layout (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.SubPointer.get_struct_record_field (|
              M.read (| self |),
              "move_core_types::annotated_visitor::VecDriver",
              "layout"
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_element_layout :
      M.IsAssociatedFunction Self "element_layout" element_layout.
    
    (*
        pub fn len(&self) -> u64 {
            self.len
        }
    *)
    Definition len (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.SubPointer.get_struct_record_field (|
              M.read (| self |),
              "move_core_types::annotated_visitor::VecDriver",
              "len"
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_len : M.IsAssociatedFunction Self "len" len.
    
    (*
        pub fn has_element(&self) -> bool {
            self.off < self.len
        }
    *)
    Definition has_element (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          BinOp.lt (|
            M.read (|
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_core_types::annotated_visitor::VecDriver",
                "off"
              |)
            |),
            M.read (|
              M.SubPointer.get_struct_record_field (|
                M.read (| self |),
                "move_core_types::annotated_visitor::VecDriver",
                "len"
              |)
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_has_element : M.IsAssociatedFunction Self "has_element" has_element.
    
    (*
        pub fn next_element<V: Visitor + ?Sized>(
            &mut self,
            visitor: &mut V,
        ) -> Result<Option<V::Value>, V::Error> {
            Ok(if self.off >= self.len {
                None
            } else {
                let res = visit_value(self.bytes, self.layout, visitor)?;
                self.off += 1;
                Some(res)
            })
        }
    *)
    Definition next_element (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ V ], [ self; visitor ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let visitor := M.alloc (| visitor |) in
          M.catch_return (|
            ltac:(M.monadic
              (Value.StructTuple
                "core::result::Result::Ok"
                [
                  M.read (|
                    M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  BinOp.ge (|
                                    M.read (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "move_core_types::annotated_visitor::VecDriver",
                                        "off"
                                      |)
                                    |),
                                    M.read (|
                                      M.SubPointer.get_struct_record_field (|
                                        M.read (| self |),
                                        "move_core_types::annotated_visitor::VecDriver",
                                        "len"
                                      |)
                                    |)
                                  |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            M.alloc (| Value.StructTuple "core::option::Option::None" [] |)));
                        fun γ =>
                          ltac:(M.monadic
                            (let~ res :=
                              M.copy (|
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.associated; Ty.associated ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_core_types::annotated_visitor::visit_value",
                                            [ V ]
                                          |),
                                          [
                                            M.read (|
                                              M.SubPointer.get_struct_record_field (|
                                                M.read (| self |),
                                                "move_core_types::annotated_visitor::VecDriver",
                                                "bytes"
                                              |)
                                            |);
                                            M.read (|
                                              M.SubPointer.get_struct_record_field (|
                                                M.read (| self |),
                                                "move_core_types::annotated_visitor::VecDriver",
                                                "layout"
                                              |)
                                            |);
                                            M.read (| visitor |)
                                          ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Break",
                                            0
                                          |) in
                                        let residual := M.copy (| γ0_0 |) in
                                        M.alloc (|
                                          M.never_to_any (|
                                            M.read (|
                                              M.return_ (|
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::try_trait::FromResidual",
                                                    Ty.apply
                                                      (Ty.path "core::result::Result")
                                                      []
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::option::Option")
                                                          []
                                                          [ Ty.associated ];
                                                        Ty.associated
                                                      ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.associated
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              |) in
                            let~ _ :=
                              let β :=
                                M.SubPointer.get_struct_record_field (|
                                  M.read (| self |),
                                  "move_core_types::annotated_visitor::VecDriver",
                                  "off"
                                |) in
                              M.write (|
                                β,
                                BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.U64 1 |)
                              |) in
                            M.alloc (|
                              Value.StructTuple "core::option::Option::Some" [ M.read (| res |) ]
                            |)))
                      ]
                    |)
                  |)
                ]))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_next_element : M.IsAssociatedFunction Self "next_element" next_element.
    
    (*
        pub fn skip_element(&mut self) -> Result<bool, Error> {
            self.next_element(&mut NullTraversal).map(|v| v.is_some())
        }
    *)
    Definition skip_element (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "core::result::Result")
                []
                [
                  Ty.apply (Ty.path "core::option::Option") [] [ Ty.tuple [] ];
                  Ty.path "move_core_types::annotated_visitor::Error"
                ],
              "map",
              [
                Ty.path "bool";
                Ty.function
                  [ Ty.tuple [ Ty.apply (Ty.path "core::option::Option") [] [ Ty.tuple [] ] ] ]
                  (Ty.path "bool")
              ]
            |),
            [
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_core_types::annotated_visitor::VecDriver",
                  "next_element",
                  [ Ty.path "move_core_types::annotated_visitor::NullTraversal" ]
                |),
                [
                  M.read (| self |);
                  M.alloc (|
                    Value.StructTuple "move_core_types::annotated_visitor::NullTraversal" []
                  |)
                ]
              |);
              M.closure
                (fun γ =>
                  ltac:(M.monadic
                    match γ with
                    | [ α0 ] =>
                      ltac:(M.monadic
                        (M.match_operator (|
                          M.alloc (| α0 |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let v := M.copy (| γ |) in
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply (Ty.path "core::option::Option") [] [ Ty.tuple [] ],
                                    "is_some",
                                    []
                                  |),
                                  [ v ]
                                |)))
                          ]
                        |)))
                    | _ => M.impossible "wrong number of arguments"
                    end))
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_skip_element : M.IsAssociatedFunction Self "skip_element" skip_element.
  End Impl_move_core_types_annotated_visitor_VecDriver.
  
  Module Impl_move_core_types_annotated_visitor_StructDriver.
    Definition Self : Ty.t := Ty.path "move_core_types::annotated_visitor::StructDriver".
    
    (*
        fn new(bytes: &'r mut &'b [u8], layout: &'l MoveStructLayout) -> Self {
            Self {
                bytes,
                layout,
                off: 0,
            }
        }
    *)
    Definition new (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ bytes; layout ] =>
        ltac:(M.monadic
          (let bytes := M.alloc (| bytes |) in
          let layout := M.alloc (| layout |) in
          Value.StructRecord
            "move_core_types::annotated_visitor::StructDriver"
            [
              ("bytes", M.read (| bytes |));
              ("layout", M.read (| layout |));
              ("off", Value.Integer IntegerKind.Usize 0)
            ]))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_new : M.IsAssociatedFunction Self "new" new.
    
    (*
        pub fn struct_layout(&self) -> &'l MoveStructLayout {
            self.layout
        }
    *)
    Definition struct_layout (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.read (|
            M.SubPointer.get_struct_record_field (|
              M.read (| self |),
              "move_core_types::annotated_visitor::StructDriver",
              "layout"
            |)
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_struct_layout :
      M.IsAssociatedFunction Self "struct_layout" struct_layout.
    
    (*
        pub fn peek_field(&self) -> Option<&'l MoveFieldLayout> {
            self.layout.fields.get(self.off)
        }
    *)
    Definition peek_field (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "slice")
                []
                [ Ty.path "move_core_types::annotated_value::MoveFieldLayout" ],
              "get",
              [ Ty.path "usize" ]
            |),
            [
              M.call_closure (|
                M.get_trait_method (|
                  "core::ops::deref::Deref",
                  Ty.apply
                    (Ty.path "alloc::vec::Vec")
                    []
                    [
                      Ty.path "move_core_types::annotated_value::MoveFieldLayout";
                      Ty.path "alloc::alloc::Global"
                    ],
                  [],
                  "deref",
                  []
                |),
                [
                  M.SubPointer.get_struct_record_field (|
                    M.read (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| self |),
                        "move_core_types::annotated_visitor::StructDriver",
                        "layout"
                      |)
                    |),
                    "move_core_types::annotated_value::MoveStructLayout",
                    "fields"
                  |)
                ]
              |);
              M.read (|
                M.SubPointer.get_struct_record_field (|
                  M.read (| self |),
                  "move_core_types::annotated_visitor::StructDriver",
                  "off"
                |)
              |)
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_peek_field : M.IsAssociatedFunction Self "peek_field" peek_field.
    
    (*
        pub fn next_field<V: Visitor + ?Sized>(
            &mut self,
            visitor: &mut V,
        ) -> Result<Option<(&'l MoveFieldLayout, V::Value)>, V::Error> {
            let Some(field) = self.peek_field() else {
                return Ok(None);
            };
    
            let res = visit_value(self.bytes, &field.layout, visitor)?;
            self.off += 1;
            Ok(Some((field, res)))
        }
    *)
    Definition next_field (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ V ], [ self; visitor ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          let visitor := M.alloc (| visitor |) in
          M.catch_return (|
            ltac:(M.monadic
              (M.read (|
                M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "move_core_types::annotated_visitor::StructDriver",
                        "peek_field",
                        []
                      |),
                      [ M.read (| self |) ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::option::Option::Some",
                            0
                          |) in
                        let field := M.copy (| γ0_0 |) in
                        let~ res :=
                          M.copy (|
                            M.match_operator (|
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::try_trait::Try",
                                    Ty.apply
                                      (Ty.path "core::result::Result")
                                      []
                                      [ Ty.associated; Ty.associated ],
                                    [],
                                    "branch",
                                    []
                                  |),
                                  [
                                    M.call_closure (|
                                      M.get_function (|
                                        "move_core_types::annotated_visitor::visit_value",
                                        [ V ]
                                      |),
                                      [
                                        M.read (|
                                          M.SubPointer.get_struct_record_field (|
                                            M.read (| self |),
                                            "move_core_types::annotated_visitor::StructDriver",
                                            "bytes"
                                          |)
                                        |);
                                        M.SubPointer.get_struct_record_field (|
                                          M.read (| field |),
                                          "move_core_types::annotated_value::MoveFieldLayout",
                                          "layout"
                                        |);
                                        M.read (| visitor |)
                                      ]
                                    |)
                                  ]
                                |)
                              |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Break",
                                        0
                                      |) in
                                    let residual := M.copy (| γ0_0 |) in
                                    M.alloc (|
                                      M.never_to_any (|
                                        M.read (|
                                          M.return_ (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::FromResidual",
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.apply
                                                      (Ty.path "core::option::Option")
                                                      []
                                                      [
                                                        Ty.tuple
                                                          [
                                                            Ty.apply
                                                              (Ty.path "&")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "move_core_types::annotated_value::MoveFieldLayout"
                                                              ];
                                                            Ty.associated
                                                          ]
                                                      ];
                                                    Ty.associated
                                                  ],
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::result::Result")
                                                    []
                                                    [
                                                      Ty.path "core::convert::Infallible";
                                                      Ty.associated
                                                    ]
                                                ],
                                                "from_residual",
                                                []
                                              |),
                                              [ M.read (| residual |) ]
                                            |)
                                          |)
                                        |)
                                      |)
                                    |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ0_0 :=
                                      M.SubPointer.get_struct_tuple_field (|
                                        γ,
                                        "core::ops::control_flow::ControlFlow::Continue",
                                        0
                                      |) in
                                    let val := M.copy (| γ0_0 |) in
                                    val))
                              ]
                            |)
                          |) in
                        let~ _ :=
                          let β :=
                            M.SubPointer.get_struct_record_field (|
                              M.read (| self |),
                              "move_core_types::annotated_visitor::StructDriver",
                              "off"
                            |) in
                          M.write (|
                            β,
                            BinOp.Wrap.add (| M.read (| β |), Value.Integer IntegerKind.Usize 1 |)
                          |) in
                        M.alloc (|
                          Value.StructTuple
                            "core::result::Result::Ok"
                            [
                              Value.StructTuple
                                "core::option::Option::Some"
                                [ Value.Tuple [ M.read (| field |); M.read (| res |) ] ]
                            ]
                        |)))
                  ]
                |)
              |)))
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_next_field : M.IsAssociatedFunction Self "next_field" next_field.
    
    (*
        pub fn skip_field(&mut self) -> Result<Option<&'l MoveFieldLayout>, Error> {
            self.next_field(&mut NullTraversal)
                .map(|res| res.map(|(f, _)| f))
        }
    *)
    Definition skip_field (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [], [ self ] =>
        ltac:(M.monadic
          (let self := M.alloc (| self |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.apply
                (Ty.path "core::result::Result")
                []
                [
                  Ty.apply
                    (Ty.path "core::option::Option")
                    []
                    [
                      Ty.tuple
                        [
                          Ty.apply
                            (Ty.path "&")
                            []
                            [ Ty.path "move_core_types::annotated_value::MoveFieldLayout" ];
                          Ty.tuple []
                        ]
                    ];
                  Ty.path "move_core_types::annotated_visitor::Error"
                ],
              "map",
              [
                Ty.apply
                  (Ty.path "core::option::Option")
                  []
                  [
                    Ty.apply
                      (Ty.path "&")
                      []
                      [ Ty.path "move_core_types::annotated_value::MoveFieldLayout" ]
                  ];
                Ty.function
                  [
                    Ty.tuple
                      [
                        Ty.apply
                          (Ty.path "core::option::Option")
                          []
                          [
                            Ty.tuple
                              [
                                Ty.apply
                                  (Ty.path "&")
                                  []
                                  [ Ty.path "move_core_types::annotated_value::MoveFieldLayout" ];
                                Ty.tuple []
                              ]
                          ]
                      ]
                  ]
                  (Ty.apply
                    (Ty.path "core::option::Option")
                    []
                    [
                      Ty.apply
                        (Ty.path "&")
                        []
                        [ Ty.path "move_core_types::annotated_value::MoveFieldLayout" ]
                    ])
              ]
            |),
            [
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_core_types::annotated_visitor::StructDriver",
                  "next_field",
                  [ Ty.path "move_core_types::annotated_visitor::NullTraversal" ]
                |),
                [
                  M.read (| self |);
                  M.alloc (|
                    Value.StructTuple "move_core_types::annotated_visitor::NullTraversal" []
                  |)
                ]
              |);
              M.closure
                (fun γ =>
                  ltac:(M.monadic
                    match γ with
                    | [ α0 ] =>
                      ltac:(M.monadic
                        (M.match_operator (|
                          M.alloc (| α0 |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let res := M.copy (| γ |) in
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "core::option::Option")
                                      []
                                      [
                                        Ty.tuple
                                          [
                                            Ty.apply
                                              (Ty.path "&")
                                              []
                                              [
                                                Ty.path
                                                  "move_core_types::annotated_value::MoveFieldLayout"
                                              ];
                                            Ty.tuple []
                                          ]
                                      ],
                                    "map",
                                    [
                                      Ty.apply
                                        (Ty.path "&")
                                        []
                                        [
                                          Ty.path
                                            "move_core_types::annotated_value::MoveFieldLayout"
                                        ];
                                      Ty.function
                                        [
                                          Ty.tuple
                                            [
                                              Ty.tuple
                                                [
                                                  Ty.apply
                                                    (Ty.path "&")
                                                    []
                                                    [
                                                      Ty.path
                                                        "move_core_types::annotated_value::MoveFieldLayout"
                                                    ];
                                                  Ty.tuple []
                                                ]
                                            ]
                                        ]
                                        (Ty.apply
                                          (Ty.path "&")
                                          []
                                          [
                                            Ty.path
                                              "move_core_types::annotated_value::MoveFieldLayout"
                                          ])
                                    ]
                                  |),
                                  [
                                    M.read (| res |);
                                    M.closure
                                      (fun γ =>
                                        ltac:(M.monadic
                                          match γ with
                                          | [ α0 ] =>
                                            ltac:(M.monadic
                                              (M.match_operator (|
                                                M.alloc (| α0 |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let γ0_0 :=
                                                        M.SubPointer.get_tuple_field (| γ, 0 |) in
                                                      let γ0_1 :=
                                                        M.SubPointer.get_tuple_field (| γ, 1 |) in
                                                      let f := M.copy (| γ0_0 |) in
                                                      M.read (| f |)))
                                                ]
                                              |)))
                                          | _ => M.impossible "wrong number of arguments"
                                          end))
                                  ]
                                |)))
                          ]
                        |)))
                    | _ => M.impossible "wrong number of arguments"
                    end))
            ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_skip_field : M.IsAssociatedFunction Self "skip_field" skip_field.
  End Impl_move_core_types_annotated_visitor_StructDriver.
  
  (*
  pub(crate) fn visit_value<V: Visitor + ?Sized>(
      bytes: &mut &[u8],
      layout: &MoveTypeLayout,
      visitor: &mut V,
  ) -> Result<V::Value, V::Error> {
      use MoveTypeLayout as L;
  
      match layout {
          L::Bool => match read_exact::<1>(bytes)? {
              [0] => visitor.visit_bool(false),
              [1] => visitor.visit_bool(true),
              [b] => Err(Error::UnexpectedByte(b).into()),
          },
  
          L::U8 => visitor.visit_u8(u8::from_le_bytes(read_exact::<1>(bytes)?)),
          L::U16 => visitor.visit_u16(u16::from_le_bytes(read_exact::<2>(bytes)?)),
          L::U32 => visitor.visit_u32(u32::from_le_bytes(read_exact::<4>(bytes)?)),
          L::U64 => visitor.visit_u64(u64::from_le_bytes(read_exact::<8>(bytes)?)),
          L::U128 => visitor.visit_u128(u128::from_le_bytes(read_exact::<16>(bytes)?)),
          L::U256 => visitor.visit_u256(U256::from_le_bytes(&read_exact::<32>(bytes)?)),
          L::Address => visitor.visit_address(AccountAddress::new(read_exact::<32>(bytes)?)),
          L::Signer => visitor.visit_signer(AccountAddress::new(read_exact::<32>(bytes)?)),
  
          L::Vector(l) => {
              let len = leb128::read::unsigned(bytes).map_err(|_| Error::UnexpectedEof)?;
              let mut driver = VecDriver::new(bytes, l.as_ref(), len);
              let res = visitor.visit_vector(&mut driver)?;
              while driver.skip_element()? {}
              Ok(res)
          }
  
          L::Struct(l) => visit_struct(bytes, l, visitor),
      }
  }
  *)
  Definition visit_value (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [ V ], [ bytes; layout; visitor ] =>
      ltac:(M.monadic
        (let bytes := M.alloc (| bytes |) in
        let layout := M.alloc (| layout |) in
        let visitor := M.alloc (| visitor |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              M.match_operator (|
                layout,
                [
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::Bool"
                        |) in
                      M.match_operator (|
                        M.match_operator (|
                          M.alloc (|
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::ops::try_trait::Try",
                                Ty.apply
                                  (Ty.path "core::result::Result")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "array")
                                      [ Value.Integer IntegerKind.Usize 1 ]
                                      [ Ty.path "u8" ];
                                    Ty.path "move_core_types::annotated_visitor::Error"
                                  ],
                                [],
                                "branch",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_function (|
                                    "move_core_types::annotated_visitor::read_exact",
                                    []
                                  |),
                                  [ M.read (| bytes |) ]
                                |)
                              ]
                            |)
                          |),
                          [
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Break",
                                    0
                                  |) in
                                let residual := M.copy (| γ0_0 |) in
                                M.alloc (|
                                  M.never_to_any (|
                                    M.read (|
                                      M.return_ (|
                                        M.call_closure (|
                                          M.get_trait_method (|
                                            "core::ops::try_trait::FromResidual",
                                            Ty.apply
                                              (Ty.path "core::result::Result")
                                              []
                                              [ Ty.associated; Ty.associated ],
                                            [
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.path "core::convert::Infallible";
                                                  Ty.path
                                                    "move_core_types::annotated_visitor::Error"
                                                ]
                                            ],
                                            "from_residual",
                                            []
                                          |),
                                          [ M.read (| residual |) ]
                                        |)
                                      |)
                                    |)
                                  |)
                                |)));
                            fun γ =>
                              ltac:(M.monadic
                                (let γ0_0 :=
                                  M.SubPointer.get_struct_tuple_field (|
                                    γ,
                                    "core::ops::control_flow::ControlFlow::Continue",
                                    0
                                  |) in
                                let val := M.copy (| γ0_0 |) in
                                val))
                          ]
                        |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ0_0 |),
                                  Value.Integer IntegerKind.U8 0
                                |) in
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "move_core_types::annotated_visitor::Visitor",
                                    V,
                                    [],
                                    "visit_bool",
                                    []
                                  |),
                                  [ M.read (| visitor |); Value.Bool false ]
                                |)
                              |)));
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ0_0 |),
                                  Value.Integer IntegerKind.U8 1
                                |) in
                              M.alloc (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "move_core_types::annotated_visitor::Visitor",
                                    V,
                                    [],
                                    "visit_bool",
                                    []
                                  |),
                                  [ M.read (| visitor |); Value.Bool true ]
                                |)
                              |)));
                          fun γ =>
                            ltac:(M.monadic
                              (let γ0_0 := M.SubPointer.get_slice_index (| γ, 0 |) in
                              let b := M.copy (| γ0_0 |) in
                              M.alloc (|
                                Value.StructTuple
                                  "core::result::Result::Err"
                                  [
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::convert::Into",
                                        Ty.path "move_core_types::annotated_visitor::Error",
                                        [ Ty.associated ],
                                        "into",
                                        []
                                      |),
                                      [
                                        Value.StructTuple
                                          "move_core_types::annotated_visitor::Error::UnexpectedByte"
                                          [ M.read (| b |) ]
                                      ]
                                    |)
                                  ]
                              |)))
                        ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::U8"
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "move_core_types::annotated_visitor::Visitor",
                            V,
                            [],
                            "visit_u8",
                            []
                          |),
                          [
                            M.read (| visitor |);
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u8", "from_le_bytes", [] |),
                              [
                                M.read (|
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::Try",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [ Value.Integer IntegerKind.Usize 1 ]
                                                [ Ty.path "u8" ];
                                              Ty.path "move_core_types::annotated_visitor::Error"
                                            ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_function (|
                                              "move_core_types::annotated_visitor::read_exact",
                                              []
                                            |),
                                            [ M.read (| bytes |) ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Break",
                                              0
                                            |) in
                                          let residual := M.copy (| γ0_0 |) in
                                          M.alloc (|
                                            M.never_to_any (|
                                              M.read (|
                                                M.return_ (|
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::try_trait::FromResidual",
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [ Ty.associated; Ty.associated ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path
                                                              "move_core_types::annotated_visitor::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |)
                                |)
                              ]
                            |)
                          ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::U16"
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "move_core_types::annotated_visitor::Visitor",
                            V,
                            [],
                            "visit_u16",
                            []
                          |),
                          [
                            M.read (| visitor |);
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u16", "from_le_bytes", [] |),
                              [
                                M.read (|
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::Try",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [ Value.Integer IntegerKind.Usize 2 ]
                                                [ Ty.path "u8" ];
                                              Ty.path "move_core_types::annotated_visitor::Error"
                                            ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_function (|
                                              "move_core_types::annotated_visitor::read_exact",
                                              []
                                            |),
                                            [ M.read (| bytes |) ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Break",
                                              0
                                            |) in
                                          let residual := M.copy (| γ0_0 |) in
                                          M.alloc (|
                                            M.never_to_any (|
                                              M.read (|
                                                M.return_ (|
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::try_trait::FromResidual",
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [ Ty.associated; Ty.associated ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path
                                                              "move_core_types::annotated_visitor::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |)
                                |)
                              ]
                            |)
                          ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::U32"
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "move_core_types::annotated_visitor::Visitor",
                            V,
                            [],
                            "visit_u32",
                            []
                          |),
                          [
                            M.read (| visitor |);
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u32", "from_le_bytes", [] |),
                              [
                                M.read (|
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::Try",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [ Value.Integer IntegerKind.Usize 4 ]
                                                [ Ty.path "u8" ];
                                              Ty.path "move_core_types::annotated_visitor::Error"
                                            ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_function (|
                                              "move_core_types::annotated_visitor::read_exact",
                                              []
                                            |),
                                            [ M.read (| bytes |) ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Break",
                                              0
                                            |) in
                                          let residual := M.copy (| γ0_0 |) in
                                          M.alloc (|
                                            M.never_to_any (|
                                              M.read (|
                                                M.return_ (|
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::try_trait::FromResidual",
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [ Ty.associated; Ty.associated ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path
                                                              "move_core_types::annotated_visitor::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |)
                                |)
                              ]
                            |)
                          ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::U64"
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "move_core_types::annotated_visitor::Visitor",
                            V,
                            [],
                            "visit_u64",
                            []
                          |),
                          [
                            M.read (| visitor |);
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u64", "from_le_bytes", [] |),
                              [
                                M.read (|
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::Try",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [ Value.Integer IntegerKind.Usize 8 ]
                                                [ Ty.path "u8" ];
                                              Ty.path "move_core_types::annotated_visitor::Error"
                                            ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_function (|
                                              "move_core_types::annotated_visitor::read_exact",
                                              []
                                            |),
                                            [ M.read (| bytes |) ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Break",
                                              0
                                            |) in
                                          let residual := M.copy (| γ0_0 |) in
                                          M.alloc (|
                                            M.never_to_any (|
                                              M.read (|
                                                M.return_ (|
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::try_trait::FromResidual",
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [ Ty.associated; Ty.associated ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path
                                                              "move_core_types::annotated_visitor::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |)
                                |)
                              ]
                            |)
                          ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::U128"
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "move_core_types::annotated_visitor::Visitor",
                            V,
                            [],
                            "visit_u128",
                            []
                          |),
                          [
                            M.read (| visitor |);
                            M.call_closure (|
                              M.get_associated_function (| Ty.path "u128", "from_le_bytes", [] |),
                              [
                                M.read (|
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::Try",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [ Value.Integer IntegerKind.Usize 16 ]
                                                [ Ty.path "u8" ];
                                              Ty.path "move_core_types::annotated_visitor::Error"
                                            ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_function (|
                                              "move_core_types::annotated_visitor::read_exact",
                                              []
                                            |),
                                            [ M.read (| bytes |) ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Break",
                                              0
                                            |) in
                                          let residual := M.copy (| γ0_0 |) in
                                          M.alloc (|
                                            M.never_to_any (|
                                              M.read (|
                                                M.return_ (|
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::try_trait::FromResidual",
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [ Ty.associated; Ty.associated ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path
                                                              "move_core_types::annotated_visitor::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |)
                                |)
                              ]
                            |)
                          ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::U256"
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "move_core_types::annotated_visitor::Visitor",
                            V,
                            [],
                            "visit_u256",
                            []
                          |),
                          [
                            M.read (| visitor |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_core_types::u256::U256",
                                "from_le_bytes",
                                []
                              |),
                              [
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::ops::try_trait::Try",
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "array")
                                              [ Value.Integer IntegerKind.Usize 32 ]
                                              [ Ty.path "u8" ];
                                            Ty.path "move_core_types::annotated_visitor::Error"
                                          ],
                                        [],
                                        "branch",
                                        []
                                      |),
                                      [
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_core_types::annotated_visitor::read_exact",
                                            []
                                          |),
                                          [ M.read (| bytes |) ]
                                        |)
                                      ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Break",
                                            0
                                          |) in
                                        let residual := M.copy (| γ0_0 |) in
                                        M.alloc (|
                                          M.never_to_any (|
                                            M.read (|
                                              M.return_ (|
                                                M.call_closure (|
                                                  M.get_trait_method (|
                                                    "core::ops::try_trait::FromResidual",
                                                    Ty.apply
                                                      (Ty.path "core::result::Result")
                                                      []
                                                      [ Ty.associated; Ty.associated ],
                                                    [
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [
                                                          Ty.path "core::convert::Infallible";
                                                          Ty.path
                                                            "move_core_types::annotated_visitor::Error"
                                                        ]
                                                    ],
                                                    "from_residual",
                                                    []
                                                  |),
                                                  [ M.read (| residual |) ]
                                                |)
                                              |)
                                            |)
                                          |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::ops::control_flow::ControlFlow::Continue",
                                            0
                                          |) in
                                        let val := M.copy (| γ0_0 |) in
                                        val))
                                  ]
                                |)
                              ]
                            |)
                          ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::Address"
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "move_core_types::annotated_visitor::Visitor",
                            V,
                            [],
                            "visit_address",
                            []
                          |),
                          [
                            M.read (| visitor |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_core_types::account_address::AccountAddress",
                                "new",
                                []
                              |),
                              [
                                M.read (|
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::Try",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [ Value.Integer IntegerKind.Usize 32 ]
                                                [ Ty.path "u8" ];
                                              Ty.path "move_core_types::annotated_visitor::Error"
                                            ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_function (|
                                              "move_core_types::annotated_visitor::read_exact",
                                              []
                                            |),
                                            [ M.read (| bytes |) ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Break",
                                              0
                                            |) in
                                          let residual := M.copy (| γ0_0 |) in
                                          M.alloc (|
                                            M.never_to_any (|
                                              M.read (|
                                                M.return_ (|
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::try_trait::FromResidual",
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [ Ty.associated; Ty.associated ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path
                                                              "move_core_types::annotated_visitor::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |)
                                |)
                              ]
                            |)
                          ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let _ :=
                        M.is_struct_tuple (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::Signer"
                        |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_trait_method (|
                            "move_core_types::annotated_visitor::Visitor",
                            V,
                            [],
                            "visit_signer",
                            []
                          |),
                          [
                            M.read (| visitor |);
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.path "move_core_types::account_address::AccountAddress",
                                "new",
                                []
                              |),
                              [
                                M.read (|
                                  M.match_operator (|
                                    M.alloc (|
                                      M.call_closure (|
                                        M.get_trait_method (|
                                          "core::ops::try_trait::Try",
                                          Ty.apply
                                            (Ty.path "core::result::Result")
                                            []
                                            [
                                              Ty.apply
                                                (Ty.path "array")
                                                [ Value.Integer IntegerKind.Usize 32 ]
                                                [ Ty.path "u8" ];
                                              Ty.path "move_core_types::annotated_visitor::Error"
                                            ],
                                          [],
                                          "branch",
                                          []
                                        |),
                                        [
                                          M.call_closure (|
                                            M.get_function (|
                                              "move_core_types::annotated_visitor::read_exact",
                                              []
                                            |),
                                            [ M.read (| bytes |) ]
                                          |)
                                        ]
                                      |)
                                    |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Break",
                                              0
                                            |) in
                                          let residual := M.copy (| γ0_0 |) in
                                          M.alloc (|
                                            M.never_to_any (|
                                              M.read (|
                                                M.return_ (|
                                                  M.call_closure (|
                                                    M.get_trait_method (|
                                                      "core::ops::try_trait::FromResidual",
                                                      Ty.apply
                                                        (Ty.path "core::result::Result")
                                                        []
                                                        [ Ty.associated; Ty.associated ],
                                                      [
                                                        Ty.apply
                                                          (Ty.path "core::result::Result")
                                                          []
                                                          [
                                                            Ty.path "core::convert::Infallible";
                                                            Ty.path
                                                              "move_core_types::annotated_visitor::Error"
                                                          ]
                                                      ],
                                                      "from_residual",
                                                      []
                                                    |),
                                                    [ M.read (| residual |) ]
                                                  |)
                                                |)
                                              |)
                                            |)
                                          |)));
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let γ0_0 :=
                                            M.SubPointer.get_struct_tuple_field (|
                                              γ,
                                              "core::ops::control_flow::ControlFlow::Continue",
                                              0
                                            |) in
                                          let val := M.copy (| γ0_0 |) in
                                          val))
                                    ]
                                  |)
                                |)
                              ]
                            |)
                          ]
                        |)
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::Vector",
                          0
                        |) in
                      let l := M.alloc (| γ1_0 |) in
                      let~ len :=
                        M.copy (|
                          M.match_operator (|
                            M.alloc (|
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::try_trait::Try",
                                  Ty.apply
                                    (Ty.path "core::result::Result")
                                    []
                                    [
                                      Ty.path "u64";
                                      Ty.path "move_core_types::annotated_visitor::Error"
                                    ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [ Ty.path "u64"; Ty.path "leb128::read::Error" ],
                                      "map_err",
                                      [
                                        Ty.path "move_core_types::annotated_visitor::Error";
                                        Ty.function
                                          [ Ty.tuple [ Ty.path "leb128::read::Error" ] ]
                                          (Ty.path "move_core_types::annotated_visitor::Error")
                                      ]
                                    |),
                                    [
                                      M.call_closure (|
                                        M.get_function (|
                                          "leb128::read::unsigned",
                                          [
                                            Ty.apply
                                              (Ty.path "&")
                                              []
                                              [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ]
                                          ]
                                        |),
                                        [ M.read (| bytes |) ]
                                      |);
                                      M.closure
                                        (fun γ =>
                                          ltac:(M.monadic
                                            match γ with
                                            | [ α0 ] =>
                                              ltac:(M.monadic
                                                (M.match_operator (|
                                                  M.alloc (| α0 |),
                                                  [
                                                    fun γ =>
                                                      ltac:(M.monadic
                                                        (Value.StructTuple
                                                          "move_core_types::annotated_visitor::Error::UnexpectedEof"
                                                          []))
                                                  ]
                                                |)))
                                            | _ => M.impossible "wrong number of arguments"
                                            end))
                                    ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Break",
                                      0
                                    |) in
                                  let residual := M.copy (| γ0_0 |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.read (|
                                        M.return_ (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::try_trait::FromResidual",
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [ Ty.associated; Ty.associated ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.path
                                                      "move_core_types::annotated_visitor::Error"
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |)
                        |) in
                      let~ driver :=
                        M.alloc (|
                          M.call_closure (|
                            M.get_associated_function (|
                              Ty.path "move_core_types::annotated_visitor::VecDriver",
                              "new",
                              []
                            |),
                            [
                              M.read (| bytes |);
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::convert::AsRef",
                                  Ty.apply
                                    (Ty.path "alloc::boxed::Box")
                                    []
                                    [
                                      Ty.path "move_core_types::annotated_value::MoveTypeLayout";
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  [ Ty.path "move_core_types::annotated_value::MoveTypeLayout" ],
                                  "as_ref",
                                  []
                                |),
                                [ M.read (| l |) ]
                              |);
                              M.read (| len |)
                            ]
                          |)
                        |) in
                      let~ res :=
                        M.copy (|
                          M.match_operator (|
                            M.alloc (|
                              M.call_closure (|
                                M.get_trait_method (|
                                  "core::ops::try_trait::Try",
                                  Ty.apply
                                    (Ty.path "core::result::Result")
                                    []
                                    [ Ty.associated; Ty.associated ],
                                  [],
                                  "branch",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "move_core_types::annotated_visitor::Visitor",
                                      V,
                                      [],
                                      "visit_vector",
                                      []
                                    |),
                                    [ M.read (| visitor |); driver ]
                                  |)
                                ]
                              |)
                            |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Break",
                                      0
                                    |) in
                                  let residual := M.copy (| γ0_0 |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.read (|
                                        M.return_ (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::try_trait::FromResidual",
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [ Ty.associated; Ty.associated ],
                                              [
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "core::convert::Infallible";
                                                    Ty.associated
                                                  ]
                                              ],
                                              "from_residual",
                                              []
                                            |),
                                            [ M.read (| residual |) ]
                                          |)
                                        |)
                                      |)
                                    |)
                                  |)));
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ0_0 :=
                                    M.SubPointer.get_struct_tuple_field (|
                                      γ,
                                      "core::ops::control_flow::ControlFlow::Continue",
                                      0
                                    |) in
                                  let val := M.copy (| γ0_0 |) in
                                  val))
                            ]
                          |)
                        |) in
                      let~ _ :=
                        M.loop (|
                          ltac:(M.monadic
                            (M.match_operator (|
                              M.alloc (| Value.Tuple [] |),
                              [
                                fun γ =>
                                  ltac:(M.monadic
                                    (let γ :=
                                      M.use
                                        (M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::try_trait::Try",
                                                Ty.apply
                                                  (Ty.path "core::result::Result")
                                                  []
                                                  [
                                                    Ty.path "bool";
                                                    Ty.path
                                                      "move_core_types::annotated_visitor::Error"
                                                  ],
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.path
                                                      "move_core_types::annotated_visitor::VecDriver",
                                                    "skip_element",
                                                    []
                                                  |),
                                                  [ driver ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::ops::control_flow::ControlFlow::Break",
                                                    0
                                                  |) in
                                                let residual := M.copy (| γ0_0 |) in
                                                M.alloc (|
                                                  M.never_to_any (|
                                                    M.read (|
                                                      M.return_ (|
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::ops::try_trait::FromResidual",
                                                            Ty.apply
                                                              (Ty.path "core::result::Result")
                                                              []
                                                              [ Ty.associated; Ty.associated ],
                                                            [
                                                              Ty.apply
                                                                (Ty.path "core::result::Result")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "core::convert::Infallible";
                                                                  Ty.path
                                                                    "move_core_types::annotated_visitor::Error"
                                                                ]
                                                            ],
                                                            "from_residual",
                                                            []
                                                          |),
                                                          [ M.read (| residual |) ]
                                                        |)
                                                      |)
                                                    |)
                                                  |)
                                                |)));
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::ops::control_flow::ControlFlow::Continue",
                                                    0
                                                  |) in
                                                let val := M.copy (| γ0_0 |) in
                                                val))
                                          ]
                                        |)) in
                                    let _ :=
                                      M.is_constant_or_break_match (|
                                        M.read (| γ |),
                                        Value.Bool true
                                      |) in
                                    M.alloc (| Value.Tuple [] |)));
                                fun γ =>
                                  ltac:(M.monadic
                                    (M.alloc (|
                                      M.never_to_any (|
                                        M.read (|
                                          let~ _ :=
                                            M.alloc (|
                                              M.never_to_any (| M.read (| M.break (||) |) |)
                                            |) in
                                          M.alloc (| Value.Tuple [] |)
                                        |)
                                      |)
                                    |)))
                              ]
                            |)))
                        |) in
                      M.alloc (|
                        Value.StructTuple "core::result::Result::Ok" [ M.read (| res |) ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (let γ := M.read (| γ |) in
                      let γ1_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ,
                          "move_core_types::annotated_value::MoveTypeLayout::Struct",
                          0
                        |) in
                      let l := M.alloc (| γ1_0 |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_function (|
                            "move_core_types::annotated_visitor::visit_struct",
                            [ V ]
                          |),
                          [ M.read (| bytes |); M.read (| l |); M.read (| visitor |) ]
                        |)
                      |)))
                ]
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_visit_value :
    M.IsFunction "move_core_types::annotated_visitor::visit_value" visit_value.
  
  (*
  pub(crate) fn visit_struct<V: Visitor + ?Sized>(
      bytes: &mut &[u8],
      layout: &MoveStructLayout,
      visitor: &mut V,
  ) -> Result<V::Value, V::Error> {
      let mut driver = StructDriver::new(bytes, layout);
      let res = visitor.visit_struct(&mut driver)?;
      while driver.skip_field()?.is_some() {}
      Ok(res)
  }
  *)
  Definition visit_struct (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [ V ], [ bytes; layout; visitor ] =>
      ltac:(M.monadic
        (let bytes := M.alloc (| bytes |) in
        let layout := M.alloc (| layout |) in
        let visitor := M.alloc (| visitor |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ driver :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "move_core_types::annotated_visitor::StructDriver",
                      "new",
                      []
                    |),
                    [ M.read (| bytes |); M.read (| layout |) ]
                  |)
                |) in
              let~ res :=
                M.copy (|
                  M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::ops::try_trait::Try",
                          Ty.apply
                            (Ty.path "core::result::Result")
                            []
                            [ Ty.associated; Ty.associated ],
                          [],
                          "branch",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "move_core_types::annotated_visitor::Visitor",
                              V,
                              [],
                              "visit_struct",
                              []
                            |),
                            [ M.read (| visitor |); driver ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Break",
                              0
                            |) in
                          let residual := M.copy (| γ0_0 |) in
                          M.alloc (|
                            M.never_to_any (|
                              M.read (|
                                M.return_ (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::ops::try_trait::FromResidual",
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [ Ty.associated; Ty.associated ],
                                      [
                                        Ty.apply
                                          (Ty.path "core::result::Result")
                                          []
                                          [ Ty.path "core::convert::Infallible"; Ty.associated ]
                                      ],
                                      "from_residual",
                                      []
                                    |),
                                    [ M.read (| residual |) ]
                                  |)
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ0_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::ops::control_flow::ControlFlow::Continue",
                              0
                            |) in
                          let val := M.copy (| γ0_0 |) in
                          val))
                    ]
                  |)
                |) in
              let~ _ :=
                M.loop (|
                  ltac:(M.monadic
                    (M.match_operator (|
                      M.alloc (| Value.Tuple [] |),
                      [
                        fun γ =>
                          ltac:(M.monadic
                            (let γ :=
                              M.use
                                (M.alloc (|
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.apply
                                        (Ty.path "core::option::Option")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "&")
                                            []
                                            [
                                              Ty.path
                                                "move_core_types::annotated_value::MoveFieldLayout"
                                            ]
                                        ],
                                      "is_some",
                                      []
                                    |),
                                    [
                                      M.match_operator (|
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::ops::try_trait::Try",
                                              Ty.apply
                                                (Ty.path "core::result::Result")
                                                []
                                                [
                                                  Ty.apply
                                                    (Ty.path "core::option::Option")
                                                    []
                                                    [
                                                      Ty.apply
                                                        (Ty.path "&")
                                                        []
                                                        [
                                                          Ty.path
                                                            "move_core_types::annotated_value::MoveFieldLayout"
                                                        ]
                                                    ];
                                                  Ty.path
                                                    "move_core_types::annotated_visitor::Error"
                                                ],
                                              [],
                                              "branch",
                                              []
                                            |),
                                            [
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path
                                                    "move_core_types::annotated_visitor::StructDriver",
                                                  "skip_field",
                                                  []
                                                |),
                                                [ driver ]
                                              |)
                                            ]
                                          |)
                                        |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let γ0_0 :=
                                                M.SubPointer.get_struct_tuple_field (|
                                                  γ,
                                                  "core::ops::control_flow::ControlFlow::Break",
                                                  0
                                                |) in
                                              let residual := M.copy (| γ0_0 |) in
                                              M.alloc (|
                                                M.never_to_any (|
                                                  M.read (|
                                                    M.return_ (|
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::ops::try_trait::FromResidual",
                                                          Ty.apply
                                                            (Ty.path "core::result::Result")
                                                            []
                                                            [ Ty.associated; Ty.associated ],
                                                          [
                                                            Ty.apply
                                                              (Ty.path "core::result::Result")
                                                              []
                                                              [
                                                                Ty.path "core::convert::Infallible";
                                                                Ty.path
                                                                  "move_core_types::annotated_visitor::Error"
                                                              ]
                                                          ],
                                                          "from_residual",
                                                          []
                                                        |),
                                                        [ M.read (| residual |) ]
                                                      |)
                                                    |)
                                                  |)
                                                |)
                                              |)));
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let γ0_0 :=
                                                M.SubPointer.get_struct_tuple_field (|
                                                  γ,
                                                  "core::ops::control_flow::ControlFlow::Continue",
                                                  0
                                                |) in
                                              let val := M.copy (| γ0_0 |) in
                                              val))
                                        ]
                                      |)
                                    ]
                                  |)
                                |)) in
                            let _ :=
                              M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                            M.alloc (| Value.Tuple [] |)));
                        fun γ =>
                          ltac:(M.monadic
                            (M.alloc (|
                              M.never_to_any (|
                                M.read (|
                                  let~ _ :=
                                    M.alloc (| M.never_to_any (| M.read (| M.break (||) |) |) |) in
                                  M.alloc (| Value.Tuple [] |)
                                |)
                              |)
                            |)))
                      ]
                    |)))
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ M.read (| res |) ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_visit_struct :
    M.IsFunction "move_core_types::annotated_visitor::visit_struct" visit_struct.
  
  (*
  fn read_exact<const N: usize>(bytes: &mut &[u8]) -> Result<[u8; N], Error> {
      let mut buf = [0u8; N];
      bytes
          .read_exact(&mut buf)
          .map_err(|_| Error::UnexpectedEof)?;
      Ok(buf)
  }
  *)
  Definition read_exact (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [ N ], [], [ bytes ] =>
      ltac:(M.monadic
        (let bytes := M.alloc (| bytes |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ buf := M.alloc (| repeat (| Value.Integer IntegerKind.U8 0, N |) |) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::ops::try_trait::Try",
                        Ty.apply
                          (Ty.path "core::result::Result")
                          []
                          [ Ty.tuple []; Ty.path "move_core_types::annotated_visitor::Error" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.apply
                              (Ty.path "core::result::Result")
                              []
                              [ Ty.tuple []; Ty.path "std::io::error::Error" ],
                            "map_err",
                            [
                              Ty.path "move_core_types::annotated_visitor::Error";
                              Ty.function
                                [ Ty.tuple [ Ty.path "std::io::error::Error" ] ]
                                (Ty.path "move_core_types::annotated_visitor::Error")
                            ]
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "std::io::Read",
                                Ty.apply
                                  (Ty.path "&")
                                  []
                                  [ Ty.apply (Ty.path "slice") [] [ Ty.path "u8" ] ],
                                [],
                                "read_exact",
                                []
                              |),
                              [ M.read (| bytes |); buf ]
                            |);
                            M.closure
                              (fun γ =>
                                ltac:(M.monadic
                                  match γ with
                                  | [ α0 ] =>
                                    ltac:(M.monadic
                                      (M.match_operator (|
                                        M.alloc (| α0 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (Value.StructTuple
                                                "move_core_types::annotated_visitor::Error::UnexpectedEof"
                                                []))
                                        ]
                                      |)))
                                  | _ => M.impossible "wrong number of arguments"
                                  end))
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Break",
                            0
                          |) in
                        let residual := M.copy (| γ0_0 |) in
                        M.alloc (|
                          M.never_to_any (|
                            M.read (|
                              M.return_ (|
                                M.call_closure (|
                                  M.get_trait_method (|
                                    "core::ops::try_trait::FromResidual",
                                    Ty.apply
                                      (Ty.path "core::result::Result")
                                      []
                                      [
                                        Ty.apply (Ty.path "array") [ N ] [ Ty.path "u8" ];
                                        Ty.path "move_core_types::annotated_visitor::Error"
                                      ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "move_core_types::annotated_visitor::Error"
                                        ]
                                    ],
                                    "from_residual",
                                    []
                                  |),
                                  [ M.read (| residual |) ]
                                |)
                              |)
                            |)
                          |)
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (let γ0_0 :=
                          M.SubPointer.get_struct_tuple_field (|
                            γ,
                            "core::ops::control_flow::ControlFlow::Continue",
                            0
                          |) in
                        let val := M.copy (| γ0_0 |) in
                        val))
                  ]
                |) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ M.read (| buf |) ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_read_exact :
    M.IsFunction "move_core_types::annotated_visitor::read_exact" read_exact.
End annotated_visitor.
