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

Module dependencies.
  (* StructRecord
    {
      name := "Context";
      const_params := [];
      ty_params := [];
      fields :=
        [
          ("module",
            Ty.apply
              (Ty.path "&")
              []
              [ Ty.path "move_binary_format::file_format::CompiledModule" ]);
          ("dependency_map",
            Ty.apply
              (Ty.path "alloc::collections::btree::map::BTreeMap")
              []
              [
                Ty.path "move_core_types::language_storage::ModuleId";
                Ty.apply
                  (Ty.path "&")
                  []
                  [ Ty.path "move_binary_format::file_format::CompiledModule" ];
                Ty.path "alloc::alloc::Global"
              ]);
          ("struct_id_to_handle_map",
            Ty.apply
              (Ty.path "alloc::collections::btree::map::BTreeMap")
              []
              [
                Ty.tuple
                  [
                    Ty.path "move_core_types::language_storage::ModuleId";
                    Ty.path "move_core_types::identifier::Identifier"
                  ];
                Ty.path "move_binary_format::file_format::StructHandleIndex";
                Ty.path "alloc::alloc::Global"
              ]);
          ("func_id_to_handle_map",
            Ty.apply
              (Ty.path "alloc::collections::btree::map::BTreeMap")
              []
              [
                Ty.tuple
                  [
                    Ty.path "move_core_types::language_storage::ModuleId";
                    Ty.path "move_core_types::identifier::Identifier"
                  ];
                Ty.path "move_binary_format::file_format::FunctionHandleIndex";
                Ty.path "alloc::alloc::Global"
              ]);
          ("function_visibilities",
            Ty.apply
              (Ty.path "alloc::collections::btree::map::BTreeMap")
              []
              [
                Ty.path "move_binary_format::file_format::FunctionHandleIndex";
                Ty.path "move_binary_format::file_format::Visibility";
                Ty.path "alloc::alloc::Global"
              ]);
          ("script_functions",
            Ty.apply
              (Ty.path "core::option::Option")
              []
              [
                Ty.apply
                  (Ty.path "alloc::collections::btree::set::BTreeSet")
                  []
                  [
                    Ty.path "move_binary_format::file_format::FunctionHandleIndex";
                    Ty.path "alloc::alloc::Global"
                  ]
              ])
        ];
    } *)
  
  Module Impl_move_bytecode_verifier_dependencies_Context.
    Definition Self : Ty.t := Ty.path "move_bytecode_verifier::dependencies::Context".
    
    (*
        fn module(
            module: &'a CompiledModule,
            dependencies: impl IntoIterator<Item = &'b CompiledModule>,
        ) -> Self {
            Self::new(module, dependencies)
        }
    *)
    Definition module (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ impl_IntoIterator_Item____'b_CompiledModule_ ], [ module; dependencies ] =>
        ltac:(M.monadic
          (let module := M.alloc (| module |) in
          let dependencies := M.alloc (| dependencies |) in
          M.call_closure (|
            M.get_associated_function (|
              Ty.path "move_bytecode_verifier::dependencies::Context",
              "new",
              [ impl_IntoIterator_Item____'b_CompiledModule_ ]
            |),
            [ M.read (| module |); M.read (| dependencies |) ]
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_module : M.IsAssociatedFunction Self "module" module.
    
    (*
        fn new(
            module: &'a CompiledModule,
            dependencies: impl IntoIterator<Item = &'b CompiledModule>,
        ) -> Self {
            let self_module = module.self_id();
            let self_module_idx = module.self_handle_idx();
            let self_function_defs = module.function_defs();
            let dependency_map = dependencies
                .into_iter()
                .filter(|d| d.self_id() != self_module)
                .map(|d| (d.self_id(), d))
                .collect();
    
            let script_functions = if module.version() < VERSION_5 {
                Some(BTreeSet::new())
            } else {
                None
            };
            let mut context = Self {
                module,
                dependency_map,
                struct_id_to_handle_map: BTreeMap::new(),
                func_id_to_handle_map: BTreeMap::new(),
                function_visibilities: BTreeMap::new(),
                script_functions,
            };
    
            let mut dependency_visibilities = BTreeMap::new();
            for (module_id, module) in &context.dependency_map {
                let friend_module_ids: BTreeSet<_> = module.immediate_friends().into_iter().collect();
    
                // Module::StructName -> def handle idx
                for struct_def in module.struct_defs() {
                    let struct_handle = module.struct_handle_at(struct_def.struct_handle);
                    let struct_name = module.identifier_at(struct_handle.name);
                    context.struct_id_to_handle_map.insert(
                        (module_id.clone(), struct_name.to_owned()),
                        struct_def.struct_handle,
                    );
                }
                // Module::FuncName -> def handle idx
                for func_def in module.function_defs() {
                    let func_handle = module.function_handle_at(func_def.function);
                    let func_name = module.identifier_at(func_handle.name);
                    dependency_visibilities.insert(
                        (module_id.clone(), func_name.to_owned()),
                        (func_def.visibility, func_def.is_entry),
                    );
                    let may_be_called = match func_def.visibility {
                        Visibility::Public => true,
                        Visibility::Friend => friend_module_ids.contains(&self_module),
                        Visibility::Private => false,
                    };
                    if may_be_called {
                        context
                            .func_id_to_handle_map
                            .insert((module_id.clone(), func_name.to_owned()), func_def.function);
                    }
                }
            }
    
            for function_def in self_function_defs {
                context
                    .function_visibilities
                    .insert(function_def.function, function_def.visibility);
                if function_def.is_entry {
                    context
                        .script_functions
                        .as_mut()
                        .map(|s| s.insert(function_def.function));
                }
            }
            for (idx, function_handle) in context.module.function_handles().iter().enumerate() {
                if function_handle.module == self_module_idx {
                    continue;
                }
                let dep_module_id = context
                    .module
                    .module_id_for_handle(context.module.module_handle_at(function_handle.module));
                let function_name = context.module.identifier_at(function_handle.name);
                let dep_file_format_version =
                    context.dependency_map.get(&dep_module_id).unwrap().version;
                let dep_function = (dep_module_id, function_name.to_owned());
                let (visibility, is_entry) = match dependency_visibilities.get(&dep_function) {
                    // The visibility does not need to be set here. If the function does not
                    // link, it will be reported by verify_imported_functions
                    None => continue,
                    Some(vis_entry) => *vis_entry,
                };
                let fhandle_idx = FunctionHandleIndex(idx as TableIndex);
                context
                    .function_visibilities
                    .insert(fhandle_idx, visibility);
                if dep_file_format_version < VERSION_5 && is_entry {
                    context
                        .script_functions
                        .as_mut()
                        .map(|s| s.insert(fhandle_idx));
                }
            }
    
            context
        }
    *)
    Definition new (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
      match ε, τ, α with
      | [], [ impl_IntoIterator_Item____'b_CompiledModule_ ], [ module; dependencies ] =>
        ltac:(M.monadic
          (let module := M.alloc (| module |) in
          let dependencies := M.alloc (| dependencies |) in
          M.read (|
            let~ self_module :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.path "move_binary_format::file_format::CompiledModule",
                    "self_id",
                    []
                  |),
                  [ M.read (| module |) ]
                |)
              |) in
            let~ self_module_idx :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.path "move_binary_format::file_format::CompiledModule",
                    "self_handle_idx",
                    []
                  |),
                  [ M.read (| module |) ]
                |)
              |) in
            let~ self_function_defs :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.path "move_binary_format::file_format::CompiledModule",
                    "function_defs",
                    []
                  |),
                  [ M.read (| module |) ]
                |)
              |) in
            let~ dependency_map :=
              M.alloc (|
                M.call_closure (|
                  M.get_trait_method (|
                    "core::iter::traits::iterator::Iterator",
                    Ty.apply
                      (Ty.path "core::iter::adapters::map::Map")
                      []
                      [
                        Ty.apply
                          (Ty.path "core::iter::adapters::filter::Filter")
                          []
                          [
                            Ty.associated;
                            Ty.function
                              [
                                Ty.tuple
                                  [
                                    Ty.apply
                                      (Ty.path "&")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "&")
                                          []
                                          [
                                            Ty.path
                                              "move_binary_format::file_format::CompiledModule"
                                          ]
                                      ]
                                  ]
                              ]
                              (Ty.path "bool")
                          ];
                        Ty.function
                          [
                            Ty.tuple
                              [
                                Ty.apply
                                  (Ty.path "&")
                                  []
                                  [ Ty.path "move_binary_format::file_format::CompiledModule" ]
                              ]
                          ]
                          (Ty.tuple
                            [
                              Ty.path "move_core_types::language_storage::ModuleId";
                              Ty.apply
                                (Ty.path "&")
                                []
                                [ Ty.path "move_binary_format::file_format::CompiledModule" ]
                            ])
                      ],
                    [],
                    "collect",
                    [
                      Ty.apply
                        (Ty.path "alloc::collections::btree::map::BTreeMap")
                        []
                        [
                          Ty.path "move_core_types::language_storage::ModuleId";
                          Ty.apply
                            (Ty.path "&")
                            []
                            [ Ty.path "move_binary_format::file_format::CompiledModule" ];
                          Ty.path "alloc::alloc::Global"
                        ]
                    ]
                  |),
                  [
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::iterator::Iterator",
                        Ty.apply
                          (Ty.path "core::iter::adapters::filter::Filter")
                          []
                          [
                            Ty.associated;
                            Ty.function
                              [
                                Ty.tuple
                                  [
                                    Ty.apply
                                      (Ty.path "&")
                                      []
                                      [
                                        Ty.apply
                                          (Ty.path "&")
                                          []
                                          [
                                            Ty.path
                                              "move_binary_format::file_format::CompiledModule"
                                          ]
                                      ]
                                  ]
                              ]
                              (Ty.path "bool")
                          ],
                        [],
                        "map",
                        [
                          Ty.tuple
                            [
                              Ty.path "move_core_types::language_storage::ModuleId";
                              Ty.apply
                                (Ty.path "&")
                                []
                                [ Ty.path "move_binary_format::file_format::CompiledModule" ]
                            ];
                          Ty.function
                            [
                              Ty.tuple
                                [
                                  Ty.apply
                                    (Ty.path "&")
                                    []
                                    [ Ty.path "move_binary_format::file_format::CompiledModule" ]
                                ]
                            ]
                            (Ty.tuple
                              [
                                Ty.path "move_core_types::language_storage::ModuleId";
                                Ty.apply
                                  (Ty.path "&")
                                  []
                                  [ Ty.path "move_binary_format::file_format::CompiledModule" ]
                              ])
                        ]
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.associated,
                            [],
                            "filter",
                            [
                              Ty.function
                                [
                                  Ty.tuple
                                    [
                                      Ty.apply
                                        (Ty.path "&")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "&")
                                            []
                                            [
                                              Ty.path
                                                "move_binary_format::file_format::CompiledModule"
                                            ]
                                        ]
                                    ]
                                ]
                                (Ty.path "bool")
                            ]
                          |),
                          [
                            M.call_closure (|
                              M.get_trait_method (|
                                "core::iter::traits::collect::IntoIterator",
                                impl_IntoIterator_Item____'b_CompiledModule_,
                                [],
                                "into_iter",
                                []
                              |),
                              [ M.read (| dependencies |) ]
                            |);
                            M.closure
                              (fun γ =>
                                ltac:(M.monadic
                                  match γ with
                                  | [ α0 ] =>
                                    ltac:(M.monadic
                                      (M.match_operator (|
                                        M.alloc (| α0 |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let d := M.copy (| γ |) in
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::cmp::PartialEq",
                                                  Ty.path
                                                    "move_core_types::language_storage::ModuleId",
                                                  [
                                                    Ty.path
                                                      "move_core_types::language_storage::ModuleId"
                                                  ],
                                                  "ne",
                                                  []
                                                |),
                                                [
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.path
                                                          "move_binary_format::file_format::CompiledModule",
                                                        "self_id",
                                                        []
                                                      |),
                                                      [ M.read (| M.read (| d |) |) ]
                                                    |)
                                                  |);
                                                  self_module
                                                ]
                                              |)))
                                        ]
                                      |)))
                                  | _ => M.impossible "wrong number of arguments"
                                  end))
                          ]
                        |);
                        M.closure
                          (fun γ =>
                            ltac:(M.monadic
                              match γ with
                              | [ α0 ] =>
                                ltac:(M.monadic
                                  (M.match_operator (|
                                    M.alloc (| α0 |),
                                    [
                                      fun γ =>
                                        ltac:(M.monadic
                                          (let d := M.copy (| γ |) in
                                          Value.Tuple
                                            [
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path
                                                    "move_binary_format::file_format::CompiledModule",
                                                  "self_id",
                                                  []
                                                |),
                                                [ M.read (| d |) ]
                                              |);
                                              M.read (| d |)
                                            ]))
                                    ]
                                  |)))
                              | _ => M.impossible "wrong number of arguments"
                              end))
                      ]
                    |)
                  ]
                |)
              |) in
            let~ script_functions :=
              M.copy (|
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.lt (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format::CompiledModule",
                                    "version",
                                    []
                                  |),
                                  [ M.read (| module |) ]
                                |),
                                M.read (|
                                  M.get_constant (|
                                    "move_binary_format::file_format_common::VERSION_5"
                                  |)
                                |)
                              |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        M.alloc (|
                          Value.StructTuple
                            "core::option::Option::Some"
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "alloc::collections::btree::set::BTreeSet")
                                    []
                                    [
                                      Ty.path
                                        "move_binary_format::file_format::FunctionHandleIndex";
                                      Ty.path "alloc::alloc::Global"
                                    ],
                                  "new",
                                  []
                                |),
                                []
                              |)
                            ]
                        |)));
                    fun γ =>
                      ltac:(M.monadic
                        (M.alloc (| Value.StructTuple "core::option::Option::None" [] |)))
                  ]
                |)
              |) in
            let~ context :=
              M.alloc (|
                Value.StructRecord
                  "move_bytecode_verifier::dependencies::Context"
                  [
                    ("module", M.read (| module |));
                    ("dependency_map", M.read (| dependency_map |));
                    ("struct_id_to_handle_map",
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply
                            (Ty.path "alloc::collections::btree::map::BTreeMap")
                            []
                            [
                              Ty.tuple
                                [
                                  Ty.path "move_core_types::language_storage::ModuleId";
                                  Ty.path "move_core_types::identifier::Identifier"
                                ];
                              Ty.path "move_binary_format::file_format::StructHandleIndex";
                              Ty.path "alloc::alloc::Global"
                            ],
                          "new",
                          []
                        |),
                        []
                      |));
                    ("func_id_to_handle_map",
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply
                            (Ty.path "alloc::collections::btree::map::BTreeMap")
                            []
                            [
                              Ty.tuple
                                [
                                  Ty.path "move_core_types::language_storage::ModuleId";
                                  Ty.path "move_core_types::identifier::Identifier"
                                ];
                              Ty.path "move_binary_format::file_format::FunctionHandleIndex";
                              Ty.path "alloc::alloc::Global"
                            ],
                          "new",
                          []
                        |),
                        []
                      |));
                    ("function_visibilities",
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply
                            (Ty.path "alloc::collections::btree::map::BTreeMap")
                            []
                            [
                              Ty.path "move_binary_format::file_format::FunctionHandleIndex";
                              Ty.path "move_binary_format::file_format::Visibility";
                              Ty.path "alloc::alloc::Global"
                            ],
                          "new",
                          []
                        |),
                        []
                      |));
                    ("script_functions", M.read (| script_functions |))
                  ]
              |) in
            let~ dependency_visibilities :=
              M.alloc (|
                M.call_closure (|
                  M.get_associated_function (|
                    Ty.apply
                      (Ty.path "alloc::collections::btree::map::BTreeMap")
                      []
                      [
                        Ty.tuple
                          [
                            Ty.path "move_core_types::language_storage::ModuleId";
                            Ty.path "move_core_types::identifier::Identifier"
                          ];
                        Ty.tuple
                          [ Ty.path "move_binary_format::file_format::Visibility"; Ty.path "bool" ];
                        Ty.path "alloc::alloc::Global"
                      ],
                    "new",
                    []
                  |),
                  []
                |)
              |) in
            let~ _ :=
              M.use
                (M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::collect::IntoIterator",
                        Ty.apply
                          (Ty.path "&")
                          []
                          [
                            Ty.apply
                              (Ty.path "alloc::collections::btree::map::BTreeMap")
                              []
                              [
                                Ty.path "move_core_types::language_storage::ModuleId";
                                Ty.apply
                                  (Ty.path "&")
                                  []
                                  [ Ty.path "move_binary_format::file_format::CompiledModule" ];
                                Ty.path "alloc::alloc::Global"
                              ]
                          ],
                        [],
                        "into_iter",
                        []
                      |),
                      [
                        M.SubPointer.get_struct_record_field (|
                          context,
                          "move_bytecode_verifier::dependencies::Context",
                          "dependency_map"
                        |)
                      ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let iter := M.copy (| γ |) in
                        M.loop (|
                          ltac:(M.monadic
                            (let~ _ :=
                              M.match_operator (|
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.apply
                                        (Ty.path "alloc::collections::btree::map::Iter")
                                        []
                                        [
                                          Ty.path "move_core_types::language_storage::ModuleId";
                                          Ty.apply
                                            (Ty.path "&")
                                            []
                                            [
                                              Ty.path
                                                "move_binary_format::file_format::CompiledModule"
                                            ]
                                        ],
                                      [],
                                      "next",
                                      []
                                    |),
                                    [ iter ]
                                  |)
                                |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let _ :=
                                        M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                      M.alloc (|
                                        M.never_to_any (| M.read (| M.break (||) |) |)
                                      |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ0_0 :=
                                        M.SubPointer.get_struct_tuple_field (|
                                          γ,
                                          "core::option::Option::Some",
                                          0
                                        |) in
                                      let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                      let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                      let module_id := M.copy (| γ1_0 |) in
                                      let module := M.copy (| γ1_1 |) in
                                      let~ friend_module_ids :=
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_trait_method (|
                                              "core::iter::traits::iterator::Iterator",
                                              Ty.apply
                                                (Ty.path "alloc::vec::into_iter::IntoIter")
                                                []
                                                [
                                                  Ty.path
                                                    "move_core_types::language_storage::ModuleId";
                                                  Ty.path "alloc::alloc::Global"
                                                ],
                                              [],
                                              "collect",
                                              [
                                                Ty.apply
                                                  (Ty.path
                                                    "alloc::collections::btree::set::BTreeSet")
                                                  []
                                                  [
                                                    Ty.path
                                                      "move_core_types::language_storage::ModuleId";
                                                    Ty.path "alloc::alloc::Global"
                                                  ]
                                              ]
                                            |),
                                            [
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::iter::traits::collect::IntoIterator",
                                                  Ty.apply
                                                    (Ty.path "alloc::vec::Vec")
                                                    []
                                                    [
                                                      Ty.path
                                                        "move_core_types::language_storage::ModuleId";
                                                      Ty.path "alloc::alloc::Global"
                                                    ],
                                                  [],
                                                  "into_iter",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.path
                                                        "move_binary_format::file_format::CompiledModule",
                                                      "immediate_friends",
                                                      []
                                                    |),
                                                    [ M.read (| M.read (| module |) |) ]
                                                  |)
                                                ]
                                              |)
                                            ]
                                          |)
                                        |) in
                                      let~ _ :=
                                        M.use
                                          (M.match_operator (|
                                            M.alloc (|
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "core::iter::traits::collect::IntoIterator",
                                                  Ty.apply
                                                    (Ty.path "&")
                                                    []
                                                    [
                                                      Ty.apply
                                                        (Ty.path "slice")
                                                        []
                                                        [
                                                          Ty.path
                                                            "move_binary_format::file_format::StructDefinition"
                                                        ]
                                                    ],
                                                  [],
                                                  "into_iter",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.path
                                                        "move_binary_format::file_format::CompiledModule",
                                                      "struct_defs",
                                                      []
                                                    |),
                                                    [ M.read (| M.read (| module |) |) ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let iter := M.copy (| γ |) in
                                                  M.loop (|
                                                    ltac:(M.monadic
                                                      (let~ _ :=
                                                        M.match_operator (|
                                                          M.alloc (|
                                                            M.call_closure (|
                                                              M.get_trait_method (|
                                                                "core::iter::traits::iterator::Iterator",
                                                                Ty.apply
                                                                  (Ty.path
                                                                    "core::slice::iter::Iter")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "move_binary_format::file_format::StructDefinition"
                                                                  ],
                                                                [],
                                                                "next",
                                                                []
                                                              |),
                                                              [ iter ]
                                                            |)
                                                          |),
                                                          [
                                                            fun γ =>
                                                              ltac:(M.monadic
                                                                (let _ :=
                                                                  M.is_struct_tuple (|
                                                                    γ,
                                                                    "core::option::Option::None"
                                                                  |) in
                                                                M.alloc (|
                                                                  M.never_to_any (|
                                                                    M.read (| M.break (||) |)
                                                                  |)
                                                                |)));
                                                            fun γ =>
                                                              ltac:(M.monadic
                                                                (let γ0_0 :=
                                                                  M.SubPointer.get_struct_tuple_field (|
                                                                    γ,
                                                                    "core::option::Option::Some",
                                                                    0
                                                                  |) in
                                                                let struct_def :=
                                                                  M.copy (| γ0_0 |) in
                                                                let~ struct_handle :=
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.path
                                                                          "move_binary_format::file_format::CompiledModule",
                                                                        "struct_handle_at",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.read (|
                                                                          M.read (| module |)
                                                                        |);
                                                                        M.read (|
                                                                          M.SubPointer.get_struct_record_field (|
                                                                            M.read (| struct_def |),
                                                                            "move_binary_format::file_format::StructDefinition",
                                                                            "struct_handle"
                                                                          |)
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |) in
                                                                let~ struct_name :=
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.path
                                                                          "move_binary_format::file_format::CompiledModule",
                                                                        "identifier_at",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.read (|
                                                                          M.read (| module |)
                                                                        |);
                                                                        M.read (|
                                                                          M.SubPointer.get_struct_record_field (|
                                                                            M.read (|
                                                                              struct_handle
                                                                            |),
                                                                            "move_binary_format::file_format::StructHandle",
                                                                            "name"
                                                                          |)
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |) in
                                                                let~ _ :=
                                                                  M.alloc (|
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "alloc::collections::btree::map::BTreeMap")
                                                                          []
                                                                          [
                                                                            Ty.tuple
                                                                              [
                                                                                Ty.path
                                                                                  "move_core_types::language_storage::ModuleId";
                                                                                Ty.path
                                                                                  "move_core_types::identifier::Identifier"
                                                                              ];
                                                                            Ty.path
                                                                              "move_binary_format::file_format::StructHandleIndex";
                                                                            Ty.path
                                                                              "alloc::alloc::Global"
                                                                          ],
                                                                        "insert",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.SubPointer.get_struct_record_field (|
                                                                          context,
                                                                          "move_bytecode_verifier::dependencies::Context",
                                                                          "struct_id_to_handle_map"
                                                                        |);
                                                                        Value.Tuple
                                                                          [
                                                                            M.call_closure (|
                                                                              M.get_trait_method (|
                                                                                "core::clone::Clone",
                                                                                Ty.path
                                                                                  "move_core_types::language_storage::ModuleId",
                                                                                [],
                                                                                "clone",
                                                                                []
                                                                              |),
                                                                              [
                                                                                M.read (|
                                                                                  module_id
                                                                                |)
                                                                              ]
                                                                            |);
                                                                            M.call_closure (|
                                                                              M.get_trait_method (|
                                                                                "alloc::borrow::ToOwned",
                                                                                Ty.path
                                                                                  "move_core_types::identifier::IdentStr",
                                                                                [],
                                                                                "to_owned",
                                                                                []
                                                                              |),
                                                                              [
                                                                                M.read (|
                                                                                  struct_name
                                                                                |)
                                                                              ]
                                                                            |)
                                                                          ];
                                                                        M.read (|
                                                                          M.SubPointer.get_struct_record_field (|
                                                                            M.read (| struct_def |),
                                                                            "move_binary_format::file_format::StructDefinition",
                                                                            "struct_handle"
                                                                          |)
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |) in
                                                                M.alloc (| Value.Tuple [] |)))
                                                          ]
                                                        |) in
                                                      M.alloc (| Value.Tuple [] |)))
                                                  |)))
                                            ]
                                          |)) in
                                      M.use
                                        (M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::iter::traits::collect::IntoIterator",
                                                Ty.apply
                                                  (Ty.path "&")
                                                  []
                                                  [
                                                    Ty.apply
                                                      (Ty.path "slice")
                                                      []
                                                      [
                                                        Ty.path
                                                          "move_binary_format::file_format::FunctionDefinition"
                                                      ]
                                                  ],
                                                [],
                                                "into_iter",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.path
                                                      "move_binary_format::file_format::CompiledModule",
                                                    "function_defs",
                                                    []
                                                  |),
                                                  [ M.read (| M.read (| module |) |) ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let iter := M.copy (| γ |) in
                                                M.loop (|
                                                  ltac:(M.monadic
                                                    (let~ _ :=
                                                      M.match_operator (|
                                                        M.alloc (|
                                                          M.call_closure (|
                                                            M.get_trait_method (|
                                                              "core::iter::traits::iterator::Iterator",
                                                              Ty.apply
                                                                (Ty.path "core::slice::iter::Iter")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "move_binary_format::file_format::FunctionDefinition"
                                                                ],
                                                              [],
                                                              "next",
                                                              []
                                                            |),
                                                            [ iter ]
                                                          |)
                                                        |),
                                                        [
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let _ :=
                                                                M.is_struct_tuple (|
                                                                  γ,
                                                                  "core::option::Option::None"
                                                                |) in
                                                              M.alloc (|
                                                                M.never_to_any (|
                                                                  M.read (| M.break (||) |)
                                                                |)
                                                              |)));
                                                          fun γ =>
                                                            ltac:(M.monadic
                                                              (let γ0_0 :=
                                                                M.SubPointer.get_struct_tuple_field (|
                                                                  γ,
                                                                  "core::option::Option::Some",
                                                                  0
                                                                |) in
                                                              let func_def := M.copy (| γ0_0 |) in
                                                              let~ func_handle :=
                                                                M.alloc (|
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.path
                                                                        "move_binary_format::file_format::CompiledModule",
                                                                      "function_handle_at",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.read (|
                                                                        M.read (| module |)
                                                                      |);
                                                                      M.read (|
                                                                        M.SubPointer.get_struct_record_field (|
                                                                          M.read (| func_def |),
                                                                          "move_binary_format::file_format::FunctionDefinition",
                                                                          "function"
                                                                        |)
                                                                      |)
                                                                    ]
                                                                  |)
                                                                |) in
                                                              let~ func_name :=
                                                                M.alloc (|
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.path
                                                                        "move_binary_format::file_format::CompiledModule",
                                                                      "identifier_at",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.read (|
                                                                        M.read (| module |)
                                                                      |);
                                                                      M.read (|
                                                                        M.SubPointer.get_struct_record_field (|
                                                                          M.read (| func_handle |),
                                                                          "move_binary_format::file_format::FunctionHandle",
                                                                          "name"
                                                                        |)
                                                                      |)
                                                                    ]
                                                                  |)
                                                                |) in
                                                              let~ _ :=
                                                                M.alloc (|
                                                                  M.call_closure (|
                                                                    M.get_associated_function (|
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "alloc::collections::btree::map::BTreeMap")
                                                                        []
                                                                        [
                                                                          Ty.tuple
                                                                            [
                                                                              Ty.path
                                                                                "move_core_types::language_storage::ModuleId";
                                                                              Ty.path
                                                                                "move_core_types::identifier::Identifier"
                                                                            ];
                                                                          Ty.tuple
                                                                            [
                                                                              Ty.path
                                                                                "move_binary_format::file_format::Visibility";
                                                                              Ty.path "bool"
                                                                            ];
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      "insert",
                                                                      []
                                                                    |),
                                                                    [
                                                                      dependency_visibilities;
                                                                      Value.Tuple
                                                                        [
                                                                          M.call_closure (|
                                                                            M.get_trait_method (|
                                                                              "core::clone::Clone",
                                                                              Ty.path
                                                                                "move_core_types::language_storage::ModuleId",
                                                                              [],
                                                                              "clone",
                                                                              []
                                                                            |),
                                                                            [ M.read (| module_id |)
                                                                            ]
                                                                          |);
                                                                          M.call_closure (|
                                                                            M.get_trait_method (|
                                                                              "alloc::borrow::ToOwned",
                                                                              Ty.path
                                                                                "move_core_types::identifier::IdentStr",
                                                                              [],
                                                                              "to_owned",
                                                                              []
                                                                            |),
                                                                            [ M.read (| func_name |)
                                                                            ]
                                                                          |)
                                                                        ];
                                                                      Value.Tuple
                                                                        [
                                                                          M.read (|
                                                                            M.SubPointer.get_struct_record_field (|
                                                                              M.read (| func_def |),
                                                                              "move_binary_format::file_format::FunctionDefinition",
                                                                              "visibility"
                                                                            |)
                                                                          |);
                                                                          M.read (|
                                                                            M.SubPointer.get_struct_record_field (|
                                                                              M.read (| func_def |),
                                                                              "move_binary_format::file_format::FunctionDefinition",
                                                                              "is_entry"
                                                                            |)
                                                                          |)
                                                                        ]
                                                                    ]
                                                                  |)
                                                                |) in
                                                              let~ may_be_called :=
                                                                M.copy (|
                                                                  M.match_operator (|
                                                                    M.SubPointer.get_struct_record_field (|
                                                                      M.read (| func_def |),
                                                                      "move_binary_format::file_format::FunctionDefinition",
                                                                      "visibility"
                                                                    |),
                                                                    [
                                                                      fun γ =>
                                                                        ltac:(M.monadic
                                                                          (let _ :=
                                                                            M.is_struct_tuple (|
                                                                              γ,
                                                                              "move_binary_format::file_format::Visibility::Public"
                                                                            |) in
                                                                          M.alloc (|
                                                                            Value.Bool true
                                                                          |)));
                                                                      fun γ =>
                                                                        ltac:(M.monadic
                                                                          (let _ :=
                                                                            M.is_struct_tuple (|
                                                                              γ,
                                                                              "move_binary_format::file_format::Visibility::Friend"
                                                                            |) in
                                                                          M.alloc (|
                                                                            M.call_closure (|
                                                                              M.get_associated_function (|
                                                                                Ty.apply
                                                                                  (Ty.path
                                                                                    "alloc::collections::btree::set::BTreeSet")
                                                                                  []
                                                                                  [
                                                                                    Ty.path
                                                                                      "move_core_types::language_storage::ModuleId";
                                                                                    Ty.path
                                                                                      "alloc::alloc::Global"
                                                                                  ],
                                                                                "contains",
                                                                                [
                                                                                  Ty.path
                                                                                    "move_core_types::language_storage::ModuleId"
                                                                                ]
                                                                              |),
                                                                              [
                                                                                friend_module_ids;
                                                                                self_module
                                                                              ]
                                                                            |)
                                                                          |)));
                                                                      fun γ =>
                                                                        ltac:(M.monadic
                                                                          (let _ :=
                                                                            M.is_struct_tuple (|
                                                                              γ,
                                                                              "move_binary_format::file_format::Visibility::Private"
                                                                            |) in
                                                                          M.alloc (|
                                                                            Value.Bool false
                                                                          |)))
                                                                    ]
                                                                  |)
                                                                |) in
                                                              M.match_operator (|
                                                                M.alloc (| Value.Tuple [] |),
                                                                [
                                                                  fun γ =>
                                                                    ltac:(M.monadic
                                                                      (let γ :=
                                                                        M.use may_be_called in
                                                                      let _ :=
                                                                        M.is_constant_or_break_match (|
                                                                          M.read (| γ |),
                                                                          Value.Bool true
                                                                        |) in
                                                                      let~ _ :=
                                                                        M.alloc (|
                                                                          M.call_closure (|
                                                                            M.get_associated_function (|
                                                                              Ty.apply
                                                                                (Ty.path
                                                                                  "alloc::collections::btree::map::BTreeMap")
                                                                                []
                                                                                [
                                                                                  Ty.tuple
                                                                                    [
                                                                                      Ty.path
                                                                                        "move_core_types::language_storage::ModuleId";
                                                                                      Ty.path
                                                                                        "move_core_types::identifier::Identifier"
                                                                                    ];
                                                                                  Ty.path
                                                                                    "move_binary_format::file_format::FunctionHandleIndex";
                                                                                  Ty.path
                                                                                    "alloc::alloc::Global"
                                                                                ],
                                                                              "insert",
                                                                              []
                                                                            |),
                                                                            [
                                                                              M.SubPointer.get_struct_record_field (|
                                                                                context,
                                                                                "move_bytecode_verifier::dependencies::Context",
                                                                                "func_id_to_handle_map"
                                                                              |);
                                                                              Value.Tuple
                                                                                [
                                                                                  M.call_closure (|
                                                                                    M.get_trait_method (|
                                                                                      "core::clone::Clone",
                                                                                      Ty.path
                                                                                        "move_core_types::language_storage::ModuleId",
                                                                                      [],
                                                                                      "clone",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      M.read (|
                                                                                        module_id
                                                                                      |)
                                                                                    ]
                                                                                  |);
                                                                                  M.call_closure (|
                                                                                    M.get_trait_method (|
                                                                                      "alloc::borrow::ToOwned",
                                                                                      Ty.path
                                                                                        "move_core_types::identifier::IdentStr",
                                                                                      [],
                                                                                      "to_owned",
                                                                                      []
                                                                                    |),
                                                                                    [
                                                                                      M.read (|
                                                                                        func_name
                                                                                      |)
                                                                                    ]
                                                                                  |)
                                                                                ];
                                                                              M.read (|
                                                                                M.SubPointer.get_struct_record_field (|
                                                                                  M.read (|
                                                                                    func_def
                                                                                  |),
                                                                                  "move_binary_format::file_format::FunctionDefinition",
                                                                                  "function"
                                                                                |)
                                                                              |)
                                                                            ]
                                                                          |)
                                                                        |) in
                                                                      M.alloc (|
                                                                        Value.Tuple []
                                                                      |)));
                                                                  fun γ =>
                                                                    ltac:(M.monadic
                                                                      (M.alloc (|
                                                                        Value.Tuple []
                                                                      |)))
                                                                ]
                                                              |)))
                                                        ]
                                                      |) in
                                                    M.alloc (| Value.Tuple [] |)))
                                                |)))
                                          ]
                                        |))))
                                ]
                              |) in
                            M.alloc (| Value.Tuple [] |)))
                        |)))
                  ]
                |)) in
            let~ _ :=
              M.use
                (M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::collect::IntoIterator",
                        Ty.apply
                          (Ty.path "&")
                          []
                          [
                            Ty.apply
                              (Ty.path "slice")
                              []
                              [ Ty.path "move_binary_format::file_format::FunctionDefinition" ]
                          ],
                        [],
                        "into_iter",
                        []
                      |),
                      [ M.read (| self_function_defs |) ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let iter := M.copy (| γ |) in
                        M.loop (|
                          ltac:(M.monadic
                            (let~ _ :=
                              M.match_operator (|
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.apply
                                        (Ty.path "core::slice::iter::Iter")
                                        []
                                        [
                                          Ty.path
                                            "move_binary_format::file_format::FunctionDefinition"
                                        ],
                                      [],
                                      "next",
                                      []
                                    |),
                                    [ iter ]
                                  |)
                                |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let _ :=
                                        M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                      M.alloc (|
                                        M.never_to_any (| M.read (| M.break (||) |) |)
                                      |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ0_0 :=
                                        M.SubPointer.get_struct_tuple_field (|
                                          γ,
                                          "core::option::Option::Some",
                                          0
                                        |) in
                                      let function_def := M.copy (| γ0_0 |) in
                                      let~ _ :=
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.apply
                                                (Ty.path "alloc::collections::btree::map::BTreeMap")
                                                []
                                                [
                                                  Ty.path
                                                    "move_binary_format::file_format::FunctionHandleIndex";
                                                  Ty.path
                                                    "move_binary_format::file_format::Visibility";
                                                  Ty.path "alloc::alloc::Global"
                                                ],
                                              "insert",
                                              []
                                            |),
                                            [
                                              M.SubPointer.get_struct_record_field (|
                                                context,
                                                "move_bytecode_verifier::dependencies::Context",
                                                "function_visibilities"
                                              |);
                                              M.read (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| function_def |),
                                                  "move_binary_format::file_format::FunctionDefinition",
                                                  "function"
                                                |)
                                              |);
                                              M.read (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| function_def |),
                                                  "move_binary_format::file_format::FunctionDefinition",
                                                  "visibility"
                                                |)
                                              |)
                                            ]
                                          |)
                                        |) in
                                      M.match_operator (|
                                        M.alloc (| Value.Tuple [] |),
                                        [
                                          fun γ =>
                                            ltac:(M.monadic
                                              (let γ :=
                                                M.use
                                                  (M.SubPointer.get_struct_record_field (|
                                                    M.read (| function_def |),
                                                    "move_binary_format::file_format::FunctionDefinition",
                                                    "is_entry"
                                                  |)) in
                                              let _ :=
                                                M.is_constant_or_break_match (|
                                                  M.read (| γ |),
                                                  Value.Bool true
                                                |) in
                                              let~ _ :=
                                                M.alloc (|
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path "core::option::Option")
                                                        []
                                                        [
                                                          Ty.apply
                                                            (Ty.path "&mut")
                                                            []
                                                            [
                                                              Ty.apply
                                                                (Ty.path
                                                                  "alloc::collections::btree::set::BTreeSet")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "move_binary_format::file_format::FunctionHandleIndex";
                                                                  Ty.path "alloc::alloc::Global"
                                                                ]
                                                            ]
                                                        ],
                                                      "map",
                                                      [
                                                        Ty.path "bool";
                                                        Ty.function
                                                          [
                                                            Ty.tuple
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "&mut")
                                                                  []
                                                                  [
                                                                    Ty.apply
                                                                      (Ty.path
                                                                        "alloc::collections::btree::set::BTreeSet")
                                                                      []
                                                                      [
                                                                        Ty.path
                                                                          "move_binary_format::file_format::FunctionHandleIndex";
                                                                        Ty.path
                                                                          "alloc::alloc::Global"
                                                                      ]
                                                                  ]
                                                              ]
                                                          ]
                                                          (Ty.path "bool")
                                                      ]
                                                    |),
                                                    [
                                                      M.call_closure (|
                                                        M.get_associated_function (|
                                                          Ty.apply
                                                            (Ty.path "core::option::Option")
                                                            []
                                                            [
                                                              Ty.apply
                                                                (Ty.path
                                                                  "alloc::collections::btree::set::BTreeSet")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "move_binary_format::file_format::FunctionHandleIndex";
                                                                  Ty.path "alloc::alloc::Global"
                                                                ]
                                                            ],
                                                          "as_mut",
                                                          []
                                                        |),
                                                        [
                                                          M.SubPointer.get_struct_record_field (|
                                                            context,
                                                            "move_bytecode_verifier::dependencies::Context",
                                                            "script_functions"
                                                          |)
                                                        ]
                                                      |);
                                                      M.closure
                                                        (fun γ =>
                                                          ltac:(M.monadic
                                                            match γ with
                                                            | [ α0 ] =>
                                                              ltac:(M.monadic
                                                                (M.match_operator (|
                                                                  M.alloc (| α0 |),
                                                                  [
                                                                    fun γ =>
                                                                      ltac:(M.monadic
                                                                        (let s := M.copy (| γ |) in
                                                                        M.call_closure (|
                                                                          M.get_associated_function (|
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::collections::btree::set::BTreeSet")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "move_binary_format::file_format::FunctionHandleIndex";
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ],
                                                                            "insert",
                                                                            []
                                                                          |),
                                                                          [
                                                                            M.read (| s |);
                                                                            M.read (|
                                                                              M.SubPointer.get_struct_record_field (|
                                                                                M.read (|
                                                                                  function_def
                                                                                |),
                                                                                "move_binary_format::file_format::FunctionDefinition",
                                                                                "function"
                                                                              |)
                                                                            |)
                                                                          ]
                                                                        |)))
                                                                  ]
                                                                |)))
                                                            | _ =>
                                                              M.impossible
                                                                "wrong number of arguments"
                                                            end))
                                                    ]
                                                  |)
                                                |) in
                                              M.alloc (| Value.Tuple [] |)));
                                          fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                        ]
                                      |)))
                                ]
                              |) in
                            M.alloc (| Value.Tuple [] |)))
                        |)))
                  ]
                |)) in
            let~ _ :=
              M.use
                (M.match_operator (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_trait_method (|
                        "core::iter::traits::collect::IntoIterator",
                        Ty.apply
                          (Ty.path "core::iter::adapters::enumerate::Enumerate")
                          []
                          [
                            Ty.apply
                              (Ty.path "core::slice::iter::Iter")
                              []
                              [ Ty.path "move_binary_format::file_format::FunctionHandle" ]
                          ],
                        [],
                        "into_iter",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_trait_method (|
                            "core::iter::traits::iterator::Iterator",
                            Ty.apply
                              (Ty.path "core::slice::iter::Iter")
                              []
                              [ Ty.path "move_binary_format::file_format::FunctionHandle" ],
                            [],
                            "enumerate",
                            []
                          |),
                          [
                            M.call_closure (|
                              M.get_associated_function (|
                                Ty.apply
                                  (Ty.path "slice")
                                  []
                                  [ Ty.path "move_binary_format::file_format::FunctionHandle" ],
                                "iter",
                                []
                              |),
                              [
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.path "move_binary_format::file_format::CompiledModule",
                                    "function_handles",
                                    []
                                  |),
                                  [
                                    M.read (|
                                      M.SubPointer.get_struct_record_field (|
                                        context,
                                        "move_bytecode_verifier::dependencies::Context",
                                        "module"
                                      |)
                                    |)
                                  ]
                                |)
                              ]
                            |)
                          ]
                        |)
                      ]
                    |)
                  |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let iter := M.copy (| γ |) in
                        M.loop (|
                          ltac:(M.monadic
                            (let~ _ :=
                              M.match_operator (|
                                M.alloc (|
                                  M.call_closure (|
                                    M.get_trait_method (|
                                      "core::iter::traits::iterator::Iterator",
                                      Ty.apply
                                        (Ty.path "core::iter::adapters::enumerate::Enumerate")
                                        []
                                        [
                                          Ty.apply
                                            (Ty.path "core::slice::iter::Iter")
                                            []
                                            [
                                              Ty.path
                                                "move_binary_format::file_format::FunctionHandle"
                                            ]
                                        ],
                                      [],
                                      "next",
                                      []
                                    |),
                                    [ iter ]
                                  |)
                                |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let _ :=
                                        M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                      M.alloc (|
                                        M.never_to_any (| M.read (| M.break (||) |) |)
                                      |)));
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ0_0 :=
                                        M.SubPointer.get_struct_tuple_field (|
                                          γ,
                                          "core::option::Option::Some",
                                          0
                                        |) in
                                      let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                      let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                      let idx := M.copy (| γ1_0 |) in
                                      let function_handle := M.copy (| γ1_1 |) in
                                      let~ _ :=
                                        M.match_operator (|
                                          M.alloc (| Value.Tuple [] |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ :=
                                                  M.use
                                                    (M.alloc (|
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::cmp::PartialEq",
                                                          Ty.path
                                                            "move_binary_format::file_format::ModuleHandleIndex",
                                                          [
                                                            Ty.path
                                                              "move_binary_format::file_format::ModuleHandleIndex"
                                                          ],
                                                          "eq",
                                                          []
                                                        |),
                                                        [
                                                          M.SubPointer.get_struct_record_field (|
                                                            M.read (| function_handle |),
                                                            "move_binary_format::file_format::FunctionHandle",
                                                            "module"
                                                          |);
                                                          self_module_idx
                                                        ]
                                                      |)
                                                    |)) in
                                                let _ :=
                                                  M.is_constant_or_break_match (|
                                                    M.read (| γ |),
                                                    Value.Bool true
                                                  |) in
                                                M.alloc (|
                                                  M.never_to_any (| M.read (| M.continue (||) |) |)
                                                |)));
                                            fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |) in
                                      let~ dep_module_id :=
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.path
                                                "move_binary_format::file_format::CompiledModule",
                                              "module_id_for_handle",
                                              []
                                            |),
                                            [
                                              M.read (|
                                                M.SubPointer.get_struct_record_field (|
                                                  context,
                                                  "move_bytecode_verifier::dependencies::Context",
                                                  "module"
                                                |)
                                              |);
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.path
                                                    "move_binary_format::file_format::CompiledModule",
                                                  "module_handle_at",
                                                  []
                                                |),
                                                [
                                                  M.read (|
                                                    M.SubPointer.get_struct_record_field (|
                                                      context,
                                                      "move_bytecode_verifier::dependencies::Context",
                                                      "module"
                                                    |)
                                                  |);
                                                  M.read (|
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| function_handle |),
                                                      "move_binary_format::file_format::FunctionHandle",
                                                      "module"
                                                    |)
                                                  |)
                                                ]
                                              |)
                                            ]
                                          |)
                                        |) in
                                      let~ function_name :=
                                        M.alloc (|
                                          M.call_closure (|
                                            M.get_associated_function (|
                                              Ty.path
                                                "move_binary_format::file_format::CompiledModule",
                                              "identifier_at",
                                              []
                                            |),
                                            [
                                              M.read (|
                                                M.SubPointer.get_struct_record_field (|
                                                  context,
                                                  "move_bytecode_verifier::dependencies::Context",
                                                  "module"
                                                |)
                                              |);
                                              M.read (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| function_handle |),
                                                  "move_binary_format::file_format::FunctionHandle",
                                                  "name"
                                                |)
                                              |)
                                            ]
                                          |)
                                        |) in
                                      let~ dep_file_format_version :=
                                        M.copy (|
                                          M.SubPointer.get_struct_record_field (|
                                            M.read (|
                                              M.call_closure (|
                                                M.get_associated_function (|
                                                  Ty.apply
                                                    (Ty.path "core::option::Option")
                                                    []
                                                    [
                                                      Ty.apply
                                                        (Ty.path "&")
                                                        []
                                                        [
                                                          Ty.apply
                                                            (Ty.path "&")
                                                            []
                                                            [
                                                              Ty.path
                                                                "move_binary_format::file_format::CompiledModule"
                                                            ]
                                                        ]
                                                    ],
                                                  "unwrap",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path
                                                          "alloc::collections::btree::map::BTreeMap")
                                                        []
                                                        [
                                                          Ty.path
                                                            "move_core_types::language_storage::ModuleId";
                                                          Ty.apply
                                                            (Ty.path "&")
                                                            []
                                                            [
                                                              Ty.path
                                                                "move_binary_format::file_format::CompiledModule"
                                                            ];
                                                          Ty.path "alloc::alloc::Global"
                                                        ],
                                                      "get",
                                                      [
                                                        Ty.path
                                                          "move_core_types::language_storage::ModuleId"
                                                      ]
                                                    |),
                                                    [
                                                      M.SubPointer.get_struct_record_field (|
                                                        context,
                                                        "move_bytecode_verifier::dependencies::Context",
                                                        "dependency_map"
                                                      |);
                                                      dep_module_id
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            "move_binary_format::file_format::CompiledModule",
                                            "version"
                                          |)
                                        |) in
                                      let~ dep_function :=
                                        M.alloc (|
                                          Value.Tuple
                                            [
                                              M.read (| dep_module_id |);
                                              M.call_closure (|
                                                M.get_trait_method (|
                                                  "alloc::borrow::ToOwned",
                                                  Ty.path "move_core_types::identifier::IdentStr",
                                                  [],
                                                  "to_owned",
                                                  []
                                                |),
                                                [ M.read (| function_name |) ]
                                              |)
                                            ]
                                        |) in
                                      M.match_operator (|
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path
                                                    "alloc::collections::btree::map::BTreeMap")
                                                  []
                                                  [
                                                    Ty.tuple
                                                      [
                                                        Ty.path
                                                          "move_core_types::language_storage::ModuleId";
                                                        Ty.path
                                                          "move_core_types::identifier::Identifier"
                                                      ];
                                                    Ty.tuple
                                                      [
                                                        Ty.path
                                                          "move_binary_format::file_format::Visibility";
                                                        Ty.path "bool"
                                                      ];
                                                    Ty.path "alloc::alloc::Global"
                                                  ],
                                                "get",
                                                [
                                                  Ty.tuple
                                                    [
                                                      Ty.path
                                                        "move_core_types::language_storage::ModuleId";
                                                      Ty.path
                                                        "move_core_types::identifier::Identifier"
                                                    ]
                                                ]
                                              |),
                                              [ dependency_visibilities; dep_function ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let _ :=
                                                  M.is_struct_tuple (|
                                                    γ,
                                                    "core::option::Option::None"
                                                  |) in
                                                M.alloc (|
                                                  M.never_to_any (| M.read (| M.continue (||) |) |)
                                                |)));
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::option::Option::Some",
                                                    0
                                                  |) in
                                                let vis_entry := M.copy (| γ0_0 |) in
                                                M.read (| vis_entry |)))
                                          ]
                                        |),
                                        [
                                          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 visibility := M.copy (| γ0_0 |) in
                                              let is_entry := M.copy (| γ0_1 |) in
                                              let~ fhandle_idx :=
                                                M.alloc (|
                                                  Value.StructTuple
                                                    "move_binary_format::file_format::FunctionHandleIndex"
                                                    [ M.rust_cast (M.read (| idx |)) ]
                                                |) in
                                              let~ _ :=
                                                M.alloc (|
                                                  M.call_closure (|
                                                    M.get_associated_function (|
                                                      Ty.apply
                                                        (Ty.path
                                                          "alloc::collections::btree::map::BTreeMap")
                                                        []
                                                        [
                                                          Ty.path
                                                            "move_binary_format::file_format::FunctionHandleIndex";
                                                          Ty.path
                                                            "move_binary_format::file_format::Visibility";
                                                          Ty.path "alloc::alloc::Global"
                                                        ],
                                                      "insert",
                                                      []
                                                    |),
                                                    [
                                                      M.SubPointer.get_struct_record_field (|
                                                        context,
                                                        "move_bytecode_verifier::dependencies::Context",
                                                        "function_visibilities"
                                                      |);
                                                      M.read (| fhandle_idx |);
                                                      M.read (| visibility |)
                                                    ]
                                                  |)
                                                |) in
                                              M.match_operator (|
                                                M.alloc (| Value.Tuple [] |),
                                                [
                                                  fun γ =>
                                                    ltac:(M.monadic
                                                      (let γ :=
                                                        M.use
                                                          (M.alloc (|
                                                            LogicalOp.and (|
                                                              BinOp.lt (|
                                                                M.read (|
                                                                  dep_file_format_version
                                                                |),
                                                                M.read (|
                                                                  M.get_constant (|
                                                                    "move_binary_format::file_format_common::VERSION_5"
                                                                  |)
                                                                |)
                                                              |),
                                                              ltac:(M.monadic
                                                                (M.read (| is_entry |)))
                                                            |)
                                                          |)) in
                                                      let _ :=
                                                        M.is_constant_or_break_match (|
                                                          M.read (| γ |),
                                                          Value.Bool true
                                                        |) in
                                                      let~ _ :=
                                                        M.alloc (|
                                                          M.call_closure (|
                                                            M.get_associated_function (|
                                                              Ty.apply
                                                                (Ty.path "core::option::Option")
                                                                []
                                                                [
                                                                  Ty.apply
                                                                    (Ty.path "&mut")
                                                                    []
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "alloc::collections::btree::set::BTreeSet")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "move_binary_format::file_format::FunctionHandleIndex";
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ]
                                                                    ]
                                                                ],
                                                              "map",
                                                              [
                                                                Ty.path "bool";
                                                                Ty.function
                                                                  [
                                                                    Ty.tuple
                                                                      [
                                                                        Ty.apply
                                                                          (Ty.path "&mut")
                                                                          []
                                                                          [
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::collections::btree::set::BTreeSet")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "move_binary_format::file_format::FunctionHandleIndex";
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ]
                                                                          ]
                                                                      ]
                                                                  ]
                                                                  (Ty.path "bool")
                                                              ]
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.apply
                                                                    (Ty.path "core::option::Option")
                                                                    []
                                                                    [
                                                                      Ty.apply
                                                                        (Ty.path
                                                                          "alloc::collections::btree::set::BTreeSet")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "move_binary_format::file_format::FunctionHandleIndex";
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ]
                                                                    ],
                                                                  "as_mut",
                                                                  []
                                                                |),
                                                                [
                                                                  M.SubPointer.get_struct_record_field (|
                                                                    context,
                                                                    "move_bytecode_verifier::dependencies::Context",
                                                                    "script_functions"
                                                                  |)
                                                                ]
                                                              |);
                                                              M.closure
                                                                (fun γ =>
                                                                  ltac:(M.monadic
                                                                    match γ with
                                                                    | [ α0 ] =>
                                                                      ltac:(M.monadic
                                                                        (M.match_operator (|
                                                                          M.alloc (| α0 |),
                                                                          [
                                                                            fun γ =>
                                                                              ltac:(M.monadic
                                                                                (let s :=
                                                                                  M.copy (| γ |) in
                                                                                M.call_closure (|
                                                                                  M.get_associated_function (|
                                                                                    Ty.apply
                                                                                      (Ty.path
                                                                                        "alloc::collections::btree::set::BTreeSet")
                                                                                      []
                                                                                      [
                                                                                        Ty.path
                                                                                          "move_binary_format::file_format::FunctionHandleIndex";
                                                                                        Ty.path
                                                                                          "alloc::alloc::Global"
                                                                                      ],
                                                                                    "insert",
                                                                                    []
                                                                                  |),
                                                                                  [
                                                                                    M.read (| s |);
                                                                                    M.read (|
                                                                                      fhandle_idx
                                                                                    |)
                                                                                  ]
                                                                                |)))
                                                                          ]
                                                                        |)))
                                                                    | _ =>
                                                                      M.impossible
                                                                        "wrong number of arguments"
                                                                    end))
                                                            ]
                                                          |)
                                                        |) in
                                                      M.alloc (| Value.Tuple [] |)));
                                                  fun γ =>
                                                    ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                                ]
                                              |)))
                                        ]
                                      |)))
                                ]
                              |) in
                            M.alloc (| Value.Tuple [] |)))
                        |)))
                  ]
                |)) in
            context
          |)))
      | _, _, _ => M.impossible "wrong number of arguments"
      end.
    
    Axiom AssociatedFunction_new : M.IsAssociatedFunction Self "new" new.
  End Impl_move_bytecode_verifier_dependencies_Context.
  
  (*
  pub fn verify_module<'a>(
      module: &CompiledModule,
      dependencies: impl IntoIterator<Item = &'a CompiledModule>,
  ) -> VMResult<()> {
      verify_module_impl(module, dependencies)
          .map_err(|e| e.finish(Location::Module(module.self_id())))
  }
  *)
  Definition verify_module (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [ impl_IntoIterator_Item____'a_CompiledModule_ ], [ module; dependencies ] =>
      ltac:(M.monadic
        (let module := M.alloc (| module |) in
        let dependencies := M.alloc (| dependencies |) in
        M.call_closure (|
          M.get_associated_function (|
            Ty.apply
              (Ty.path "core::result::Result")
              []
              [ Ty.tuple []; Ty.path "move_binary_format::errors::PartialVMError" ],
            "map_err",
            [
              Ty.path "move_binary_format::errors::VMError";
              Ty.function
                [ Ty.tuple [ Ty.path "move_binary_format::errors::PartialVMError" ] ]
                (Ty.path "move_binary_format::errors::VMError")
            ]
          |),
          [
            M.call_closure (|
              M.get_function (|
                "move_bytecode_verifier::dependencies::verify_module_impl",
                [ impl_IntoIterator_Item____'a_CompiledModule_ ]
              |),
              [ M.read (| module |); M.read (| dependencies |) ]
            |);
            M.closure
              (fun γ =>
                ltac:(M.monadic
                  match γ with
                  | [ α0 ] =>
                    ltac:(M.monadic
                      (M.match_operator (|
                        M.alloc (| α0 |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let e := M.copy (| γ |) in
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.path "move_binary_format::errors::PartialVMError",
                                  "finish",
                                  []
                                |),
                                [
                                  M.read (| e |);
                                  Value.StructTuple
                                    "move_binary_format::errors::Location::Module"
                                    [
                                      M.call_closure (|
                                        M.get_associated_function (|
                                          Ty.path "move_binary_format::file_format::CompiledModule",
                                          "self_id",
                                          []
                                        |),
                                        [ M.read (| module |) ]
                                      |)
                                    ]
                                ]
                              |)))
                        ]
                      |)))
                  | _ => M.impossible "wrong number of arguments"
                  end))
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_verify_module :
    M.IsFunction "move_bytecode_verifier::dependencies::verify_module" verify_module.
  
  (*
  fn verify_module_impl<'a>(
      module: &CompiledModule,
      dependencies: impl IntoIterator<Item = &'a CompiledModule>,
  ) -> PartialVMResult<()> {
      let context = &Context::module(module, dependencies);
  
      verify_imported_modules(context)?;
      verify_imported_structs(context)?;
      verify_imported_functions(context)?;
      verify_all_script_visibility_usage(context)
  }
  *)
  Definition verify_module_impl (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [ impl_IntoIterator_Item____'a_CompiledModule_ ], [ module; dependencies ] =>
      ltac:(M.monadic
        (let module := M.alloc (| module |) in
        let dependencies := M.alloc (| dependencies |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ context :=
                M.alloc (|
                  M.alloc (|
                    M.call_closure (|
                      M.get_associated_function (|
                        Ty.path "move_bytecode_verifier::dependencies::Context",
                        "module",
                        [ impl_IntoIterator_Item____'a_CompiledModule_ ]
                      |),
                      [ M.read (| module |); M.read (| dependencies |) ]
                    |)
                  |)
                |) 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_binary_format::errors::PartialVMError" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_bytecode_verifier::dependencies::verify_imported_modules",
                            []
                          |),
                          [ M.read (| context |) ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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.path "move_binary_format::errors::PartialVMError"
                                      ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "move_binary_format::errors::PartialVMError"
                                        ]
                                    ],
                                    "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.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_binary_format::errors::PartialVMError" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_bytecode_verifier::dependencies::verify_imported_structs",
                            []
                          |),
                          [ M.read (| context |) ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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.path "move_binary_format::errors::PartialVMError"
                                      ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "move_binary_format::errors::PartialVMError"
                                        ]
                                    ],
                                    "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.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_binary_format::errors::PartialVMError" ],
                        [],
                        "branch",
                        []
                      |),
                      [
                        M.call_closure (|
                          M.get_function (|
                            "move_bytecode_verifier::dependencies::verify_imported_functions",
                            []
                          |),
                          [ M.read (| context |) ]
                        |)
                      ]
                    |)
                  |),
                  [
                    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.path "move_binary_format::errors::PartialVMError"
                                      ],
                                    [
                                      Ty.apply
                                        (Ty.path "core::result::Result")
                                        []
                                        [
                                          Ty.path "core::convert::Infallible";
                                          Ty.path "move_binary_format::errors::PartialVMError"
                                        ]
                                    ],
                                    "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 (|
                M.call_closure (|
                  M.get_function (|
                    "move_bytecode_verifier::dependencies::verify_all_script_visibility_usage",
                    []
                  |),
                  [ M.read (| context |) ]
                |)
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_verify_module_impl :
    M.IsFunction "move_bytecode_verifier::dependencies::verify_module_impl" verify_module_impl.
  
  (*
  fn verify_imported_modules(context: &Context) -> PartialVMResult<()> {
      let self_module = context.module.self_handle_idx();
      for (idx, module_handle) in context.module.module_handles().iter().enumerate() {
          let module_id = context.module.module_id_for_handle(module_handle);
          if ModuleHandleIndex(idx as u16) != self_module
              && !context.dependency_map.contains_key(&module_id)
          {
              return Err(verification_error(
                  StatusCode::MISSING_DEPENDENCY,
                  IndexKind::ModuleHandle,
                  idx as TableIndex,
              ));
          }
      }
      Ok(())
  }
  *)
  Definition verify_imported_modules (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ context ] =>
      ltac:(M.monadic
        (let context := M.alloc (| context |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ self_module :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "move_binary_format::file_format::CompiledModule",
                      "self_handle_idx",
                      []
                    |),
                    [
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| context |),
                          "move_bytecode_verifier::dependencies::Context",
                          "module"
                        |)
                      |)
                    ]
                  |)
                |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::enumerate::Enumerate")
                            []
                            [
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::ModuleHandle" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::ModuleHandle" ],
                              [],
                              "enumerate",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "slice")
                                    []
                                    [ Ty.path "move_binary_format::file_format::ModuleHandle" ],
                                  "iter",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format::CompiledModule",
                                      "module_handles",
                                      []
                                    |),
                                    [
                                      M.read (|
                                        M.SubPointer.get_struct_record_field (|
                                          M.read (| context |),
                                          "move_bytecode_verifier::dependencies::Context",
                                          "module"
                                        |)
                                      |)
                                    ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::enumerate::Enumerate")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::slice::iter::Iter")
                                              []
                                              [
                                                Ty.path
                                                  "move_binary_format::file_format::ModuleHandle"
                                              ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                        let idx := M.copy (| γ1_0 |) in
                                        let module_handle := M.copy (| γ1_1 |) in
                                        let~ module_id :=
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format::CompiledModule",
                                                "module_id_for_handle",
                                                []
                                              |),
                                              [
                                                M.read (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| context |),
                                                    "move_bytecode_verifier::dependencies::Context",
                                                    "module"
                                                  |)
                                                |);
                                                M.read (| module_handle |)
                                              ]
                                            |)
                                          |) in
                                        M.match_operator (|
                                          M.alloc (| Value.Tuple [] |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ :=
                                                  M.use
                                                    (M.alloc (|
                                                      LogicalOp.and (|
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::cmp::PartialEq",
                                                            Ty.path
                                                              "move_binary_format::file_format::ModuleHandleIndex",
                                                            [
                                                              Ty.path
                                                                "move_binary_format::file_format::ModuleHandleIndex"
                                                            ],
                                                            "ne",
                                                            []
                                                          |),
                                                          [
                                                            M.alloc (|
                                                              Value.StructTuple
                                                                "move_binary_format::file_format::ModuleHandleIndex"
                                                                [ M.rust_cast (M.read (| idx |)) ]
                                                            |);
                                                            self_module
                                                          ]
                                                        |),
                                                        ltac:(M.monadic
                                                          (UnOp.not (|
                                                            M.call_closure (|
                                                              M.get_associated_function (|
                                                                Ty.apply
                                                                  (Ty.path
                                                                    "alloc::collections::btree::map::BTreeMap")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "move_core_types::language_storage::ModuleId";
                                                                    Ty.apply
                                                                      (Ty.path "&")
                                                                      []
                                                                      [
                                                                        Ty.path
                                                                          "move_binary_format::file_format::CompiledModule"
                                                                      ];
                                                                    Ty.path "alloc::alloc::Global"
                                                                  ],
                                                                "contains_key",
                                                                [
                                                                  Ty.path
                                                                    "move_core_types::language_storage::ModuleId"
                                                                ]
                                                              |),
                                                              [
                                                                M.SubPointer.get_struct_record_field (|
                                                                  M.read (| context |),
                                                                  "move_bytecode_verifier::dependencies::Context",
                                                                  "dependency_map"
                                                                |);
                                                                module_id
                                                              ]
                                                            |)
                                                          |)))
                                                      |)
                                                    |)) in
                                                let _ :=
                                                  M.is_constant_or_break_match (|
                                                    M.read (| γ |),
                                                    Value.Bool true
                                                  |) in
                                                M.alloc (|
                                                  M.never_to_any (|
                                                    M.read (|
                                                      M.return_ (|
                                                        Value.StructTuple
                                                          "core::result::Result::Err"
                                                          [
                                                            M.call_closure (|
                                                              M.get_function (|
                                                                "move_binary_format::errors::verification_error",
                                                                []
                                                              |),
                                                              [
                                                                Value.StructTuple
                                                                  "move_core_types::vm_status::StatusCode::MISSING_DEPENDENCY"
                                                                  [];
                                                                Value.StructTuple
                                                                  "move_binary_format::IndexKind::ModuleHandle"
                                                                  [];
                                                                M.rust_cast (M.read (| idx |))
                                                              ]
                                                            |)
                                                          ]
                                                      |)
                                                    |)
                                                  |)
                                                |)));
                                            fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_verify_imported_modules :
    M.IsFunction
      "move_bytecode_verifier::dependencies::verify_imported_modules"
      verify_imported_modules.
  
  (*
  fn verify_imported_structs(context: &Context) -> PartialVMResult<()> {
      let self_module = context.module.self_handle_idx();
      for (idx, struct_handle) in context.module.struct_handles().iter().enumerate() {
          if struct_handle.module == self_module {
              continue;
          }
          let owner_module_id = context
              .module
              .module_id_for_handle(context.module.module_handle_at(struct_handle.module));
          // TODO: remove unwrap
          let owner_module = safe_unwrap!(context.dependency_map.get(&owner_module_id));
          let struct_name = context.module.identifier_at(struct_handle.name);
          match context
              .struct_id_to_handle_map
              .get(&(owner_module_id, struct_name.to_owned()))
          {
              Some(def_idx) => {
                  let def_handle = owner_module.struct_handle_at( *def_idx);
                  if !compatible_struct_abilities(struct_handle.abilities, def_handle.abilities)
                      || !compatible_struct_type_parameters(
                          &struct_handle.type_parameters,
                          &def_handle.type_parameters,
                      )
                  {
                      return Err(verification_error(
                          StatusCode::TYPE_MISMATCH,
                          IndexKind::StructHandle,
                          idx as TableIndex,
                      ));
                  }
              }
              None => {
                  return Err(verification_error(
                      StatusCode::LOOKUP_FAILED,
                      IndexKind::StructHandle,
                      idx as TableIndex,
                  ))
              }
          }
      }
      Ok(())
  }
  *)
  Definition verify_imported_structs (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ context ] =>
      ltac:(M.monadic
        (let context := M.alloc (| context |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ self_module :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "move_binary_format::file_format::CompiledModule",
                      "self_handle_idx",
                      []
                    |),
                    [
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| context |),
                          "move_bytecode_verifier::dependencies::Context",
                          "module"
                        |)
                      |)
                    ]
                  |)
                |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::enumerate::Enumerate")
                            []
                            [
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::StructHandle" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::StructHandle" ],
                              [],
                              "enumerate",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "slice")
                                    []
                                    [ Ty.path "move_binary_format::file_format::StructHandle" ],
                                  "iter",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format::CompiledModule",
                                      "struct_handles",
                                      []
                                    |),
                                    [
                                      M.read (|
                                        M.SubPointer.get_struct_record_field (|
                                          M.read (| context |),
                                          "move_bytecode_verifier::dependencies::Context",
                                          "module"
                                        |)
                                      |)
                                    ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::enumerate::Enumerate")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::slice::iter::Iter")
                                              []
                                              [
                                                Ty.path
                                                  "move_binary_format::file_format::StructHandle"
                                              ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                        let idx := M.copy (| γ1_0 |) in
                                        let struct_handle := M.copy (| γ1_1 |) in
                                        let~ _ :=
                                          M.match_operator (|
                                            M.alloc (| Value.Tuple [] |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ :=
                                                    M.use
                                                      (M.alloc (|
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::cmp::PartialEq",
                                                            Ty.path
                                                              "move_binary_format::file_format::ModuleHandleIndex",
                                                            [
                                                              Ty.path
                                                                "move_binary_format::file_format::ModuleHandleIndex"
                                                            ],
                                                            "eq",
                                                            []
                                                          |),
                                                          [
                                                            M.SubPointer.get_struct_record_field (|
                                                              M.read (| struct_handle |),
                                                              "move_binary_format::file_format::StructHandle",
                                                              "module"
                                                            |);
                                                            self_module
                                                          ]
                                                        |)
                                                      |)) in
                                                  let _ :=
                                                    M.is_constant_or_break_match (|
                                                      M.read (| γ |),
                                                      Value.Bool true
                                                    |) in
                                                  M.alloc (|
                                                    M.never_to_any (|
                                                      M.read (| M.continue (||) |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |) in
                                        let~ owner_module_id :=
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format::CompiledModule",
                                                "module_id_for_handle",
                                                []
                                              |),
                                              [
                                                M.read (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| context |),
                                                    "move_bytecode_verifier::dependencies::Context",
                                                    "module"
                                                  |)
                                                |);
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.path
                                                      "move_binary_format::file_format::CompiledModule",
                                                    "module_handle_at",
                                                    []
                                                  |),
                                                  [
                                                    M.read (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| context |),
                                                        "move_bytecode_verifier::dependencies::Context",
                                                        "module"
                                                      |)
                                                    |);
                                                    M.read (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| struct_handle |),
                                                        "move_binary_format::file_format::StructHandle",
                                                        "module"
                                                      |)
                                                    |)
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |) in
                                        let~ owner_module :=
                                          M.copy (|
                                            M.match_operator (|
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply
                                                      (Ty.path
                                                        "alloc::collections::btree::map::BTreeMap")
                                                      []
                                                      [
                                                        Ty.path
                                                          "move_core_types::language_storage::ModuleId";
                                                        Ty.apply
                                                          (Ty.path "&")
                                                          []
                                                          [
                                                            Ty.path
                                                              "move_binary_format::file_format::CompiledModule"
                                                          ];
                                                        Ty.path "alloc::alloc::Global"
                                                      ],
                                                    "get",
                                                    [
                                                      Ty.path
                                                        "move_core_types::language_storage::ModuleId"
                                                    ]
                                                  |),
                                                  [
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| context |),
                                                      "move_bytecode_verifier::dependencies::Context",
                                                      "dependency_map"
                                                    |);
                                                    owner_module_id
                                                  ]
                                                |)
                                              |),
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let γ0_0 :=
                                                      M.SubPointer.get_struct_tuple_field (|
                                                        γ,
                                                        "core::option::Option::Some",
                                                        0
                                                      |) in
                                                    let x := M.copy (| γ0_0 |) in
                                                    x));
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let _ :=
                                                      M.is_struct_tuple (|
                                                        γ,
                                                        "core::option::Option::None"
                                                      |) in
                                                    let~ err :=
                                                      M.alloc (|
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.path
                                                              "move_binary_format::errors::PartialVMError",
                                                            "with_message",
                                                            []
                                                          |),
                                                          [
                                                            M.call_closure (|
                                                              M.get_associated_function (|
                                                                Ty.path
                                                                  "move_binary_format::errors::PartialVMError",
                                                                "new",
                                                                []
                                                              |),
                                                              [
                                                                Value.StructTuple
                                                                  "move_core_types::vm_status::StatusCode::UNKNOWN_INVARIANT_VIOLATION_ERROR"
                                                                  []
                                                              ]
                                                            |);
                                                            M.call_closure (|
                                                              M.get_function (|
                                                                "core::hint::must_use",
                                                                [ Ty.path "alloc::string::String" ]
                                                              |),
                                                              [
                                                                M.read (|
                                                                  let~ res :=
                                                                    M.alloc (|
                                                                      M.call_closure (|
                                                                        M.get_function (|
                                                                          "alloc::fmt::format",
                                                                          []
                                                                        |),
                                                                        [
                                                                          M.call_closure (|
                                                                            M.get_associated_function (|
                                                                              Ty.path
                                                                                "core::fmt::Arguments",
                                                                              "new_v1",
                                                                              []
                                                                            |),
                                                                            [
                                                                              M.alloc (|
                                                                                Value.Array
                                                                                  [
                                                                                    M.read (|
                                                                                      Value.String
                                                                                        "crates/move-bytecode-verifier/src/dependencies.rs:195 (none)"
                                                                                    |)
                                                                                  ]
                                                                              |);
                                                                              M.alloc (|
                                                                                M.call_closure (|
                                                                                  M.get_associated_function (|
                                                                                    Ty.path
                                                                                      "core::fmt::rt::Argument",
                                                                                    "none",
                                                                                    []
                                                                                  |),
                                                                                  []
                                                                                |)
                                                                              |)
                                                                            ]
                                                                          |)
                                                                        ]
                                                                      |)
                                                                    |) in
                                                                  res
                                                                |)
                                                              ]
                                                            |)
                                                          ]
                                                        |)
                                                      |) in
                                                    M.match_operator (|
                                                      M.alloc (| Value.Tuple [] |),
                                                      [
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (let γ :=
                                                              M.use
                                                                (M.alloc (| Value.Bool true |)) in
                                                            let _ :=
                                                              M.is_constant_or_break_match (|
                                                                M.read (| γ |),
                                                                Value.Bool true
                                                              |) in
                                                            M.alloc (|
                                                              M.never_to_any (|
                                                                M.call_closure (|
                                                                  M.get_function (|
                                                                    "core::panicking::panic_fmt",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.path
                                                                          "core::fmt::Arguments",
                                                                        "new_v1",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.alloc (|
                                                                          Value.Array
                                                                            [
                                                                              M.read (|
                                                                                Value.String ""
                                                                              |)
                                                                            ]
                                                                        |);
                                                                        M.alloc (|
                                                                          Value.Array
                                                                            [
                                                                              M.call_closure (|
                                                                                M.get_associated_function (|
                                                                                  Ty.path
                                                                                    "core::fmt::rt::Argument",
                                                                                  "new_debug",
                                                                                  [
                                                                                    Ty.path
                                                                                      "move_binary_format::errors::PartialVMError"
                                                                                  ]
                                                                                |),
                                                                                [ err ]
                                                                              |)
                                                                            ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  ]
                                                                |)
                                                              |)
                                                            |)));
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (M.alloc (|
                                                              M.never_to_any (|
                                                                M.read (|
                                                                  M.return_ (|
                                                                    Value.StructTuple
                                                                      "core::result::Result::Err"
                                                                      [ M.read (| err |) ]
                                                                  |)
                                                                |)
                                                              |)
                                                            |)))
                                                      ]
                                                    |)))
                                              ]
                                            |)
                                          |) in
                                        let~ struct_name :=
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format::CompiledModule",
                                                "identifier_at",
                                                []
                                              |),
                                              [
                                                M.read (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| context |),
                                                    "move_bytecode_verifier::dependencies::Context",
                                                    "module"
                                                  |)
                                                |);
                                                M.read (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| struct_handle |),
                                                    "move_binary_format::file_format::StructHandle",
                                                    "name"
                                                  |)
                                                |)
                                              ]
                                            |)
                                          |) in
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path
                                                    "alloc::collections::btree::map::BTreeMap")
                                                  []
                                                  [
                                                    Ty.tuple
                                                      [
                                                        Ty.path
                                                          "move_core_types::language_storage::ModuleId";
                                                        Ty.path
                                                          "move_core_types::identifier::Identifier"
                                                      ];
                                                    Ty.path
                                                      "move_binary_format::file_format::StructHandleIndex";
                                                    Ty.path "alloc::alloc::Global"
                                                  ],
                                                "get",
                                                [
                                                  Ty.tuple
                                                    [
                                                      Ty.path
                                                        "move_core_types::language_storage::ModuleId";
                                                      Ty.path
                                                        "move_core_types::identifier::Identifier"
                                                    ]
                                                ]
                                              |),
                                              [
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| context |),
                                                  "move_bytecode_verifier::dependencies::Context",
                                                  "struct_id_to_handle_map"
                                                |);
                                                M.alloc (|
                                                  Value.Tuple
                                                    [
                                                      M.read (| owner_module_id |);
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "alloc::borrow::ToOwned",
                                                          Ty.path
                                                            "move_core_types::identifier::IdentStr",
                                                          [],
                                                          "to_owned",
                                                          []
                                                        |),
                                                        [ M.read (| struct_name |) ]
                                                      |)
                                                    ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::option::Option::Some",
                                                    0
                                                  |) in
                                                let def_idx := M.copy (| γ0_0 |) in
                                                let~ def_handle :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.path
                                                          "move_binary_format::file_format::CompiledModule",
                                                        "struct_handle_at",
                                                        []
                                                      |),
                                                      [
                                                        M.read (| M.read (| owner_module |) |);
                                                        M.read (| M.read (| def_idx |) |)
                                                      ]
                                                    |)
                                                  |) in
                                                M.match_operator (|
                                                  M.alloc (| Value.Tuple [] |),
                                                  [
                                                    fun γ =>
                                                      ltac:(M.monadic
                                                        (let γ :=
                                                          M.use
                                                            (M.alloc (|
                                                              LogicalOp.or (|
                                                                UnOp.not (|
                                                                  M.call_closure (|
                                                                    M.get_function (|
                                                                      "move_bytecode_verifier::dependencies::compatible_struct_abilities",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.read (|
                                                                        M.SubPointer.get_struct_record_field (|
                                                                          M.read (|
                                                                            struct_handle
                                                                          |),
                                                                          "move_binary_format::file_format::StructHandle",
                                                                          "abilities"
                                                                        |)
                                                                      |);
                                                                      M.read (|
                                                                        M.SubPointer.get_struct_record_field (|
                                                                          M.read (| def_handle |),
                                                                          "move_binary_format::file_format::StructHandle",
                                                                          "abilities"
                                                                        |)
                                                                      |)
                                                                    ]
                                                                  |)
                                                                |),
                                                                ltac:(M.monadic
                                                                  (UnOp.not (|
                                                                    M.call_closure (|
                                                                      M.get_function (|
                                                                        "move_bytecode_verifier::dependencies::compatible_struct_type_parameters",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_trait_method (|
                                                                            "core::ops::deref::Deref",
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::vec::Vec")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "move_binary_format::file_format::StructTypeParameter";
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ],
                                                                            [],
                                                                            "deref",
                                                                            []
                                                                          |),
                                                                          [
                                                                            M.SubPointer.get_struct_record_field (|
                                                                              M.read (|
                                                                                struct_handle
                                                                              |),
                                                                              "move_binary_format::file_format::StructHandle",
                                                                              "type_parameters"
                                                                            |)
                                                                          ]
                                                                        |);
                                                                        M.call_closure (|
                                                                          M.get_trait_method (|
                                                                            "core::ops::deref::Deref",
                                                                            Ty.apply
                                                                              (Ty.path
                                                                                "alloc::vec::Vec")
                                                                              []
                                                                              [
                                                                                Ty.path
                                                                                  "move_binary_format::file_format::StructTypeParameter";
                                                                                Ty.path
                                                                                  "alloc::alloc::Global"
                                                                              ],
                                                                            [],
                                                                            "deref",
                                                                            []
                                                                          |),
                                                                          [
                                                                            M.SubPointer.get_struct_record_field (|
                                                                              M.read (|
                                                                                def_handle
                                                                              |),
                                                                              "move_binary_format::file_format::StructHandle",
                                                                              "type_parameters"
                                                                            |)
                                                                          ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  |)))
                                                              |)
                                                            |)) in
                                                        let _ :=
                                                          M.is_constant_or_break_match (|
                                                            M.read (| γ |),
                                                            Value.Bool true
                                                          |) in
                                                        M.alloc (|
                                                          M.never_to_any (|
                                                            M.read (|
                                                              M.return_ (|
                                                                Value.StructTuple
                                                                  "core::result::Result::Err"
                                                                  [
                                                                    M.call_closure (|
                                                                      M.get_function (|
                                                                        "move_binary_format::errors::verification_error",
                                                                        []
                                                                      |),
                                                                      [
                                                                        Value.StructTuple
                                                                          "move_core_types::vm_status::StatusCode::TYPE_MISMATCH"
                                                                          [];
                                                                        Value.StructTuple
                                                                          "move_binary_format::IndexKind::StructHandle"
                                                                          [];
                                                                        M.rust_cast
                                                                          (M.read (| idx |))
                                                                      ]
                                                                    |)
                                                                  ]
                                                              |)
                                                            |)
                                                          |)
                                                        |)));
                                                    fun γ =>
                                                      ltac:(M.monadic
                                                        (M.alloc (| Value.Tuple [] |)))
                                                  ]
                                                |)));
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let _ :=
                                                  M.is_struct_tuple (|
                                                    γ,
                                                    "core::option::Option::None"
                                                  |) in
                                                M.alloc (|
                                                  M.never_to_any (|
                                                    M.read (|
                                                      M.return_ (|
                                                        Value.StructTuple
                                                          "core::result::Result::Err"
                                                          [
                                                            M.call_closure (|
                                                              M.get_function (|
                                                                "move_binary_format::errors::verification_error",
                                                                []
                                                              |),
                                                              [
                                                                Value.StructTuple
                                                                  "move_core_types::vm_status::StatusCode::LOOKUP_FAILED"
                                                                  [];
                                                                Value.StructTuple
                                                                  "move_binary_format::IndexKind::StructHandle"
                                                                  [];
                                                                M.rust_cast (M.read (| idx |))
                                                              ]
                                                            |)
                                                          ]
                                                      |)
                                                    |)
                                                  |)
                                                |)))
                                          ]
                                        |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_verify_imported_structs :
    M.IsFunction
      "move_bytecode_verifier::dependencies::verify_imported_structs"
      verify_imported_structs.
  
  (*
  fn verify_imported_functions(context: &Context) -> PartialVMResult<()> {
      let self_module = context.module.self_handle_idx();
      for (idx, function_handle) in context.module.function_handles().iter().enumerate() {
          if function_handle.module == self_module {
              continue;
          }
          let owner_module_id = context
              .module
              .module_id_for_handle(context.module.module_handle_at(function_handle.module));
          let function_name = context.module.identifier_at(function_handle.name);
          let owner_module = safe_unwrap!(context.dependency_map.get(&owner_module_id));
          match context
              .func_id_to_handle_map
              .get(&(owner_module_id.clone(), function_name.to_owned()))
          {
              Some(def_idx) => {
                  let def_handle = owner_module.function_handle_at( *def_idx);
                  // compatible type parameter constraints
                  if !compatible_fun_type_parameters(
                      &function_handle.type_parameters,
                      &def_handle.type_parameters,
                  ) {
                      return Err(verification_error(
                          StatusCode::TYPE_MISMATCH,
                          IndexKind::FunctionHandle,
                          idx as TableIndex,
                      ));
                  }
                  // same parameters
                  let handle_params = context.module.signature_at(function_handle.parameters);
                  let def_params = match context.dependency_map.get(&owner_module_id) {
                      Some(module) => module.signature_at(def_handle.parameters),
                      None => {
                          return Err(verification_error(
                              StatusCode::LOOKUP_FAILED,
                              IndexKind::FunctionHandle,
                              idx as TableIndex,
                          ))
                      }
                  };
  
                  compare_cross_module_signatures(
                      context,
                      &handle_params.0,
                      &def_params.0,
                      owner_module,
                  )
                  .map_err(|e| e.at_index(IndexKind::FunctionHandle, idx as TableIndex))?;
  
                  // same return_
                  let handle_return = context.module.signature_at(function_handle.return_);
                  let def_return = match context.dependency_map.get(&owner_module_id) {
                      Some(module) => module.signature_at(def_handle.return_),
                      None => {
                          return Err(verification_error(
                              StatusCode::LOOKUP_FAILED,
                              IndexKind::FunctionHandle,
                              idx as TableIndex,
                          ))
                      }
                  };
  
                  compare_cross_module_signatures(
                      context,
                      &handle_return.0,
                      &def_return.0,
                      owner_module,
                  )
                  .map_err(|e| e.at_index(IndexKind::FunctionHandle, idx as TableIndex))?;
              }
              None => {
                  return Err(verification_error(
                      StatusCode::LOOKUP_FAILED,
                      IndexKind::FunctionHandle,
                      idx as TableIndex,
                  ));
              }
          }
      }
      Ok(())
  }
  *)
  Definition verify_imported_functions (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ context ] =>
      ltac:(M.monadic
        (let context := M.alloc (| context |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ self_module :=
                M.alloc (|
                  M.call_closure (|
                    M.get_associated_function (|
                      Ty.path "move_binary_format::file_format::CompiledModule",
                      "self_handle_idx",
                      []
                    |),
                    [
                      M.read (|
                        M.SubPointer.get_struct_record_field (|
                          M.read (| context |),
                          "move_bytecode_verifier::dependencies::Context",
                          "module"
                        |)
                      |)
                    ]
                  |)
                |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::enumerate::Enumerate")
                            []
                            [
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::FunctionHandle" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::FunctionHandle" ],
                              [],
                              "enumerate",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "slice")
                                    []
                                    [ Ty.path "move_binary_format::file_format::FunctionHandle" ],
                                  "iter",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format::CompiledModule",
                                      "function_handles",
                                      []
                                    |),
                                    [
                                      M.read (|
                                        M.SubPointer.get_struct_record_field (|
                                          M.read (| context |),
                                          "move_bytecode_verifier::dependencies::Context",
                                          "module"
                                        |)
                                      |)
                                    ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::enumerate::Enumerate")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::slice::iter::Iter")
                                              []
                                              [
                                                Ty.path
                                                  "move_binary_format::file_format::FunctionHandle"
                                              ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                        let idx := M.copy (| γ1_0 |) in
                                        let function_handle := M.copy (| γ1_1 |) in
                                        let~ _ :=
                                          M.match_operator (|
                                            M.alloc (| Value.Tuple [] |),
                                            [
                                              fun γ =>
                                                ltac:(M.monadic
                                                  (let γ :=
                                                    M.use
                                                      (M.alloc (|
                                                        M.call_closure (|
                                                          M.get_trait_method (|
                                                            "core::cmp::PartialEq",
                                                            Ty.path
                                                              "move_binary_format::file_format::ModuleHandleIndex",
                                                            [
                                                              Ty.path
                                                                "move_binary_format::file_format::ModuleHandleIndex"
                                                            ],
                                                            "eq",
                                                            []
                                                          |),
                                                          [
                                                            M.SubPointer.get_struct_record_field (|
                                                              M.read (| function_handle |),
                                                              "move_binary_format::file_format::FunctionHandle",
                                                              "module"
                                                            |);
                                                            self_module
                                                          ]
                                                        |)
                                                      |)) in
                                                  let _ :=
                                                    M.is_constant_or_break_match (|
                                                      M.read (| γ |),
                                                      Value.Bool true
                                                    |) in
                                                  M.alloc (|
                                                    M.never_to_any (|
                                                      M.read (| M.continue (||) |)
                                                    |)
                                                  |)));
                                              fun γ =>
                                                ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                            ]
                                          |) in
                                        let~ owner_module_id :=
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format::CompiledModule",
                                                "module_id_for_handle",
                                                []
                                              |),
                                              [
                                                M.read (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| context |),
                                                    "move_bytecode_verifier::dependencies::Context",
                                                    "module"
                                                  |)
                                                |);
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.path
                                                      "move_binary_format::file_format::CompiledModule",
                                                    "module_handle_at",
                                                    []
                                                  |),
                                                  [
                                                    M.read (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| context |),
                                                        "move_bytecode_verifier::dependencies::Context",
                                                        "module"
                                                      |)
                                                    |);
                                                    M.read (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| function_handle |),
                                                        "move_binary_format::file_format::FunctionHandle",
                                                        "module"
                                                      |)
                                                    |)
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |) in
                                        let~ function_name :=
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format::CompiledModule",
                                                "identifier_at",
                                                []
                                              |),
                                              [
                                                M.read (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| context |),
                                                    "move_bytecode_verifier::dependencies::Context",
                                                    "module"
                                                  |)
                                                |);
                                                M.read (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| function_handle |),
                                                    "move_binary_format::file_format::FunctionHandle",
                                                    "name"
                                                  |)
                                                |)
                                              ]
                                            |)
                                          |) in
                                        let~ owner_module :=
                                          M.copy (|
                                            M.match_operator (|
                                              M.alloc (|
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply
                                                      (Ty.path
                                                        "alloc::collections::btree::map::BTreeMap")
                                                      []
                                                      [
                                                        Ty.path
                                                          "move_core_types::language_storage::ModuleId";
                                                        Ty.apply
                                                          (Ty.path "&")
                                                          []
                                                          [
                                                            Ty.path
                                                              "move_binary_format::file_format::CompiledModule"
                                                          ];
                                                        Ty.path "alloc::alloc::Global"
                                                      ],
                                                    "get",
                                                    [
                                                      Ty.path
                                                        "move_core_types::language_storage::ModuleId"
                                                    ]
                                                  |),
                                                  [
                                                    M.SubPointer.get_struct_record_field (|
                                                      M.read (| context |),
                                                      "move_bytecode_verifier::dependencies::Context",
                                                      "dependency_map"
                                                    |);
                                                    owner_module_id
                                                  ]
                                                |)
                                              |),
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let γ0_0 :=
                                                      M.SubPointer.get_struct_tuple_field (|
                                                        γ,
                                                        "core::option::Option::Some",
                                                        0
                                                      |) in
                                                    let x := M.copy (| γ0_0 |) in
                                                    x));
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let _ :=
                                                      M.is_struct_tuple (|
                                                        γ,
                                                        "core::option::Option::None"
                                                      |) in
                                                    let~ err :=
                                                      M.alloc (|
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.path
                                                              "move_binary_format::errors::PartialVMError",
                                                            "with_message",
                                                            []
                                                          |),
                                                          [
                                                            M.call_closure (|
                                                              M.get_associated_function (|
                                                                Ty.path
                                                                  "move_binary_format::errors::PartialVMError",
                                                                "new",
                                                                []
                                                              |),
                                                              [
                                                                Value.StructTuple
                                                                  "move_core_types::vm_status::StatusCode::UNKNOWN_INVARIANT_VIOLATION_ERROR"
                                                                  []
                                                              ]
                                                            |);
                                                            M.call_closure (|
                                                              M.get_function (|
                                                                "core::hint::must_use",
                                                                [ Ty.path "alloc::string::String" ]
                                                              |),
                                                              [
                                                                M.read (|
                                                                  let~ res :=
                                                                    M.alloc (|
                                                                      M.call_closure (|
                                                                        M.get_function (|
                                                                          "alloc::fmt::format",
                                                                          []
                                                                        |),
                                                                        [
                                                                          M.call_closure (|
                                                                            M.get_associated_function (|
                                                                              Ty.path
                                                                                "core::fmt::Arguments",
                                                                              "new_v1",
                                                                              []
                                                                            |),
                                                                            [
                                                                              M.alloc (|
                                                                                Value.Array
                                                                                  [
                                                                                    M.read (|
                                                                                      Value.String
                                                                                        "crates/move-bytecode-verifier/src/dependencies.rs:238 (none)"
                                                                                    |)
                                                                                  ]
                                                                              |);
                                                                              M.alloc (|
                                                                                M.call_closure (|
                                                                                  M.get_associated_function (|
                                                                                    Ty.path
                                                                                      "core::fmt::rt::Argument",
                                                                                    "none",
                                                                                    []
                                                                                  |),
                                                                                  []
                                                                                |)
                                                                              |)
                                                                            ]
                                                                          |)
                                                                        ]
                                                                      |)
                                                                    |) in
                                                                  res
                                                                |)
                                                              ]
                                                            |)
                                                          ]
                                                        |)
                                                      |) in
                                                    M.match_operator (|
                                                      M.alloc (| Value.Tuple [] |),
                                                      [
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (let γ :=
                                                              M.use
                                                                (M.alloc (| Value.Bool true |)) in
                                                            let _ :=
                                                              M.is_constant_or_break_match (|
                                                                M.read (| γ |),
                                                                Value.Bool true
                                                              |) in
                                                            M.alloc (|
                                                              M.never_to_any (|
                                                                M.call_closure (|
                                                                  M.get_function (|
                                                                    "core::panicking::panic_fmt",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.path
                                                                          "core::fmt::Arguments",
                                                                        "new_v1",
                                                                        []
                                                                      |),
                                                                      [
                                                                        M.alloc (|
                                                                          Value.Array
                                                                            [
                                                                              M.read (|
                                                                                Value.String ""
                                                                              |)
                                                                            ]
                                                                        |);
                                                                        M.alloc (|
                                                                          Value.Array
                                                                            [
                                                                              M.call_closure (|
                                                                                M.get_associated_function (|
                                                                                  Ty.path
                                                                                    "core::fmt::rt::Argument",
                                                                                  "new_debug",
                                                                                  [
                                                                                    Ty.path
                                                                                      "move_binary_format::errors::PartialVMError"
                                                                                  ]
                                                                                |),
                                                                                [ err ]
                                                                              |)
                                                                            ]
                                                                        |)
                                                                      ]
                                                                    |)
                                                                  ]
                                                                |)
                                                              |)
                                                            |)));
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (M.alloc (|
                                                              M.never_to_any (|
                                                                M.read (|
                                                                  M.return_ (|
                                                                    Value.StructTuple
                                                                      "core::result::Result::Err"
                                                                      [ M.read (| err |) ]
                                                                  |)
                                                                |)
                                                              |)
                                                            |)))
                                                      ]
                                                    |)))
                                              ]
                                            |)
                                          |) in
                                        M.match_operator (|
                                          M.alloc (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.apply
                                                  (Ty.path
                                                    "alloc::collections::btree::map::BTreeMap")
                                                  []
                                                  [
                                                    Ty.tuple
                                                      [
                                                        Ty.path
                                                          "move_core_types::language_storage::ModuleId";
                                                        Ty.path
                                                          "move_core_types::identifier::Identifier"
                                                      ];
                                                    Ty.path
                                                      "move_binary_format::file_format::FunctionHandleIndex";
                                                    Ty.path "alloc::alloc::Global"
                                                  ],
                                                "get",
                                                [
                                                  Ty.tuple
                                                    [
                                                      Ty.path
                                                        "move_core_types::language_storage::ModuleId";
                                                      Ty.path
                                                        "move_core_types::identifier::Identifier"
                                                    ]
                                                ]
                                              |),
                                              [
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| context |),
                                                  "move_bytecode_verifier::dependencies::Context",
                                                  "func_id_to_handle_map"
                                                |);
                                                M.alloc (|
                                                  Value.Tuple
                                                    [
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "core::clone::Clone",
                                                          Ty.path
                                                            "move_core_types::language_storage::ModuleId",
                                                          [],
                                                          "clone",
                                                          []
                                                        |),
                                                        [ owner_module_id ]
                                                      |);
                                                      M.call_closure (|
                                                        M.get_trait_method (|
                                                          "alloc::borrow::ToOwned",
                                                          Ty.path
                                                            "move_core_types::identifier::IdentStr",
                                                          [],
                                                          "to_owned",
                                                          []
                                                        |),
                                                        [ M.read (| function_name |) ]
                                                      |)
                                                    ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let γ0_0 :=
                                                  M.SubPointer.get_struct_tuple_field (|
                                                    γ,
                                                    "core::option::Option::Some",
                                                    0
                                                  |) in
                                                let def_idx := M.copy (| γ0_0 |) in
                                                let~ def_handle :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.path
                                                          "move_binary_format::file_format::CompiledModule",
                                                        "function_handle_at",
                                                        []
                                                      |),
                                                      [
                                                        M.read (| M.read (| owner_module |) |);
                                                        M.read (| M.read (| def_idx |) |)
                                                      ]
                                                    |)
                                                  |) in
                                                let~ _ :=
                                                  M.match_operator (|
                                                    M.alloc (| Value.Tuple [] |),
                                                    [
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (let γ :=
                                                            M.use
                                                              (M.alloc (|
                                                                UnOp.not (|
                                                                  M.call_closure (|
                                                                    M.get_function (|
                                                                      "move_bytecode_verifier::dependencies::compatible_fun_type_parameters",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_trait_method (|
                                                                          "core::ops::deref::Deref",
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "alloc::vec::Vec")
                                                                            []
                                                                            [
                                                                              Ty.path
                                                                                "move_binary_format::file_format::AbilitySet";
                                                                              Ty.path
                                                                                "alloc::alloc::Global"
                                                                            ],
                                                                          [],
                                                                          "deref",
                                                                          []
                                                                        |),
                                                                        [
                                                                          M.SubPointer.get_struct_record_field (|
                                                                            M.read (|
                                                                              function_handle
                                                                            |),
                                                                            "move_binary_format::file_format::FunctionHandle",
                                                                            "type_parameters"
                                                                          |)
                                                                        ]
                                                                      |);
                                                                      M.call_closure (|
                                                                        M.get_trait_method (|
                                                                          "core::ops::deref::Deref",
                                                                          Ty.apply
                                                                            (Ty.path
                                                                              "alloc::vec::Vec")
                                                                            []
                                                                            [
                                                                              Ty.path
                                                                                "move_binary_format::file_format::AbilitySet";
                                                                              Ty.path
                                                                                "alloc::alloc::Global"
                                                                            ],
                                                                          [],
                                                                          "deref",
                                                                          []
                                                                        |),
                                                                        [
                                                                          M.SubPointer.get_struct_record_field (|
                                                                            M.read (| def_handle |),
                                                                            "move_binary_format::file_format::FunctionHandle",
                                                                            "type_parameters"
                                                                          |)
                                                                        ]
                                                                      |)
                                                                    ]
                                                                  |)
                                                                |)
                                                              |)) in
                                                          let _ :=
                                                            M.is_constant_or_break_match (|
                                                              M.read (| γ |),
                                                              Value.Bool true
                                                            |) in
                                                          M.alloc (|
                                                            M.never_to_any (|
                                                              M.read (|
                                                                M.return_ (|
                                                                  Value.StructTuple
                                                                    "core::result::Result::Err"
                                                                    [
                                                                      M.call_closure (|
                                                                        M.get_function (|
                                                                          "move_binary_format::errors::verification_error",
                                                                          []
                                                                        |),
                                                                        [
                                                                          Value.StructTuple
                                                                            "move_core_types::vm_status::StatusCode::TYPE_MISMATCH"
                                                                            [];
                                                                          Value.StructTuple
                                                                            "move_binary_format::IndexKind::FunctionHandle"
                                                                            [];
                                                                          M.rust_cast
                                                                            (M.read (| idx |))
                                                                        ]
                                                                      |)
                                                                    ]
                                                                |)
                                                              |)
                                                            |)
                                                          |)));
                                                      fun γ =>
                                                        ltac:(M.monadic
                                                          (M.alloc (| Value.Tuple [] |)))
                                                    ]
                                                  |) in
                                                let~ handle_params :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.path
                                                          "move_binary_format::file_format::CompiledModule",
                                                        "signature_at",
                                                        []
                                                      |),
                                                      [
                                                        M.read (|
                                                          M.SubPointer.get_struct_record_field (|
                                                            M.read (| context |),
                                                            "move_bytecode_verifier::dependencies::Context",
                                                            "module"
                                                          |)
                                                        |);
                                                        M.read (|
                                                          M.SubPointer.get_struct_record_field (|
                                                            M.read (| function_handle |),
                                                            "move_binary_format::file_format::FunctionHandle",
                                                            "parameters"
                                                          |)
                                                        |)
                                                      ]
                                                    |)
                                                  |) in
                                                let~ def_params :=
                                                  M.copy (|
                                                    M.match_operator (|
                                                      M.alloc (|
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.apply
                                                              (Ty.path
                                                                "alloc::collections::btree::map::BTreeMap")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "move_core_types::language_storage::ModuleId";
                                                                Ty.apply
                                                                  (Ty.path "&")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "move_binary_format::file_format::CompiledModule"
                                                                  ];
                                                                Ty.path "alloc::alloc::Global"
                                                              ],
                                                            "get",
                                                            [
                                                              Ty.path
                                                                "move_core_types::language_storage::ModuleId"
                                                            ]
                                                          |),
                                                          [
                                                            M.SubPointer.get_struct_record_field (|
                                                              M.read (| context |),
                                                              "move_bytecode_verifier::dependencies::Context",
                                                              "dependency_map"
                                                            |);
                                                            owner_module_id
                                                          ]
                                                        |)
                                                      |),
                                                      [
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (let γ0_0 :=
                                                              M.SubPointer.get_struct_tuple_field (|
                                                                γ,
                                                                "core::option::Option::Some",
                                                                0
                                                              |) in
                                                            let module := M.copy (| γ0_0 |) in
                                                            M.alloc (|
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.path
                                                                    "move_binary_format::file_format::CompiledModule",
                                                                  "signature_at",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| M.read (| module |) |);
                                                                  M.read (|
                                                                    M.SubPointer.get_struct_record_field (|
                                                                      M.read (| def_handle |),
                                                                      "move_binary_format::file_format::FunctionHandle",
                                                                      "parameters"
                                                                    |)
                                                                  |)
                                                                ]
                                                              |)
                                                            |)));
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (let _ :=
                                                              M.is_struct_tuple (|
                                                                γ,
                                                                "core::option::Option::None"
                                                              |) in
                                                            M.alloc (|
                                                              M.never_to_any (|
                                                                M.read (|
                                                                  M.return_ (|
                                                                    Value.StructTuple
                                                                      "core::result::Result::Err"
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_function (|
                                                                            "move_binary_format::errors::verification_error",
                                                                            []
                                                                          |),
                                                                          [
                                                                            Value.StructTuple
                                                                              "move_core_types::vm_status::StatusCode::LOOKUP_FAILED"
                                                                              [];
                                                                            Value.StructTuple
                                                                              "move_binary_format::IndexKind::FunctionHandle"
                                                                              [];
                                                                            M.rust_cast
                                                                              (M.read (| idx |))
                                                                          ]
                                                                        |)
                                                                      ]
                                                                  |)
                                                                |)
                                                              |)
                                                            |)))
                                                      ]
                                                    |)
                                                  |) 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_binary_format::errors::PartialVMError"
                                                            ],
                                                          [],
                                                          "branch",
                                                          []
                                                        |),
                                                        [
                                                          M.call_closure (|
                                                            M.get_associated_function (|
                                                              Ty.apply
                                                                (Ty.path "core::result::Result")
                                                                []
                                                                [
                                                                  Ty.tuple [];
                                                                  Ty.path
                                                                    "move_binary_format::errors::PartialVMError"
                                                                ],
                                                              "map_err",
                                                              [
                                                                Ty.path
                                                                  "move_binary_format::errors::PartialVMError";
                                                                Ty.function
                                                                  [
                                                                    Ty.tuple
                                                                      [
                                                                        Ty.path
                                                                          "move_binary_format::errors::PartialVMError"
                                                                      ]
                                                                  ]
                                                                  (Ty.path
                                                                    "move_binary_format::errors::PartialVMError")
                                                              ]
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_bytecode_verifier::dependencies::compare_cross_module_signatures",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| context |);
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::ops::deref::Deref",
                                                                      Ty.apply
                                                                        (Ty.path "alloc::vec::Vec")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "move_binary_format::file_format::SignatureToken";
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      [],
                                                                      "deref",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.SubPointer.get_struct_tuple_field (|
                                                                        M.read (| handle_params |),
                                                                        "move_binary_format::file_format::Signature",
                                                                        0
                                                                      |)
                                                                    ]
                                                                  |);
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::ops::deref::Deref",
                                                                      Ty.apply
                                                                        (Ty.path "alloc::vec::Vec")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "move_binary_format::file_format::SignatureToken";
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      [],
                                                                      "deref",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.SubPointer.get_struct_tuple_field (|
                                                                        M.read (| def_params |),
                                                                        "move_binary_format::file_format::Signature",
                                                                        0
                                                                      |)
                                                                    ]
                                                                  |);
                                                                  M.read (|
                                                                    M.read (| owner_module |)
                                                                  |)
                                                                ]
                                                              |);
                                                              M.closure
                                                                (fun γ =>
                                                                  ltac:(M.monadic
                                                                    match γ with
                                                                    | [ α0 ] =>
                                                                      ltac:(M.monadic
                                                                        (M.match_operator (|
                                                                          M.alloc (| α0 |),
                                                                          [
                                                                            fun γ =>
                                                                              ltac:(M.monadic
                                                                                (let e :=
                                                                                  M.copy (| γ |) in
                                                                                M.call_closure (|
                                                                                  M.get_associated_function (|
                                                                                    Ty.path
                                                                                      "move_binary_format::errors::PartialVMError",
                                                                                    "at_index",
                                                                                    []
                                                                                  |),
                                                                                  [
                                                                                    M.read (| e |);
                                                                                    Value.StructTuple
                                                                                      "move_binary_format::IndexKind::FunctionHandle"
                                                                                      [];
                                                                                    M.rust_cast
                                                                                      (M.read (|
                                                                                        idx
                                                                                      |))
                                                                                  ]
                                                                                |)))
                                                                          ]
                                                                        |)))
                                                                    | _ =>
                                                                      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.tuple [];
                                                                          Ty.path
                                                                            "move_binary_format::errors::PartialVMError"
                                                                        ],
                                                                      [
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::result::Result")
                                                                          []
                                                                          [
                                                                            Ty.path
                                                                              "core::convert::Infallible";
                                                                            Ty.path
                                                                              "move_binary_format::errors::PartialVMError"
                                                                          ]
                                                                      ],
                                                                      "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~ handle_return :=
                                                  M.alloc (|
                                                    M.call_closure (|
                                                      M.get_associated_function (|
                                                        Ty.path
                                                          "move_binary_format::file_format::CompiledModule",
                                                        "signature_at",
                                                        []
                                                      |),
                                                      [
                                                        M.read (|
                                                          M.SubPointer.get_struct_record_field (|
                                                            M.read (| context |),
                                                            "move_bytecode_verifier::dependencies::Context",
                                                            "module"
                                                          |)
                                                        |);
                                                        M.read (|
                                                          M.SubPointer.get_struct_record_field (|
                                                            M.read (| function_handle |),
                                                            "move_binary_format::file_format::FunctionHandle",
                                                            "return_"
                                                          |)
                                                        |)
                                                      ]
                                                    |)
                                                  |) in
                                                let~ def_return :=
                                                  M.copy (|
                                                    M.match_operator (|
                                                      M.alloc (|
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.apply
                                                              (Ty.path
                                                                "alloc::collections::btree::map::BTreeMap")
                                                              []
                                                              [
                                                                Ty.path
                                                                  "move_core_types::language_storage::ModuleId";
                                                                Ty.apply
                                                                  (Ty.path "&")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "move_binary_format::file_format::CompiledModule"
                                                                  ];
                                                                Ty.path "alloc::alloc::Global"
                                                              ],
                                                            "get",
                                                            [
                                                              Ty.path
                                                                "move_core_types::language_storage::ModuleId"
                                                            ]
                                                          |),
                                                          [
                                                            M.SubPointer.get_struct_record_field (|
                                                              M.read (| context |),
                                                              "move_bytecode_verifier::dependencies::Context",
                                                              "dependency_map"
                                                            |);
                                                            owner_module_id
                                                          ]
                                                        |)
                                                      |),
                                                      [
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (let γ0_0 :=
                                                              M.SubPointer.get_struct_tuple_field (|
                                                                γ,
                                                                "core::option::Option::Some",
                                                                0
                                                              |) in
                                                            let module := M.copy (| γ0_0 |) in
                                                            M.alloc (|
                                                              M.call_closure (|
                                                                M.get_associated_function (|
                                                                  Ty.path
                                                                    "move_binary_format::file_format::CompiledModule",
                                                                  "signature_at",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| M.read (| module |) |);
                                                                  M.read (|
                                                                    M.SubPointer.get_struct_record_field (|
                                                                      M.read (| def_handle |),
                                                                      "move_binary_format::file_format::FunctionHandle",
                                                                      "return_"
                                                                    |)
                                                                  |)
                                                                ]
                                                              |)
                                                            |)));
                                                        fun γ =>
                                                          ltac:(M.monadic
                                                            (let _ :=
                                                              M.is_struct_tuple (|
                                                                γ,
                                                                "core::option::Option::None"
                                                              |) in
                                                            M.alloc (|
                                                              M.never_to_any (|
                                                                M.read (|
                                                                  M.return_ (|
                                                                    Value.StructTuple
                                                                      "core::result::Result::Err"
                                                                      [
                                                                        M.call_closure (|
                                                                          M.get_function (|
                                                                            "move_binary_format::errors::verification_error",
                                                                            []
                                                                          |),
                                                                          [
                                                                            Value.StructTuple
                                                                              "move_core_types::vm_status::StatusCode::LOOKUP_FAILED"
                                                                              [];
                                                                            Value.StructTuple
                                                                              "move_binary_format::IndexKind::FunctionHandle"
                                                                              [];
                                                                            M.rust_cast
                                                                              (M.read (| idx |))
                                                                          ]
                                                                        |)
                                                                      ]
                                                                  |)
                                                                |)
                                                              |)
                                                            |)))
                                                      ]
                                                    |)
                                                  |) 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_binary_format::errors::PartialVMError"
                                                            ],
                                                          [],
                                                          "branch",
                                                          []
                                                        |),
                                                        [
                                                          M.call_closure (|
                                                            M.get_associated_function (|
                                                              Ty.apply
                                                                (Ty.path "core::result::Result")
                                                                []
                                                                [
                                                                  Ty.tuple [];
                                                                  Ty.path
                                                                    "move_binary_format::errors::PartialVMError"
                                                                ],
                                                              "map_err",
                                                              [
                                                                Ty.path
                                                                  "move_binary_format::errors::PartialVMError";
                                                                Ty.function
                                                                  [
                                                                    Ty.tuple
                                                                      [
                                                                        Ty.path
                                                                          "move_binary_format::errors::PartialVMError"
                                                                      ]
                                                                  ]
                                                                  (Ty.path
                                                                    "move_binary_format::errors::PartialVMError")
                                                              ]
                                                            |),
                                                            [
                                                              M.call_closure (|
                                                                M.get_function (|
                                                                  "move_bytecode_verifier::dependencies::compare_cross_module_signatures",
                                                                  []
                                                                |),
                                                                [
                                                                  M.read (| context |);
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::ops::deref::Deref",
                                                                      Ty.apply
                                                                        (Ty.path "alloc::vec::Vec")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "move_binary_format::file_format::SignatureToken";
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      [],
                                                                      "deref",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.SubPointer.get_struct_tuple_field (|
                                                                        M.read (| handle_return |),
                                                                        "move_binary_format::file_format::Signature",
                                                                        0
                                                                      |)
                                                                    ]
                                                                  |);
                                                                  M.call_closure (|
                                                                    M.get_trait_method (|
                                                                      "core::ops::deref::Deref",
                                                                      Ty.apply
                                                                        (Ty.path "alloc::vec::Vec")
                                                                        []
                                                                        [
                                                                          Ty.path
                                                                            "move_binary_format::file_format::SignatureToken";
                                                                          Ty.path
                                                                            "alloc::alloc::Global"
                                                                        ],
                                                                      [],
                                                                      "deref",
                                                                      []
                                                                    |),
                                                                    [
                                                                      M.SubPointer.get_struct_tuple_field (|
                                                                        M.read (| def_return |),
                                                                        "move_binary_format::file_format::Signature",
                                                                        0
                                                                      |)
                                                                    ]
                                                                  |);
                                                                  M.read (|
                                                                    M.read (| owner_module |)
                                                                  |)
                                                                ]
                                                              |);
                                                              M.closure
                                                                (fun γ =>
                                                                  ltac:(M.monadic
                                                                    match γ with
                                                                    | [ α0 ] =>
                                                                      ltac:(M.monadic
                                                                        (M.match_operator (|
                                                                          M.alloc (| α0 |),
                                                                          [
                                                                            fun γ =>
                                                                              ltac:(M.monadic
                                                                                (let e :=
                                                                                  M.copy (| γ |) in
                                                                                M.call_closure (|
                                                                                  M.get_associated_function (|
                                                                                    Ty.path
                                                                                      "move_binary_format::errors::PartialVMError",
                                                                                    "at_index",
                                                                                    []
                                                                                  |),
                                                                                  [
                                                                                    M.read (| e |);
                                                                                    Value.StructTuple
                                                                                      "move_binary_format::IndexKind::FunctionHandle"
                                                                                      [];
                                                                                    M.rust_cast
                                                                                      (M.read (|
                                                                                        idx
                                                                                      |))
                                                                                  ]
                                                                                |)))
                                                                          ]
                                                                        |)))
                                                                    | _ =>
                                                                      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.tuple [];
                                                                          Ty.path
                                                                            "move_binary_format::errors::PartialVMError"
                                                                        ],
                                                                      [
                                                                        Ty.apply
                                                                          (Ty.path
                                                                            "core::result::Result")
                                                                          []
                                                                          [
                                                                            Ty.path
                                                                              "core::convert::Infallible";
                                                                            Ty.path
                                                                              "move_binary_format::errors::PartialVMError"
                                                                          ]
                                                                      ],
                                                                      "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.Tuple [] |)));
                                            fun γ =>
                                              ltac:(M.monadic
                                                (let _ :=
                                                  M.is_struct_tuple (|
                                                    γ,
                                                    "core::option::Option::None"
                                                  |) in
                                                M.alloc (|
                                                  M.never_to_any (|
                                                    M.read (|
                                                      M.return_ (|
                                                        Value.StructTuple
                                                          "core::result::Result::Err"
                                                          [
                                                            M.call_closure (|
                                                              M.get_function (|
                                                                "move_binary_format::errors::verification_error",
                                                                []
                                                              |),
                                                              [
                                                                Value.StructTuple
                                                                  "move_core_types::vm_status::StatusCode::LOOKUP_FAILED"
                                                                  [];
                                                                Value.StructTuple
                                                                  "move_binary_format::IndexKind::FunctionHandle"
                                                                  [];
                                                                M.rust_cast (M.read (| idx |))
                                                              ]
                                                            |)
                                                          ]
                                                      |)
                                                    |)
                                                  |)
                                                |)))
                                          ]
                                        |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_verify_imported_functions :
    M.IsFunction
      "move_bytecode_verifier::dependencies::verify_imported_functions"
      verify_imported_functions.
  
  (*
  fn compatible_struct_abilities(
      local_struct_abilities_declaration: AbilitySet,
      defined_struct_abilities: AbilitySet,
  ) -> bool {
      local_struct_abilities_declaration.is_subset(defined_struct_abilities)
  }
  *)
  Definition compatible_struct_abilities
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ local_struct_abilities_declaration; defined_struct_abilities ] =>
      ltac:(M.monadic
        (let local_struct_abilities_declaration :=
          M.alloc (| local_struct_abilities_declaration |) in
        let defined_struct_abilities := M.alloc (| defined_struct_abilities |) in
        M.call_closure (|
          M.get_associated_function (|
            Ty.path "move_binary_format::file_format::AbilitySet",
            "is_subset",
            []
          |),
          [ M.read (| local_struct_abilities_declaration |); M.read (| defined_struct_abilities |) ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_compatible_struct_abilities :
    M.IsFunction
      "move_bytecode_verifier::dependencies::compatible_struct_abilities"
      compatible_struct_abilities.
  
  (*
  fn compatible_fun_type_parameters(
      local_type_parameters_declaration: &[AbilitySet],
      defined_type_parameters: &[AbilitySet],
  ) -> bool {
      local_type_parameters_declaration.len() == defined_type_parameters.len()
          && local_type_parameters_declaration
              .iter()
              .zip(defined_type_parameters)
              .all(
                  |(
                      local_type_parameter_constraints_declaration,
                      defined_type_parameter_constraints,
                  )| {
                      compatible_type_parameter_constraints(
                          *local_type_parameter_constraints_declaration,
                          *defined_type_parameter_constraints,
                      )
                  },
              )
  }
  *)
  Definition compatible_fun_type_parameters
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ local_type_parameters_declaration; defined_type_parameters ] =>
      ltac:(M.monadic
        (let local_type_parameters_declaration := M.alloc (| local_type_parameters_declaration |) in
        let defined_type_parameters := M.alloc (| defined_type_parameters |) in
        LogicalOp.and (|
          BinOp.eq (|
            M.call_closure (|
              M.get_associated_function (|
                Ty.apply
                  (Ty.path "slice")
                  []
                  [ Ty.path "move_binary_format::file_format::AbilitySet" ],
                "len",
                []
              |),
              [ M.read (| local_type_parameters_declaration |) ]
            |),
            M.call_closure (|
              M.get_associated_function (|
                Ty.apply
                  (Ty.path "slice")
                  []
                  [ Ty.path "move_binary_format::file_format::AbilitySet" ],
                "len",
                []
              |),
              [ M.read (| defined_type_parameters |) ]
            |)
          |),
          ltac:(M.monadic
            (M.call_closure (|
              M.get_trait_method (|
                "core::iter::traits::iterator::Iterator",
                Ty.apply
                  (Ty.path "core::iter::adapters::zip::Zip")
                  []
                  [
                    Ty.apply
                      (Ty.path "core::slice::iter::Iter")
                      []
                      [ Ty.path "move_binary_format::file_format::AbilitySet" ];
                    Ty.apply
                      (Ty.path "core::slice::iter::Iter")
                      []
                      [ Ty.path "move_binary_format::file_format::AbilitySet" ]
                  ],
                [],
                "all",
                [
                  Ty.function
                    [
                      Ty.tuple
                        [
                          Ty.tuple
                            [
                              Ty.apply
                                (Ty.path "&")
                                []
                                [ Ty.path "move_binary_format::file_format::AbilitySet" ];
                              Ty.apply
                                (Ty.path "&")
                                []
                                [ Ty.path "move_binary_format::file_format::AbilitySet" ]
                            ]
                        ]
                    ]
                    (Ty.path "bool")
                ]
              |),
              [
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::iterator::Iterator",
                      Ty.apply
                        (Ty.path "core::slice::iter::Iter")
                        []
                        [ Ty.path "move_binary_format::file_format::AbilitySet" ],
                      [],
                      "zip",
                      [
                        Ty.apply
                          (Ty.path "&")
                          []
                          [
                            Ty.apply
                              (Ty.path "slice")
                              []
                              [ Ty.path "move_binary_format::file_format::AbilitySet" ]
                          ]
                      ]
                    |),
                    [
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply
                            (Ty.path "slice")
                            []
                            [ Ty.path "move_binary_format::file_format::AbilitySet" ],
                          "iter",
                          []
                        |),
                        [ M.read (| local_type_parameters_declaration |) ]
                      |);
                      M.read (| defined_type_parameters |)
                    ]
                  |)
                |);
                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 local_type_parameter_constraints_declaration :=
                                    M.copy (| γ0_0 |) in
                                  let defined_type_parameter_constraints := M.copy (| γ0_1 |) in
                                  M.call_closure (|
                                    M.get_function (|
                                      "move_bytecode_verifier::dependencies::compatible_type_parameter_constraints",
                                      []
                                    |),
                                    [
                                      M.read (|
                                        M.read (| local_type_parameter_constraints_declaration |)
                                      |);
                                      M.read (| M.read (| defined_type_parameter_constraints |) |)
                                    ]
                                  |)))
                            ]
                          |)))
                      | _ => M.impossible "wrong number of arguments"
                      end))
              ]
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_compatible_fun_type_parameters :
    M.IsFunction
      "move_bytecode_verifier::dependencies::compatible_fun_type_parameters"
      compatible_fun_type_parameters.
  
  (*
  fn compatible_struct_type_parameters(
      local_type_parameters_declaration: &[StructTypeParameter],
      defined_type_parameters: &[StructTypeParameter],
  ) -> bool {
      local_type_parameters_declaration.len() == defined_type_parameters.len()
          && local_type_parameters_declaration
              .iter()
              .zip(defined_type_parameters)
              .all(
                  |(local_type_parameter_declaration, defined_type_parameter)| {
                      compatible_type_parameter_phantom_decl(
                          local_type_parameter_declaration,
                          defined_type_parameter,
                      ) && compatible_type_parameter_constraints(
                          local_type_parameter_declaration.constraints,
                          defined_type_parameter.constraints,
                      )
                  },
              )
  }
  *)
  Definition compatible_struct_type_parameters
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ local_type_parameters_declaration; defined_type_parameters ] =>
      ltac:(M.monadic
        (let local_type_parameters_declaration := M.alloc (| local_type_parameters_declaration |) in
        let defined_type_parameters := M.alloc (| defined_type_parameters |) in
        LogicalOp.and (|
          BinOp.eq (|
            M.call_closure (|
              M.get_associated_function (|
                Ty.apply
                  (Ty.path "slice")
                  []
                  [ Ty.path "move_binary_format::file_format::StructTypeParameter" ],
                "len",
                []
              |),
              [ M.read (| local_type_parameters_declaration |) ]
            |),
            M.call_closure (|
              M.get_associated_function (|
                Ty.apply
                  (Ty.path "slice")
                  []
                  [ Ty.path "move_binary_format::file_format::StructTypeParameter" ],
                "len",
                []
              |),
              [ M.read (| defined_type_parameters |) ]
            |)
          |),
          ltac:(M.monadic
            (M.call_closure (|
              M.get_trait_method (|
                "core::iter::traits::iterator::Iterator",
                Ty.apply
                  (Ty.path "core::iter::adapters::zip::Zip")
                  []
                  [
                    Ty.apply
                      (Ty.path "core::slice::iter::Iter")
                      []
                      [ Ty.path "move_binary_format::file_format::StructTypeParameter" ];
                    Ty.apply
                      (Ty.path "core::slice::iter::Iter")
                      []
                      [ Ty.path "move_binary_format::file_format::StructTypeParameter" ]
                  ],
                [],
                "all",
                [
                  Ty.function
                    [
                      Ty.tuple
                        [
                          Ty.tuple
                            [
                              Ty.apply
                                (Ty.path "&")
                                []
                                [ Ty.path "move_binary_format::file_format::StructTypeParameter" ];
                              Ty.apply
                                (Ty.path "&")
                                []
                                [ Ty.path "move_binary_format::file_format::StructTypeParameter" ]
                            ]
                        ]
                    ]
                    (Ty.path "bool")
                ]
              |),
              [
                M.alloc (|
                  M.call_closure (|
                    M.get_trait_method (|
                      "core::iter::traits::iterator::Iterator",
                      Ty.apply
                        (Ty.path "core::slice::iter::Iter")
                        []
                        [ Ty.path "move_binary_format::file_format::StructTypeParameter" ],
                      [],
                      "zip",
                      [
                        Ty.apply
                          (Ty.path "&")
                          []
                          [
                            Ty.apply
                              (Ty.path "slice")
                              []
                              [ Ty.path "move_binary_format::file_format::StructTypeParameter" ]
                          ]
                      ]
                    |),
                    [
                      M.call_closure (|
                        M.get_associated_function (|
                          Ty.apply
                            (Ty.path "slice")
                            []
                            [ Ty.path "move_binary_format::file_format::StructTypeParameter" ],
                          "iter",
                          []
                        |),
                        [ M.read (| local_type_parameters_declaration |) ]
                      |);
                      M.read (| defined_type_parameters |)
                    ]
                  |)
                |);
                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 local_type_parameter_declaration := M.copy (| γ0_0 |) in
                                  let defined_type_parameter := M.copy (| γ0_1 |) in
                                  LogicalOp.and (|
                                    M.call_closure (|
                                      M.get_function (|
                                        "move_bytecode_verifier::dependencies::compatible_type_parameter_phantom_decl",
                                        []
                                      |),
                                      [
                                        M.read (| local_type_parameter_declaration |);
                                        M.read (| defined_type_parameter |)
                                      ]
                                    |),
                                    ltac:(M.monadic
                                      (M.call_closure (|
                                        M.get_function (|
                                          "move_bytecode_verifier::dependencies::compatible_type_parameter_constraints",
                                          []
                                        |),
                                        [
                                          M.read (|
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| local_type_parameter_declaration |),
                                              "move_binary_format::file_format::StructTypeParameter",
                                              "constraints"
                                            |)
                                          |);
                                          M.read (|
                                            M.SubPointer.get_struct_record_field (|
                                              M.read (| defined_type_parameter |),
                                              "move_binary_format::file_format::StructTypeParameter",
                                              "constraints"
                                            |)
                                          |)
                                        ]
                                      |)))
                                  |)))
                            ]
                          |)))
                      | _ => M.impossible "wrong number of arguments"
                      end))
              ]
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_compatible_struct_type_parameters :
    M.IsFunction
      "move_bytecode_verifier::dependencies::compatible_struct_type_parameters"
      compatible_struct_type_parameters.
  
  (*
  fn compatible_type_parameter_constraints(
      local_type_parameter_constraints_declaration: AbilitySet,
      defined_type_parameter_constraints: AbilitySet,
  ) -> bool {
      defined_type_parameter_constraints.is_subset(local_type_parameter_constraints_declaration)
  }
  *)
  Definition compatible_type_parameter_constraints
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [],
        [],
        [ local_type_parameter_constraints_declaration; defined_type_parameter_constraints ] =>
      ltac:(M.monadic
        (let local_type_parameter_constraints_declaration :=
          M.alloc (| local_type_parameter_constraints_declaration |) in
        let defined_type_parameter_constraints :=
          M.alloc (| defined_type_parameter_constraints |) in
        M.call_closure (|
          M.get_associated_function (|
            Ty.path "move_binary_format::file_format::AbilitySet",
            "is_subset",
            []
          |),
          [
            M.read (| defined_type_parameter_constraints |);
            M.read (| local_type_parameter_constraints_declaration |)
          ]
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_compatible_type_parameter_constraints :
    M.IsFunction
      "move_bytecode_verifier::dependencies::compatible_type_parameter_constraints"
      compatible_type_parameter_constraints.
  
  (*
  fn compatible_type_parameter_phantom_decl(
      local_type_parameter_declaration: &StructTypeParameter,
      defined_type_parameter: &StructTypeParameter,
  ) -> bool {
      // local_type_parameter_declaration.is_phantom => defined_type_parameter.is_phantom
      !local_type_parameter_declaration.is_phantom || defined_type_parameter.is_phantom
  }
  *)
  Definition compatible_type_parameter_phantom_decl
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ local_type_parameter_declaration; defined_type_parameter ] =>
      ltac:(M.monadic
        (let local_type_parameter_declaration := M.alloc (| local_type_parameter_declaration |) in
        let defined_type_parameter := M.alloc (| defined_type_parameter |) in
        LogicalOp.or (|
          UnOp.not (|
            M.read (|
              M.SubPointer.get_struct_record_field (|
                M.read (| local_type_parameter_declaration |),
                "move_binary_format::file_format::StructTypeParameter",
                "is_phantom"
              |)
            |)
          |),
          ltac:(M.monadic
            (M.read (|
              M.SubPointer.get_struct_record_field (|
                M.read (| defined_type_parameter |),
                "move_binary_format::file_format::StructTypeParameter",
                "is_phantom"
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_compatible_type_parameter_phantom_decl :
    M.IsFunction
      "move_bytecode_verifier::dependencies::compatible_type_parameter_phantom_decl"
      compatible_type_parameter_phantom_decl.
  
  (*
  fn compare_cross_module_signatures(
      context: &Context,
      handle_sig: &[SignatureToken],
      def_sig: &[SignatureToken],
      def_module: &CompiledModule,
  ) -> PartialVMResult<()> {
      if handle_sig.len() != def_sig.len() {
          return Err(PartialVMError::new(StatusCode::TYPE_MISMATCH));
      }
      for (handle_type, def_type) in handle_sig.iter().zip(def_sig) {
          compare_types(context, handle_type, def_type, def_module)?;
      }
      Ok(())
  }
  *)
  Definition compare_cross_module_signatures
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ context; handle_sig; def_sig; def_module ] =>
      ltac:(M.monadic
        (let context := M.alloc (| context |) in
        let handle_sig := M.alloc (| handle_sig |) in
        let def_sig := M.alloc (| def_sig |) in
        let def_module := M.alloc (| def_module |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ :=
                          M.use
                            (M.alloc (|
                              BinOp.ne (|
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [ Ty.path "move_binary_format::file_format::SignatureToken" ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| handle_sig |) ]
                                |),
                                M.call_closure (|
                                  M.get_associated_function (|
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [ Ty.path "move_binary_format::file_format::SignatureToken" ],
                                    "len",
                                    []
                                  |),
                                  [ M.read (| def_sig |) ]
                                |)
                              |)
                            |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        M.alloc (|
                          M.never_to_any (|
                            M.read (|
                              M.return_ (|
                                Value.StructTuple
                                  "core::result::Result::Err"
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "move_binary_format::errors::PartialVMError",
                                        "new",
                                        []
                                      |),
                                      [
                                        Value.StructTuple
                                          "move_core_types::vm_status::StatusCode::TYPE_MISMATCH"
                                          []
                                      ]
                                    |)
                                  ]
                              |)
                            |)
                          |)
                        |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::zip::Zip")
                            []
                            [
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::SignatureToken" ];
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::SignatureToken" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::SignatureToken" ],
                              [],
                              "zip",
                              [
                                Ty.apply
                                  (Ty.path "&")
                                  []
                                  [
                                    Ty.apply
                                      (Ty.path "slice")
                                      []
                                      [ Ty.path "move_binary_format::file_format::SignatureToken" ]
                                  ]
                              ]
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "slice")
                                    []
                                    [ Ty.path "move_binary_format::file_format::SignatureToken" ],
                                  "iter",
                                  []
                                |),
                                [ M.read (| handle_sig |) ]
                              |);
                              M.read (| def_sig |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::zip::Zip")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::slice::iter::Iter")
                                              []
                                              [
                                                Ty.path
                                                  "move_binary_format::file_format::SignatureToken"
                                              ];
                                            Ty.apply
                                              (Ty.path "core::slice::iter::Iter")
                                              []
                                              [
                                                Ty.path
                                                  "move_binary_format::file_format::SignatureToken"
                                              ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                        let handle_type := M.copy (| γ1_0 |) in
                                        let def_type := M.copy (| γ1_1 |) 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_binary_format::errors::PartialVMError"
                                                    ],
                                                  [],
                                                  "branch",
                                                  []
                                                |),
                                                [
                                                  M.call_closure (|
                                                    M.get_function (|
                                                      "move_bytecode_verifier::dependencies::compare_types",
                                                      []
                                                    |),
                                                    [
                                                      M.read (| context |);
                                                      M.read (| handle_type |);
                                                      M.read (| def_type |);
                                                      M.read (| def_module |)
                                                    ]
                                                  |)
                                                ]
                                              |)
                                            |),
                                            [
                                              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.path
                                                                    "move_binary_format::errors::PartialVMError"
                                                                ],
                                                              [
                                                                Ty.apply
                                                                  (Ty.path "core::result::Result")
                                                                  []
                                                                  [
                                                                    Ty.path
                                                                      "core::convert::Infallible";
                                                                    Ty.path
                                                                      "move_binary_format::errors::PartialVMError"
                                                                  ]
                                                              ],
                                                              "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.Tuple [] |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_compare_cross_module_signatures :
    M.IsFunction
      "move_bytecode_verifier::dependencies::compare_cross_module_signatures"
      compare_cross_module_signatures.
  
  (*
  fn compare_types(
      context: &Context,
      handle_type: &SignatureToken,
      def_type: &SignatureToken,
      def_module: &CompiledModule,
  ) -> PartialVMResult<()> {
      match (handle_type, def_type) {
          (SignatureToken::Bool, SignatureToken::Bool)
          | (SignatureToken::U8, SignatureToken::U8)
          | (SignatureToken::U16, SignatureToken::U16)
          | (SignatureToken::U32, SignatureToken::U32)
          | (SignatureToken::U64, SignatureToken::U64)
          | (SignatureToken::U128, SignatureToken::U128)
          | (SignatureToken::U256, SignatureToken::U256)
          | (SignatureToken::Address, SignatureToken::Address)
          | (SignatureToken::Signer, SignatureToken::Signer) => Ok(()),
          (SignatureToken::Vector(ty1), SignatureToken::Vector(ty2)) => {
              compare_types(context, ty1, ty2, def_module)
          }
          (SignatureToken::Struct(idx1), SignatureToken::Struct(idx2)) => {
              compare_structs(context, *idx1, *idx2, def_module)
          }
          (
              SignatureToken::StructInstantiation(struct_inst1),
              SignatureToken::StructInstantiation(struct_inst2),
          ) => {
              let (idx1, inst1) = &**struct_inst1;
              let (idx2, inst2) = &**struct_inst2;
              compare_structs(context, *idx1, *idx2, def_module)?;
              compare_cross_module_signatures(context, inst1, inst2, def_module)
          }
          (SignatureToken::Reference(ty1), SignatureToken::Reference(ty2))
          | (SignatureToken::MutableReference(ty1), SignatureToken::MutableReference(ty2)) => {
              compare_types(context, ty1, ty2, def_module)
          }
          (SignatureToken::TypeParameter(idx1), SignatureToken::TypeParameter(idx2)) => {
              if idx1 != idx2 {
                  Err(PartialVMError::new(StatusCode::TYPE_MISMATCH))
              } else {
                  Ok(())
              }
          }
          (SignatureToken::Bool, _)
          | (SignatureToken::U8, _)
          | (SignatureToken::U64, _)
          | (SignatureToken::U128, _)
          | (SignatureToken::Address, _)
          | (SignatureToken::Signer, _)
          | (SignatureToken::Vector(_), _)
          | (SignatureToken::Struct(_), _)
          | (SignatureToken::StructInstantiation(_), _)
          | (SignatureToken::Reference(_), _)
          | (SignatureToken::MutableReference(_), _)
          | (SignatureToken::TypeParameter(_), _)
          | (SignatureToken::U16, _)
          | (SignatureToken::U32, _)
          | (SignatureToken::U256, _) => Err(PartialVMError::new(StatusCode::TYPE_MISMATCH)),
      }
  }
  *)
  Definition compare_types (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ context; handle_type; def_type; def_module ] =>
      ltac:(M.monadic
        (let context := M.alloc (| context |) in
        let handle_type := M.alloc (| handle_type |) in
        let def_type := M.alloc (| def_type |) in
        let def_module := M.alloc (| def_module |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              M.match_operator (|
                M.alloc (| Value.Tuple [ M.read (| handle_type |); M.read (| def_type |) ] |),
                [
                  fun γ =>
                    ltac:(M.monadic
                      (M.find_or_pattern (|
                        γ,
                        [
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Bool"
                                |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::Bool"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U8"
                                |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::U8"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U16"
                                |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::U16"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U32"
                                |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::U32"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U64"
                                |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::U64"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U128"
                                |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::U128"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U256"
                                |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::U256"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Address"
                                |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::Address"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Signer"
                                |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::Signer"
                                |) in
                              Value.Tuple []))
                        ],
                        M.closure
                          (fun γ =>
                            ltac:(M.monadic
                              match γ with
                              | [] =>
                                ltac:(M.monadic
                                  (M.alloc (|
                                    Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]
                                  |)))
                              | _ => M.impossible "wrong number of arguments"
                              end))
                      |)));
                  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 γ0_0 := M.read (| γ0_0 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "move_binary_format::file_format::SignatureToken::Vector",
                          0
                        |) in
                      let ty1 := M.alloc (| γ2_0 |) in
                      let γ0_1 := M.read (| γ0_1 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_1,
                          "move_binary_format::file_format::SignatureToken::Vector",
                          0
                        |) in
                      let ty2 := M.alloc (| γ2_0 |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_function (|
                            "move_bytecode_verifier::dependencies::compare_types",
                            []
                          |),
                          [
                            M.read (| context |);
                            M.read (| M.read (| ty1 |) |);
                            M.read (| M.read (| ty2 |) |);
                            M.read (| def_module |)
                          ]
                        |)
                      |)));
                  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 γ0_0 := M.read (| γ0_0 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "move_binary_format::file_format::SignatureToken::Struct",
                          0
                        |) in
                      let idx1 := M.alloc (| γ2_0 |) in
                      let γ0_1 := M.read (| γ0_1 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_1,
                          "move_binary_format::file_format::SignatureToken::Struct",
                          0
                        |) in
                      let idx2 := M.alloc (| γ2_0 |) in
                      M.alloc (|
                        M.call_closure (|
                          M.get_function (|
                            "move_bytecode_verifier::dependencies::compare_structs",
                            []
                          |),
                          [
                            M.read (| context |);
                            M.read (| M.read (| idx1 |) |);
                            M.read (| M.read (| idx2 |) |);
                            M.read (| def_module |)
                          ]
                        |)
                      |)));
                  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 γ0_0 := M.read (| γ0_0 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "move_binary_format::file_format::SignatureToken::StructInstantiation",
                          0
                        |) in
                      let struct_inst1 := M.alloc (| γ2_0 |) in
                      let γ0_1 := M.read (| γ0_1 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_1,
                          "move_binary_format::file_format::SignatureToken::StructInstantiation",
                          0
                        |) in
                      let struct_inst2 := M.alloc (| γ2_0 |) in
                      M.match_operator (|
                        M.alloc (| M.read (| M.read (| struct_inst1 |) |) |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ := M.read (| γ |) in
                              let γ1_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                              let γ1_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                              let idx1 := M.alloc (| γ1_0 |) in
                              let inst1 := M.alloc (| γ1_1 |) in
                              M.match_operator (|
                                M.alloc (| M.read (| M.read (| struct_inst2 |) |) |),
                                [
                                  fun γ =>
                                    ltac:(M.monadic
                                      (let γ := M.read (| γ |) in
                                      let γ1_0 := M.SubPointer.get_tuple_field (| γ, 0 |) in
                                      let γ1_1 := M.SubPointer.get_tuple_field (| γ, 1 |) in
                                      let idx2 := M.alloc (| γ1_0 |) in
                                      let inst2 := M.alloc (| γ1_1 |) 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_binary_format::errors::PartialVMError"
                                                  ],
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_function (|
                                                    "move_bytecode_verifier::dependencies::compare_structs",
                                                    []
                                                  |),
                                                  [
                                                    M.read (| context |);
                                                    M.read (| M.read (| idx1 |) |);
                                                    M.read (| M.read (| idx2 |) |);
                                                    M.read (| def_module |)
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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.path
                                                                  "move_binary_format::errors::PartialVMError"
                                                              ],
                                                            [
                                                              Ty.apply
                                                                (Ty.path "core::result::Result")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "core::convert::Infallible";
                                                                  Ty.path
                                                                    "move_binary_format::errors::PartialVMError"
                                                                ]
                                                            ],
                                                            "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 (|
                                        M.call_closure (|
                                          M.get_function (|
                                            "move_bytecode_verifier::dependencies::compare_cross_module_signatures",
                                            []
                                          |),
                                          [
                                            M.read (| context |);
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::deref::Deref",
                                                Ty.apply
                                                  (Ty.path "alloc::vec::Vec")
                                                  []
                                                  [
                                                    Ty.path
                                                      "move_binary_format::file_format::SignatureToken";
                                                    Ty.path "alloc::alloc::Global"
                                                  ],
                                                [],
                                                "deref",
                                                []
                                              |),
                                              [ M.read (| inst1 |) ]
                                            |);
                                            M.call_closure (|
                                              M.get_trait_method (|
                                                "core::ops::deref::Deref",
                                                Ty.apply
                                                  (Ty.path "alloc::vec::Vec")
                                                  []
                                                  [
                                                    Ty.path
                                                      "move_binary_format::file_format::SignatureToken";
                                                    Ty.path "alloc::alloc::Global"
                                                  ],
                                                [],
                                                "deref",
                                                []
                                              |),
                                              [ M.read (| inst2 |) ]
                                            |);
                                            M.read (| def_module |)
                                          ]
                                        |)
                                      |)))
                                ]
                              |)))
                        ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (M.find_or_pattern (|
                        γ,
                        [
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Reference",
                                  0
                                |) in
                              let ty1 := M.alloc (| γ2_0 |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::Reference",
                                  0
                                |) in
                              let ty2 := M.alloc (| γ2_0 |) in
                              Value.Tuple [ ty1; ty2 ]));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::MutableReference",
                                  0
                                |) in
                              let ty1 := M.alloc (| γ2_0 |) in
                              let γ0_1 := M.read (| γ0_1 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_1,
                                  "move_binary_format::file_format::SignatureToken::MutableReference",
                                  0
                                |) in
                              let ty2 := M.alloc (| γ2_0 |) in
                              Value.Tuple [ ty1; ty2 ]))
                        ],
                        M.closure
                          (fun γ =>
                            ltac:(M.monadic
                              match γ with
                              | [ ty1; ty2 ] =>
                                ltac:(M.monadic
                                  (M.alloc (|
                                    M.call_closure (|
                                      M.get_function (|
                                        "move_bytecode_verifier::dependencies::compare_types",
                                        []
                                      |),
                                      [
                                        M.read (| context |);
                                        M.read (| M.read (| ty1 |) |);
                                        M.read (| M.read (| ty2 |) |);
                                        M.read (| def_module |)
                                      ]
                                    |)
                                  |)))
                              | _ => M.impossible "wrong number of arguments"
                              end))
                      |)));
                  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 γ0_0 := M.read (| γ0_0 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_0,
                          "move_binary_format::file_format::SignatureToken::TypeParameter",
                          0
                        |) in
                      let idx1 := M.alloc (| γ2_0 |) in
                      let γ0_1 := M.read (| γ0_1 |) in
                      let γ2_0 :=
                        M.SubPointer.get_struct_tuple_field (|
                          γ0_1,
                          "move_binary_format::file_format::SignatureToken::TypeParameter",
                          0
                        |) in
                      let idx2 := M.alloc (| γ2_0 |) in
                      M.match_operator (|
                        M.alloc (| Value.Tuple [] |),
                        [
                          fun γ =>
                            ltac:(M.monadic
                              (let γ :=
                                M.use
                                  (M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::cmp::PartialEq",
                                        Ty.apply (Ty.path "&") [] [ Ty.path "u16" ],
                                        [ Ty.apply (Ty.path "&") [] [ Ty.path "u16" ] ],
                                        "ne",
                                        []
                                      |),
                                      [ idx1; idx2 ]
                                    |)
                                  |)) in
                              let _ :=
                                M.is_constant_or_break_match (|
                                  M.read (| γ |),
                                  Value.Bool true
                                |) in
                              M.alloc (|
                                Value.StructTuple
                                  "core::result::Result::Err"
                                  [
                                    M.call_closure (|
                                      M.get_associated_function (|
                                        Ty.path "move_binary_format::errors::PartialVMError",
                                        "new",
                                        []
                                      |),
                                      [
                                        Value.StructTuple
                                          "move_core_types::vm_status::StatusCode::TYPE_MISMATCH"
                                          []
                                      ]
                                    |)
                                  ]
                              |)));
                          fun γ =>
                            ltac:(M.monadic
                              (M.alloc (|
                                Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]
                              |)))
                        ]
                      |)));
                  fun γ =>
                    ltac:(M.monadic
                      (M.find_or_pattern (|
                        γ,
                        [
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Bool"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U8"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U64"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U128"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Address"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Signer"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Vector",
                                  0
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Struct",
                                  0
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::StructInstantiation",
                                  0
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::Reference",
                                  0
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::MutableReference",
                                  0
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let γ2_0 :=
                                M.SubPointer.get_struct_tuple_field (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::TypeParameter",
                                  0
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U16"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U32"
                                |) in
                              Value.Tuple []));
                          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 γ0_0 := M.read (| γ0_0 |) in
                              let _ :=
                                M.is_struct_tuple (|
                                  γ0_0,
                                  "move_binary_format::file_format::SignatureToken::U256"
                                |) in
                              Value.Tuple []))
                        ],
                        M.closure
                          (fun γ =>
                            ltac:(M.monadic
                              match γ with
                              | [] =>
                                ltac:(M.monadic
                                  (M.alloc (|
                                    Value.StructTuple
                                      "core::result::Result::Err"
                                      [
                                        M.call_closure (|
                                          M.get_associated_function (|
                                            Ty.path "move_binary_format::errors::PartialVMError",
                                            "new",
                                            []
                                          |),
                                          [
                                            Value.StructTuple
                                              "move_core_types::vm_status::StatusCode::TYPE_MISMATCH"
                                              []
                                          ]
                                        |)
                                      ]
                                  |)))
                              | _ => M.impossible "wrong number of arguments"
                              end))
                      |)))
                ]
              |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_compare_types :
    M.IsFunction "move_bytecode_verifier::dependencies::compare_types" compare_types.
  
  (*
  fn compare_structs(
      context: &Context,
      idx1: StructHandleIndex,
      idx2: StructHandleIndex,
      def_module: &CompiledModule,
  ) -> PartialVMResult<()> {
      // grab ModuleId and struct name for the module being verified
      let struct_handle = context.module.struct_handle_at(idx1);
      let module_handle = context.module.module_handle_at(struct_handle.module);
      let module_id = context.module.module_id_for_handle(module_handle);
      let struct_name = context.module.identifier_at(struct_handle.name);
  
      // grab ModuleId and struct name for the definition
      let def_struct_handle = def_module.struct_handle_at(idx2);
      let def_module_handle = def_module.module_handle_at(def_struct_handle.module);
      let def_module_id = def_module.module_id_for_handle(def_module_handle);
      let def_struct_name = def_module.identifier_at(def_struct_handle.name);
  
      if module_id != def_module_id || struct_name != def_struct_name {
          Err(PartialVMError::new(StatusCode::TYPE_MISMATCH))
      } else {
          Ok(())
      }
  }
  *)
  Definition compare_structs (ε : list Value.t) (τ : list Ty.t) (α : list Value.t) : M :=
    match ε, τ, α with
    | [], [], [ context; idx1; idx2; def_module ] =>
      ltac:(M.monadic
        (let context := M.alloc (| context |) in
        let idx1 := M.alloc (| idx1 |) in
        let idx2 := M.alloc (| idx2 |) in
        let def_module := M.alloc (| def_module |) in
        M.read (|
          let~ struct_handle :=
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_binary_format::file_format::CompiledModule",
                  "struct_handle_at",
                  []
                |),
                [
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| context |),
                      "move_bytecode_verifier::dependencies::Context",
                      "module"
                    |)
                  |);
                  M.read (| idx1 |)
                ]
              |)
            |) in
          let~ module_handle :=
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_binary_format::file_format::CompiledModule",
                  "module_handle_at",
                  []
                |),
                [
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| context |),
                      "move_bytecode_verifier::dependencies::Context",
                      "module"
                    |)
                  |);
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| struct_handle |),
                      "move_binary_format::file_format::StructHandle",
                      "module"
                    |)
                  |)
                ]
              |)
            |) in
          let~ module_id :=
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_binary_format::file_format::CompiledModule",
                  "module_id_for_handle",
                  []
                |),
                [
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| context |),
                      "move_bytecode_verifier::dependencies::Context",
                      "module"
                    |)
                  |);
                  M.read (| module_handle |)
                ]
              |)
            |) in
          let~ struct_name :=
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_binary_format::file_format::CompiledModule",
                  "identifier_at",
                  []
                |),
                [
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| context |),
                      "move_bytecode_verifier::dependencies::Context",
                      "module"
                    |)
                  |);
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| struct_handle |),
                      "move_binary_format::file_format::StructHandle",
                      "name"
                    |)
                  |)
                ]
              |)
            |) in
          let~ def_struct_handle :=
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_binary_format::file_format::CompiledModule",
                  "struct_handle_at",
                  []
                |),
                [ M.read (| def_module |); M.read (| idx2 |) ]
              |)
            |) in
          let~ def_module_handle :=
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_binary_format::file_format::CompiledModule",
                  "module_handle_at",
                  []
                |),
                [
                  M.read (| def_module |);
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| def_struct_handle |),
                      "move_binary_format::file_format::StructHandle",
                      "module"
                    |)
                  |)
                ]
              |)
            |) in
          let~ def_module_id :=
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_binary_format::file_format::CompiledModule",
                  "module_id_for_handle",
                  []
                |),
                [ M.read (| def_module |); M.read (| def_module_handle |) ]
              |)
            |) in
          let~ def_struct_name :=
            M.alloc (|
              M.call_closure (|
                M.get_associated_function (|
                  Ty.path "move_binary_format::file_format::CompiledModule",
                  "identifier_at",
                  []
                |),
                [
                  M.read (| def_module |);
                  M.read (|
                    M.SubPointer.get_struct_record_field (|
                      M.read (| def_struct_handle |),
                      "move_binary_format::file_format::StructHandle",
                      "name"
                    |)
                  |)
                ]
              |)
            |) in
          M.match_operator (|
            M.alloc (| Value.Tuple [] |),
            [
              fun γ =>
                ltac:(M.monadic
                  (let γ :=
                    M.use
                      (M.alloc (|
                        LogicalOp.or (|
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::cmp::PartialEq",
                              Ty.path "move_core_types::language_storage::ModuleId",
                              [ Ty.path "move_core_types::language_storage::ModuleId" ],
                              "ne",
                              []
                            |),
                            [ module_id; def_module_id ]
                          |),
                          ltac:(M.monadic
                            (M.call_closure (|
                              M.get_trait_method (|
                                "core::cmp::PartialEq",
                                Ty.apply
                                  (Ty.path "&")
                                  []
                                  [ Ty.path "move_core_types::identifier::IdentStr" ],
                                [
                                  Ty.apply
                                    (Ty.path "&")
                                    []
                                    [ Ty.path "move_core_types::identifier::IdentStr" ]
                                ],
                                "ne",
                                []
                              |),
                              [ struct_name; def_struct_name ]
                            |)))
                        |)
                      |)) in
                  let _ := M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                  M.alloc (|
                    Value.StructTuple
                      "core::result::Result::Err"
                      [
                        M.call_closure (|
                          M.get_associated_function (|
                            Ty.path "move_binary_format::errors::PartialVMError",
                            "new",
                            []
                          |),
                          [
                            Value.StructTuple
                              "move_core_types::vm_status::StatusCode::TYPE_MISMATCH"
                              []
                          ]
                        |)
                      ]
                  |)));
              fun γ =>
                ltac:(M.monadic
                  (M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)))
            ]
          |)
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_compare_structs :
    M.IsFunction "move_bytecode_verifier::dependencies::compare_structs" compare_structs.
  
  (*
  fn verify_all_script_visibility_usage(context: &Context) -> PartialVMResult<()> {
      // script visibility deprecated after V5
      let script_functions = match &context.script_functions {
          None => return Ok(()),
          Some(s) => s,
      };
      debug_assert!(context.module.version() < VERSION_5);
      let m = context.module;
      {
          {
              for (idx, fdef) in m.function_defs().iter().enumerate() {
                  let code = match &fdef.code {
                      None => continue,
                      Some(code) => &code.code,
                  };
                  verify_script_visibility_usage(
                      context.module,
                      script_functions,
                      fdef.is_entry,
                      FunctionDefinitionIndex(idx as TableIndex),
                      code,
                  )?
              }
              Ok(())
          }
      }
  }
  *)
  Definition verify_all_script_visibility_usage
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ context ] =>
      ltac:(M.monadic
        (let context := M.alloc (| context |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ script_functions :=
                M.copy (|
                  M.match_operator (|
                    M.alloc (|
                      M.SubPointer.get_struct_record_field (|
                        M.read (| context |),
                        "move_bytecode_verifier::dependencies::Context",
                        "script_functions"
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let _ := M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                          M.alloc (|
                            M.never_to_any (|
                              M.read (|
                                M.return_ (|
                                  Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ]
                                |)
                              |)
                            |)
                          |)));
                      fun γ =>
                        ltac:(M.monadic
                          (let γ := M.read (| γ |) in
                          let γ1_0 :=
                            M.SubPointer.get_struct_tuple_field (|
                              γ,
                              "core::option::Option::Some",
                              0
                            |) in
                          let s := M.alloc (| γ1_0 |) in
                          s))
                    ]
                  |)
                |) in
              let~ _ :=
                M.match_operator (|
                  M.alloc (| Value.Tuple [] |),
                  [
                    fun γ =>
                      ltac:(M.monadic
                        (let γ := M.use (M.alloc (| Value.Bool true |)) in
                        let _ :=
                          M.is_constant_or_break_match (| M.read (| γ |), Value.Bool true |) in
                        let~ _ :=
                          M.match_operator (|
                            M.alloc (| Value.Tuple [] |),
                            [
                              fun γ =>
                                ltac:(M.monadic
                                  (let γ :=
                                    M.use
                                      (M.alloc (|
                                        UnOp.not (|
                                          BinOp.lt (|
                                            M.call_closure (|
                                              M.get_associated_function (|
                                                Ty.path
                                                  "move_binary_format::file_format::CompiledModule",
                                                "version",
                                                []
                                              |),
                                              [
                                                M.read (|
                                                  M.SubPointer.get_struct_record_field (|
                                                    M.read (| context |),
                                                    "move_bytecode_verifier::dependencies::Context",
                                                    "module"
                                                  |)
                                                |)
                                              ]
                                            |),
                                            M.read (|
                                              M.get_constant (|
                                                "move_binary_format::file_format_common::VERSION_5"
                                              |)
                                            |)
                                          |)
                                        |)
                                      |)) in
                                  let _ :=
                                    M.is_constant_or_break_match (|
                                      M.read (| γ |),
                                      Value.Bool true
                                    |) in
                                  M.alloc (|
                                    M.never_to_any (|
                                      M.call_closure (|
                                        M.get_function (| "core::panicking::panic", [] |),
                                        [
                                          M.read (|
                                            Value.String
                                              "assertion failed: context.module.version() < VERSION_5"
                                          |)
                                        ]
                                      |)
                                    |)
                                  |)));
                              fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                            ]
                          |) in
                        M.alloc (| Value.Tuple [] |)));
                    fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                  ]
                |) in
              let~ m :=
                M.copy (|
                  M.SubPointer.get_struct_record_field (|
                    M.read (| context |),
                    "move_bytecode_verifier::dependencies::Context",
                    "module"
                  |)
                |) in
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::enumerate::Enumerate")
                            []
                            [
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::FunctionDefinition" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::FunctionDefinition" ],
                              [],
                              "enumerate",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "slice")
                                    []
                                    [ Ty.path "move_binary_format::file_format::FunctionDefinition"
                                    ],
                                  "iter",
                                  []
                                |),
                                [
                                  M.call_closure (|
                                    M.get_associated_function (|
                                      Ty.path "move_binary_format::file_format::CompiledModule",
                                      "function_defs",
                                      []
                                    |),
                                    [ M.read (| m |) ]
                                  |)
                                ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::enumerate::Enumerate")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::slice::iter::Iter")
                                              []
                                              [
                                                Ty.path
                                                  "move_binary_format::file_format::FunctionDefinition"
                                              ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                        let idx := M.copy (| γ1_0 |) in
                                        let fdef := M.copy (| γ1_1 |) in
                                        let~ code :=
                                          M.copy (|
                                            M.match_operator (|
                                              M.alloc (|
                                                M.SubPointer.get_struct_record_field (|
                                                  M.read (| fdef |),
                                                  "move_binary_format::file_format::FunctionDefinition",
                                                  "code"
                                                |)
                                              |),
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let γ := M.read (| γ |) in
                                                    let _ :=
                                                      M.is_struct_tuple (|
                                                        γ,
                                                        "core::option::Option::None"
                                                      |) in
                                                    M.alloc (|
                                                      M.never_to_any (|
                                                        M.read (| M.continue (||) |)
                                                      |)
                                                    |)));
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let γ := M.read (| γ |) in
                                                    let γ1_0 :=
                                                      M.SubPointer.get_struct_tuple_field (|
                                                        γ,
                                                        "core::option::Option::Some",
                                                        0
                                                      |) in
                                                    let code := M.alloc (| γ1_0 |) in
                                                    M.alloc (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| code |),
                                                        "move_binary_format::file_format::CodeUnit",
                                                        "code"
                                                      |)
                                                    |)))
                                              ]
                                            |)
                                          |) in
                                        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_binary_format::errors::PartialVMError"
                                                  ],
                                                [],
                                                "branch",
                                                []
                                              |),
                                              [
                                                M.call_closure (|
                                                  M.get_function (|
                                                    "move_bytecode_verifier::dependencies::verify_script_visibility_usage",
                                                    []
                                                  |),
                                                  [
                                                    M.read (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| context |),
                                                        "move_bytecode_verifier::dependencies::Context",
                                                        "module"
                                                      |)
                                                    |);
                                                    M.read (| script_functions |);
                                                    M.read (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.read (| fdef |),
                                                        "move_binary_format::file_format::FunctionDefinition",
                                                        "is_entry"
                                                      |)
                                                    |);
                                                    Value.StructTuple
                                                      "move_binary_format::file_format::FunctionDefinitionIndex"
                                                      [ M.rust_cast (M.read (| idx |)) ];
                                                    M.call_closure (|
                                                      M.get_trait_method (|
                                                        "core::ops::deref::Deref",
                                                        Ty.apply
                                                          (Ty.path "alloc::vec::Vec")
                                                          []
                                                          [
                                                            Ty.path
                                                              "move_binary_format::file_format::Bytecode";
                                                            Ty.path "alloc::alloc::Global"
                                                          ],
                                                        [],
                                                        "deref",
                                                        []
                                                      |),
                                                      [ M.read (| code |) ]
                                                    |)
                                                  ]
                                                |)
                                              ]
                                            |)
                                          |),
                                          [
                                            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.path
                                                                  "move_binary_format::errors::PartialVMError"
                                                              ],
                                                            [
                                                              Ty.apply
                                                                (Ty.path "core::result::Result")
                                                                []
                                                                [
                                                                  Ty.path
                                                                    "core::convert::Infallible";
                                                                  Ty.path
                                                                    "move_binary_format::errors::PartialVMError"
                                                                ]
                                                            ],
                                                            "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.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_verify_all_script_visibility_usage :
    M.IsFunction
      "move_bytecode_verifier::dependencies::verify_all_script_visibility_usage"
      verify_all_script_visibility_usage.
  
  (*
  fn verify_script_visibility_usage(
      module: &CompiledModule,
      script_functions: &BTreeSet<FunctionHandleIndex>,
      current_is_entry: bool,
      fdef_idx: FunctionDefinitionIndex,
      code: &[Bytecode],
  ) -> PartialVMResult<()> {
      for (idx, instr) in code.iter().enumerate() {
          let idx = idx as CodeOffset;
          let fhandle_idx = match instr {
              Bytecode::Call(fhandle_idx) => fhandle_idx,
              Bytecode::CallGeneric(finst_idx) => {
                  &module.function_instantiation_at( *finst_idx).handle
              }
              _ => continue,
          };
          match (current_is_entry, script_functions.contains(fhandle_idx)) {
              (true, true) => (),
              (_, true) => {
                  return Err(PartialVMError::new(
                      StatusCode::CALLED_SCRIPT_VISIBLE_FROM_NON_SCRIPT_VISIBLE,
                  )
                  .at_code_offset(fdef_idx, idx)
                  .with_message(
                      "script-visible functions can only be called from scripts or other \
                      script-visible functions"
                          .to_string(),
                  ));
              }
              _ => (),
          }
      }
      Ok(())
  }
  *)
  Definition verify_script_visibility_usage
      (ε : list Value.t)
      (τ : list Ty.t)
      (α : list Value.t)
      : M :=
    match ε, τ, α with
    | [], [], [ module; script_functions; current_is_entry; fdef_idx; code ] =>
      ltac:(M.monadic
        (let module := M.alloc (| module |) in
        let script_functions := M.alloc (| script_functions |) in
        let current_is_entry := M.alloc (| current_is_entry |) in
        let fdef_idx := M.alloc (| fdef_idx |) in
        let code := M.alloc (| code |) in
        M.catch_return (|
          ltac:(M.monadic
            (M.read (|
              let~ _ :=
                M.use
                  (M.match_operator (|
                    M.alloc (|
                      M.call_closure (|
                        M.get_trait_method (|
                          "core::iter::traits::collect::IntoIterator",
                          Ty.apply
                            (Ty.path "core::iter::adapters::enumerate::Enumerate")
                            []
                            [
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::Bytecode" ]
                            ],
                          [],
                          "into_iter",
                          []
                        |),
                        [
                          M.call_closure (|
                            M.get_trait_method (|
                              "core::iter::traits::iterator::Iterator",
                              Ty.apply
                                (Ty.path "core::slice::iter::Iter")
                                []
                                [ Ty.path "move_binary_format::file_format::Bytecode" ],
                              [],
                              "enumerate",
                              []
                            |),
                            [
                              M.call_closure (|
                                M.get_associated_function (|
                                  Ty.apply
                                    (Ty.path "slice")
                                    []
                                    [ Ty.path "move_binary_format::file_format::Bytecode" ],
                                  "iter",
                                  []
                                |),
                                [ M.read (| code |) ]
                              |)
                            ]
                          |)
                        ]
                      |)
                    |),
                    [
                      fun γ =>
                        ltac:(M.monadic
                          (let iter := M.copy (| γ |) in
                          M.loop (|
                            ltac:(M.monadic
                              (let~ _ :=
                                M.match_operator (|
                                  M.alloc (|
                                    M.call_closure (|
                                      M.get_trait_method (|
                                        "core::iter::traits::iterator::Iterator",
                                        Ty.apply
                                          (Ty.path "core::iter::adapters::enumerate::Enumerate")
                                          []
                                          [
                                            Ty.apply
                                              (Ty.path "core::slice::iter::Iter")
                                              []
                                              [ Ty.path "move_binary_format::file_format::Bytecode"
                                              ]
                                          ],
                                        [],
                                        "next",
                                        []
                                      |),
                                      [ iter ]
                                    |)
                                  |),
                                  [
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let _ :=
                                          M.is_struct_tuple (| γ, "core::option::Option::None" |) in
                                        M.alloc (|
                                          M.never_to_any (| M.read (| M.break (||) |) |)
                                        |)));
                                    fun γ =>
                                      ltac:(M.monadic
                                        (let γ0_0 :=
                                          M.SubPointer.get_struct_tuple_field (|
                                            γ,
                                            "core::option::Option::Some",
                                            0
                                          |) in
                                        let γ1_0 := M.SubPointer.get_tuple_field (| γ0_0, 0 |) in
                                        let γ1_1 := M.SubPointer.get_tuple_field (| γ0_0, 1 |) in
                                        let idx := M.copy (| γ1_0 |) in
                                        let instr := M.copy (| γ1_1 |) in
                                        let~ idx := M.alloc (| M.rust_cast (M.read (| idx |)) |) in
                                        let~ fhandle_idx :=
                                          M.copy (|
                                            M.match_operator (|
                                              instr,
                                              [
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let γ := M.read (| γ |) in
                                                    let γ1_0 :=
                                                      M.SubPointer.get_struct_tuple_field (|
                                                        γ,
                                                        "move_binary_format::file_format::Bytecode::Call",
                                                        0
                                                      |) in
                                                    let fhandle_idx := M.alloc (| γ1_0 |) in
                                                    fhandle_idx));
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (let γ := M.read (| γ |) in
                                                    let γ1_0 :=
                                                      M.SubPointer.get_struct_tuple_field (|
                                                        γ,
                                                        "move_binary_format::file_format::Bytecode::CallGeneric",
                                                        0
                                                      |) in
                                                    let finst_idx := M.alloc (| γ1_0 |) in
                                                    M.alloc (|
                                                      M.SubPointer.get_struct_record_field (|
                                                        M.call_closure (|
                                                          M.get_associated_function (|
                                                            Ty.path
                                                              "move_binary_format::file_format::CompiledModule",
                                                            "function_instantiation_at",
                                                            []
                                                          |),
                                                          [
                                                            M.read (| module |);
                                                            M.read (| M.read (| finst_idx |) |)
                                                          ]
                                                        |),
                                                        "move_binary_format::file_format::FunctionInstantiation",
                                                        "handle"
                                                      |)
                                                    |)));
                                                fun γ =>
                                                  ltac:(M.monadic
                                                    (M.alloc (|
                                                      M.never_to_any (|
                                                        M.read (| M.continue (||) |)
                                                      |)
                                                    |)))
                                              ]
                                            |)
                                          |) in
                                        M.match_operator (|
                                          M.alloc (|
                                            Value.Tuple
                                              [
                                                M.read (| current_is_entry |);
                                                M.call_closure (|
                                                  M.get_associated_function (|
                                                    Ty.apply
                                                      (Ty.path
                                                        "alloc::collections::btree::set::BTreeSet")
                                                      []
                                                      [
                                                        Ty.path
                                                          "move_binary_format::file_format::FunctionHandleIndex";
                                                        Ty.path "alloc::alloc::Global"
                                                      ],
                                                    "contains",
                                                    [
                                                      Ty.path
                                                        "move_binary_format::file_format::FunctionHandleIndex"
                                                    ]
                                                  |),
                                                  [
                                                    M.read (| script_functions |);
                                                    M.read (| fhandle_idx |)
                                                  ]
                                                |)
                                              ]
                                          |),
                                          [
                                            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 _ :=
                                                  M.is_constant_or_break_match (|
                                                    M.read (| γ0_0 |),
                                                    Value.Bool true
                                                  |) in
                                                let _ :=
                                                  M.is_constant_or_break_match (|
                                                    M.read (| γ0_1 |),
                                                    Value.Bool true
                                                  |) in
                                                M.alloc (| Value.Tuple [] |)));
                                            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 _ :=
                                                  M.is_constant_or_break_match (|
                                                    M.read (| γ0_1 |),
                                                    Value.Bool true
                                                  |) in
                                                M.alloc (|
                                                  M.never_to_any (|
                                                    M.read (|
                                                      M.return_ (|
                                                        Value.StructTuple
                                                          "core::result::Result::Err"
                                                          [
                                                            M.call_closure (|
                                                              M.get_associated_function (|
                                                                Ty.path
                                                                  "move_binary_format::errors::PartialVMError",
                                                                "with_message",
                                                                []
                                                              |),
                                                              [
                                                                M.call_closure (|
                                                                  M.get_associated_function (|
                                                                    Ty.path
                                                                      "move_binary_format::errors::PartialVMError",
                                                                    "at_code_offset",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.call_closure (|
                                                                      M.get_associated_function (|
                                                                        Ty.path
                                                                          "move_binary_format::errors::PartialVMError",
                                                                        "new",
                                                                        []
                                                                      |),
                                                                      [
                                                                        Value.StructTuple
                                                                          "move_core_types::vm_status::StatusCode::CALLED_SCRIPT_VISIBLE_FROM_NON_SCRIPT_VISIBLE"
                                                                          []
                                                                      ]
                                                                    |);
                                                                    M.read (| fdef_idx |);
                                                                    M.read (| idx |)
                                                                  ]
                                                                |);
                                                                M.call_closure (|
                                                                  M.get_trait_method (|
                                                                    "alloc::string::ToString",
                                                                    Ty.path "str",
                                                                    [],
                                                                    "to_string",
                                                                    []
                                                                  |),
                                                                  [
                                                                    M.read (|
                                                                      Value.String
                                                                        "script-visible functions can only be called from scripts or other script-visible functions"
                                                                    |)
                                                                  ]
                                                                |)
                                                              ]
                                                            |)
                                                          ]
                                                      |)
                                                    |)
                                                  |)
                                                |)));
                                            fun γ => ltac:(M.monadic (M.alloc (| Value.Tuple [] |)))
                                          ]
                                        |)))
                                  ]
                                |) in
                              M.alloc (| Value.Tuple [] |)))
                          |)))
                    ]
                  |)) in
              M.alloc (| Value.StructTuple "core::result::Result::Ok" [ Value.Tuple [] ] |)
            |)))
        |)))
    | _, _, _ => M.impossible "wrong number of arguments"
    end.
  
  Axiom Function_verify_script_visibility_usage :
    M.IsFunction
      "move_bytecode_verifier::dependencies::verify_script_visibility_usage"
      verify_script_visibility_usage.
End dependencies.
